xiejun
2025-01-22 d9183aa80ae17d36b79dda48c6b1d7fa22a80ee3
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.protobuf.ServiceException;
import com.vci.ubcs.code.applyjtcodeservice.feign.IMdmInterJtClient;
@@ -1247,19 +1248,21 @@
               //我们需要先查询一下,内容是否已经存在
               if (!CollectionUtils.isEmpty(thisCbos)) {
                  List<String> existIds = new ArrayList<>();
                  // TODO: 2024/12/3 Ludc 这儿查询做了修改改成组成一句sql查询,而不是分批次查询
                  LambdaQueryWrapper<CodeAllCode> wrapper =  Wrappers.<CodeAllCode>query().lambda()
                     .eq(CodeAllCode::getCodeRuleOid, ruleOid);
                  VciBaseUtil.switchCollectionForOracleIn(thisCbos).stream().forEach(cbos -> {
                     List<CodeAllCode> codeAllCodeList = codeAllCodeService.selectByWrapper(Wrappers.<CodeAllCode>query().lambda().eq(CodeAllCode::getCodeRuleOid, ruleOid)
                        .notIn(CodeAllCode::getId, cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0]))
                        .notIn(CodeAllCode::getLcStatus, CodeAllCodeLC.TASK_BACK.getValue() + "','" + CodeAllCodeLC.OBSOLETED.getValue())
                     );
                     existIds.addAll(Optional.ofNullable(codeAllCodeList).orElseGet(() -> new ArrayList<>()).stream().map(s -> {
                        String id = s.getId();
                        if (StringUtils.isBlank(id)) {
                           id = s.getId();
                        }
                        return id;
                     }).collect(Collectors.toList()));
                     wrapper.notIn(CodeAllCode::getId, cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0]));
                  });
                  wrapper.notIn(CodeAllCode::getLcStatus, CodeAllCodeLC.TASK_BACK.getValue() + "','" + CodeAllCodeLC.OBSOLETED.getValue());
                  List<CodeAllCode> codeAllCodeList = codeAllCodeService.selectByWrapper(wrapper);
                  existIds.addAll(Optional.ofNullable(codeAllCodeList).orElseGet(() -> new ArrayList<>()).stream().map(s -> {
                     String id = s.getId();
                     if (StringUtils.isBlank(id)) {
                        id = s.getId();
                     }
                     return id;
                  }).collect(Collectors.toList()));
                  List<String> existIdCbos = thisCbos.stream().filter(s -> {
                     String id = s.getId();
                     if (StringUtils.isBlank(id)) {
@@ -3373,10 +3376,16 @@
   private void getCodeOrderDTOs(CodeClassifyVO codeClassifyVO, CodeClassifyTemplateVO templateVO, Map<String, RowDatas> codeDataMap, Map<String, ClientBusinessObject> codeSystemObjectMap, List<CodeOrderDTO> codeOrderDTOList, Map<String, String> errorMap, boolean isCodeOrGroupCode) {
      codeSystemObjectMap.keySet().forEach(code -> {
         ClientBusinessObject sysDataObject = codeSystemObjectMap.get(code);
         if (isCodeOrGroupCode) {
            code = sysDataObject.getAttributeValue("GROUPCODE");
         /*if (isCodeOrGroupCode) {
         //   code = sysDataObject.getAttributeValue("GROUPCODE");
            if (StringUtils.isBlank(code)) {
               code = sysDataObject.getId();
            }
         }*/
         if(isCodeOrGroupCode){
            String groupCode=sysDataObject.getAttributeValue("GROUPCODE");
            if(codeDataMap.containsKey(groupCode)){
               code=groupCode;
            }
         }
         CodeOrderDTO orderDTO = new CodeOrderDTO();
@@ -4118,7 +4127,8 @@
         StringBuffer sb = new StringBuffer();
         sb.append(" select id from ");
         sb.append(finalTableName);
         sb.append(" where 1=1 ");
         //sb.append(" where 1 = 1");
         sb.append(" where lastr = 1 and lastv = 1"); //TODO:涉及到已升版的数据也应该排除掉,否则会报重
         sb.append(" and id in (");
         sb.append(VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])));
         sb.append(")");
@@ -4951,7 +4961,7 @@
      }
   }
   /******
   /**
    * 根据编码规则缓存数据
    * @param uuid
    * @param codeImprotDataVOs
@@ -4995,7 +5005,7 @@
      });
   }
   /****
   /**
    * 数据相似项数据校验redis缓存
    * @param codeClassifyOid
    * @param templateVO