ludc
2023-07-21 095c79efb36c7fae5672fa0b2481c6b688cba7eb
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java
@@ -69,11 +69,6 @@
   @Resource
   private CodeClassifyTemplateAttrMapper codeClassifyTemplateAttrMapper;
   //   @Resource
   //   CodeClstempattrMapper codeClstempattrMapper;
      //   @Resource
   //   ICodeTempphaseService codeTempphaseService;
   @Resource
   IDictBizClient iDictBizClient;
@@ -403,7 +398,7 @@
            throw new VciBaseException("{0}{1}属性的时间格式不符合要求",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()});
         }
         //如果是组合规则,里面使用的属性不能缺失,也都得显示
         String componentrule = codeClassifyTemplateAttrDTO.getComponentrule();
         String componentrule = codeClassifyTemplateAttrDTO.getComponentRule();
         boolean isContainsDynamicParameter = PatternUtil.isContainsDynamicParameter(componentrule);
         if(isContainsDynamicParameter){
            List<String> userdAttrList =  PatternUtil.getKeyListByContent(componentrule);//包含的所有${xxx}中的xxx
@@ -414,7 +409,7 @@
               }
               //要看看表单是否显示
               String unFormDisplayAttr = userdAttrList.stream().filter(s -> !VciBaseUtil.getBoolean(attrDTOMap.getOrDefault(s.toLowerCase(Locale.ROOT),
                  new CodeClassifyTemplateAttrDTO()).getFormdisplayflag())).collect(Collectors.joining(","));
                  new CodeClassifyTemplateAttrDTO()).getFormDisplayFlag())).collect(Collectors.joining(","));
               if(StringUtils.isNotBlank(unFormDisplayAttr)){
                  throw new VciBaseException("{0}属性是组合规则,但是规则里包含的属性[{1}]在当前模板中没有设置 表单显示 ",new String[]{codeClassifyTemplateAttrDO.getName(),unFormDisplayAttr});
               }
@@ -422,7 +417,7 @@
         }
         if(CLASSIFYTEMPLATEOID==null){
            CLASSIFYTEMPLATEOID = codeClassifyTemplateAttrDTO.getClassifytemplateoid();
            CLASSIFYTEMPLATEOID = codeClassifyTemplateAttrDTO.getClassifyTemplateOid();
         }
      }
@@ -444,7 +439,7 @@
      }
//      BatchCBO batchCBOTemplateDelete = new BatchCBO();
      if(!CollectionUtils.isEmpty(oids)){
         baseMapper.deleteBatchIds(oids);
         this.removeBatchByIds(oids);
      }
      //再新增
@@ -465,8 +460,8 @@
         for (String s : prefix) {
            DictBiz dictBiz = new DictBiz();
            dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR);
            dictBiz.setDictKey(s);
            dictBiz.setDictValue("prefix");
            dictBiz.setDictKey("prefix");
            dictBiz.setDictValue(s);
            iDictBizClient.getCheck(dictBiz) ;
         }
//            .saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"prefix",prefix,sessionInfo);
@@ -475,8 +470,8 @@
         for (String s : suffix) {
            DictBiz dictBiz = new DictBiz();
            dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR);
            dictBiz.setDictKey(s);
            dictBiz.setDictValue("suffix");
            dictBiz.setDictKey("suffix");
            dictBiz.setDictValue(s);
            iDictBizClient.getCheck(dictBiz) ;
         }
//         charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"suffix",suffix,sessionInfo);
@@ -485,8 +480,8 @@
         for (String s : dateFormates) {
            DictBiz dictBiz = new DictBiz();
            dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR);
            dictBiz.setDictKey(s);
            dictBiz.setDictValue("dateFormates");
            dictBiz.setDictKey("dateFormates");
            dictBiz.setDictValue(s);
            iDictBizClient.getCheck(dictBiz) ;
         }
//         charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"dateFormates",dateFormates,sessionInfo);
@@ -547,7 +542,7 @@
      }
      //判断传过来的参照配置是否是json格式
      if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getReferbtmid())&&!checkKVObj(codeClassifyTemplateAttrDTO.getReferbtmid())){
      if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getReferBtmId())&&!checkKVObj(codeClassifyTemplateAttrDTO.getReferBtmId())){
         throw new VciBaseException("枚举注入数据格式错误!");
      }
@@ -717,28 +712,28 @@
         return dataGrid;
      }
      //这个业务类型下的所有属性
      R<BtmTypeVO> btmTypeVOR = btmTypeClient.getAllAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId());
      if(btmTypeVOR.getCode() != 200){
         throw new ServiceException("业务类型feign调用失败!");
      R<BtmTypeVO> btmTypeVOR = btmTypeClient.getAllAttributeByBtmOid(codeClassifyTemplateDO.getBtmTypeId());
      if(!btmTypeVOR.isSuccess()){
         throw new ServiceException("业务类型feign调用错误!");
      }
      //这个模板下已经有的属性
//      VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class);
//      queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid);
      // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class);
      // queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid);
      Map<String,Object> condition = new HashMap<>(1);
      condition.put("CLASSIFYTEMPLATEOID",templateAttrOid);
      List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = baseMapper.selectByMap(condition);
      List<String> btmOids = new ArrayList<String>();
      List<String> btmIds = new ArrayList<String>();
      for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDOList){
         btmOids.add(codeClassifyTemplateAttrDO.getId());
         btmIds.add(codeClassifyTemplateAttrDO.getId());
      }
      //过滤掉已经存在的属性
      List<BtmTypeAttributeVO> boAttrss = new ArrayList<BtmTypeAttributeVO>();
      for (BtmTypeAttributeVO osBtmTypeAttributeVO:btmTypeVOR.getData().getAttributes()){
         if(!btmOids.contains(osBtmTypeAttributeVO.getId())){
         if(!btmIds.contains(osBtmTypeAttributeVO.getId())){
            //看看是不是有模糊查询
            boolean inSearch = true;
            if(StringUtils.isNotBlank(name) && !osBtmTypeAttributeVO.getName().contains(name.replace("*",""))){
@@ -779,21 +774,13 @@
      CodeClassifyTemplate codeClassifyTemplateDO = codeClassifyTemplateMapper.selectById(templateAttrOid);
      //这个业务类型下的所有属性
      // TODO 待完善
      List<BtmTypeAttributeVO> boAttrs =  null; // (List<BtmTypeAttributeVO>) attributeClient.selectById(codeClassifyTemplateDO.getBtmTypeId());//this.btmService.listAttributeByBtmIdHasDefault(codeClassifyTemplateDO.getBtmTypeId());
//      codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId());
//      BeanUtils.copyProperties(codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()),boAttrs);
      // TODO 已完善
      List<BtmTypeAttributeVO> boAttrs =  (List<BtmTypeAttributeVO>) btmTypeClient.getAllAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId());
      //这个模板下已经有的属性
      //把默认的属性也添加到boAttrs
      if(boAttrs == null){
         boAttrs = new ArrayList<>();
      }
//      VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class);
//      queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid);
//      Map<String,Object> condition = new HashMap<>(1);
//      condition.put("CLASSIFYTEMPLATEOID",templateAttrOid);
      QueryWrapper<CodeClassifyTemplateAttr> wrapper=new QueryWrapper<>();
      wrapper.eq("CLASSIFYTEMPLATEOID",templateAttrOid);