6-26 - bug修复
parent
972aa1949b
commit
897cfd777e
|
|
@ -1,11 +1,13 @@
|
||||||
package com.zcloud.safetyDutyList.command.tasklist;
|
package com.zcloud.safetyDutyList.command.tasklist;
|
||||||
|
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.safetyDutyList.command.query.tasklist.MessageNoticeExe;
|
||||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskExecutionCloseCmd;
|
import com.zcloud.safetyDutyList.dto.tasklist.TaskExecutionCloseCmd;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -20,10 +22,12 @@ import java.util.List;
|
||||||
* 2. 将任务模板状态更新为已关闭
|
* 2. 将任务模板状态更新为已关闭
|
||||||
* 3. 同时关闭关联的所有进行中的任务执行记录
|
* 3. 同时关闭关联的所有进行中的任务执行记录
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TaskExecutionCloseExe {
|
public class TaskExecutionCloseExe {
|
||||||
private final TaskExecutionGateway taskExecutionGateway;
|
private final TaskExecutionGateway taskExecutionGateway;
|
||||||
|
private final MessageNoticeExe messageNoticeExe;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void execute(TaskExecutionCloseCmd cmd) {
|
public void execute(TaskExecutionCloseCmd cmd) {
|
||||||
|
|
@ -38,5 +42,12 @@ public class TaskExecutionCloseExe {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
throw new BizException("关闭任务失败");
|
throw new BizException("关闭任务失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 完成待办
|
||||||
|
try {
|
||||||
|
messageNoticeExe.sendMessageCompleteEvent(executionE.getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("关闭任务时,完成待办失败",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,14 @@ package com.zcloud.safetyDutyList.command.tasklist;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
|
import com.zcloud.safetyDutyList.command.query.tasklist.MessageNoticeExe;
|
||||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -26,12 +28,14 @@ import java.util.Objects;
|
||||||
* 3. 同时关闭该清单下所有进行中的下发记录
|
* 3. 同时关闭该清单下所有进行中的下发记录
|
||||||
* 4. 同时关闭所有下发记录下进行中的任务执行记录
|
* 4. 同时关闭所有下发记录下进行中的任务执行记录
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TaskListIssueCloseExe {
|
public class TaskListIssueCloseExe {
|
||||||
private final TaskListGateway taskListGateway;
|
private final TaskListGateway taskListGateway;
|
||||||
private final TaskListIssueGateway taskListIssueGateway;
|
private final TaskListIssueGateway taskListIssueGateway;
|
||||||
private final TaskExecutionGateway taskExecutionGateway;
|
private final TaskExecutionGateway taskExecutionGateway;
|
||||||
|
private final MessageNoticeExe messageNoticeExe;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void execute(String taskIssueId) {
|
public void execute(String taskIssueId) {
|
||||||
|
|
@ -67,6 +71,13 @@ public class TaskListIssueCloseExe {
|
||||||
executionE.setTaskStatus(TaskStatusEnum.CLOSED.getCode());
|
executionE.setTaskStatus(TaskStatusEnum.CLOSED.getCode());
|
||||||
taskExecutionGateway.update(executionE);
|
taskExecutionGateway.update(executionE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 完成待办
|
||||||
|
messageNoticeExe.sendMessageCompleteEvent(executionE.getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("关闭下发记录时,完成待办失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.zcloud.safetyDutyList.command.tasklist;
|
package com.zcloud.safetyDutyList.command.tasklist;
|
||||||
|
|
||||||
|
import com.zcloud.safetyDutyList.command.query.tasklist.MessageNoticeExe;
|
||||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||||
|
|
@ -26,6 +27,7 @@ import java.util.List;
|
||||||
public class TaskListStatusUpdateExe {
|
public class TaskListStatusUpdateExe {
|
||||||
private final TaskListIssueGateway taskListIssueGateway;
|
private final TaskListIssueGateway taskListIssueGateway;
|
||||||
private final TaskExecutionGateway taskExecutionGateway;
|
private final TaskExecutionGateway taskExecutionGateway;
|
||||||
|
private final MessageNoticeExe messageNoticeExe;
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -41,7 +43,7 @@ public class TaskListStatusUpdateExe {
|
||||||
issueE.setStatus(TaskStatusEnum.COMPLETED.getCode());
|
issueE.setStatus(TaskStatusEnum.COMPLETED.getCode());
|
||||||
taskListIssueGateway.update(issueE);
|
taskListIssueGateway.update(issueE);
|
||||||
|
|
||||||
// 同时关闭该下发记录下所有进行中的任务执行记录
|
// 同时将该下发记录下所有进行中的任务执行记录
|
||||||
List<TaskExecutionE> executionList = taskExecutionGateway.listByTaskIssueId(issueE.getTaskIssueId());
|
List<TaskExecutionE> executionList = taskExecutionGateway.listByTaskIssueId(issueE.getTaskIssueId());
|
||||||
if (executionList != null) {
|
if (executionList != null) {
|
||||||
for (TaskExecutionE executionE : executionList) {
|
for (TaskExecutionE executionE : executionList) {
|
||||||
|
|
@ -49,6 +51,13 @@ public class TaskListStatusUpdateExe {
|
||||||
executionE.setTaskStatus(TaskStatusEnum.COMPLETED.getCode());
|
executionE.setTaskStatus(TaskStatusEnum.COMPLETED.getCode());
|
||||||
taskExecutionGateway.update(executionE);
|
taskExecutionGateway.update(executionE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 完成待办
|
||||||
|
try {
|
||||||
|
messageNoticeExe.sendMessageCompleteEvent(executionE.getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("【定时任务1】完成待办失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue