diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanInspect.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanInspect.java index 1c04dff3..fe0d68ab 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanInspect.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanInspect.java @@ -29,6 +29,7 @@ public class DmsPlanInspect extends BaseEntity /** 计划名称 */ @Excel(name = "计划名称") private String planInspectName; + private Long inspectLevel; /** 检查类型(1巡检,2点检) */ @Excel(name = "检查类型(1巡检,2点检)") @@ -73,6 +74,41 @@ public class DmsPlanInspect extends BaseEntity private String routeName; private Long hour; private Long week; + private Long day; + private Long month; + private Long year; + public Long getInspectLevel() + { + return inspectLevel; + } + public void setInspectLevel(Long inspectLevel) + { + this.inspectLevel = inspectLevel; + } + public Long getDay() + { + return day; + } + public void setDay(Long day) + { + this.day = day; + } + public Long getMonth() + { + return month; + } + public void setMonth(Long month) + { + this.month = month; + } + public Long getYear() + { + return year; + } + public void setYear(Long year) + { + this.year = year; + } public Long getHour() { return hour; diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanMaint.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanMaint.java index a5188ee5..94d4c644 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanMaint.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanMaint.java @@ -48,6 +48,9 @@ public class DmsPlanMaint extends BaseEntity private Long timeLimit; private Long hour; private Long week; + private Long day; + private Long month; + private Long year; @@ -198,6 +201,30 @@ public class DmsPlanMaint extends BaseEntity { this.week = week; } + public Long getDay() + { + return day; + } + public void setDay(Long day) + { + this.day = day; + } + public Long getMonth() + { + return month; + } + public void setMonth(Long month) + { + this.month = month; + } + public Long getYear() + { + return year; + } + public void setYear(Long year) + { + this.year = year; + } public Long getMaintStatus() { diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanInspectServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanInspectServiceImpl.java index e8207c51..e6b2104f 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanInspectServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanInspectServiceImpl.java @@ -108,10 +108,34 @@ public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService @Override public int insertDmsPlanInspect(DmsPlanInspect dmsPlanInspect) { - Long week = dmsPlanInspect.getWeek(); - week += 1; + String day = "*"; + String month = "*"; + String week = "*"; + String year = "*"; + String cron = ""; + if (dmsPlanInspect.getDay()!=null){ + day = dmsPlanInspect.getDay().toString(); + } + if (dmsPlanInspect.getMonth()!=null){ + month = dmsPlanInspect.getMonth().toString(); + } + if (dmsPlanInspect.getWeek()!=null){ + Long weekDay = dmsPlanInspect.getWeek() + 1; + week = weekDay.toString(); + } + if (dmsPlanInspect.getYear()!=null){ + year = dmsPlanInspect.getYear().toString(); + } + if (dmsPlanInspect.getInspectLevel().equals(1l)){ + cron = "0 0 "+dmsPlanInspect.getHour()+" "+day+" "+month+" ?"; + } + if (dmsPlanInspect.getInspectLevel().equals(2l)){ + cron = "0 0 "+dmsPlanInspect.getHour()+" ?"+" "+month+" "+week; + } + if (dmsPlanInspect.getInspectLevel().equals(3l)){ + cron = "0 0 "+dmsPlanInspect.getHour()+" "+day+" "+ month+" ? "+year; + } String planInspectCode = Seq.getId(Seq.planInspectSeqType, Seq.planInspectCode); - String cron = "* * "+dmsPlanInspect.getHour()+" ? * "+week; SysJob job = new SysJob(); job.setJobName("点巡检计划编号" + planInspectCode + "工单任务"); job.setJobGroup("DEFAULT"); diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintServiceImpl.java index 292c7e36..a397f7b3 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicInteger; import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; @@ -89,10 +90,35 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService { @Transactional @Override public int insertDmsPlanMaint(DmsPlanMaint dmsPlanMaint) { - Long week = dmsPlanMaint.getWeek(); - week += 1; + String day = "*"; + String month = "*"; + String week = "*"; + String year = "*"; + String cron = ""; + if (dmsPlanMaint.getDay()!=null){ + day = dmsPlanMaint.getDay().toString(); + } + if (dmsPlanMaint.getMonth()!=null){ + month = dmsPlanMaint.getMonth().toString(); + } + if (dmsPlanMaint.getWeek()!=null){ + Long weekDay = dmsPlanMaint.getWeek() + 1; + week = weekDay.toString(); + } + if (dmsPlanMaint.getYear()!=null){ + year = dmsPlanMaint.getYear().toString(); + } + if (dmsPlanMaint.getMaintLevel().equals(1l)){ + cron = "0 0 "+dmsPlanMaint.getHour()+" "+day+" "+month+" ?"; + } + if (dmsPlanMaint.getMaintLevel().equals(2l)){ + cron = "0 0 "+dmsPlanMaint.getHour()+" ?"+" "+month+" "+week; + } + if (dmsPlanMaint.getMaintLevel().equals(3l)){ + cron = "0 0 "+dmsPlanMaint.getHour()+" "+day+" "+ month+" ? "+year; + } String planMaintCode = Seq.getId(Seq.planMaintSeqType, Seq.planMaintCode); - String cron = "* * "+dmsPlanMaint.getHour()+" ? * "+week; +// String cron = "* * "+dmsPlanMaint.getHour()+" ? * "+week; SysJob job = new SysJob(); job.setJobName("保养计划编号" + planMaintCode + "工单任务"); job.setJobGroup("DEFAULT");