移交管理

new
JilingLee 1 year ago
parent d9cab3ddd1
commit c7574db604

@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -19,11 +21,13 @@ import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*;
@ -93,23 +97,23 @@ public class TurnOverController {
List<TurnOverDO> list = pageResult.getList();
if (CollUtil.isNotEmpty(list)) {
for (TurnOverDO t : list) {
List<BpmTaskRespVO> taskListByProcessInstanceId = taskService.getTaskListByProcessInstanceId(t.getProcessInstanceId());
Optional<BpmTaskRespVO> latestTask = taskListByProcessInstanceId.stream()
.filter(task -> task.getEndTime() != null)
.sorted(Comparator.comparing(BpmTaskRespVO::getEndTime).reversed())
.findFirst();
if (latestTask.isPresent()) {
BpmTaskRespVO latest = latestTask.get();
// 找到了endTime最新的任务
TurnOverUpdateReqVO updateReqVO = new TurnOverUpdateReqVO();
updateReqVO.setId(t.getId());
if (!latest.getResult().toString().equals(t.getStatus())) {
updateReqVO.setStatus(latest.getResult().toString());
turnOverService.updateTurnOver(updateReqVO);
if (t.getProcessInstanceId() != null) {
List<BpmTaskRespVO> taskListByProcessInstanceId = taskService.getTaskListByProcessInstanceId(t.getProcessInstanceId());
Optional<BpmTaskRespVO> latestTask = taskListByProcessInstanceId.stream()
.filter(task -> task.getEndTime() != null)
.sorted(Comparator.comparing(BpmTaskRespVO::getEndTime).reversed())
.findFirst();
if (latestTask.isPresent()) {
BpmTaskRespVO latest = latestTask.get();
// 找到了endTime最新的任务
TurnOverUpdateReqVO updateReqVO = new TurnOverUpdateReqVO();
updateReqVO.setId(t.getId());
if (!latest.getResult().toString().equals(t.getStatus())) {
updateReqVO.setStatus(latest.getResult().toString());
turnOverService.updateTurnOver(updateReqVO);
}
}
} else {
// 没有找到有endTime的任务
}
}
PageResult<TurnOverDO> pageResult2 = turnOverService.getTurnOverPage(pageVO);
@ -123,7 +127,7 @@ public class TurnOverController {
@PreAuthorize("@ss.hasPermission('archives:turn-over:export')")
@OperateLog(type = EXPORT)
public void exportTurnOverExcel(@Valid TurnOverExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<TurnOverDO> list = turnOverService.getTurnOverList(exportReqVO);
// 导出 Excel
List<TurnOverExcelVO> datas = TurnOverConvert.INSTANCE.convertList02(list);

Loading…
Cancel
Save