|
|
|
@ -48,6 +48,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.flowable.bpmn.constants.BpmnXMLConstants;
|
|
|
|
|
import org.flowable.bpmn.model.*;
|
|
|
|
@ -70,12 +71,14 @@ import org.flowable.task.api.history.HistoricTaskInstance;
|
|
|
|
|
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -122,6 +125,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
private OcrPrevailCloudLogService prevailCloudLogService;
|
|
|
|
|
@Resource
|
|
|
|
|
private PrevailCloudApi prevailCloudApi;
|
|
|
|
|
@Autowired
|
|
|
|
|
private OcrContractorTaskService contractorTaskService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void myTodoTaskList(PageUtils vo, HttpServletRequest request) {
|
|
|
|
@ -837,6 +842,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
*
|
|
|
|
|
* @param processInstanceId
|
|
|
|
|
*/
|
|
|
|
|
@SneakyThrows
|
|
|
|
|
public FlowTaskCompleteVO updateNowTaskAssignee(String processInstanceId, String processDefinitionId, String deptid) {
|
|
|
|
|
|
|
|
|
|
FlowTaskCompleteVO flowTaskCompleteVO = null;
|
|
|
|
@ -901,8 +907,31 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
List<String> candidateUsers = userTask.getCandidateUsers();
|
|
|
|
|
if (null != candidateUsers && !candidateUsers.isEmpty()) {
|
|
|
|
|
Random rand = new Random();
|
|
|
|
|
OcrTaskchildPicture taskchildPicture = ocrTaskchildPictureService.getOne(new LambdaQueryWrapper<OcrTaskchildPicture>().eq(OcrTaskchildPicture::getProcessinstanceid, processInstanceId).eq(OcrTaskchildPicture::getProcessdefinitionid, processDefinitionId));
|
|
|
|
|
OcrPicture first = ocrPictureService.getOne(new LambdaQueryWrapper<OcrPicture>().eq(OcrPicture::getId, taskchildPicture.getPictureid()));
|
|
|
|
|
List<OcrContractorTask> contractorList = contractorTaskService.list(new LambdaQueryWrapper<OcrContractorTask>().eq(OcrContractorTask::getTenantId, taskchildPicture.getTenantid()));
|
|
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(contractorList)) {
|
|
|
|
|
Class<? extends OcrPicture> aClass = first.getClass();
|
|
|
|
|
Field field = aClass.getDeclaredField(contractorList.get(0).getField());
|
|
|
|
|
field.setAccessible(true);
|
|
|
|
|
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> assigneeList = new ArrayList<>();
|
|
|
|
|
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())));
|
|
|
|
|
}else {
|
|
|
|
|
taskService.claim(task.getId(), candidateUsers.get(rand.nextInt(candidateUsers.size())));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
taskService.claim(task.getId(), candidateUsers.get(rand.nextInt(candidateUsers.size())));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//得到候选组
|
|
|
|
|
List<String> candidateGroups = userTask.getCandidateGroups();
|
|
|
|
|