CZT
2023-11-27 c206acfaedc69c390fb67daa81bc686f58a212ef
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.ld.igds.grain.view;
 
import com.ld.igds.common.CoreCommonService;
import com.ld.igds.constant.Constant;
import com.ld.igds.grain.dto.GrainParam;
import com.ld.igds.grain.manager.GrainManager;
import com.ld.igds.io.response.GrainResponse;
import com.ld.igds.models.Depot;
import com.ld.igds.models.DicSysConf;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
 
/**
 * 粮情管理
 */
@Component
public class SysGrainManager {
 
    @Autowired
    private CoreCommonService coreCommonService;
    @Autowired
    private GrainManager grainManager;
 
    /**
     * 多个仓采集 -- 根据一分机多仓配置是否开启,进行区分执行
     * @param list
     * @return
     */
    public String batchCheck(List<Depot> list) {
 
        GrainResponse result = null;
        String msg = "";
        GrainParam param = new GrainParam();
        param.setDeptId(list.get(0).getDeptId());
        param.setCompanyId(list.get(0).getCompanyId());
 
        StringBuffer sb = new StringBuffer();
        for (Depot depot : list) {
            sb.append(depot.getId() + ",");
 
        }
        param.setDepotIds(sb.toString());
 
        //获取系统配置参数
        DicSysConf sysConf = coreCommonService.getCacheSysConf(param.getCompanyId());
 
        //若一分机多仓未配置时
        if (StringUtils.isEmpty(sysConf.getGrainMoreTag())) {
            result = grainManager.checkBatch1(param, sysConf);
        }
 
        //若一分机多仓未开启时
        if (Constant.YN_N.equals(sysConf.getGrainMoreTag())) {
            result = grainManager.checkBatch1(param, sysConf);
        }
 
        //若一分机多仓开启时
        if (Constant.YN_Y.equals(sysConf.getGrainMoreTag())) {
            result = grainManager.checkBatch2(param, sysConf);
        }
        if(result == null){
            msg = "定时检测执行失败!";
        }else {
            msg = result.getMsg();
        }
        return msg;
    }
}