|
@@ -33,6 +33,7 @@ import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
@@ -58,6 +59,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -979,7 +981,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiOperationSupport(order = 16)
|
|
|
@ApiOperation(value = "自定义排序")
|
|
|
public R<Boolean> diySort(@RequestBody DiySortVO vo) {
|
|
|
- //获取排序集合
|
|
|
+ //获取排序集合 自定义当前同级排序
|
|
|
List<String> sortList = vo.getSortList();
|
|
|
if (sortList.size() > 0) {
|
|
|
for (int i = 0, l = sortList.size(); i < l; i++) {
|
|
@@ -995,6 +997,59 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //对整棵树进行排序(资料查询需要同步显示排序,所以如此设计逻辑) ,采用自增
|
|
|
+ List<String> sortLists = vo.getSortList();
|
|
|
+ String id = sortLists.stream().map(String::valueOf).findAny().orElse(null);
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
+
|
|
|
+ //获取合同段整棵树
|
|
|
+ List<WbsTreeContract> list = null;
|
|
|
+ if (ObjectUtil.isNotEmpty(wbsTreeContract)) {
|
|
|
+ list = informationQueryService.getContractWbsTreeAll(wbsTreeContract);
|
|
|
+ }
|
|
|
+ List<WbsTreeContract> result = 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(next.getParentId()) && next.getParentId() == 0) {
|
|
|
+ //根节点
|
|
|
+ next.setSort(1);
|
|
|
+ } else if (ObjectUtil.isNotEmpty(next.getParentId()) && next.getParentId() != 0) {
|
|
|
+ //其他节点
|
|
|
+ next.setSort(sort);
|
|
|
+ sort++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改排序
|
|
|
+ result.add(next);
|
|
|
+
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ informationQueryService.updateBatchByPKeyId(result);
|
|
|
+
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
+
|
|
|
return R.data(false);
|
|
|
}
|
|
|
|