|
@@ -3,7 +3,6 @@ package com.rongwei.sfcommon.sys.service.impl;
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.rongwe.scentity.domian.*;
|
|
|
import com.rongwe.scentity.vo.ExportHiddenDangerVo;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysDictDo;
|
|
@@ -232,17 +231,23 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
|
|
|
subList = templateZibiaoDos.stream()
|
|
|
.filter(subData -> tempId.equals(subData.getMubanid()))
|
|
|
.collect(Collectors.toList());
|
|
|
+ List<ApsHazardInvestigationTemplateZibiaoDo> updateGenerationDateList = new ArrayList<>();
|
|
|
+ // 判断需要生成任务的模板数据
|
|
|
+ subList = subList.stream().filter(data -> {
|
|
|
+ Date date = preGenerationCheck(data, instance);
|
|
|
+ // 保存上一次生产记录的时间
|
|
|
+ ApsHazardInvestigationTemplateZibiaoDo updateGenerationDateDo = new ApsHazardInvestigationTemplateZibiaoDo();
|
|
|
+ updateGenerationDateDo.setId(data.getId());
|
|
|
+ updateGenerationDateDo.setGenerationdate(date);
|
|
|
+ updateGenerationDateList.add(updateGenerationDateDo);
|
|
|
+ return date != null;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ // 当前模板对应的管控措施不满足任务生成条件
|
|
|
if (subList.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- Date date = preGenerationCheck(mainData, instance);
|
|
|
- if (date == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- apsHazardInvestigationTemplateService.update(new LambdaUpdateWrapper<ApsHazardInvestigationTemplateDo>()
|
|
|
- .eq(ApsHazardInvestigationTemplateDo::getId,mainData.getId())
|
|
|
- .set(ApsHazardInvestigationTemplateDo::getGenerationdate,date));
|
|
|
- hazardInvestigationService.assembleTask(mainData,subList);
|
|
|
+ apsHazardInvestigationTemplateZibiaoService.updateBatchById(updateGenerationDateList);
|
|
|
+ hazardInvestigationService.assembleTask(mainData, subList);
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
@@ -250,7 +255,7 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
|
|
|
@Override
|
|
|
public R qualificationCertificateRemind() {
|
|
|
List<AspCompanyCertificationsDo> list = aspCompanyCertificationsService.list(new LambdaQueryWrapper<AspCompanyCertificationsDo>()
|
|
|
- .eq(AspCompanyCertificationsDo::getDeleted,"0")
|
|
|
+ .eq(AspCompanyCertificationsDo::getDeleted, "0")
|
|
|
.apply(" (DATEDIFF(NEXTREVIEWDATE,NOW()) <0 or DATEDIFF(NEXTREVIEWDATE,NOW()) in (30,15,7))"));
|
|
|
aspCompanyCertificationsService.sendRemind(list);
|
|
|
return R.ok();
|
|
@@ -258,20 +263,21 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
|
|
|
|
|
|
/**
|
|
|
* 更新隐患任务预警状态
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public R updateHiddenDangerWarningStatus() {
|
|
|
List<HiddenDangerTrackDo> hiddenDangerTracks = hiddenDangerTrackService.list(
|
|
|
- new LambdaQueryWrapper<HiddenDangerTrackDo>().eq(HiddenDangerTrackDo::getDeleted,"0")
|
|
|
- .ne(HiddenDangerTrackDo::getHazardstate,"9"));
|
|
|
+ new LambdaQueryWrapper<HiddenDangerTrackDo>().eq(HiddenDangerTrackDo::getDeleted, "0")
|
|
|
+ .ne(HiddenDangerTrackDo::getHazardstate, "9"));
|
|
|
JSCommonUtils.parameterCheck(hiddenDangerTracks::isEmpty, "暂无需要更新状态的隐患任务", "暂无需要更新状态的隐患任务");
|
|
|
- List<HiddenDangerTrackDo> updateList= new ArrayList<>();
|
|
|
+ List<HiddenDangerTrackDo> updateList = new ArrayList<>();
|
|
|
HiddenDangerTrackDo updateDo;
|
|
|
for (HiddenDangerTrackDo hiddenDangerTrack : hiddenDangerTracks) {
|
|
|
//限整改日期
|
|
|
Date deadlineforhazardcontrol = hiddenDangerTrack.getDeadlineforhazardcontrol();
|
|
|
- if (deadlineforhazardcontrol == null ) {
|
|
|
+ if (deadlineforhazardcontrol == null) {
|
|
|
continue;
|
|
|
}
|
|
|
updateDo = new HiddenDangerTrackDo();
|
|
@@ -280,9 +286,9 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
|
|
|
Date end = DateUtil.parseDate(DateUtil.format(deadlineforhazardcontrol, "yyyy-MM-dd"));
|
|
|
Long bday = DateUtil.between(bg, end, DateUnit.DAY, false);
|
|
|
// 更新预警状态
|
|
|
- if (bday>3){
|
|
|
+ if (bday > 3) {
|
|
|
updateDo.setWarnstatus("正常");
|
|
|
- }else if(bday > 1) {
|
|
|
+ } else if (bday > 1) {
|
|
|
updateDo.setWarnstatus("3天");
|
|
|
} else if (bday >= 0) {
|
|
|
updateDo.setWarnstatus("1天");
|
|
@@ -292,13 +298,13 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
|
|
|
updateDo.setModifydate(new Date());
|
|
|
updateList.add(updateDo);
|
|
|
}
|
|
|
- if(!updateList.isEmpty()){
|
|
|
+ if (!updateList.isEmpty()) {
|
|
|
hiddenDangerTrackService.updateBatchById(updateList);
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
- public Date preGenerationCheck(ApsHazardInvestigationTemplateDo hazardInvestigationTemplateDo,
|
|
|
+ public Date preGenerationCheck(ApsHazardInvestigationTemplateZibiaoDo hazardInvestigationTemplateDo,
|
|
|
Calendar calendar) {
|
|
|
int currentMonth = calendar.get(Calendar.MONTH) + 1; // 月份是从0开始的,所以加1
|
|
|
int currentDay = calendar.get(Calendar.DAY_OF_MONTH); // 当前日
|
|
@@ -319,14 +325,14 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
|
|
|
LocalTime startTime = LocalTime.parse(hazardInvestigationTemplateDo.getStartingtimeofwork());
|
|
|
LocalTime endTime = LocalTime.parse(hazardInvestigationTemplateDo.getEndtimeofwork());
|
|
|
LocalTime currentTime = LocalTime.now();
|
|
|
- if(!currentTime.isBefore(startTime) && !currentTime.isAfter(endTime)){
|
|
|
+ if (!currentTime.isBefore(startTime) && !currentTime.isAfter(endTime)) {
|
|
|
// 如果生成时间为空 或者 巡检周期大于时间差值
|
|
|
- if(generationdate==null || inspectioncycle == i){
|
|
|
+ if (generationdate == null || inspectioncycle == i) {
|
|
|
return returnDate;
|
|
|
- }else{
|
|
|
- return null;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return null;
|
|
|
}
|
|
|
} else if (SaveConstans.INSPECTION_CYCLE_UNIT.DAY.equals(inspectioncycleunit)) {
|