|
@@ -3,20 +3,16 @@ package cn.iocoder.yudao.module.iscs.job;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
|
-import cn.iocoder.yudao.module.infra.service.job.JobLogService;
|
|
|
|
|
import cn.iocoder.yudao.module.iscs.controller.admin.jobticket.vo.JobTicketSaveReqVO;
|
|
import cn.iocoder.yudao.module.iscs.controller.admin.jobticket.vo.JobTicketSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanRespVO;
|
|
import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanRespVO;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopDO;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopExecutionPlanDO;
|
|
|
|
|
import cn.iocoder.yudao.module.iscs.service.jobticket.JobTicketService;
|
|
import cn.iocoder.yudao.module.iscs.service.jobticket.JobTicketService;
|
|
|
import cn.iocoder.yudao.module.iscs.service.sop.SopExecutionPlanService;
|
|
import cn.iocoder.yudao.module.iscs.service.sop.SopExecutionPlanService;
|
|
|
import cn.iocoder.yudao.module.iscs.service.sop.SopService;
|
|
import cn.iocoder.yudao.module.iscs.service.sop.SopService;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -50,16 +46,20 @@ public class SopExecutionPlanJob implements JobHandler {
|
|
|
SopExecutionPlanRespVO sopExecutionPlanRespVO = new SopExecutionPlanRespVO();
|
|
SopExecutionPlanRespVO sopExecutionPlanRespVO = new SopExecutionPlanRespVO();
|
|
|
sopExecutionPlanRespVO.setNextExecutDate(yyyymmdd);
|
|
sopExecutionPlanRespVO.setNextExecutDate(yyyymmdd);
|
|
|
List<SopExecutionPlanRespVO> list = sopExecutionPlanService.getList(sopExecutionPlanRespVO);
|
|
List<SopExecutionPlanRespVO> list = sopExecutionPlanService.getList(sopExecutionPlanRespVO);
|
|
|
|
|
+ List<Long> sopIds = new ArrayList<>();
|
|
|
|
|
+ List<Long> ticketIds = new ArrayList<>();
|
|
|
for (SopExecutionPlanRespVO executionPlanRespVO : list) {
|
|
for (SopExecutionPlanRespVO executionPlanRespVO : list) {
|
|
|
if (executionPlanRespVO.getEnableExecutionPlan() != null && executionPlanRespVO.getEnableExecutionPlan().equals(1)) {
|
|
if (executionPlanRespVO.getEnableExecutionPlan() != null && executionPlanRespVO.getEnableExecutionPlan().equals(1)) {
|
|
|
// 开始生成作业
|
|
// 开始生成作业
|
|
|
JobTicketSaveReqVO jobTicketSaveReqVO = new JobTicketSaveReqVO();
|
|
JobTicketSaveReqVO jobTicketSaveReqVO = new JobTicketSaveReqVO();
|
|
|
jobTicketSaveReqVO.setSopId(executionPlanRespVO.getSopId());
|
|
jobTicketSaveReqVO.setSopId(executionPlanRespVO.getSopId());
|
|
|
- jobTicketService.insertJobTicketBySop(jobTicketSaveReqVO);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ jobTicketSaveReqVO.setTicketName("SOP计划执行作业-" + executionPlanRespVO.getSopId() + "-" + yyyymmdd);
|
|
|
|
|
+ Long l = jobTicketService.insertJobTicketBySop(jobTicketSaveReqVO);
|
|
|
|
|
+ sopIds.add(executionPlanRespVO.getSopId());
|
|
|
|
|
+ ticketIds.add(l);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return String.format("定时执行清理定时任务日志数量 %s 个", 1);
|
|
|
|
|
|
|
+ return String.format("定时执行sop生成作业,sopIds = " + sopIds + ",ticketIds = " + ticketIds);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|