From c728ff3960180eee5887575161468626d91deee5 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 4 Aug 2022 10:16:51 +0800 Subject: [PATCH] =?UTF-8?q?getByApplyFlag=E5=A2=9E=E5=8A=A0backToFirst?= =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TAbilityApplicationController.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index dcf69b61..97793251 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -32,7 +32,11 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.activiti.engine.HistoryService; +import org.activiti.engine.history.HistoricProcessInstance; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -55,6 +59,7 @@ import java.util.stream.Collectors; @RequestMapping("processForm/tabilityapplication") @Api(tags = "能力申请表单") public class TAbilityApplicationController { + private static final Logger logger = LoggerFactory.getLogger(TAbilityApplicationController.class); @Autowired private TAbilityApplicationService tAbilityApplicationService; @Autowired @@ -69,6 +74,8 @@ public class TAbilityApplicationController { private CameraChannelMapper cameraChannelMapper; @Autowired private SysDeptService sysDeptService; + @Autowired + protected HistoryService historyService; @Value("${project.place}") private Integer projectPlace; @@ -169,6 +176,21 @@ public class TAbilityApplicationController { return new Result().ok(LocalDateTime.now().toString()); } +// 获取流程内参数 +// @GetMapping("test") +// public Result tt(String id) { +// HistoricProcessInstance processInstanceDTO = +// historyService.createHistoricProcessInstanceQuery().processInstanceId(id).includeProcessVariables().singleResult(); +// if (processInstanceDTO != null) { +// logger.info(processInstanceDTO.getProcessVariables().toString()); +// if (processInstanceDTO.getProcessVariables().containsKey("backToFirst")) { +// logger.info(processInstanceDTO.getProcessVariables().getOrDefault("backToFirst", "false") + ""); +// } +// return new Result().ok(JSON.toJSONString(processInstanceDTO.getProcessVariables())); +// } +// return new Result().ok(LocalDateTime.now().toString()); +// } + @GetMapping("getByApplyFlag/{applyFlag}") @ApiOperation("根据申请标识获取能力申请信息") @LogOperation("根据申请标识获取能力申请信息") @@ -226,6 +248,23 @@ public class TAbilityApplicationController { camera = cameraList; List finalCamera = camera; + + boolean backToFirst = false; + + HistoricProcessInstance processInstanceDTO = + historyService.createHistoricProcessInstanceQuery().processInstanceId(tAbilityApplicationDTOList.get(0).getInstanceId()).includeProcessVariables().singleResult(); + if (processInstanceDTO != null) { + logger.info(JSON.toJSONString(processInstanceDTO.getProcessVariables())); + if (processInstanceDTO.getProcessVariables().containsKey("backToFirst")) { + try { + backToFirst = Boolean.parseBoolean(processInstanceDTO.getProcessVariables().getOrDefault("backToFirst", "false").toString()); + } catch (Exception exception) { + logger.info("{}未被驳回", tAbilityApplicationDTOList.get(0).getInstanceId()); + } + } + } + + boolean finalBackToFirst = backToFirst; return new HashMap() { { put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id @@ -241,6 +280,7 @@ public class TAbilityApplicationController { if (!finalCamera.isEmpty()) { put("camera", finalCamera); // 流程详情 } + put("backToFirst", finalBackToFirst); } }; }).filter(Objects::nonNull).collect(Collectors.groupingBy(t -> {