|
@@ -3,10 +3,13 @@ package org.springblade.manager.service.impl;
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.mixsmart.utils.CustomFunction;
|
|
|
+import com.mixsmart.utils.StringUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.entity.WbsParam;
|
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
@@ -17,6 +20,7 @@ import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -40,7 +44,8 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
|
|
|
public String createFileTitle(Long nodeId, Long contractId, WbsTreeContract wbsTreeContract) {
|
|
|
if (BaseUtils.isNotNull(nodeId, contractId)) {
|
|
|
StaticLog.info("获取节点{}文件题名", nodeId);
|
|
|
- List<WbsTreeContract> nodes = chain(contractId, nodeId, wbsTreeContract.getPKeyId(), wbsTreeContract);
|
|
|
+ // List<WbsTreeContract> nodes = chain(contractId, nodeId, wbsTreeContract.getPKeyId(), wbsTreeContract);
|
|
|
+ List<WbsTreeContract> nodes = tracing(wbsTreeContract.getPKeyId());
|
|
|
if (Func.isNotEmpty(nodes)) {
|
|
|
/*优先取私有*/
|
|
|
WbsParam wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, wbsTreeContract.getPKeyId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1"));
|
|
@@ -55,6 +60,27 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public List<WbsTreeContract> tracing(@NotNull Long pkeyId){
|
|
|
+ WbsTreeContract one = this.treeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+ if (one != null) {
|
|
|
+ List<WbsTreeContract> list = new ArrayList<>();
|
|
|
+ list.add(one);
|
|
|
+ int max = 20;
|
|
|
+ int loop = 0;
|
|
|
+ String parentId = one.getParentId().toString();
|
|
|
+ while (loop < max && StringUtils.isNotEquals(0, parentId)) {
|
|
|
+ WbsTreeContract next = this.treeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId, one.getContractId()).eq(WbsTreeContract::getId, parentId));
|
|
|
+ parentId = next.getParentId().toString();
|
|
|
+ list.add(next);
|
|
|
+ loop++;
|
|
|
+ }
|
|
|
+ Collections.reverse(list);
|
|
|
+ list.remove(0);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public List<WbsParam> findByNodeId(Long nodeId) {
|