cl
6 天以前 50393719d85fc30438456b0d0f065573a404fba5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
    }
}