|
|
@@ -1959,7 +1959,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
List<InformationQuery> result = new ArrayList<>();
|
|
|
- List<List<String>> partition = Lists.partition(vo.getWbsIds(), 500);
|
|
|
+ List<List<String>> partition = Lists.partition(vo.getWbsIds(), 5000);
|
|
|
for (List<String> wbsIds : partition) {
|
|
|
vo.setWbsIds(wbsIds);
|
|
|
List<InformationQuery> queries = baseMapper.selectInformationQueryPageTwo(vo);
|
|
|
@@ -1970,10 +1970,77 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
_logger.info("合同段 " + node.getContractId() + " 获取当前资料 执行时间:" + executionTime + " ms");
|
|
|
|
|
|
if (result.size() != 0) {
|
|
|
+ List<InformationQueryVO> voResult = JSONArray.parseArray(JSONObject.toJSONString(result), InformationQueryVO.class);
|
|
|
+ if (ObjectUtil.isEmpty(voResult)) {
|
|
|
+ page.setRecords(null);
|
|
|
+ } else if (voResult.size() == 1) {
|
|
|
+ page.setRecords(voResult);
|
|
|
+ page.setTotal(voResult.size());
|
|
|
+ } else if (voResult.size() > 1) {
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(vo.getIsFirst())) {
|
|
|
+ long current = (page.getCurrent() - 1) * page.getSize();
|
|
|
+ if (current < 0) {
|
|
|
+ throw new IllegalArgumentException("当前页码不能小于0");
|
|
|
+ }
|
|
|
+ int currentNow = (int) (current / page.getSize() + 1);
|
|
|
+ int pageSize = (int) page.getSize();
|
|
|
+ int fromIndex = (currentNow - 1) * pageSize;
|
|
|
+ int toIndex = Math.min(currentNow * pageSize, voResult.size());
|
|
|
+ List<InformationQueryVO> subList = voResult.subList(fromIndex, toIndex);
|
|
|
+ page.setRecords(subList);
|
|
|
+ page.setTotal(voResult.size());
|
|
|
+ } else {
|
|
|
+ childNodesPkeyIds.add(0, node.getPKeyId());
|
|
|
+ if (childNodesPkeyIds.size() > 1) {
|
|
|
+ LinkedList<InformationQueryVO> resultData = new LinkedList<>();
|
|
|
+ LinkedHashMap<Long, InformationQueryVO> dataMaps = voResult.stream()
|
|
|
+ .collect(Collectors.toMap(InformationQueryVO::getWbsId, Function.identity(),
|
|
|
+ (oldValue, newValue) -> oldValue, LinkedHashMap::new));
|
|
|
+ for (Long pKeyId : childNodesPkeyIds) {
|
|
|
+ InformationQueryVO queryVO = dataMaps.get(pKeyId);
|
|
|
+ if (queryVO != null) {
|
|
|
+ resultData.add(queryVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (resultData.size() > 0) {
|
|
|
+ long current = (page.getCurrent() - 1) * page.getSize();
|
|
|
+ if (current < 0) {
|
|
|
+ throw new IllegalArgumentException("当前页码不能小于0");
|
|
|
+ }
|
|
|
+ int currentNow = (int) (current / page.getSize() + 1);
|
|
|
+ int pageSize = (int) page.getSize();
|
|
|
+ int fromIndex = (currentNow - 1) * pageSize;
|
|
|
+ int toIndex = Math.min(currentNow * pageSize, resultData.size());
|
|
|
+ List<InformationQueryVO> subList = resultData.subList(fromIndex, toIndex);
|
|
|
+ page.setRecords(subList);
|
|
|
+ page.setTotal(resultData.size());
|
|
|
+ } else {
|
|
|
+ page.setRecords(null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ long current = (page.getCurrent() - 1) * page.getSize();
|
|
|
+ if (current < 0) {
|
|
|
+ throw new IllegalArgumentException("当前页码不能小于0");
|
|
|
+ }
|
|
|
+ int currentNow = (int) (current / page.getSize() + 1);
|
|
|
+ int pageSize = (int) page.getSize();
|
|
|
+ int fromIndex = (currentNow - 1) * pageSize;
|
|
|
+ int toIndex = Math.min(currentNow * pageSize, voResult.size());
|
|
|
+ List<InformationQueryVO> subList = voResult.subList(fromIndex, toIndex);
|
|
|
+ page.setRecords(subList);
|
|
|
+ page.setTotal(voResult.size());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<InformationQueryVO> records = page.getRecords();
|
|
|
+ if (records == null || records.isEmpty()) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
Map<String, List<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(","));
|
|
|
+
|
|
|
+ List<Long> informationIds = records.stream().filter(f -> f.getStatus().equals(1) || f.getStatus().equals(2)).map(InformationQueryVO::getId).collect(Collectors.toList());
|
|
|
+ String informationIdsStr = informationIds.stream().map(id -> "'" + id + "'").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,create_time FROM u_task WHERE form_data_id IN(" + informationIdsStr + ") AND status IN (1, 2) AND is_deleted = 0", new BeanPropertyRowMapper<>(Task.class));
|
|
|
taskMaps = query.stream().collect(Collectors.groupingBy(Task::getFormDataId));
|
|
|
@@ -1984,7 +2051,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<String> sjRecordIds = result.stream().map(InformationQuery::getSjRecordIds).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ List<String> sjRecordIds = records.stream().map(InformationQueryVO::getSjRecordIds).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
Set<Long> ids = new HashSet<>();
|
|
|
for (String sjRecordId : sjRecordIds) {
|
|
|
List<Long> longs = Func.toLongList(sjRecordId);
|
|
|
@@ -1994,12 +2061,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
if (ids.size() > 0) {
|
|
|
informationQueries = jdbcTemplate.query("SELECT id FROM u_information_query WHERE id IN(" + StringUtils.join(ids, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
}
|
|
|
-
|
|
|
- List<InformationQueryVO> voResult = JSONArray.parseArray(JSONObject.toJSONString(result), InformationQueryVO.class);
|
|
|
List<InformationQuery> finalInformationQueries = informationQueries;
|
|
|
Map<String, List<Task>> finalTaskMaps = taskMaps;
|
|
|
Map<String, List<TaskParallel>> finalTaskParallelMaps = taskParallelMaps;
|
|
|
- voResult.forEach(vor -> {
|
|
|
+ records.forEach(vor -> {
|
|
|
if(vor.getId()==1838134135841955842L){
|
|
|
System.out.println("111");
|
|
|
}
|
|
|
@@ -2061,99 +2126,34 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
- if(!ObjectUtil.isEmpty(voResult)){
|
|
|
+ if(!ObjectUtil.isEmpty(records)){
|
|
|
//过滤审批人状态
|
|
|
if (vo.getWaitingUserStatus() != null) {
|
|
|
- voResult = voResult.stream()
|
|
|
- .filter(vo1 -> {
|
|
|
- List<InformationQueryVO.WaitingUser> waitingUsers = vo1.getWaitingUserList();
|
|
|
- if(waitingUsers!=null){
|
|
|
- //签字正常状态
|
|
|
- if (vo.getWaitingUserStatus() == 2) {
|
|
|
- // 当 waitingUserStatus == 2 时,所有元素的 status 都必须等于 waitingUserStatus
|
|
|
- return waitingUsers.stream().allMatch(waitingUser ->waitingUser!=null&&waitingUser.getStatus()!=null&& waitingUser.getStatus().equals(vo.getWaitingUserStatus()));
|
|
|
- } else {
|
|
|
- // 当 waitingUserStatus != 2 时,只要有一个元素的 status 等于 waitingUserStatus 就满足
|
|
|
- return waitingUsers.stream().anyMatch(waitingUser ->waitingUser!=null&&waitingUser.getStatus()!=null&& waitingUser.getStatus().equals(vo.getWaitingUserStatus()));
|
|
|
+ records = records.stream()
|
|
|
+ .filter(vo1 -> {
|
|
|
+ List<InformationQueryVO.WaitingUser> waitingUsers = vo1.getWaitingUserList();
|
|
|
+ if(waitingUsers!=null){
|
|
|
+ //签字正常状态
|
|
|
+ if (vo.getWaitingUserStatus() == 2) {
|
|
|
+ // 当 waitingUserStatus == 2 时,所有元素的 status 都必须等于 waitingUserStatus
|
|
|
+ return waitingUsers.stream().allMatch(waitingUser ->waitingUser!=null&&waitingUser.getStatus()!=null&& waitingUser.getStatus().equals(vo.getWaitingUserStatus()));
|
|
|
+ } else {
|
|
|
+ // 当 waitingUserStatus != 2 时,只要有一个元素的 status 等于 waitingUserStatus 就满足
|
|
|
+ return waitingUsers.stream().anyMatch(waitingUser ->waitingUser!=null&&waitingUser.getStatus()!=null&& waitingUser.getStatus().equals(vo.getWaitingUserStatus()));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- return false;
|
|
|
- })
|
|
|
- .collect(Collectors.toList());
|
|
|
- }
|
|
|
- }
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- for (InformationQueryVO queryVO : voResult) {
|
|
|
- sb=sb.append(queryVO.getId()+",");
|
|
|
- }
|
|
|
- System.out.println(sb);
|
|
|
- if (ObjectUtil.isEmpty(voResult)) {
|
|
|
- return page.setRecords(null);
|
|
|
- }
|
|
|
- else if (voResult.size() == 1) {
|
|
|
- page.setRecords(voResult);
|
|
|
- page.setTotal(voResult.size());
|
|
|
- return page;
|
|
|
-
|
|
|
- } else if (voResult.size() > 1) {
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(vo.getIsFirst())) {
|
|
|
- long current = (page.getCurrent() - 1) * page.getSize();
|
|
|
- if (current < 0) {
|
|
|
- throw new IllegalArgumentException("当前页码不能小于0");
|
|
|
- }
|
|
|
- int currentNow = (int) (current / page.getSize() + 1);
|
|
|
- int pageSize = (int) page.getSize();
|
|
|
- int fromIndex = (currentNow - 1) * pageSize;
|
|
|
- int toIndex = Math.min(currentNow * pageSize, voResult.size());
|
|
|
- List<InformationQueryVO> subList = voResult.subList(fromIndex, toIndex);
|
|
|
- page.setRecords(subList);
|
|
|
- page.setTotal(voResult.size());
|
|
|
- return page;
|
|
|
- } else {
|
|
|
- childNodesPkeyIds.add(0, node.getPKeyId());
|
|
|
- if (childNodesPkeyIds.size() > 1) {
|
|
|
- LinkedList<InformationQueryVO> resultData = new LinkedList<>();
|
|
|
- LinkedHashMap<Long, InformationQueryVO> dataMaps = voResult.stream()
|
|
|
- .collect(Collectors.toMap(InformationQueryVO::getWbsId, Function.identity(),
|
|
|
- (oldValue, newValue) -> oldValue, LinkedHashMap::new));
|
|
|
- for (Long pKeyId : childNodesPkeyIds) {
|
|
|
- InformationQueryVO queryVO = dataMaps.get(pKeyId);
|
|
|
- if (queryVO != null) {
|
|
|
- resultData.add(queryVO);
|
|
|
- }
|
|
|
- }
|
|
|
- if (resultData.size() > 0) {
|
|
|
- long current = (page.getCurrent() - 1) * page.getSize();
|
|
|
- if (current < 0) {
|
|
|
- throw new IllegalArgumentException("当前页码不能小于0");
|
|
|
- }
|
|
|
- int currentNow = (int) (current / page.getSize() + 1);
|
|
|
- int pageSize = (int) page.getSize();
|
|
|
- int fromIndex = (currentNow - 1) * pageSize;
|
|
|
- int toIndex = Math.min(currentNow * pageSize, resultData.size());
|
|
|
- List<InformationQueryVO> subList = resultData.subList(fromIndex, toIndex);
|
|
|
- page.setRecords(subList);
|
|
|
- page.setTotal(resultData.size());
|
|
|
- return page;
|
|
|
- } else {
|
|
|
- return page.setRecords(null);
|
|
|
- }
|
|
|
- } else {
|
|
|
- long current = (page.getCurrent() - 1) * page.getSize();
|
|
|
- if (current < 0) {
|
|
|
- throw new IllegalArgumentException("当前页码不能小于0");
|
|
|
- }
|
|
|
- int currentNow = (int) (current / page.getSize() + 1);
|
|
|
- int pageSize = (int) page.getSize();
|
|
|
- int fromIndex = (currentNow - 1) * pageSize;
|
|
|
- int toIndex = Math.min(currentNow * pageSize, voResult.size());
|
|
|
- List<InformationQueryVO> subList = voResult.subList(fromIndex, toIndex);
|
|
|
- page.setRecords(subList);
|
|
|
- page.setTotal(voResult.size());
|
|
|
- return page;
|
|
|
- }
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
}
|
|
|
- }
|
|
|
+ page.setRecords(records);
|
|
|
+ }
|
|
|
+ return page;
|
|
|
+// StringBuilder sb = new StringBuilder();
|
|
|
+// for (InformationQueryVO queryVO : voResult) {
|
|
|
+// sb=sb.append(queryVO.getId()+",");
|
|
|
+// }
|
|
|
+// System.out.println(sb);
|
|
|
}
|
|
|
return page.setRecords(null);
|
|
|
}
|