|
@@ -116,13 +116,11 @@ public class RecycleBinInfoServiceImpl extends BaseServiceImpl<RecycleBinInfoMap
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
String[] split = ids.split(",");
|
|
|
- ids = Arrays.stream(split).filter(StringUtil::isNumeric).collect(Collectors.joining(","));
|
|
|
- if (ids.isEmpty()) {
|
|
|
+ Set<Long> set = Arrays.stream(split).filter(StringUtil::isNumeric).map(Long::parseLong).collect(Collectors.toSet());
|
|
|
+ if (set.isEmpty()) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
-
|
|
|
-// return this.list(Wrappers.<RecycleBinInfo>lambdaQuery().eq(RecycleBinInfo::getOperationId, info.getOperationId()).eq(RecycleBinInfo::getDelType, info.getDelType()).eq(RecycleBinInfo::getStatus, info.getStatus()));
|
|
|
- return this.baseMapper.queryOperation(ids);
|
|
|
+ return this.baseMapper.queryOperation(set);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -130,22 +128,31 @@ public class RecycleBinInfoServiceImpl extends BaseServiceImpl<RecycleBinInfoMap
|
|
|
if (ids == null || ids.isEmpty()) {
|
|
|
return true;
|
|
|
}
|
|
|
- List<WbsTreeContract> query = jdbcTemplate.query("select * from m_wbs_tree_contract where p_key_id in ( " + ids + ") and is_deleted = 0 and type = 1", new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ List<WbsTreeContract> query = jdbcTemplate.query("select * from m_wbs_tree_contract where p_key_id in ( " + ids + ") and is_deleted = 1 and type = 1", new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
if (query.isEmpty()) {
|
|
|
return true;
|
|
|
}
|
|
|
- List<WbsTreeContract> rootContracts = new ArrayList<>();
|
|
|
+
|
|
|
List<String> parentIds = new ArrayList<>();
|
|
|
- for (WbsTreeContract contract : query) {
|
|
|
- if (rootIds.contains(contract.getPKeyId() + "")) {
|
|
|
- rootContracts.add(contract);
|
|
|
- }
|
|
|
- String ancestorsPId = contract.getAncestorsPId();
|
|
|
- if (StringUtil.hasText(ancestorsPId)) {
|
|
|
- String[] split = ancestorsPId.split(",");
|
|
|
- for (String s : split) {
|
|
|
- if (StringUtil.isNumeric(s)) {
|
|
|
- parentIds.add(s);
|
|
|
+ Map<Long, WbsTreeContract> rootMap = new HashMap<>();
|
|
|
+ {
|
|
|
+ Map<Long, WbsTreeContract> tempMap = query.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, item -> item));
|
|
|
+ for (WbsTreeContract contract : query) {
|
|
|
+ String ancestorsPId = contract.getAncestorsPId();
|
|
|
+ if (StringUtil.hasText(ancestorsPId)) {
|
|
|
+ String[] split = ancestorsPId.split(",");
|
|
|
+ WbsTreeContract root = null;
|
|
|
+ for (String s : split) {
|
|
|
+ if (StringUtil.isNumeric(s)) {
|
|
|
+ parentIds.add(s);
|
|
|
+ WbsTreeContract wbsTreeContract = tempMap.get(Long.parseLong(s));
|
|
|
+ if (root == null && wbsTreeContract != null) {
|
|
|
+ root = wbsTreeContract;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (root != null) {
|
|
|
+ rootMap.put(contract.getPKeyId(), root);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -156,7 +163,7 @@ public class RecycleBinInfoServiceImpl extends BaseServiceImpl<RecycleBinInfoMap
|
|
|
} else {
|
|
|
parentContracts = new ArrayList<>();
|
|
|
}
|
|
|
- Map<Long, WbsTreeContract> rootMap = rootContracts.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, item -> item));
|
|
|
+
|
|
|
Map<Long, WbsTreeContract> parentMap = parentContracts.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, item -> item));
|
|
|
String contractId = query.get(0).getContractId();
|
|
|
List<InformationQuery> queries = informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().select(InformationQuery::getWbsId, InformationQuery::getClassify, InformationQuery::getName)
|
|
@@ -182,6 +189,7 @@ public class RecycleBinInfoServiceImpl extends BaseServiceImpl<RecycleBinInfoMap
|
|
|
info.setCreateUser(AuthUtil.getUserId());
|
|
|
info.setOperationTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
info.setDelId(contract.getPKeyId());
|
|
|
+ info.setBusinessId(contract.getAncestorsPId());
|
|
|
|
|
|
WbsTreeContract delRoot = rootMap.get(contract.getPKeyId());
|
|
|
if (delRoot != null) {
|
|
@@ -335,6 +343,7 @@ public class RecycleBinInfoServiceImpl extends BaseServiceImpl<RecycleBinInfoMap
|
|
|
info.setCreateTime(recycleBin.getCreateTime());
|
|
|
info.setOperationTime(recycleBin.getOperationTime());
|
|
|
info.setDelId(contract.getPKeyId());
|
|
|
+ info.setBusinessId(contract.getAncestorsPId());
|
|
|
if (recycleBin.getIsDeleted() == 1) {
|
|
|
info.setStatus(1);
|
|
|
info.setUpdateUser(recycleBin.getUpdateUser());
|