From f7d45da70da6d02fa476d97d2a9fec187de5881d Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期二, 15 七月 2025 10:46:33 +0800 Subject: [PATCH] art: 技术状态鉴定工单-流程问题修改 --- lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java | 181 +++++++++++++++++++++++---------------------- 1 files changed, 93 insertions(+), 88 deletions(-) diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java index fb5e489..83e2c91 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java @@ -163,80 +163,85 @@ UserTask nextTask = nextFlowNode.getUserTask(); Task task2 = null; Optional<Task> first = task2List.stream().filter(t -> t.getTaskDefinitionKey().equals(nextTask.getId())).findFirst(); - task2 = first.orElseGet(() -> task2List.get(0)); - if (task2 != null) { - // 涓嬩釜鑺傜偣鍊欓�変汉 - List<String> beforeParamsCandidateUsernames = flowCallBackService.flowCandidateUsernamesOfTask(task2.getTaskDefinitionKey(), taskVo.getValues()); - List<String> candidateUsers = taskVo.getCandidateUsers(); - if (CollUtil.isNotEmpty(candidateUsers)) { - // 鍓嶇浼犲叆鍊欓�変汉 瑕嗙洊 - beforeParamsCandidateUsernames = candidateUsers; - } - if (task.getTaskDefinitionKey().equals(task2.getTaskDefinitionKey())) { - //澶氬疄渚� 浼氱 TODO - // * 褰撳墠鑺傜偣鏄細绛捐妭鐐癸紝娌℃湁璧板畬 - business.setTaskId(task2.getId()) -// .setActStatus(ActStatus.doing) - .setDoneUsers(doneUserList.toJSONString()) - ; - String todoUsersStr = business.getTodoUsers(); - JSONArray todosArr = JSON.parseArray(todoUsersStr); - // 鍒犻櫎鍚庨噸鍐� - for (Object oldUser : todosArr) { - taskService.deleteCandidateUser(task2.getId(), oldUser.toString()); - } - // 閲嶅啓 - if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)) { - beforeParamsCandidateUsernames.remove(loginUser.getUsername()); - // 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� - for (String newUser : beforeParamsCandidateUsernames) { - taskService.addCandidateUser(task2.getId(), newUser); - } - business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); - } else { - todosArr.remove(loginUser.getUsername()); - for (Object oldUser : todosArr) { - taskService.addCandidateUser(task2.getId(), oldUser.toString()); - } - business.setTodoUsers(todosArr.toJSONString()); - } - - } else { - //鑳藉澶勭悊涓嬩釜鑺傜偣鐨勫�欓�変汉 - List<SysUser> nextFlowNodeUserList = nextFlowNode.getUserList(); - List<String> collect_username = nextFlowNodeUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); + if(!first.isPresent() && !checkParallelCompletion(taskVo.getTaskId())){ + //涓嬩釜鑺傜偣浠诲姟杩樻槸骞惰缃戝叧鐨勪换鍔� + flowMyBusinessService.removeById(business.getId()); + } else { + task2 = first.orElseGet(() -> task2List.get(0)); + if (task2 != null) { + // 涓嬩釜鑺傜偣鍊欓�変汉 + List<String> beforeParamsCandidateUsernames = flowCallBackService.flowCandidateUsernamesOfTask(task2.getTaskDefinitionKey(), taskVo.getValues()); + List<String> candidateUsers = taskVo.getCandidateUsers(); if (CollUtil.isNotEmpty(candidateUsers)) { - // 鍓嶇浼犲叆鍊欓�変汉 - collect_username = candidateUsers; + // 鍓嶇浼犲叆鍊欓�変汉 瑕嗙洊 + beforeParamsCandidateUsernames = candidateUsers; } - business - .setTaskId(task2.getId()) -// .setActStatus(ActStatus.doing) - .setTaskNameId(nextTask.getId()) - .setTaskName(nextTask.getName()) - .setPriority(nextTask.getPriority()) - .setDoneUsers(doneUserList.toJSONString()) - .setTodoUsers(JSON.toJSONString(collect_username)) - ; - // 鍒犻櫎鍚庨噸鍐� - for (String oldUser : collect_username) { - taskService.deleteCandidateUser(task2.getId(), oldUser); - } - if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)) { - // 鍓嶇娌℃湁浼犲叆鍊欓�変汉 && 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� - for (String newUser : beforeParamsCandidateUsernames) { - taskService.addCandidateUser(task2.getId(), newUser); + if (task.getTaskDefinitionKey().equals(task2.getTaskDefinitionKey())) { + //澶氬疄渚� 浼氱 TODO + // * 褰撳墠鑺傜偣鏄細绛捐妭鐐癸紝娌℃湁璧板畬 + business.setTaskId(task2.getId()) +// .setActStatus(ActStatus.doing) + .setDoneUsers(doneUserList.toJSONString()) + ; + String todoUsersStr = business.getTodoUsers(); + JSONArray todosArr = JSON.parseArray(todoUsersStr); + // 鍒犻櫎鍚庨噸鍐� + for (Object oldUser : todosArr) { + taskService.deleteCandidateUser(task2.getId(), oldUser.toString()); } - business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + // 閲嶅啓 + if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)) { + beforeParamsCandidateUsernames.remove(loginUser.getUsername()); + // 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2.getId(), newUser); + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } else { + todosArr.remove(loginUser.getUsername()); + for (Object oldUser : todosArr) { + taskService.addCandidateUser(task2.getId(), oldUser.toString()); + } + business.setTodoUsers(todosArr.toJSONString()); + } + } else { - for (String oldUser : collect_username) { - taskService.addCandidateUser(task2.getId(), oldUser); + //鑳藉澶勭悊涓嬩釜鑺傜偣鐨勫�欓�変汉 + List<SysUser> nextFlowNodeUserList = nextFlowNode.getUserList(); + List<String> collect_username = nextFlowNodeUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(candidateUsers)) { + // 鍓嶇浼犲叆鍊欓�変汉 + collect_username = candidateUsers; } - business.setTodoUsers(JSON.toJSONString(collect_username)); + business + .setTaskId(task2.getId()) +// .setActStatus(ActStatus.doing) + .setTaskNameId(nextTask.getId()) + .setTaskName(nextTask.getName()) + .setPriority(nextTask.getPriority()) + .setDoneUsers(doneUserList.toJSONString()) + .setTodoUsers(JSON.toJSONString(collect_username)) + ; + // 鍒犻櫎鍚庨噸鍐� + for (String oldUser : collect_username) { + taskService.deleteCandidateUser(task2.getId(), oldUser); + } + if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)) { + // 鍓嶇娌℃湁浼犲叆鍊欓�変汉 && 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2.getId(), newUser); + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } else { + for (String oldUser : collect_username) { + taskService.addCandidateUser(task2.getId(), oldUser); + } + business.setTodoUsers(JSON.toJSONString(collect_username)); + } } } + flowMyBusinessService.updateById(business); } - flowMyBusinessService.updateById(business); } else { for(FlowNextDto nextFlowNode : nextFlowNodeList) { @@ -1150,28 +1155,28 @@ String username = iFlowThirdService.getLoginUser().getUsername(); flowMyBusinessDto.setCurrentUser(username); List<FlowTaskDto> list = flowMyBusinessService.ListMyBusiness(flowMyBusinessDto); - list.forEach(flowTaskDto -> { - // 娴佺▼鍙戣捣浜轰俊鎭� - HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(flowTaskDto.getProcInsId()) - .singleResult(); - if (historicProcessInstance != null) { - SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); - if (startUser != null) { - flowTaskDto.setStartUserId(startUser.getUsername()); - flowTaskDto.setStartUserName(startUser.getRealname()); - } - List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); - flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername, "锛�")); - if (flowTaskDto.getTodoUsers() == null) { - flowTaskDto.setTodoUsers(""); - } else { - //鍘婚櫎[] - flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\\[", "").replaceAll("\\]", "")); - flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\"", "")); - } - } - }); +// list.forEach(flowTaskDto -> { +// // 娴佺▼鍙戣捣浜轰俊鎭� +// HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() +// .processInstanceId(flowTaskDto.getProcInsId()) +// .singleResult(); +// if (historicProcessInstance != null) { +// SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); +// if (startUser != null) { +// flowTaskDto.setStartUserId(startUser.getUsername()); +// flowTaskDto.setStartUserName(startUser.getRealname()); +// } +// List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); +// flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername, "锛�")); +// if (flowTaskDto.getTodoUsers() == null) { +// flowTaskDto.setTodoUsers(""); +// } else { +// //鍘婚櫎[] +// flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\\[", "").replaceAll("\\]", "")); +// flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\"", "")); +// } +// } +// }); IPage<FlowTaskDto> flowTaskDtoIPage = new Page<>(); flowTaskDtoIPage.setRecords(list); flowTaskDtoIPage.setTotal(page.getTotal()); -- Gitblit v1.9.3