feat:修改创建任务动态厂商

pull/166/head
sunchenliang 11 months ago
parent fe9700d07b
commit 8327da7f59

@ -918,22 +918,18 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
String fieldValue = (String) field.get(first);
log.info("厂商名称------{}", fieldValue);
List<String> collect = contractorList.stream().filter(contractorTask -> contractorTask.getContractor().equals(fieldValue)).map(OcrContractorTask::getTaskUserAssignee).collect(Collectors.toList());
List<String> assignees = new ArrayList<>();
List<String> assigneeList = new ArrayList<>();
for (String str : candidateUsers) {
if (collect.contains(str)) {
assigneeList.add(str);
}
}
List<String> assigneeList = getUserCollect(candidateUsers,collect,true);
// for (String str : candidateUsers) {
// if (collect.contains(str)) {
// assigneeList.add(str);
// }
// }
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(assigneeList)) {
taskService.claim(task.getId(), assigneeList.get(rand.nextInt(assigneeList.size())));
}
if (CollectionUtils.isEmpty(assigneeList) && org.apache.commons.collections4.CollectionUtils.isNotEmpty(userList)) {
List<String> userCcollect = candidateUsers.stream().filter(o -> !userList.contains(o)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(userCcollect)) {
userCcollect = candidateUsers;
}
taskService.claim(task.getId(), userCcollect.get(rand.nextInt(userCcollect.size())));
if (CollectionUtils.isEmpty(assigneeList) && org.apache.commons.collections4.CollectionUtils.isNotEmpty(collect)) {
List<String> userCollect = getUserCollect(candidateUsers, collect, false);
taskService.claim(task.getId(), userCollect.get(rand.nextInt(userCollect.size())));
} else {
taskService.claim(task.getId(), candidateUsers.get(rand.nextInt(candidateUsers.size())));
}
@ -984,6 +980,27 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
return flowTaskCompleteVO;
}
private static List<String> getUserCollect(List<String> candidateUsers, List<String> userList, Boolean type) {
List<String> userCcollect = new ArrayList<>();
for (String candidateUser : candidateUsers) {
for (String user : userList) {
if (type) {
if (user.contains(candidateUser)) {
userCcollect.add(candidateUser);
}
} else {
if (!user.contains(candidateUser)) {
userCcollect.add(candidateUser);
}
}
}
}
if (CollectionUtils.isEmpty(userCcollect) && !type) {
userCcollect = candidateUsers;
}
return userCcollect;
}
/**
*
*/

@ -1036,7 +1036,7 @@
and (FIND_IN_SET(#{thisLoginUserid.value}
, tcp.ASSIGNEE) or
<if test="contractor != null">
if((select count(1) from ocr_contractor_task where tenant_id =#{tenantid.value} and pic.${contractor.value} = contractor and task_user_assignee = #{thisLoginUserid.value})>1, 1=1,tcp.STATES = 5)
if((select count(1) from ocr_contractor_task where tenant_id =#{tenantid.value} and pic.${contractor.value} = contractor and FIND_IN_SET(#{thisLoginUserid.value},task_user_assignee))>1, 1=1,tcp.STATES = 5)
</if>
<if test="contractor == null">
tcp.STATES = 5

Loading…
Cancel
Save