|
@@ -991,6 +991,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setSort(i);
|
|
|
//修改排序
|
|
|
this.wbsTreeContractClient.updateContractNodeParameter(newData);
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1002,49 +1003,63 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
String id = sortLists.stream().map(String::valueOf).findAny().orElse(null);
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
|
|
|
+ //当前项目全部填报资料
|
|
|
+ List<InformationQuery> informationQueries = informationQueryService.getBaseMapper().selectList(Wrappers.<InformationQuery>lambdaQuery()
|
|
|
+ .eq(InformationQuery::getProjectId, wbsTreeContract.getProjectId())
|
|
|
+ .eq(InformationQuery::getContractId, wbsTreeContract.getContractId())
|
|
|
+ );
|
|
|
+
|
|
|
//获取合同段整棵树
|
|
|
List<WbsTreeContract> list = null;
|
|
|
if (ObjectUtil.isNotEmpty(wbsTreeContract)) {
|
|
|
list = informationQueryService.getContractWbsTreeAll(wbsTreeContract);
|
|
|
}
|
|
|
+
|
|
|
List<WbsTreeContract> result = new ArrayList<>();
|
|
|
+ List<InformationQuery> infos = new ArrayList<>();
|
|
|
+
|
|
|
if (Objects.requireNonNull(list).size() > 0) {
|
|
|
+
|
|
|
+ //删除当前自定义排序节点
|
|
|
Iterator<WbsTreeContract> iterator = list.iterator();
|
|
|
- int sort = 2;
|
|
|
while (iterator.hasNext()) {
|
|
|
WbsTreeContract next = iterator.next();
|
|
|
- if (ObjectUtil.isNotEmpty(next)) {
|
|
|
- if (sortList.size() > 0) {
|
|
|
- boolean b = true;
|
|
|
- for (String nowId : sortList) {
|
|
|
- if (next.getPKeyId().equals(Long.parseLong(nowId))) {
|
|
|
- //剔除自定义排序节点
|
|
|
- iterator.remove();
|
|
|
- b = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!b){
|
|
|
- continue;
|
|
|
- }
|
|
|
+ for (String pId : sortList) {
|
|
|
+ if (next.getPKeyId().toString().equals(pId)) {
|
|
|
+ iterator.remove();
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(next.getParentId()) && next.getParentId() == 0) {
|
|
|
- //根节点
|
|
|
- next.setSort(1);
|
|
|
- } else if (ObjectUtil.isNotEmpty(next.getParentId()) && next.getParentId() != 0) {
|
|
|
- //其他节点
|
|
|
- next.setSort(sort);
|
|
|
- sort++;
|
|
|
+ //Map<Long, List<WbsTreeContract>> collect = list.parallelStream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
+
|
|
|
+ int sort = 1;
|
|
|
+
|
|
|
+ //for (Map.Entry<Long, List<WbsTreeContract>> longListEntry : collect.entrySet()) {
|
|
|
+ //for (WbsTreeContract treeContract : longListEntry.getValue()) {
|
|
|
+ for (WbsTreeContract treeContract : list) {
|
|
|
+ if (ObjectUtil.isNotEmpty(treeContract.getParentId()) && treeContract.getParentId() == 0) {
|
|
|
+ //根节点
|
|
|
+ treeContract.setSort(sort++);
|
|
|
+ result.add(treeContract);
|
|
|
+ } else if (ObjectUtil.isNotEmpty(treeContract.getParentId()) && treeContract.getParentId() != 0) {
|
|
|
+ //填报资料排序
|
|
|
+ InformationQuery informationQuery = informationQueries.stream().filter(f -> f.getWbsId().equals(treeContract.getPKeyId())).findAny().orElse(null);
|
|
|
+ if (informationQuery != null) {
|
|
|
+ informationQuery.setSort(sort);
|
|
|
+ infos.add(informationQuery);
|
|
|
}
|
|
|
|
|
|
- //修改排序
|
|
|
- result.add(next);
|
|
|
-
|
|
|
- iterator.remove();
|
|
|
+ //其他节点
|
|
|
+ treeContract.setSort(sort++);
|
|
|
+ result.add(treeContract);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ for (InformationQuery info : infos) {
|
|
|
+ informationQueryService.updateById(info);
|
|
|
+ }
|
|
|
+
|
|
|
informationQueryService.updateBatchByPKeyId(result);
|
|
|
|
|
|
return R.data(true);
|