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