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