|
@@ -20,7 +20,6 @@ import com.rongwei.safecommon.utils.JSCommonUtils;
|
|
|
import com.rongwei.sfcommon.sys.dao.AspShiftTimeDao;
|
|
|
import com.rongwei.sfcommon.sys.dao.CheckTemplateDao;
|
|
|
import com.rongwei.sfcommon.sys.service.*;
|
|
|
-import com.rongwei.sfcommon.utils.MlConstants;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -80,7 +79,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
@Autowired
|
|
|
private ThemeCheckContentService themeCheckContentService;
|
|
|
@Autowired
|
|
|
- private AspRiskUnitServiceImpl aspRiskUnitService;
|
|
|
+ private AspRiskUnitService aspRiskUnitService;
|
|
|
@Autowired
|
|
|
private AspPersonnelCheckConfigService aspPersonnelCheckConfigService;
|
|
|
|
|
@@ -154,9 +153,9 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
if (map.isEmpty()) {
|
|
|
//map.put("TEMPLATETYPE",MlConstants.TEMPLATETYPE_POINT_CHECK);
|
|
|
// 模板状态
|
|
|
- map.put("ENABLESTATUS", MlConstants.TEMPLATE_STATUS_OPEM);
|
|
|
+ map.put("ENABLESTATUS", TEMPLATE_STATUS_OPEM);
|
|
|
// 任务生成类型
|
|
|
- map.put("JOBSTARTTYPE", MlConstants.JOB_START_TYPE_AUTO);
|
|
|
+ map.put("JOBSTARTTYPE", JOB_START_TYPE_AUTO);
|
|
|
runTask = true;
|
|
|
} else {
|
|
|
String checkTemplateId = map.getOrDefault("ID", "").toString();
|
|
@@ -220,7 +219,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
}
|
|
|
|
|
|
// 白班
|
|
|
- if (CHECK_SHIFT_EVERY_SHIFT.equals(shift) || MlConstants.CHECK_SHIFT_EVERY_DAY_SHIFT.equals(shift)) {
|
|
|
+ if (CHECK_SHIFT_EVERY_SHIFT.equals(shift) || CHECK_SHIFT_EVERY_DAY_SHIFT.equals(shift)) {
|
|
|
addCheckItems(dayItems, shiftcount, checkTemplateItem);
|
|
|
}
|
|
|
// 夜班
|
|
@@ -232,20 +231,20 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
addCheckItems(middleItems, shiftcount, checkTemplateItem);
|
|
|
}
|
|
|
// 长白班 每班数据不需要生成长白班
|
|
|
- if (MlConstants.CHECK_SHIFT_EVERY_CHANGBAI_CLASS_SHIFT.equals(shift)) {
|
|
|
+ if (CHECK_SHIFT_EVERY_CHANGBAI_CLASS_SHIFT.equals(shift)) {
|
|
|
addCheckItems(changbaiClassItems, shiftcount, checkTemplateItem);
|
|
|
}
|
|
|
}
|
|
|
// 生成点检任务
|
|
|
System.out.println("dayItems:" + dayItems.size() + "***" + "middleItems:" + middleItems.size() + "***" + "nightItems:" + nightItems.size());
|
|
|
// 白班任务
|
|
|
- createPointCheckByTemplate(checkTemplate, dayItems, MlConstants.CHECK_SHIFT_EVERY_DAY_SHIFT);
|
|
|
+ createPointCheckByTemplate(checkTemplate, dayItems, CHECK_SHIFT_EVERY_DAY_SHIFT);
|
|
|
// 中班任务
|
|
|
createPointCheckByTemplate(checkTemplate, middleItems, CHECK_SHIFT_EVERY_MIDDLE_SHIFT);
|
|
|
// 夜班任务
|
|
|
createPointCheckByTemplate(checkTemplate, nightItems, CHECK_SHIFT_EVERY_NIGHT_SHIFT);
|
|
|
// 长白班任务
|
|
|
- createPointCheckByTemplate(checkTemplate, changbaiClassItems, MlConstants.CHECK_SHIFT_EVERY_CHANGBAI_CLASS_SHIFT);
|
|
|
+ createPointCheckByTemplate(checkTemplate, changbaiClassItems, CHECK_SHIFT_EVERY_CHANGBAI_CLASS_SHIFT);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -346,7 +345,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
// 每个设备生成一条点检任务
|
|
|
CheckItemsDo checkItemsdo = checkItemsService.getById(checkitemsid);
|
|
|
// 如当前设备未禁用状态则不生成点检任务
|
|
|
- if (checkItemsdo == null || MlConstants.CHECKITEM_STATUS_DISABLE.equals(checkItemsdo.getEnabled())) {
|
|
|
+ if (checkItemsdo == null || CHECKITEM_STATUS_DISABLE.equals(checkItemsdo.getEnabled())) {
|
|
|
continue;
|
|
|
}
|
|
|
// 点检编号
|
|
@@ -366,9 +365,9 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
//班次
|
|
|
pointCheckDo.setShift(shift);
|
|
|
//点检状态默认待点检
|
|
|
- pointCheckDo.setCheckstatus(MlConstants.POINT_CHECK_STATUS_WAIT);
|
|
|
+ pointCheckDo.setCheckstatus(POINT_CHECK_STATUS_WAIT);
|
|
|
// 点检预警状态默认正常
|
|
|
- pointCheckDo.setCheckwarnstatus(MlConstants.POINTCEHCK_WARNSTATUS_NORMAL);
|
|
|
+ pointCheckDo.setCheckwarnstatus(POINTCEHCK_WARNSTATUS_NORMAL);
|
|
|
pointCheckDo.setTenantid(checkTemplate.getTenantid());
|
|
|
pointCheckDo.setSource("1");
|
|
|
pointCheckDo.setTemplatetype(templatetype);
|
|
@@ -500,7 +499,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
String oldId = map.get("oldId").toString();
|
|
|
CheckTemplateDo checkTemplate = new CheckTemplateDo();
|
|
|
checkTemplate.setId(oldId);
|
|
|
- checkTemplate.setEnablestatus(MlConstants.TEMPLATE_STATUS_CLOSE);
|
|
|
+ checkTemplate.setEnablestatus(TEMPLATE_STATUS_CLOSE);
|
|
|
this.updateById(checkTemplate);
|
|
|
}
|
|
|
}
|
|
@@ -541,26 +540,37 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
|
|
|
List<AspRiskUnitDo> aspRiskUnitDos = Collections.emptyList();
|
|
|
// 设备
|
|
|
List<CheckItemsDo> checkitemList = Collections.emptyList();
|
|
|
- List<String> checkAreaIds = new ArrayList<>();
|
|
|
+ List<String> checkAreaIds;
|
|
|
String checkAttr;
|
|
|
String checkType;
|
|
|
+ String checkItemIds = "1".equals(checkTemplateDo.getObjclass()) ? checkTemplateDo.getCheckitemids() :
|
|
|
+ checkTemplateDo.getRiskunitid();
|
|
|
+ // 特殊逻辑处理 如果是定时任务 不抛出异常 只记录日志信息
|
|
|
+ String returnErrorMsg = "";
|
|
|
+ if (JOB_START_TYPE_DISPOSABLE.equals(checkTemplateDo.getJobstarttype())) {
|
|
|
+ returnErrorMsg = "没有选择对应的检查对象信息,无法生成任务";
|
|
|
+ }
|
|
|
+ parameterCheck(() -> StringUtils.isBlank(checkItemIds), returnErrorMsg,
|
|
|
+ "检查类型为:{},检查设备或者风险分析单元为空", checkTemplateDo.getObjclass());
|
|
|
if ("1".equals(checkTemplateDo.getObjclass())) {
|
|
|
// 设备 ID
|
|
|
- String checkitemids = checkTemplateDo.getCheckitemids();
|
|
|
- parameterCheck(() -> StringUtils.isBlank(checkitemids), "设备为空", "设备为空");
|
|
|
- checkitemList = checkItemsService.getBaseMapper().selectBatchIds(Arrays.asList(checkitemids.split(",")));
|
|
|
+ checkitemList = checkItemsService.selectBatchIds(Arrays.asList(checkItemIds.split(",")));
|
|
|
checkAreaIds = checkitemList.stream().map(CheckItemsDo::getId).collect(Collectors.toList());
|
|
|
checkAttr = CheckType.EQU;
|
|
|
checkType = ResponsiblePositionAttribute.EQU_CHECK;
|
|
|
} else {
|
|
|
// 风险单元 ID
|
|
|
- String riskunitid = checkTemplateDo.getRiskunitid();
|
|
|
- parameterCheck(() -> StringUtils.isBlank(riskunitid), "风险单元为空", "风险单元为空");
|
|
|
- aspRiskUnitDos = aspRiskUnitService.getBaseMapper().selectBatchIds(Arrays.asList(riskunitid.split(",")));
|
|
|
+ aspRiskUnitDos = aspRiskUnitService.selectBatchIds(Arrays.asList(checkItemIds.split(",")));
|
|
|
checkAreaIds = aspRiskUnitDos.stream().map(AspRiskUnitDo::getId).collect(Collectors.toList());
|
|
|
checkAttr = CheckType.RISK;
|
|
|
checkType = ResponsiblePositionAttribute.RISK_CHECK;
|
|
|
}
|
|
|
+ // 特殊逻辑处理 如果是定时任务 不抛出异常 只记录日志信息
|
|
|
+ returnErrorMsg = "";
|
|
|
+ if (JOB_START_TYPE_DISPOSABLE.equals(checkTemplateDo.getJobstarttype())) {
|
|
|
+ returnErrorMsg = "该模板对应的检查对象已被删除,请联系系统管理员";
|
|
|
+ }
|
|
|
+ parameterCheck(checkAreaIds::isEmpty, returnErrorMsg, "风险单元为空");
|
|
|
// 检查人员为空的时,从人员检查配置中获取人员,设置为检察人员
|
|
|
if (checkUserMap.isEmpty()) {
|
|
|
// 从设备中获取检查人
|