|
@@ -9,7 +9,6 @@ import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
-import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
|
|
|
import com.rongwei.safecommon.utils.JSCommonUtils;
|
|
|
import com.rongwei.sfcommon.sys.service.HazardInvestigationService;
|
|
|
import org.slf4j.Logger;
|
|
@@ -72,10 +71,12 @@ public class HazardInvestigationServiceImpl implements HazardInvestigationServic
|
|
|
public void assembleTask(ApsHazardInvestigationTemplateDo tempData) {
|
|
|
|
|
|
SysUserVo currentUser = JSCommonUtils.getCurrentUser();
|
|
|
+
|
|
|
if (StringUtils.isBlank(tempData.getHiddendangerid())) {
|
|
|
log.error("风险点为空");
|
|
|
throw new RuntimeException("模板对应需检查的风险点为空");
|
|
|
}
|
|
|
+
|
|
|
// 获取模板对应的检查项
|
|
|
List<ApsHazardInvestigationTemplateZibiaoDo> checkItemList = apsHazardInvestigationTemplateZibiaoService.list(new LambdaQueryWrapper<ApsHazardInvestigationTemplateZibiaoDo>()
|
|
|
.eq(BaseDo::getDeleted, "0")
|
|
@@ -116,7 +117,7 @@ public class HazardInvestigationServiceImpl implements HazardInvestigationServic
|
|
|
apsDetailsHazardInvestigationTasksDo.setRiskanalysisobjectcode(tempData.getHiddendanger());
|
|
|
apsDetailsHazardInvestigationTasksDo.setNumber(
|
|
|
JSCommonUtils.streamCodeGeneration("aps_details_hazard_investigation_tasks_NUMBER",
|
|
|
- "YH@{date:yyyyMMdd}@{serialNumber:#000000}","date:yyyyMM",
|
|
|
+ "YH@{date:yyyyMMdd}@{serialNumber:#000000}", "date:yyyyMM",
|
|
|
""));
|
|
|
apsDetailsHazardInvestigationTasksDo.setIdentifyperple(s.getDutyofficername());
|
|
|
apsDetailsHazardInvestigationTasksDo.setIdentifyperpleid(s.getDutyofficerid());
|
|
@@ -124,7 +125,7 @@ public class HazardInvestigationServiceImpl implements HazardInvestigationServic
|
|
|
apsDetailsHazardInvestigationTasksDo.setPlannedstarttime(startTime);
|
|
|
apsDetailsHazardInvestigationTasksDo.setPlannedendtime(endTime);
|
|
|
taskSaveList.add(apsDetailsHazardInvestigationTasksDo);
|
|
|
- taskDetailSaveList.addAll(assembleTaskDetails(currentUser,apsDetailsHazardInvestigationTasksDo, checkItemList));
|
|
|
+ taskDetailSaveList.addAll(assembleTaskDetails(currentUser, apsDetailsHazardInvestigationTasksDo, checkItemList));
|
|
|
}
|
|
|
apsDetailsHazardInvestigationTasksServiceImpl.saveBatch(taskSaveList);
|
|
|
apsDetailsHazardInvestigationTasksJcxzibiaoService.saveBatch(taskDetailSaveList);
|
|
@@ -164,4 +165,43 @@ public class HazardInvestigationServiceImpl implements HazardInvestigationServic
|
|
|
return subSaveList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验模板中的检查项是否需要生成任务信息
|
|
|
+ */
|
|
|
+ public int verifyBeforeGeneratingTasks(ApsHazardInvestigationTemplateZibiaoDo investigationTemplateZibiaoDo) {
|
|
|
+ // 检查项的创建时间
|
|
|
+ Date createdate = investigationTemplateZibiaoDo.getCreatedate();
|
|
|
+ // 巡检周期
|
|
|
+ Integer inspectioncycle = investigationTemplateZibiaoDo.getInspectioncycle();
|
|
|
+ // 周期单位
|
|
|
+ String inspectioncycleunit = investigationTemplateZibiaoDo.getInspectioncycleunit();
|
|
|
+ int generationFrequency=0;
|
|
|
+ if (inspectioncycle == null || inspectioncycle == 0) {
|
|
|
+ log.error("巡检周期为空");
|
|
|
+ throw new CustomException("巡检周期为空");
|
|
|
+ }
|
|
|
+ Calendar instance = Calendar.getInstance();
|
|
|
+ switch (inspectioncycleunit) {
|
|
|
+ case "0": // 小时 每几小时巡检一次
|
|
|
+ generationFrequency = 24/inspectioncycle;
|
|
|
+ break;
|
|
|
+ case "1": //天 每几天巡检一次
|
|
|
+ generationFrequency = inspectioncycle;
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "2": // 月
|
|
|
+ generationFrequency = inspectioncycle;
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "3": // 年
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ log.debug("当前检测周期异常");
|
|
|
+ throw new CustomException("检查周期为空");
|
|
|
+ }
|
|
|
+ return generationFrequency;
|
|
|
+ }
|
|
|
+
|
|
|
}
|