fujunling
2023-06-01 d7eba1786ed1fba2b3674f9da3af4fbf1a3f8692
Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/impl/DockingPreClassifyServiceImpl.java
@@ -19,10 +19,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.*;
/**
@@ -36,7 +33,7 @@
   /**
    * 上级节点的属性名称
    */
   public static  final String PARENT_FIELD_NAME = "parentCodeClassifyOid";
   public static  final String PARENT_FIELD_NAME = "pid";
   /***
    * 集团分类属性
    */
@@ -70,35 +67,51 @@
   @Override
   public List<Tree> treeCompanyGroupClassify(TreeQueryObject treeQueryObject) {
      log.info("获取集团分类树start...");
      Map<String,String> conditionMap= treeQueryObject.getConditionMap();
      if(conditionMap==null){
         conditionMap=new HashMap<>();
      }
      TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME.toLowerCase(Locale.ROOT));
      treeWrapperOptions.copyFromTreeQuery(treeQueryObject);
      List<DockingPreClassifyVO> dockingPreClassifyVOS= getCompanyGourpClassByParentId(treeQueryObject.getParentOid(),true);
      List<DockingPreClassifyVO> dockingPreClassifyVOS= getCompanyGourpClassByParentId(treeQueryObject.getParentOid(),false);
      List<Tree> tree= revisionModelUtil.doList2Trees(dockingPreClassifyVOS,treeWrapperOptions,(DockingPreClassifyVO s) ->{
         //可以在这里处理树节点的显示
         return s.getId() + " " + s.getName();//(FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s.getLcStatus()) ? (" 【停用】 ") : "");
      });
      setTreeConig(tree,conditionMap);
      log.info("获取集团分类树end...");
      return tree;
   }
   private void setTreeConig(List<Tree> tree,Map<String,String >conditionMap){
      boolean checkHasChild=false;
      Iterator var6 =  tree.listIterator();
      while(var6.hasNext()){
         Tree trees = (Tree) var6.next();
         boolean checkHasChild=dockingPreClassifyMapper.checkHasChild(trees.getOid());
         List<Tree> childrenList=trees.getChildren();
         if(childrenList.size()>0){
            checkHasChild=true;
         }
         boolean checkHas=false;
         //如果与条件传过来的值匹配的上则设置为选中
         if(conditionMap.containsKey(MdmBtmTypeConstant.CODE_CLASSIFY_OID_FIELD)){
            String codeClassifyId=conditionMap.get(MdmBtmTypeConstant.CODE_CLASSIFY_OID_FIELD);
            boolean checkHas=dockingPreAttrMappingService.checkHasConfigByTragetCodeclassifyId(codeClassifyId);
            if(checkHas) {
               trees.setChecked(true);
            }
            checkHas = dockingPreAttrMappingService.checkHasConfigByTragetCodeclassifyId(codeClassifyId, trees.getOid());
         }
         ;
         if (checkHas) {
            trees.setChecked(true);
         }
         if(checkHasChild){
            trees.setLeaf(false);
         }else{
            trees.setLeaf(true);
         }
         if(checkHasChild) {
            setTreeConig(childrenList,conditionMap);
         }
      }
      log.info("获取集团分类树end...");
      return tree;
   }
   /***