From 79b74fd838d1c79d1d737eaba8f81554f37bb4bb Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 26 五月 2023 19:22:58 +0800
Subject: [PATCH] 代码整合
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java | 57 ++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
index 98d8b8e..c9cf1ad 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -25,6 +25,8 @@
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
+import com.vci.ubcs.omd.feign.IBtmTypeClient;
+import com.vci.ubcs.omd.vo.BtmTypeVO;
import com.vci.ubcs.starter.bo.WriteExcelData;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.poi.bo.ReadExcelOption;
@@ -34,6 +36,7 @@
import com.vci.ubcs.starter.revision.model.TreeQueryObject;
import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
+import com.vci.ubcs.starter.util.BladeTreeQueryObject;
import com.vci.ubcs.starter.util.LocalFileUtil;
import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject;
import com.vci.ubcs.starter.web.pagemodel.DataGrid;
@@ -45,10 +48,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.cache.utils.CacheUtil;
+import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -74,10 +79,14 @@
@Resource
private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
+
@Resource
- CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
+ private CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
+
@Resource
- ICodeRuleService ICodeRuleService;
+ private IBtmTypeClient btmTypeClient;
+
+
/**
* 鏃ュ織
@@ -255,7 +264,7 @@
if(StringUtils.isBlank(oid)){
throw new ServiceException("oid涓嶈兘涓虹┖锛�");
}
- return !codeClassifyMapper.checkHasChild(oid.trim());
+ return codeClassifyMapper.checkHasChild(oid.trim());
}
@@ -508,8 +517,7 @@
return null;
}
-
-// /**
+ // /**
// * 鏍规嵁鏍戝舰鏌ヨ瀵硅薄鏉ユ煡璇㈡暟鎹璞�
// *
// * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄
@@ -668,7 +676,6 @@
ExcelUtil.writeDataToFile(excelName, excelOption);
return excelName;
}
-
/**
* 瀵煎叆鍒嗙被
@@ -1000,7 +1007,7 @@
* @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
*/
@Override
- public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
+ public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
return codeClassifyDO2VO(selectByOid(oid));
}
@@ -1021,7 +1028,7 @@
}
/**
- * 涓婚搴撶殑鏍�
+ * 涓婚搴撶殑鏍�,宸茬粡鑱旇皟涓氬姟绫诲瀷鏌ヨ
*
* @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄
* @return 涓婚搴撴樉绀烘爲
@@ -1032,10 +1039,20 @@
treeQueryObject = new TreeQueryObject();
}
if(treeQueryObject.getConditionMap() == null){
- treeQueryObject.setConditionMap(new HashMap<>());
+ treeQueryObject.setConditionMap(new HashMap<String,String>());
}
treeQueryObject.getConditionMap().put(PARENT_FIELD_NAME, "=null");
- return treeCodeClassify(treeQueryObject);
+ List<Tree> trees = treeCodeClassify(treeQueryObject);
+ treeQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE);
+ BaseQueryObject baseQueryObject = new BaseQueryObject();
+ baseQueryObject.setConditionMap(treeQueryObject.getConditionMap());
+ List<BtmTypeVO> btmTypeVOS = btmTypeClient.getRef(baseQueryObject).getData();
+ if(Func.isEmpty(btmTypeVOS) || Func.isEmpty(trees)){
+ return null;
+ }
+ List<Tree> treeList = trees.stream().filter(tree -> btmTypeVOS.stream().
+ anyMatch(btmType -> Objects.equals(tree.getAttributes().get("id"), btmType.getId()))).collect(Collectors.toList());
+ return treeList;
}
/**
@@ -1089,21 +1106,22 @@
CodeClassify classifyDO = selectByOid(codeClassifyOid);
//鏌ヨ涓婄骇
fullInfo.setCurrentClassifyVO(codeClassifyDO2VO(classifyDO));
- List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid);
- List<CodeClassify> codeClassifyList = new ArrayList<>();
- for (Map<String, Object> map : maps) {
- CodeClassify codeClassify = new CodeClassify();
- codeClassify.setOid(String.valueOf(map.get("OID")));
- codeClassify.setOid(String.valueOf(map.get("LEVEL")));
- codeClassifyList.add(codeClassify);
- }
+// List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid);
+// List<Map<String, Object>> maps = selectAllLevelParentByOid(codeClassifyOid);
+ List<CodeClassify> codeClassifyList = selectAllLevelParentByOid(codeClassifyOid);
+// for (Map<String, Object> map : maps) {
+// CodeClassify codeClassify = new CodeClassify();
+// codeClassify.setOid(String.valueOf(map.get("OID")));
+// codeClassify.setDataLevel((Integer) map.get("LEVEL"));
+// codeClassifyList.add(codeClassify);
+// }
+
fullInfo.setParentClassifyVOs(codeClassifyDO2VOs(codeClassifyList));
if(!CollectionUtils.isEmpty(fullInfo.getParentClassifyVOs())){
fullInfo.setTopClassifyVO(fullInfo.getParentClassifyVOs().stream().filter(s->StringUtils.isBlank(s.getParentcodeclassifyoid())).findFirst().orElseGet(()->null));
}
return fullInfo;
}
-
/**
* 缁熻瀛愯妭鐐圭殑涓暟
@@ -1119,4 +1137,5 @@
wrapper.eq("parentCodeClassifyOid",codeClassifyOid);
return codeClassifyMapper.selectCount(wrapper).intValue();
}
+
}
--
Gitblit v1.9.3