package com.vincent.rsf.server.manager.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.vincent.rsf.server.manager.entity.Task;
|
import com.vincent.rsf.server.manager.enums.TaskStsType;
|
import com.vincent.rsf.server.manager.mapper.TaskMapper;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 任务明细 plat_order_code 对应云仓通知单号时,是否仍有执行中任务
|
*/
|
@Component
|
public class CloudWmsOrderTaskRunningHelper {
|
|
@Autowired
|
private TaskMapper taskMapper;
|
|
public boolean hasRunningTasksForPlatOrder(String platOrderCode) {
|
if (StringUtils.isBlank(platOrderCode)) {
|
return false;
|
}
|
QueryWrapper<Task> qw = new QueryWrapper<>();
|
qw.eq("deleted", 0);
|
qw.apply("EXISTS (SELECT 1 FROM man_task_item ti WHERE ti.task_id = man_task.id AND ti.deleted = 0 AND ti.plat_order_code = {0})", platOrderCode);
|
qw.and(w -> w
|
.nested(n -> n.lt("task_type", 100).lt("task_status", TaskStsType.COMPLETE_IN.id))
|
.or(n -> n.ge("task_type", 101).lt("task_status", TaskStsType.COMPLETE_OUT.id)));
|
Integer cnt = taskMapper.selectCount(qw);
|
return cnt != null && cnt > 0;
|
}
|
}
|