设备管理点巡检,保养的计划新增加巡检级别新生成cron

master
maxw@mesnac.com 1 month ago
parent 6f9334bbab
commit 1d16402cc0

@ -29,6 +29,7 @@ public class DmsPlanInspect extends BaseEntity
/** 计划名称 */ /** 计划名称 */
@Excel(name = "计划名称") @Excel(name = "计划名称")
private String planInspectName; private String planInspectName;
private Long inspectLevel;
/** 检查类型(1巡检,2点检) */ /** 检查类型(1巡检,2点检) */
@Excel(name = "检查类型(1巡检,2点检)") @Excel(name = "检查类型(1巡检,2点检)")
@ -73,6 +74,41 @@ public class DmsPlanInspect extends BaseEntity
private String routeName; private String routeName;
private Long hour; private Long hour;
private Long week; 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() public Long getHour()
{ {
return hour; return hour;

@ -48,6 +48,9 @@ public class DmsPlanMaint extends BaseEntity
private Long timeLimit; private Long timeLimit;
private Long hour; private Long hour;
private Long week; private Long week;
private Long day;
private Long month;
private Long year;
@ -198,6 +201,30 @@ public class DmsPlanMaint extends BaseEntity
{ {
this.week = week; 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() public Long getMaintStatus()
{ {

@ -108,10 +108,34 @@ public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService
@Override @Override
public int insertDmsPlanInspect(DmsPlanInspect dmsPlanInspect) public int insertDmsPlanInspect(DmsPlanInspect dmsPlanInspect)
{ {
Long week = dmsPlanInspect.getWeek(); String day = "*";
week += 1; 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 planInspectCode = Seq.getId(Seq.planInspectSeqType, Seq.planInspectCode);
String cron = "* * "+dmsPlanInspect.getHour()+" ? * "+week;
SysJob job = new SysJob(); SysJob job = new SysJob();
job.setJobName("点巡检计划编号" + planInspectCode + "工单任务"); job.setJobName("点巡检计划编号" + planInspectCode + "工单任务");
job.setJobGroup("DEFAULT"); job.setJobGroup("DEFAULT");

@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -89,10 +90,35 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
@Transactional @Transactional
@Override @Override
public int insertDmsPlanMaint(DmsPlanMaint dmsPlanMaint) { public int insertDmsPlanMaint(DmsPlanMaint dmsPlanMaint) {
Long week = dmsPlanMaint.getWeek(); String day = "*";
week += 1; 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 planMaintCode = Seq.getId(Seq.planMaintSeqType, Seq.planMaintCode);
String cron = "* * "+dmsPlanMaint.getHour()+" ? * "+week; // String cron = "* * "+dmsPlanMaint.getHour()+" ? * "+week;
SysJob job = new SysJob(); SysJob job = new SysJob();
job.setJobName("保养计划编号" + planMaintCode + "工单任务"); job.setJobName("保养计划编号" + planMaintCode + "工单任务");
job.setJobGroup("DEFAULT"); job.setJobGroup("DEFAULT");

Loading…
Cancel
Save