lihang
2023-06-06 93e2df19d543dbf2cd806ab205efd20be9f71111
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -19,10 +19,14 @@
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
<<<<<<< Updated upstream
import com.vci.ubcs.omd.cache.EnumCache;
import com.vci.ubcs.omd.enums.EnumEnum;
import com.vci.ubcs.omd.feign.IBtmTypeClient;
import com.vci.ubcs.omd.vo.BtmTypeAttributeVO;
=======
import com.vci.ubcs.omd.feign.IBtmTypeClient;
>>>>>>> Stashed changes
import com.vci.ubcs.omd.vo.BtmTypeVO;
import com.vci.ubcs.starter.bo.WriteExcelData;
import com.vci.ubcs.starter.exception.VciBaseException;
@@ -77,7 +81,19 @@
   private ICodeRuleService codeRuleService;
   @Resource
<<<<<<< Updated upstream
   private IBtmTypeClient btmTypeClient;
=======
   private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
   @Resource
   private CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
   @Resource
   private IBtmTypeClient btmTypeClient;
>>>>>>> Stashed changes
   /**
    * 日志
@@ -873,7 +889,7 @@
    * @return 属性的信息,包含默认的属性
    */
   @Override
   public DataGrid<BtmTypeAttributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject) {
   public DataGrid<BtmTypeAttributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject) throws ServiceException{
      if(baseQueryObject == null){
         baseQueryObject = new BaseQueryObject();
      }
@@ -897,8 +913,11 @@
      Map<String,Object> condition = new HashMap<>(1);
      condition.put("pkbtmtype",topClassifyVO.getBtmtypeid());
      BtmTypeVO data = btmTypeClient.getDetail(btmTypeOid).getData();
      List<BtmTypeAttributeVO> unDefaultAttributes = data.getAttributes();
      R<BtmTypeVO> btmTypeDetail = btmTypeClient.getDetail(btmTypeOid);
      if(btmTypeDetail.getCode() != 200){
         throw new ServiceException("业务类型feign接口调用出错");
      }
      List<BtmTypeAttributeVO> unDefaultAttributes = btmTypeDetail.getData().getAttributes();
      // List<CodeOsbtmtypeattributeEntity> unDefaultAttributes = codeOsbtmtypeattributeMapper.selectByMap(condition);
      // List<OsBtmTypeAttributeVO> unDefaultAttributes = btmService. (topClassifyVO.getBtmtypeid());
      List<BtmTypeAttributeVO> attributeVOS = new ArrayList<>();
@@ -908,8 +927,8 @@
            BeanUtils.copyProperties(attr,attributeVO);
            attributeVO.setAttrDataType(attr.getAttrDataType());
            attributeVO.setAttributeLength(attr.getAttributeLength());
            attributeVO.setBtmTypeId(data.getId());
            attributeVO.setBtmname(data.getName());
            attributeVO.setBtmTypeId(btmTypeDetail.getData().getId());
            attributeVO.setBtmname(btmTypeDetail.getData().getName());
            attributeVO.setAttrDataTypeText(EnumCache.getValue(EnumEnum.VCO_FIELD_TYPE,attr.getAttrDataType()));
            boolean add = true;
            if(StringUtils.isNotBlank(id) && !attributeVO.getId().contains(id.replace("*",""))){
@@ -920,6 +939,25 @@
            }
            if(add){
               attributeVOS.add(attributeVO);
            }
         });
      }
      R<BtmTypeVO> btmTypeVOR = btmTypeClient.getDefaultAttrByBtmId(topClassifyVO.getBtmtypeid());
      if(btmTypeVOR.getCode() != 200){
         throw new ServiceException("业务类型feign接口调用出错");
      }
      List<BtmTypeAttributeVO> defaultAttrVOS = btmTypeVOR.getData().getAttributes();
      if(!CollectionUtils.isEmpty(defaultAttrVOS)){
         defaultAttrVOS.stream().forEach(attr->{
            boolean add = true;
            if(StringUtils.isNotBlank(id) && !attr.getId().contains(id.replace("*",""))){
               add = false;
            }
            if(StringUtils.isNotBlank(name) && !attr.getId().contains(name.replace("*",""))){
               add = false;
            }
            if(add){
               attributeVOS.add(attr);
            }
         });
      }
@@ -1009,7 +1047,11 @@
   }
   /**
<<<<<<< Updated upstream
    * 主题库的树,已联调业务类型查询feign
=======
    * 主题库的树,已经联调业务类型查询
>>>>>>> Stashed changes
    *
    * @param treeQueryObject 树形查询对象
    * @return 主题库显示树
@@ -1031,6 +1073,7 @@
      if(Func.isEmpty(btmTypeVOS) || Func.isEmpty(trees)){
         return null;
      }
<<<<<<< Updated upstream
      List<Tree> treeList = trees.stream().filter(tree -> !CollectionUtils.isEmpty(btmTypeVOS.stream().filter(btmType -> {
               if(Objects.equals(tree.getAttributes().get("id"), btmType.getId())){
                  tree.getAttributes().put("btmTypeOid",btmType.getOid());
@@ -1039,6 +1082,10 @@
               return false;
            }).collect(Collectors.toList())))
         .collect(Collectors.toList());
=======
      List<Tree> treeList = trees.stream().filter(tree -> btmTypeVOS.stream().
         anyMatch(btmType -> Objects.equals(tree.getAttributes().get("id"), btmType.getId()))).collect(Collectors.toList());
>>>>>>> Stashed changes
      return treeList;
   }