Merge branch 'dev'

This commit is contained in:
wangliwen 2022-08-04 10:16:58 +08:00
commit 2360250ef6
1 changed files with 40 additions and 0 deletions

View File

@ -32,7 +32,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -55,6 +59,7 @@ import java.util.stream.Collectors;
@RequestMapping("processForm/tabilityapplication") @RequestMapping("processForm/tabilityapplication")
@Api(tags = "能力申请表单") @Api(tags = "能力申请表单")
public class TAbilityApplicationController { public class TAbilityApplicationController {
private static final Logger logger = LoggerFactory.getLogger(TAbilityApplicationController.class);
@Autowired @Autowired
private TAbilityApplicationService tAbilityApplicationService; private TAbilityApplicationService tAbilityApplicationService;
@Autowired @Autowired
@ -69,6 +74,8 @@ public class TAbilityApplicationController {
private CameraChannelMapper cameraChannelMapper; private CameraChannelMapper cameraChannelMapper;
@Autowired @Autowired
private SysDeptService sysDeptService; private SysDeptService sysDeptService;
@Autowired
protected HistoryService historyService;
@Value("${project.place}") @Value("${project.place}")
private Integer projectPlace; private Integer projectPlace;
@ -169,6 +176,21 @@ public class TAbilityApplicationController {
return new Result<String>().ok(LocalDateTime.now().toString()); return new Result<String>().ok(LocalDateTime.now().toString());
} }
// 获取流程内参数
// @GetMapping("test")
// public Result<String> 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<String>().ok(JSON.toJSONString(processInstanceDTO.getProcessVariables()));
// }
// return new Result<String>().ok(LocalDateTime.now().toString());
// }
@GetMapping("getByApplyFlag/{applyFlag}") @GetMapping("getByApplyFlag/{applyFlag}")
@ApiOperation("根据申请标识获取能力申请信息") @ApiOperation("根据申请标识获取能力申请信息")
@LogOperation("根据申请标识获取能力申请信息") @LogOperation("根据申请标识获取能力申请信息")
@ -226,6 +248,23 @@ public class TAbilityApplicationController {
camera = cameraList; camera = cameraList;
List<Object> finalCamera = camera; List<Object> 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<String, Object>() { return new HashMap<String, Object>() {
{ {
put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id
@ -241,6 +280,7 @@ public class TAbilityApplicationController {
if (!finalCamera.isEmpty()) { if (!finalCamera.isEmpty()) {
put("camera", finalCamera); // 流程详情 put("camera", finalCamera); // 流程详情
} }
put("backToFirst", finalBackToFirst);
} }
}; };
}).filter(Objects::nonNull).collect(Collectors.groupingBy(t -> { }).filter(Objects::nonNull).collect(Collectors.groupingBy(t -> {