From 4d6ef8b333cb6b9a4ca97966c6a696d56b0f3c89 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 01 三月 2024 16:31:06 +0800
Subject: [PATCH] 近义词查询规则清空当前id和text
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java | 79 ++++++++++++++++++++++++---------------
1 files changed, 49 insertions(+), 30 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 ad4b63b..c880d23 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
@@ -71,6 +71,7 @@
import java.awt.event.ItemEvent;
import java.io.File;
import java.util.*;
+import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -116,10 +117,12 @@
@Resource
private CodeBasicSecMapper codeBasicSecMapper;
+
/**
* 涓婄骇鑺傜偣鐨勫睘鎬у悕绉�
*/
public static final String PARENT_FIELD_NAME = "parentCodeClassifyOid";
+
/**
* 浣跨敤鏌ヨ灏佽鍣ㄦ潵鏌ヨ
* @param wrapper 鏌ヨ灏佽鍣�
@@ -510,7 +513,7 @@
* @return 涓婚搴撳垎绫绘樉绀烘爲
*/
@Override
- public List<Tree> referTree(TreeQueryObject treeQueryObject) {
+ public List<Tree> referTree(TreeQueryObject treeQueryObject) throws ServiceException{
if(treeQueryObject == null){
treeQueryObject = new TreeQueryObject();
}
@@ -520,7 +523,7 @@
if(treeQueryObject.getConditionMap().containsKey(LC_STATUS)) {
treeQueryObject.getConditionMap().remove(LC_STATUS);
}
- if(treeQueryObject.getExtandParamsMap() ==null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) {
+ if(treeQueryObject.getExtandParamsMap() == null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) {
}
treeQueryObject.getConditionMap().put(LC_STATUS, FRAMEWORK_DATA_ENABLED);
return treeCodeClassify(treeQueryObject);
@@ -550,7 +553,7 @@
* @return 涓婚搴撳垎绫� 鏄剧ず鏍�
*/
@Override
- public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) {
+ public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) throws ServiceException{
List<CodeClassify> doList = null;
String id = null;
String lcStatus = null;
@@ -560,6 +563,7 @@
}
if(StringUtils.isNotBlank(id) || StringUtils.isNotBlank(lcStatus) ){
//String tableName = this.getTableName(treeQueryObject.getConditionMap().get("btmTypeId"),treeQueryObject.getConditionMap().get("id"), treeQueryObject.getConditionMap().get("lcStatus"));
+ // TODO: 2024-1-24 23:25鎴戝幓鎺変簡鎳掑姞杞斤紝鍥犱负浼氬奖鍝嶆暟鎹巿鏉冭繃婊ゅ拰鍒嗙被鎼滅储鍔熻兘锛岃�屼笖杩欏効鎰熻娌″繀瑕佸仛鎳掑姞杞�
doList = codeClassifyMapper
.selectCodeClassifyDOByTree(
treeQueryObject.getConditionMap().get("id"),
@@ -578,33 +582,32 @@
List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList);
TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME);
treeWrapperOptions.copyFromTreeQuery(treeQueryObject);
- List<Tree> tree= revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO s) ->{
+ List<Tree> tree = revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO s) ->{
//鍙互鍦ㄨ繖閲屽鐞嗘爲鑺傜偣鐨勬樉绀�
return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s
.getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : "");
});
- //瓒呯鏄剧ず鎵�鏈夊垎绫�
- if(VciBaseUtil.checkAdminTenant()){
- Iterator var6 = tree.listIterator();
- while(var6.hasNext()){
- Tree trees = (Tree) var6.next();
- boolean checkHasChild=codeClassifyMapper.checkHasChild(trees.getOid());
- if(checkHasChild){
- trees.setLeaf(false);
- }else{
- trees.setLeaf(true);
- }
- }
- }else {
+ // 闈炶秴绠¤繃婊ゆ湭鎺堟潈鐨勫垎绫�
+ if(!VciBaseUtil.checkAdminTenant()){
// 閭d簺鍒嗙被鍏峰鏌ョ湅鏉冮檺
- R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(Arrays.asList(AuthUtil.getUser().getRoleId().split(",")));
+ R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(
+ Arrays.asList(AuthUtil.getUser().getRoleId().split(",")),
+ treeQueryObject.getConditionMap().getOrDefault("authType","classify_auth"),
+ treeQueryObject.getConditionMap().getOrDefault("buttonCode","classify_view"),
+ treeQueryObject.getConditionMap().getOrDefault("menuCode","classifyTree")
+ );
// 璇锋眰澶辫触鎴栬�呰姹傚緱鍒扮殑鍏峰鏌ョ湅鏉冮檺鐨勫垎绫籭d闆嗗悎涓虹┖
- if(!viewClassByRoleIds.isSuccess() && !viewClassByRoleIds.getData().isEmpty()){
- return new ArrayList<>();
+ if(!viewClassByRoleIds.isSuccess() && viewClassByRoleIds.getData().isEmpty()){
+ throw new ServiceException("涓绘暟鎹煡鐪嬫潈闄愭湭閰嶇疆锛屾垨閰嶇疆鏈夎锛�");
}
// 杩囨护
filterTreeNodes(tree,viewClassByRoleIds.getData());
}
+ // 鍔犺浇鍒嗙被鏄惁鍏锋湁瀛愬垎绫�
+ tree.parallelStream().forEach(item -> {
+ boolean checkHasChild = checkHasChild(item.getOid());
+ item.setLeaf(!checkHasChild);
+ });
return tree;
}
@@ -617,10 +620,10 @@
Iterator<Tree> iterator = trees.iterator();
while (iterator.hasNext()) {
Tree tree = iterator.next();
- Boolean checkHasChild = codeClassifyMapper.checkHasChild(tree.getOid());
- tree.setLeaf(!checkHasChild);
+ /*Boolean checkHasChild = checkHasChild(tree.getOid());
+ tree.setLeaf(!checkHasChild);*/
if (classifyIds.contains(tree.getOid())) {
- // 濡傛灉椤跺眰鑺傜偣瀛樺湪浜� classifyIds 涓紝鐩存帴淇濈暀鍏跺瓙鑺傜偣闆嗗悎
+ // 濡傛灉椤跺眰鑺傜偣瀛樺湪 classifyIds 锛岀洿鎺ヤ繚鐣欏叾瀛愯妭鐐归泦鍚�
continue;
}
if (tree.getChildren() != null && !tree.getChildren().isEmpty()) {
@@ -741,6 +744,24 @@
String oids = codeClassifies.stream()
.map(CodeClassify::getOid)
.map(s -> "'" + s + "'")
+ .collect(Collectors.joining(","));;
+ return oids;
+ }
+
+ /**
+ * 鏍规嵁椤跺眰鑺傜偣oid鏌ヨ鎵�鏈夊彾瀛愯妭鐐瑰垎绫籵id
+ * @param pid
+ * @return
+ */
+ @Override
+ public String selectLeafByPid(String pid) {
+ List<CodeClassify> codeClassifies = codeClassifyMapper.selectLeafByPid(pid);
+ if(codeClassifies.isEmpty()){
+ return "";
+ }
+ String oids = codeClassifies.stream()
+ .map(CodeClassify::getOid)
+ .map(s ->s)
.collect(Collectors.joining(","));;
return oids;
}
@@ -1456,11 +1477,11 @@
if(!CollectionUtils.isEmpty(dataList)){
for(Map data:dataList){
CodeClassify codeClassifyDO = new CodeClassify();
- codeClassifyDO.setOid(VciBaseUtil.getStringValueFromObject(data.get("OID")));
- codeClassifyDO.setId(VciBaseUtil.getStringValueFromObject(data.get("ID")));
- codeClassifyDO.setName(VciBaseUtil.getStringValueFromObject(data.get("NAME")));
- codeClassifyDO.setBtmTypeId(VciBaseUtil.getStringValueFromObject(data.get("BTMTYPEID")));
- codeClassifyDO.setBtmTypeName(VciBaseUtil.getStringValueFromObject(data.get("BTMTYPENAME")));
+ codeClassifyDO.setOid(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"OID")));
+ codeClassifyDO.setId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"ID")));
+ codeClassifyDO.setName(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"NAME")));
+ codeClassifyDO.setBtmTypeId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"BTMTYPEID")));
+ codeClassifyDO.setBtmTypeName(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"BTMTYPENAME")));
oidList.add(codeClassifyDO);
}
}
@@ -1524,7 +1545,5 @@
wrapper.eq("parentCodeClassifyOid",codeClassifyOid);
return codeClassifyMapper.selectCount(wrapper).intValue();
}
-
-
}
--
Gitblit v1.9.3