xiejun
2023-06-30 0dcc09e1c247dee976ee8d95bc6afd04548f3d50
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -759,7 +759,7 @@
    * @return 有错误信息的excel
    */
   @Override
   public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) {
   public CodeImProtRusultVO batchImportHistoryData(String codeClassifyOid, String classifyAttr,File file) throws  Throwable{
      VciBaseUtil.alertNotNull(codeClassifyOid,"分类的主键");
      ReadExcelOption reo = new ReadExcelOption();
      reo.setReadAllSheet(true);
@@ -1895,9 +1895,30 @@
      getFieldIndexMap(titleRowData, attrNameIdMap, fieldIndexMap);
      Map<String, String> cboOidMap = new HashMap<>();
      cboOidMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(codeDataMap.keySet().toArray(new String[0])) + ")");
      R<BtmTypeVO>  r= btmTypeClient.getDetail(templateVO.getBtmTypeId());
      BtmTypeVO btmTypeVO =r.getData();
      String tableName=btmTypeVO.getTableName();
      String tableName ="";
      try {
         R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
         if(r.getCode()!=200) {
            throw new Throwable(r.getMsg());
         }
         BtmTypeVO btmTypeVO = r.getData();
         if (btmTypeVO == null) {
            throw new Throwable("根据业务类型未查询到业务类型对象!");
         }
         tableName = btmTypeVO.getTableName();
         if (StringUtils.isBlank(tableName)) {
            throw new Throwable("根据业务类型未查询到业务类型相关联的表");
         }
      }catch (Throwable e){
         log.error("查询业务对象表"+e);
         XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO=new XMLResultDataObjectDetailDO();
         xmlResultDataObjectDetailDO.setErrorid("103");
         xmlResultDataObjectDetailDO.setMsg("查询业务对象表"+e);
         xmlResultDataObjectDetailDO.setId("");
         xmlResultDataObjectDetailDO.setCode("");
         resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO);
         return;
      }
      StringBuffer sb=new StringBuffer();
      sb.append(" select * from ");
@@ -2978,21 +2999,35 @@
    * @param cboList 数据的列表
    * @param errorMap 错误的信息
    */
   private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap){
   private void batchCheckIdExistOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String ,String> errorMap) throws Throwable{
      List<String> existIds = new ArrayList<>();
      String tableName ="";
      try {
         R<BtmTypeVO> r = btmTypeClient.getAllAttributeByBtmId(templateVO.getBtmTypeId());
         if(r.getCode()!=200) {
            throw new Throwable(r.getMsg());
         }
         BtmTypeVO btmTypeVO = r.getData();
         if (btmTypeVO == null) {
            throw new Throwable("根据业务类型未查询到业务类型对象!");
         }
         tableName = btmTypeVO.getTableName();
         if (StringUtils.isBlank(tableName)) {
            throw new Throwable("根据业务类型未查询到业务类型相关联的表");
         }
      }catch (Throwable e){
         throw e;
      }
      String finalTableName = tableName;
      VciBaseUtil.switchCollectionForOracleIn(cboList).stream().forEach(cbos -> {
         Map<String, String> conditionMap = new HashMap<>();
         conditionMap.put("id", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])) + ")");
         R<BtmTypeVO>  r= btmTypeClient.getDetail(templateVO.getBtmTypeId());
         BtmTypeVO btmTypeVO =r.getData();
         String tableName=btmTypeVO.getTableName();
         StringBuffer sb=new StringBuffer();
         sb.append(" select id from ");
         sb.append(tableName);
         sb.append(finalTableName);
         sb.append(" where 1=1 ");
         sb.append(" id in (");
         sb.append(" and id in (");
         sb.append(VciBaseUtil.toInSql(cbos.stream().map(s -> s.getId()).collect(Collectors.toSet()).toArray(new String[0])));
         sb.append(")");
         List<String> idList= commonsMapper.selectById(sb.toString());
@@ -3815,8 +3850,8 @@
         }else{
            if (!CollectionUtils.isEmpty(conditionMap)) {
               Map<String, String> andConditionMap = new HashMap<>();
               andConditionMap.put("islastr", "1");
               andConditionMap.put("islastv", "1");
               andConditionMap.put("lastr", "1");
               andConditionMap.put("lastv", "1");
               conditionMap.putAll(andConditionMap);
               PageHelper pageHelper = new PageHelper(-1);
               pageHelper.addDefaultDesc("id");