|
@@ -5,11 +5,14 @@ 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.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.jobticket.JobTicketDO;
|
|
|
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.ArrayList;
|
|
@@ -50,10 +53,22 @@ public class SopExecutionPlanJob implements JobHandler {
|
|
|
List<Long> ticketIds = 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)) {
|
|
|
|
|
+ // 检查有没有生成,没有生成得话补充生成
|
|
|
|
|
+ String nextExecutDate = executionPlanRespVO.getNextExecutDate();
|
|
|
|
|
+ String startTime = executionPlanRespVO.getStartTime();
|
|
|
|
|
+ String planStartTime = StringUtils.isBlank(startTime) ? nextExecutDate : nextExecutDate + " " + startTime;
|
|
|
|
|
+ JobTicketDO one = jobTicketService.getOne(Wrappers.<JobTicketDO>lambdaQuery()
|
|
|
|
|
+ .eq(JobTicketDO::getSopId, executionPlanRespVO.getSopId())
|
|
|
|
|
+ .eq(JobTicketDO::getPlanStartTime, planStartTime));
|
|
|
|
|
+ if (one != null) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
// 开始生成作业
|
|
// 开始生成作业
|
|
|
JobTicketSaveReqVO jobTicketSaveReqVO = new JobTicketSaveReqVO();
|
|
JobTicketSaveReqVO jobTicketSaveReqVO = new JobTicketSaveReqVO();
|
|
|
jobTicketSaveReqVO.setSopId(executionPlanRespVO.getSopId());
|
|
jobTicketSaveReqVO.setSopId(executionPlanRespVO.getSopId());
|
|
|
jobTicketSaveReqVO.setTicketName("SOP计划执行作业-" + executionPlanRespVO.getSopId() + "-" + yyyymmdd);
|
|
jobTicketSaveReqVO.setTicketName("SOP计划执行作业-" + executionPlanRespVO.getSopId() + "-" + yyyymmdd);
|
|
|
|
|
+ jobTicketSaveReqVO.setCreateType("1");
|
|
|
|
|
+ jobTicketSaveReqVO.setPlanStartTime(planStartTime);
|
|
|
Long l = jobTicketService.insertJobTicketBySop(jobTicketSaveReqVO);
|
|
Long l = jobTicketService.insertJobTicketBySop(jobTicketSaveReqVO);
|
|
|
sopIds.add(executionPlanRespVO.getSopId());
|
|
sopIds.add(executionPlanRespVO.getSopId());
|
|
|
ticketIds.add(l);
|
|
ticketIds.add(l);
|