|
@@ -513,8 +513,40 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
|
|
|
|
//转换VO
|
|
|
if (result != null && result.size() != 0) {
|
|
|
+
|
|
|
+ //属于待审批和已审批状态,查询待办信息
|
|
|
+ Map<Long, Task> taskMaps = new HashMap<>();
|
|
|
+ Map<String, List<TaskParallel>> taskParallelMaps = new HashMap<>();
|
|
|
+ List<Long> informationIds = result.stream().filter(f -> f.getStatus().equals(1) || f.getStatus().equals(2)).map(InformationQuery::getId).collect(Collectors.toList());
|
|
|
+ String informationIdsStr = informationIds.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ if (StringUtils.isNotEmpty(informationIdsStr)) {
|
|
|
+ List<Task> query = jdbcTemplate.query("SELECT id,form_data_id,process_instance_id,approval_type,status,batch,project_id,contract_id FROM u_task WHERE form_data_id IN(" + informationIdsStr + ") AND status IN (1, 2, 3) AND is_deleted = 0", new BeanPropertyRowMapper<>(Task.class));
|
|
|
+ taskMaps = query.stream().collect(Collectors.toMap(Task::getId, Function.identity()));
|
|
|
+
|
|
|
+ Set<String> processInstanceIds = query.stream().map(Task::getProcessInstanceId).map(id -> "'" + id + "'").collect(Collectors.toSet());
|
|
|
+ if (processInstanceIds.size() > 0) {
|
|
|
+ List<TaskParallel> taskParallels = jdbcTemplate.query("select task_user, task_user_name, e_visa_status, status, process_instance_id from u_task_parallel where is_deleted = 0 and process_instance_id in(" + StringUtils.join(processInstanceIds, ",") + ")", new BeanPropertyRowMapper<>(TaskParallel.class));
|
|
|
+ taskParallelMaps = taskParallels.stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //校验关联的工序节点是否全都已审批
|
|
|
+ List<String> sjRecordIds = result.stream().map(InformationQuery::getSjRecordIds).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ Set<Long> ids = new HashSet<>();
|
|
|
+ for (String sjRecordId : sjRecordIds) {
|
|
|
+ List<Long> longs = Func.toLongList(sjRecordId);
|
|
|
+ ids.addAll(longs);
|
|
|
+ }
|
|
|
+ List<InformationQuery> informationQueries = new ArrayList<>();
|
|
|
+ if (ids.size() > 0) {
|
|
|
+ informationQueries = baseMapper.selectBatchIds(ids);
|
|
|
+ }
|
|
|
+
|
|
|
List<InformationQueryVO> voResult = JSONArray.parseArray(JSONObject.toJSONString(result), InformationQueryVO.class);
|
|
|
//处理流程状态
|
|
|
+ List<InformationQuery> finalInformationQueries = informationQueries;
|
|
|
+ Map<Long, Task> finalTaskMaps = taskMaps;
|
|
|
+ Map<String, List<TaskParallel>> finalTaskParallelMaps = taskParallelMaps;
|
|
|
voResult.forEach(vor -> {
|
|
|
if (ObjectUtil.isNotEmpty(vor.getCreateTime())) {
|
|
|
vor.setStartTime(DateUtil.format(vor.getCreateTime(), "yyyy-MM-dd"));
|
|
@@ -540,7 +572,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
|
|
|
|
if (Arrays.asList("1,2".split(",")).contains(vor.getStatus().toString())) {
|
|
|
//说明属于待审批和已审批状态,查询待办信息
|
|
|
- List<Task> tasks = this.taskClient.queryTaskListByFormDataId(String.valueOf(vor.getId()));
|
|
|
+ /*List<Task> tasks = this.taskClient.queryTaskListByFormDataId(String.valueOf(vor.getId()));
|
|
|
if (tasks != null && tasks.size() > 0) {
|
|
|
//查询当前任务的所有待办人
|
|
|
List<TaskParallel> linkTasks = this.taskParallelService.queryApprovalUser(tasks.get(0).getProcessInstanceId());
|
|
@@ -550,18 +582,37 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
|
}
|
|
|
//设置上报批次
|
|
|
vor.setReportNumber(String.valueOf(tasks.get(0).getBatch()));
|
|
|
+ }*/
|
|
|
+ Task task = finalTaskMaps.getOrDefault(vor.getId(), null);
|
|
|
+ if (task != null) {
|
|
|
+ //查询当前任务的所有待办人
|
|
|
+ List<TaskParallel> linkTasks = finalTaskParallelMaps.getOrDefault(task.getProcessInstanceId(), null);
|
|
|
+ if (linkTasks != null && linkTasks.size() > 0) {
|
|
|
+ //处理审批状态
|
|
|
+ this.integrationMethod(vor, linkTasks);
|
|
|
+ }
|
|
|
+ //设置上报批次
|
|
|
+ vor.setReportNumber(String.valueOf(task.getBatch()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//校验关联的工序节点是否全都已审批
|
|
|
if (StringUtils.isNotEmpty(vor.getSjRecordIds())) {
|
|
|
- List<InformationQuery> informationQueryList = this.baseMapper.selectBatchIds(Func.toLongList(vor.getSjRecordIds()));
|
|
|
+ /*List<InformationQuery> informationQueryList = this.baseMapper.selectBatchIds(Func.toLongList(vor.getSjRecordIds()));
|
|
|
List<InformationQuery> collect = informationQueryList.stream().filter(f -> f.getStatus().equals(2)).collect(Collectors.toList());
|
|
|
if (collect.size() == informationQueryList.size()) {
|
|
|
vor.setIsApprove(true);
|
|
|
} else {
|
|
|
vor.setIsApprove(false);
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ List<String> recordIdList = Func.toStrList(vor.getSjRecordIds());
|
|
|
+ List<InformationQuery> informationQueryList = finalInformationQueries.stream()
|
|
|
+ .filter(f -> recordIdList.contains(f.getId().toString()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ boolean isApprove = informationQueryList.stream()
|
|
|
+ .allMatch(f -> f.getStatus().equals(2));
|
|
|
+ vor.setIsApprove(isApprove);
|
|
|
}
|
|
|
|
|
|
//试验关联文件pdf
|
|
@@ -570,7 +621,6 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
|
|
|
if (ObjectUtil.isEmpty(voResult)) {
|