|
@@ -1,12 +1,27 @@
|
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
+import cn.hutool.log.StaticLog;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.mixsmart.utils.CustomFunction;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.common.utils.BaseUtils;
|
|
|
+import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.StringPool;
|
|
|
import org.springblade.manager.entity.WbsParam;
|
|
|
+import org.springblade.manager.entity.WbsTreeContract;
|
|
|
import org.springblade.manager.mapper.WbsParamMapper;
|
|
|
import org.springblade.manager.service.IWbsParamService;
|
|
|
+import org.springblade.manager.service.IWbsTreeContractService;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* @author yangyj
|
|
|
* @Date 2022/6/17 17:00
|
|
@@ -15,4 +30,25 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsParam> implements IWbsParamService {
|
|
|
+ private final IWbsTreeContractService treeContractService;
|
|
|
+ private static final String NOT_SET="还未配置提名规则";
|
|
|
+ /**
|
|
|
+ * 文件题名*/
|
|
|
+ public static final String FILE_TITLE="FILE_TITLE";
|
|
|
+ @Override
|
|
|
+ @Cacheable(cacheNames = "file_title", key = "#nodeId+'@'+#contractId")
|
|
|
+ public String crateFileTitle(Long nodeId,Long contractId) {
|
|
|
+ if(BaseUtils.isNotNull(nodeId,contractId)){
|
|
|
+ StaticLog.info("获取节点{}文件题名",nodeId);
|
|
|
+ List<WbsTreeContract> nodes = treeContractService.searchParentAllNode(nodeId,contractId);
|
|
|
+ if(Func.isNotEmpty(nodes)){
|
|
|
+ WbsParam wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getWbsId,nodeId).eq(WbsParam::getK,FILE_TITLE));
|
|
|
+ if(Func.isNotEmpty(wp)){
|
|
|
+ CustomFunction.tree(nodes.stream().map(WbsTreeContract::getFullName).collect(Collectors.toList()), wp.getV());
|
|
|
+ }
|
|
|
+ return NOT_SET;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|