ludc
2024-03-18 309de8506f5e08dea1c8fdd0d377f0884aa21dd7
Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/feigh/MdmInterJtClient.java
@@ -2,6 +2,7 @@
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.shaded.com.google.protobuf.ServiceException;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.vci.ubcs.code.applyjtcodeservice.entity.*;
import com.vci.ubcs.code.applyjtcodeservice.feign.IMdmInterJtClient;
@@ -36,8 +37,10 @@
@Data
@Slf4j
public class MdmInterJtClient implements IMdmInterJtClient {
   @Value("${docking.apply.partCoe:10}")
   public String partCoe;
   /**
    * 集团申请单服务
    */
@@ -57,10 +60,12 @@
    * 集团分类申请单服务
    */
   private final IDockingPreClassifyService dockingPreClassifyService;
   /***
    * 属性映射服务
    */
   private final IDockingPreAttrMappingService dockingPreAttrMappingService;
   /**
    * 集团取值范围申请单服务
    */
@@ -73,6 +78,7 @@
   @Autowired(required = false)
   private IMdmEngineClient mdmEngineClient;
   /***
    * 申请集团编码
    * @return
@@ -112,6 +118,7 @@
         return R.fail("集团码数据修改失败:"+e.getMessage());
      }
   }
   /*
    * 主数据业务服务
    */
@@ -185,16 +192,23 @@
            String jdatabtmname = dockingPreApplyForm.getDataBtmName();
            if (res) {
               //此处需要查询业务数据,去更改
               BaseModel baseModel = new BaseModel();
               String classOid=baseModel.getData().getOrDefault("CODECLSFID","");
               if(partCoe.equals(classOid)){
                  baseModel.setId(10+customCoding);
               R<List<BaseModel>> R = mdmEngineClient.selectByTypeAndOid(jdatabtmname,jdataid);
               if(R.isSuccess()){
                  List<BaseModel> oldDatalist=new ArrayList<>();
                  List<BaseModel> newDatalist=R.getData();
                  if(!CollectionUtils.isEmpty(newDatalist)){
                     if(editObjectMap.containsKey(jdatabtmname)){
                        oldDatalist=editObjectMap.getOrDefault(jdatabtmname,new ArrayList<>());
                     }
                     BaseModel baseModel=oldDatalist.get(0);
                     //DefaultAttrAssimtUtil.updateDefaultAttrAssimt(baseModel);
                     baseModel.setLastModifyTime(new Date());
                     baseModel.getData().put("groupcode",customCoding);
                     log.info("申请单:"+applyId+",集团码:"+customCoding+"编码:"+baseModel.getId());
                     oldDatalist.add(baseModel);
                     editObjectMap.put(jdatabtmname,oldDatalist);
                  }
               }
               String btmeName=baseModel.getBtmname();
               baseModel.getData().put("groupcode",customCoding);
               log.info("申请单:"+applyId+",集团码:"+customCoding+"编码:"+baseModel.getId());
               editObjectMap.getOrDefault(btmeName,new ArrayList<>()).add(baseModel);
            }
         }
         if(!CollectionUtils.isEmpty(editObjectMap)) {
@@ -203,10 +217,12 @@
               mdmEngineClient.updateBatchBtypeDatas(btmName, modeList);
            });
         }
         dockingPreApplyFormService.saveOrUpdateBatch(dockingPreApplyFormList);
         if(!CollectionUtils.isEmpty(dockingPreApplyFormList)){
            dockingPreApplyFormService.saveOrUpdateBatch(dockingPreApplyFormList);
         }
      }catch (Throwable e){
         e.printStackTrace();
         return R.fail("集团码集成赋值失败"+e);
          return R.fail("集团码集成赋值失败,原因:"+e.getMessage());
      }
      log.info("获取集团集团码,赋值到主数据 end");
      return R.success("集团码赋值成功");
@@ -284,6 +300,7 @@
         throw new Throwable("存储视图模型出现问题");
      }
   }
   /***
    * 获取分类视图
    *
@@ -339,7 +356,6 @@
         throw new Throwable("组织分类" + nodeLinkName + "模型视图存储出现问题");
      }
   }
   /***
    * 获取模型视图属性