|
@@ -509,22 +509,38 @@ public class FormulaController {
|
|
|
WbsTreeContract one = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
if (one != null) {
|
|
|
List<String> list = new ArrayList<>();
|
|
|
- list.add(Func.isNotBlank(one.getFullName()) ? one.getFullName() : one.getNodeName());
|
|
|
- int max = 20;
|
|
|
- int loop = 0;
|
|
|
- String parentId = one.getParentId().toString();
|
|
|
- while (loop < max && StringUtils.isNotEquals(0, parentId)) {
|
|
|
- WbsTreeContract next = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId, one.getContractId()).eq(WbsTreeContract::getId, parentId));
|
|
|
- if(next==null){
|
|
|
- return R.fail("断链");
|
|
|
+ if(Func.isNotBlank(one.getTreeCode())){
|
|
|
+ List<String> treeCodes= FormulaUtils.treeCodeSplit(one.getTreeCode());
|
|
|
+ treeCodes.remove(treeCodes.size()-1);
|
|
|
+ List<WbsTreeContract> chains = this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getTreeCode,treeCodes));
|
|
|
+ if(chains.size()>0){
|
|
|
+ chains.add(one);
|
|
|
+ chains.remove(0);
|
|
|
+ ContractInfo info = contractInfoService.getById(one.getContractId());
|
|
|
+ list.add(info.getContractName());
|
|
|
+ chains.forEach(next->{
|
|
|
+ list.add(Func.isNotBlank(next.getFullName()) ? next.getFullName() : next.getNodeName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ list.add(Func.isNotBlank(one.getFullName()) ? one.getFullName() : one.getNodeName());
|
|
|
+ int max = 20;
|
|
|
+ int loop = 0;
|
|
|
+ String parentId = one.getParentId().toString();
|
|
|
+ while (loop < max && StringUtils.isNotEquals(0, parentId)) {
|
|
|
+ WbsTreeContract next = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId, one.getContractId()).eq(WbsTreeContract::getId, parentId));
|
|
|
+ if(next==null){
|
|
|
+ return R.fail("断链");
|
|
|
+ }
|
|
|
+ parentId = next.getParentId().toString();
|
|
|
+ list.add(Func.isNotBlank(next.getFullName()) ? next.getFullName() : next.getNodeName());
|
|
|
+ loop++;
|
|
|
}
|
|
|
- parentId = next.getParentId().toString();
|
|
|
- list.add(Func.isNotBlank(next.getFullName()) ? next.getFullName() : next.getNodeName());
|
|
|
- loop++;
|
|
|
+ ContractInfo info = contractInfoService.getById(one.getContractId());
|
|
|
+ Collections.reverse(list);
|
|
|
+ list.set(0, info.getContractName());
|
|
|
}
|
|
|
- ContractInfo info = contractInfoService.getById(one.getContractId());
|
|
|
- Collections.reverse(list);
|
|
|
- list.set(0, info.getContractName());
|
|
|
+
|
|
|
final String[] indent = {"-"};
|
|
|
String result = list.stream()
|
|
|
.map(item -> {
|