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;
|
}
|
}
|