|
@@ -40,7 +40,6 @@ import org.activiti.engine.task.Task;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
@@ -2255,11 +2254,6 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(flowId);
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程实体数据为空"));
|
|
|
|
|
|
- Gson gson = new Gson();
|
|
|
- List<FlowTaskResult> flowTaskResultList = this.getFlowTaskResult(tfCustomFlowEntity);
|
|
|
- List<FlowViewTaskResult> flowViewTaskResultList = gson.fromJson(gson.toJson(flowTaskResultList), new TypeToken<List<FlowViewTaskResult>>() {
|
|
|
- }.getType());
|
|
|
-
|
|
|
//获取流程id
|
|
|
List<TExamTaskFlow> tExamTaskFlowList = tExamTaskFlowService.findByFlowEntityId(tfCustomFlowEntity.getId());
|
|
|
Optional.ofNullable(tExamTaskFlowList).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程数据为空"));
|
|
@@ -2271,12 +2265,12 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Map<String, Object> flowProcessVarMap = this.getFlowProcessVarMap(tfCustomFlowEntity);
|
|
|
Map<String, FlowTaskResult> setupMap = (Map<String, FlowTaskResult>) flowProcessVarMap.get(SystemConstant.SETUP_MAP);
|
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
FlowTaskResult currFlowTaskResult = null;
|
|
|
for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
|
|
|
FlowTaskResult flowTaskResult = gson.fromJson(gson.toJson(entry.getValue()), FlowTaskResult.class);
|
|
|
if (Objects.nonNull(tfFlowApprove.getSetup()) && flowTaskResult.getSetup().intValue() == tfFlowApprove.getSetup().intValue()) {
|
|
|
- currFlowTaskResult = new FlowTaskResult();
|
|
|
- BeanUtils.copyProperties(flowTaskResult, currFlowTaskResult);
|
|
|
+ currFlowTaskResult = flowTaskResult;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -2290,36 +2284,28 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
//获取流程审批历史
|
|
|
List<TFFlowLogResult> tfFlowLogResultList = tfFlowLogService.findByExamTaskId(tExamTaskFlowList.get(0).getTaskId());
|
|
|
if (Objects.nonNull(tfFlowLogResultList) && tfFlowLogResultList.size() > 0) {
|
|
|
- LinkedMultiValueMap<Integer, TFFlowViewLogResult> tfFlowViewLogResultMap = new LinkedMultiValueMap<>();
|
|
|
- for (TFFlowLogResult t : tfFlowLogResultList) {
|
|
|
- tfFlowViewLogResultMap.add(t.getApproveSetup(), new TFFlowViewLogResult(t));
|
|
|
- }
|
|
|
-
|
|
|
- for (FlowViewTaskResult f : flowViewTaskResultList) {
|
|
|
- CustomFlowVarDto customFlowVarDto = gson.fromJson(gson.toJson(agginessMap.get(f.getTaskKey())), CustomFlowVarDto.class);
|
|
|
- if (f.getSetup().intValue() <= currFlowTaskResult.getSetup().intValue()) {//已审节点
|
|
|
- if (currFlowTaskResult.getSetup().intValue() == f.getSetup().intValue()) {//当前审批节点
|
|
|
- f.setCurrentTask(true);
|
|
|
- List<TFFlowViewLogResult> tfFlowViewLogResultList = tfFlowViewLogResultMap.get(f.getSetup());
|
|
|
- f.setTfFlowViewLogResultList(tfFlowViewLogResultList);
|
|
|
- TFFlowViewLogResult tfFlowViewLogResult = tfFlowViewLogResultList.get(tfFlowViewLogResultList.size() - 1);
|
|
|
- f.setCurrentApproveUsers(tfFlowViewLogResult.getPendApproveUserName());
|
|
|
- } else {
|
|
|
- //上一节点审核人
|
|
|
- f.setTfFlowViewLogResultList(tfFlowViewLogResultMap.get(f.getSetup()));
|
|
|
- }
|
|
|
- } else if (f.getSetup().intValue() > currFlowTaskResult.getSetup().intValue()) {//待审核节点
|
|
|
- //下一节点审批人
|
|
|
- if (Objects.nonNull(customFlowVarDto.getApproveIds())) {
|
|
|
- ApproveUserResult approveUserResult = sysUserService.findByIds(customFlowVarDto.getApproveIds().stream().map(x -> SystemConstant.convertIdToLong(x)).collect(Collectors.toList()));
|
|
|
- f.setPendApproveUsers(approveUserResult.getPendApproveUsers());
|
|
|
- f.setTfFlowViewLogResultList(tfFlowViewLogResultMap.get(f.getSetup()));
|
|
|
- }
|
|
|
+ List<TFFlowViewLogResult> flowViewTaskResultList = gson.fromJson(gson.toJson(tfFlowLogResultList), new TypeToken<List<TFFlowViewLogResult>>() {
|
|
|
+ }.getType());
|
|
|
+ if (Objects.nonNull(currFlowTaskResult)) {
|
|
|
+ CustomFlowVarDto customFlowVarDto = gson.fromJson(gson.toJson(agginessMap.get(currFlowTaskResult.getTaskKey())), CustomFlowVarDto.class);
|
|
|
+ String nextApproveUsers = flowViewTaskResultList.get(flowViewTaskResultList.size() - 1).getPendApproveUserName();
|
|
|
+ if (Objects.nonNull(customFlowVarDto.getMultipleUserApproveType()) && customFlowVarDto.getMultipleUserApproveType() == CustomFlowMultipleUserApproveTypeEnum.ORDER) {
|
|
|
+ String[] strs = nextApproveUsers.split(",");
|
|
|
+ nextApproveUsers = strs[0];
|
|
|
}
|
|
|
- f.setMultipleUserApproveType(customFlowVarDto.getMultipleUserApproveType());
|
|
|
+ return new FlowViewResult(customFlowVarDto.getMultipleUserApproveType(), currFlowTaskResult, nextApproveUsers, flowViewTaskResultList);
|
|
|
+ } else {
|
|
|
+ return new FlowViewResult(flowViewTaskResultList);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (Objects.nonNull(currFlowTaskResult)) {
|
|
|
+ CustomFlowVarDto customFlowVarDto = gson.fromJson(gson.toJson(agginessMap.get(currFlowTaskResult.getTaskKey())), CustomFlowVarDto.class);
|
|
|
+ ApproveUserResult approveUserResult = Objects.nonNull(customFlowVarDto.getApproveIds()) ? sysUserService.findByIds(customFlowVarDto.getApproveIds().stream().map(x -> SystemConstant.convertIdToLong(x)).collect(Collectors.toList())) : null;
|
|
|
+ return new FlowViewResult(customFlowVarDto.getMultipleUserApproveType(), currFlowTaskResult, Objects.nonNull(approveUserResult) ? approveUserResult.getPendApproveUsers() : null, null);
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|
|
|
- return new FlowViewResult(flowViewTaskResultList);
|
|
|
}
|
|
|
|
|
|
/**
|