|
@@ -757,6 +757,17 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
@Override
|
|
|
public List<FlowTaskResult> getTaskAll(String flowId) {
|
|
|
TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByFlowId(SystemConstant.convertIdToLong(flowId));
|
|
|
+ Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("自定义流程实体数据为空"));
|
|
|
+ return this.getFlowTaskResult(tfCustomFlowEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取流程节点信息
|
|
|
+ *
|
|
|
+ * @param tfCustomFlowEntity
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected List<FlowTaskResult> getFlowTaskResult(TFCustomFlowEntity tfCustomFlowEntity) {
|
|
|
Map<String, Object> flowProcessVarMap = this.getFlowProcessVarMap(tfCustomFlowEntity);
|
|
|
Map<String, FlowTaskResult> setupMap = (Map<String, FlowTaskResult>) flowProcessVarMap.get(SystemConstant.SETUP_MAP);
|
|
|
Optional.ofNullable(setupMap).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程没有步骤数据!"));
|
|
@@ -765,7 +776,7 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Gson gson = new Gson();
|
|
|
for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
|
|
|
FlowTaskResult FlowTaskResult = gson.fromJson(gson.toJson(entry.getValue()), FlowTaskResult.class);
|
|
|
- FlowTaskResult.setFlowId(SystemConstant.convertIdToLong(flowId));
|
|
|
+ FlowTaskResult.setFlowId(tfCustomFlowEntity.getFlowId());
|
|
|
flowTaskResultList.add(FlowTaskResult);
|
|
|
}
|
|
|
return flowTaskResultList;
|
|
@@ -2198,7 +2209,7 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public TaskInfoResult taskInfo(Long taskId) {
|
|
|
+ public TaskInfoResult getTaskInfo(Long taskId) {
|
|
|
Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
|
|
|
Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程任务为空或该流程已被他人审核,请刷新再试!"));
|
|
|
Long flowId = SystemConstant.convertIdToLong(task.getProcessInstanceId());
|
|
@@ -2228,6 +2239,60 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
return taskInfoResult;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取当前流程信息
|
|
|
+ *
|
|
|
+ * @param flowId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public FlowViewResult getFlowView(Long flowId) {
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ 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("流程数据为空"));
|
|
|
+
|
|
|
+ //获取当前流程节点
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(flowId, sysUser.getSchoolId());
|
|
|
+ Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程审核数据为空"));
|
|
|
+
|
|
|
+ Map<String, Object> flowProcessVarMap = this.getFlowProcessVarMap(tfCustomFlowEntity);
|
|
|
+ Map<String, FlowTaskResult> setupMap = (Map<String, FlowTaskResult>) flowProcessVarMap.get(SystemConstant.SETUP_MAP);
|
|
|
+
|
|
|
+ FlowViewResult flowViewResult = null;
|
|
|
+ for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
|
|
|
+ FlowTaskResult customFlowVarDto = gson.fromJson(gson.toJson(entry.getValue()), FlowTaskResult.class);
|
|
|
+ if (Objects.nonNull(tfFlowApprove.getSetup()) && customFlowVarDto.getSetup().intValue() == tfFlowApprove.getSetup().intValue()) {
|
|
|
+ flowViewResult = new FlowViewResult(flowId, customFlowVarDto.getTaskName(), customFlowVarDto.getTaskKey(), customFlowVarDto.getSetup());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ flowViewResult = Objects.isNull(flowViewResult) ? new FlowViewResult() : flowViewResult;
|
|
|
+ //获取流程待审批人
|
|
|
+ Map<String, CustomFlowVarDto> agginessMap = (Map<String, CustomFlowVarDto>) flowProcessVarMap.get(SystemConstant.AGGINESS_MAP);
|
|
|
+ if (Objects.nonNull(tfFlowApprove.getTransferAssignee())) {
|
|
|
+ agginessMap = JacksonUtil.readJson(tfFlowApprove.getTransferAssignee(), Map.class);
|
|
|
+ }
|
|
|
+// Map<String, Object> varMap = new HashMap<>();
|
|
|
+// for (Map.Entry<String, CustomFlowVarDto> entry : agginessMap.entrySet()) {
|
|
|
+// CustomFlowVarDto customFlowVarDto = gson.fromJson(gson.toJson(entry.getValue()), CustomFlowVarDto.class);
|
|
|
+// varMap.computeIfAbsent(customFlowVarDto.getFlowTaskVar(), s -> customFlowVarDto.getApproveIds().size() == 1 ? customFlowVarDto.getApproveIds().get(0) : customFlowVarDto.getApproveIds());
|
|
|
+// }
|
|
|
+
|
|
|
+ //获取流程审批历史
|
|
|
+ List<TFFlowLogResult> tfFlowLogResultList = tfFlowLogService.findByExamTaskId(tExamTaskFlowList.get(0).getTaskId());
|
|
|
+ flowViewResult.setFlowTaskResultList(flowViewTaskResultList);
|
|
|
+ flowViewResult.setTfFlowLogResultList(tfFlowLogResultList);
|
|
|
+ return flowViewResult;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取流程变量
|
|
|
*
|