Merge branch 'dev' into docker_package

This commit is contained in:
wangliwen 2022-07-18 18:52:12 +08:00
commit 46576aa4fa
1 changed files with 32 additions and 15 deletions

View File

@ -33,8 +33,10 @@ 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.RuntimeService;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricProcessInstanceQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -45,10 +47,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -77,6 +76,8 @@ public class TAbilityApplicationController {
private SysDeptService sysDeptService;
@Autowired
protected RuntimeService runtimeService;
@Autowired
protected HistoryService historyService;
@Value("${project.place}")
private Integer projectPlace;
@ -107,14 +108,26 @@ public class TAbilityApplicationController {
if (inStanceId == null) {
return index;
}
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().processInstanceId(inStanceId + "").singleResult();
if (execution != null) {
index.setEnded(execution.isEnded()); // 流程引擎内是否已结束
} else {
if (params.containsKey("ended")) {
index.setEnded(Boolean.valueOf(params.get("ended").toString()));
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processInstanceIds(new HashSet<String>() {
{
add(inStanceId + "");
}
});
HistoricProcessInstance historicProcessInstance = query.singleResult();
if (historicProcessInstance != null && historicProcessInstance.getEndTime() != null) {
index.setEnded(true);
} else {
index.setEnded(false);
}
// ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().processInstanceId(inStanceId + "").singleResult();
// if (execution != null) {
// index.setEnded(execution.isEnded()); // 流程引擎内是否已结束
// } else {
// if (params.containsKey("ended")) {
// index.setEnded(Boolean.valueOf(params.get("ended").toString()));
// }
// }
List<TAbilityApplicationDTO> dtos =
tAbilityApplicationService.getByInstanceId(inStanceId + "");
if (!dtos.isEmpty()) {
@ -215,18 +228,22 @@ public class TAbilityApplicationController {
camera = cameraList;
List<Object> finalCamera = camera;
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().processInstanceId(tAbilityApplicationDTOList.get(0).getInstanceId() + "").singleResult();
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processInstanceIds(new HashSet<String>() {
{
add(tAbilityApplicationDTOList.get(0).getInstanceId() + "");
}
});
HistoricProcessInstance historicProcessInstance = query.singleResult();
Map<String, Object> resourceApplication = new HashMap<String, Object>() {
{
put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id
put("resourceOwnerDept", tAbilityApplicationDTOList.get(0).getResourceOwnerDept()); // 资源所属部门信息
put("resources", resourceDTOS);//申请的该部门的能力资源
if (execution != null) {
put("ended", execution.isEnded());
if (historicProcessInstance != null && historicProcessInstance.getEndTime() != null) {
put("ended", true);
} else {
put("ended", false);
}
put("taskHandleDetailInfo", taskHandleDetailInfo); // 流程详情
if (!finalCamera.isEmpty()) {
put("camera", finalCamera); // 流程详情