|
@@ -989,6 +989,79 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
989
|
989
|
return AjaxResult.success(map);
|
990
|
990
|
}
|
991
|
991
|
|
|
992
|
+ /**
|
|
993
|
+ * 获取历史完整流转记录
|
|
994
|
+ *
|
|
995
|
+ * @param procInsId 流程实例Id
|
|
996
|
+ * @return
|
|
997
|
+ */
|
|
998
|
+ @Override
|
|
999
|
+ public AjaxResult flowRecordFull(String procInsId, String deployId) {
|
|
1000
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
1001
|
+ if (StringUtils.isNotBlank(procInsId)) {
|
|
1002
|
+ List<HistoricActivityInstance> list = historyService
|
|
1003
|
+ .createHistoricActivityInstanceQuery()
|
|
1004
|
+ .processInstanceId(procInsId)
|
|
1005
|
+ .orderByHistoricActivityInstanceStartTime()
|
|
1006
|
+ .desc().list();
|
|
1007
|
+ List<FlowTaskDto> hisFlowList = new ArrayList<>();
|
|
1008
|
+ for (HistoricActivityInstance histIns : list) {
|
|
1009
|
+ if (StringUtils.isNotBlank(histIns.getTaskId())) {
|
|
1010
|
+ FlowTaskDto flowTask = new FlowTaskDto();
|
|
1011
|
+ flowTask.setTaskId(histIns.getTaskId());
|
|
1012
|
+ flowTask.setTaskName(histIns.getActivityName());
|
|
1013
|
+ flowTask.setCreateTime(histIns.getStartTime());
|
|
1014
|
+ flowTask.setFinishTime(histIns.getEndTime());
|
|
1015
|
+ if (StringUtils.isNotBlank(histIns.getAssignee())) {
|
|
1016
|
+ SysUser sysUser = sysUserService.selectUserById(Long.parseLong(histIns.getAssignee()));
|
|
1017
|
+ flowTask.setAssigneeId(sysUser.getUserId());
|
|
1018
|
+ flowTask.setAssigneeName(sysUser.getNickName());
|
|
1019
|
+ flowTask.setDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
|
|
1020
|
+ }
|
|
1021
|
+ // 展示审批人员
|
|
1022
|
+ List<HistoricIdentityLink> linksForTask = historyService.getHistoricIdentityLinksForTask(histIns.getTaskId());
|
|
1023
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
1024
|
+ for (HistoricIdentityLink identityLink : linksForTask) {
|
|
1025
|
+ // 获选人,候选组/角色(多个)
|
|
1026
|
+ if ("candidate".equals(identityLink.getType())) {
|
|
1027
|
+ if (StringUtils.isNotBlank(identityLink.getUserId())) {
|
|
1028
|
+ SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId()));
|
|
1029
|
+ stringBuilder.append(sysUser.getNickName()).append(",");
|
|
1030
|
+ }
|
|
1031
|
+ if (StringUtils.isNotBlank(identityLink.getGroupId())) {
|
|
1032
|
+ SysRole sysRole = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
|
|
1033
|
+ stringBuilder.append(sysRole.getRoleName()).append(",");
|
|
1034
|
+ }
|
|
1035
|
+ }
|
|
1036
|
+ }
|
|
1037
|
+ if (StringUtils.isNotBlank(stringBuilder)) {
|
|
1038
|
+ flowTask.setCandidate(stringBuilder.substring(0, stringBuilder.length() - 1));
|
|
1039
|
+ }
|
|
1040
|
+
|
|
1041
|
+ flowTask.setDuration(histIns.getDurationInMillis() == null || histIns.getDurationInMillis() == 0 ? null : getDate(histIns.getDurationInMillis()));
|
|
1042
|
+ // 获取意见评论内容
|
|
1043
|
+ List<Comment> commentList = taskService.getProcessInstanceComments(histIns.getProcessInstanceId());
|
|
1044
|
+ commentList.forEach(comment -> {
|
|
1045
|
+ if (histIns.getTaskId().equals(comment.getTaskId())) {
|
|
1046
|
+ flowTask.setComment(FlowCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build());
|
|
1047
|
+ }
|
|
1048
|
+ });
|
|
1049
|
+ hisFlowList.add(flowTask);
|
|
1050
|
+ }
|
|
1051
|
+ }
|
|
1052
|
+ map.put("flowList", hisFlowList);
|
|
1053
|
+ }
|
|
1054
|
+ // 第一次申请获取初始化表单
|
|
1055
|
+ if (StringUtils.isNotBlank(deployId)) {
|
|
1056
|
+ SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId);
|
|
1057
|
+ if (Objects.isNull(sysForm)) {
|
|
1058
|
+ return AjaxResult.error("请先配置流程表单");
|
|
1059
|
+ }
|
|
1060
|
+ map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));
|
|
1061
|
+ }
|
|
1062
|
+ return AjaxResult.success(map);
|
|
1063
|
+ }
|
|
1064
|
+
|
992
|
1065
|
/**
|
993
|
1066
|
* 根据任务ID查询挂载的表单信息
|
994
|
1067
|
*
|