ludc
2023-05-27 d9fb787c2eb0bc4058087b81bc5f01abbaf2ba65
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -34,6 +34,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;
@@ -44,10 +45,12 @@
import org.apache.poi.hssf.util.HSSFColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.cache.utils.CacheUtil;import com.vci.ubcs.core.log.exception.ServiceException;
import org.springblade.core.cache.utils.CacheUtil;
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;
@@ -73,10 +76,14 @@
   @Resource
   private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
   @Resource
   CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
   private CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
   @Resource
   ICodeRuleService ICodeRuleService;
   private IBtmTypeClient btmTypeClient;
   /**
    * 日志
@@ -254,7 +261,7 @@
      if(StringUtils.isBlank(oid)){
         throw new ServiceException("oid不能为空!");
      }
      return !codeClassifyMapper.checkHasChild(oid.trim());
      return codeClassifyMapper.checkHasChild(oid.trim());
   }
@@ -507,8 +514,7 @@
      return null;
   }
//   /**
   //   /**
//    * 根据树形查询对象来查询数据对象
//    *
//    * @param treeQueryObject 树形查询对象
@@ -999,7 +1005,7 @@
    * @throws VciBaseException 参数为空,数据不存在时会抛出异常
    */
   @Override
   public  CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
   public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
      return codeClassifyDO2VO(selectByOid(oid));
   }
@@ -1020,7 +1026,7 @@
   }
   /**
    * 主题库的树
    * 主题库的树,已经联调业务类型查询
    *
    * @param treeQueryObject 树形查询对象
    * @return 主题库显示树
@@ -1031,10 +1037,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;
   }
   /**
@@ -1088,14 +1104,16 @@
      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));
@@ -1118,4 +1136,5 @@
      wrapper.eq("parentCodeClassifyOid",codeClassifyOid);
      return codeClassifyMapper.selectCount(wrapper).intValue();
   }
}