From d4ff6edc9c65f37fcaa6058231e5c0bed96a083c Mon Sep 17 00:00:00 2001 From: ludc <pUXmgxCf6A> Date: 星期一, 29 五月 2023 16:55:00 +0800 Subject: [PATCH] 集团主模型和模型详细信息接口移植开发 --- Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/impl/GroupMdmInterServiceImpl.java | 376 +++++++++++++++++++++++++++++++++++++ Source/UBCS/ubcs-service/ubcs-webservice/src/main/resources/application-dev.yml | 7 Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/feign/MdmApplyGroupCodeProvider.java | 19 + Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryClassModelVO.java | 109 ++++++++++ Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryModelVO.java | 19 - Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/IGroupMdmInterService.java | 17 + Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelQueryVO.java | 31 +++ 7 files changed, 551 insertions(+), 27 deletions(-) diff --git a/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/feign/MdmApplyGroupCodeProvider.java b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/feign/MdmApplyGroupCodeProvider.java index 2069dd0..8b74ced 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/feign/MdmApplyGroupCodeProvider.java +++ b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/feign/MdmApplyGroupCodeProvider.java @@ -5,9 +5,7 @@ * @date 2023-05-26 */ -import com.vci.ubcs.code.webservice.vo.DockingClassifyModelAttrVO; -import com.vci.ubcs.code.webservice.vo.DockingGroupDataVO; -import com.vci.ubcs.code.webservice.vo.DockingResultVO; +import com.vci.ubcs.code.webservice.vo.*; import com.vci.ubcs.starter.exception.VciBaseException; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -41,7 +39,20 @@ @PostMapping("/externalMainData/receiveAddApply") DockingResultVO receiveEditApply(@NotNull @RequestBody DockingGroupDataVO dockingGroupDataVO)throws VciBaseException; + /*** + * 鏌ヨ涓诲垎绫绘ā鍨� + * @param dockingModelQueryVO + * @return 鎵ц缁撴灉 + */ + @PostMapping("/externalMainData/queryMdmModel") + DockingQueryModelVO queryMdmModel(@NotNull @RequestBody DockingModelQueryVO dockingModelQueryVO); - + /*** + * 鏌ヨ鍒嗙被璇︾粏妯″瀷瑙嗗浘 + * @param dockingModelQueryVO + * @return 鎵ц缁撴灉 + */ + @PostMapping("/externalMainData/queryClassModel") + DockingQueryClassModelVO queryClassModel(@NotNull @RequestBody DockingModelQueryVO dockingModelQueryVO); } diff --git a/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelQueryVO.java b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelQueryVO.java new file mode 100644 index 0000000..4f1cf77 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelQueryVO.java @@ -0,0 +1,31 @@ +package com.vci.ubcs.code.webservice.vo; + +public class DockingModelQueryVO { + private String sysName; + + private String classId; + + public String getSysName() { + return sysName; + } + + public void setSysName(String sysName) { + this.sysName = sysName; + } + + public String getClassId() { + return classId; + } + + public void setClassId(String classId) { + this.classId = classId; + } + + @Override + public String toString() { + return "DockingModelQueryVO{" + + "sysName='" + sysName + '\'' + + ", classId='" + classId + '\'' + + '}'; + } +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryClassModelVO.java b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryClassModelVO.java new file mode 100644 index 0000000..adad878 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryClassModelVO.java @@ -0,0 +1,109 @@ +package com.vci.ubcs.code.webservice.vo; + +import java.util.List; + +/*** + * 闆嗗洟鍒嗙被淇℃伅 + * @author xiejun + * @date 2023-05-26 + */ + +public class DockingQueryClassModelVO { + /*** + * 杩斿洖缂栫爜 + */ + private int code=1; + /*** + * 杩斿洖淇℃伅 + */ + private String msg="鎺ュ彛璋冪敤鎴愬姛"; + + /*** + * 绯荤粺鏍囪瘑 + */ + private String sysName; + /*** + * 鏁版嵁闆� + */ + private DockingClassifyMainVO mainData; + /*** + * 鏁版嵁闆� + */ + private DockingClassifyMainVO data; + + private String applyEntId; + /*** + * 鏁版嵁闆� + */ + private DockingClassifyMainVO dataStructure; + + public String getSysName() { + return sysName; + } + + public void setSysName(String sysName) { + this.sysName = sysName; + } + + + public String getApplyEntId() { + return applyEntId; + } + + public void setApplyEntId(String applyEntId) { + this.applyEntId = applyEntId; + } + + public void setMainData(DockingClassifyMainVO mainData) { + this.mainData = mainData; + } + + public DockingClassifyMainVO getDataStructure() { + return dataStructure; + } + + public DockingClassifyMainVO getMainData() { + return mainData; + } + + public DockingClassifyMainVO getData() { + return data; + } + + public void setData(DockingClassifyMainVO data) { + this.data = data; + } + + public void setDataStructure(DockingClassifyMainVO dataStructure) { + this.dataStructure = dataStructure; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + @Override + public String toString() { + return "DockingQueryClassModelVO{" + + "code=" + code + + ", msg='" + msg + '\'' + + ", sysName='" + sysName + '\'' + + ", mainData=" + mainData + + ", data=" + data + + ", applyEntId='" + applyEntId + '\'' + + ", dataStructure=" + dataStructure + + '}'; + } +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelVO.java b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryModelVO.java similarity index 66% rename from Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelVO.java rename to Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryModelVO.java index 845e0c2..a9c4622 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingModelVO.java +++ b/Source/UBCS/ubcs-service-api/ubcs-webservice-api/src/main/java/com/vci/ubcs/code/webservice/vo/DockingQueryModelVO.java @@ -2,13 +2,8 @@ import java.util.List; -/*** - * 闆嗗洟鍒嗙被淇℃伅 - * @author xiejun - * @date 2023-05-26 - */ +public class DockingQueryModelVO { -public class DockingModelVO { private int code; private String msg; private List<DockingClassifyVO> data; @@ -31,12 +26,8 @@ this.data = data; } - @Override - public String toString() { - return "ClsfModeObject{" + - "code=" + code + - ", msg='" + msg + '\'' + - ", data=" + data + - '}'; - } + + + + } diff --git a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/IGroupMdmInterService.java b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/IGroupMdmInterService.java index 67972cf..9dc936c 100644 --- a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/IGroupMdmInterService.java +++ b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/IGroupMdmInterService.java @@ -28,10 +28,21 @@ public R receiveEditApply(String oids, String btmName)throws Throwable; /*** - * - * @return + * 鏌ヨ鍒嗙被璇︾粏妯″瀷瑙嗗浘 + * @param jtclsfId锛氶泦鍥㈠垎绫籵id + * @return 杩斿洖缁撴灉淇℃伅 * @throws Throwable */ - public R pubJTclsfModel()throws Throwable; + public R queryClassModel(String jtclsfId)throws Throwable; + + + + /*** + * 鏌ヨ鍒嗙被璇︾粏妯″瀷瑙嗗浘 + * @param jtclsfId锛氶泦鍥㈠垎绫籵id + * @return 杩斿洖缁撴灉淇℃伅 + * @throws Throwable + */ + public R queryMdmModel()throws Throwable; } diff --git a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/impl/GroupMdmInterServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/impl/GroupMdmInterServiceImpl.java index cf3146d..90eaac9 100644 --- a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/impl/GroupMdmInterServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/code/webservice/service/impl/GroupMdmInterServiceImpl.java @@ -42,8 +42,13 @@ private String msg=""; - @Value("${docking.apply.unitCode:410-MDM}") + + @Value("${docking.apply.unitCode:41000}") public String dockingApplyUnitCode; + + @Value("${docking.apply.sysName:410-MDM}") + public String dockingApplySysName; + @Autowired(required = false) private MdmApplyGroupCodeProvider mdmApplyGroupCodeProvider; /*** @@ -90,8 +95,8 @@ * @return 杩斿洖缁撴灉淇℃伅 * @throws Exception */ + @Transactional(rollbackFor = VciBaseException.class) @Override - @Transactional public R applyGroupCode(String oids, String btmName) throws VciBaseException { try { List<BaseModel> updateCbos = new ArrayList<BaseModel>(); @@ -206,6 +211,7 @@ * @return 杩斿洖缁撴灉淇℃伅 * @throws Throwable */ + @Transactional(rollbackFor = VciBaseException.class) @Override public R receiveEditApply(String oids, String btmName) throws VciBaseException { List<BaseModel> updateCbos=new ArrayList<BaseModel>(); @@ -313,10 +319,370 @@ } } + /*** + * 鑾峰彇闆嗗洟妯″瀷璇︾粏淇℃伅鎵ц淇濆瓨 + * @param groupClassifyId + * @return + * @throws VciBaseException + */ @Override - public R pubJTclsfModel() throws Throwable { - return null; + public R queryClassModel(String groupClassifyId) throws VciBaseException { + log.info("鑾峰彇闆嗗洟妯″瀷璇︾粏淇℃伅鎵ц淇濆瓨start"); + String message="鎵ц鎴愬姛锛�"; + try { + if (StringUtils.isBlank(groupClassifyId)) { + message = "鍙傛暟锛氶泦鍥㈠垎绫讳富閿紝涓虹┖!"; + log.info(message); + throw new Throwable(message); + } + if (StringUtils.isBlank(dockingApplySysName)) { + message = "鑾峰彇绯荤粺鏍囪瘑" + dockingApplySysName + "涓虹┖锛岃鏌ョ湅閰嶇疆锛�"; + log.info(message); + throw new Throwable(message); + } + DockingModelQueryVO dockingModelQueryVO = new DockingModelQueryVO(); + dockingModelQueryVO.setClassId(groupClassifyId); + dockingModelQueryVO.setSysName(dockingApplySysName); + DockingQueryClassModelVO dockingQueryClassifyModelVO = mdmApplyGroupCodeProvider.queryClassModel(dockingModelQueryVO); + if (dockingQueryClassifyModelVO != null) { + int code = dockingQueryClassifyModelVO.getCode(); + message = dockingQueryClassifyModelVO.getMsg(); + if (code == 1) { + this.saveDatas(dockingQueryClassifyModelVO); + } else { + log.info(message); + throw new Throwable(message); + } + }else{ + message="鏈幏浠庨泦鍥㈣幏鍙栧埌浠讳綍妯″瀷淇℃伅"; + log.info(message); + throw new Throwable(message); + } + return R.success(message); + }catch (Throwable e){ + e.printStackTrace();; + log.error("鑾峰彇鏁版嵁妯″瀷璇︾粏淇℃伅澶辫触"+e); + R.fail(message); + } + log.info("鑾峰彇闆嗗洟妯″瀷璇︾粏淇℃伅鎵ц淇濆瓨end"); + return R.success(message); } + + /*** + * 浠庨泦鍥㈣幏鍙栦富妯″瀷淇℃伅鎵ц淇濆瓨 + * @return + * @throws Throwable + */ + @Override + public R queryMdmModel() throws Throwable { + String message="鎵ц鎴愬姛锛�"; + log.info("浠庨泦鍥㈣幏鍙栦富妯″瀷淇℃伅鎵ц淇濆瓨鎺ュ彛statr"); + try { + if (StringUtils.isBlank(dockingApplySysName)) { + message = "鑾峰彇绯荤粺鏍囪瘑" + dockingApplySysName + "涓虹┖锛岃鏌ョ湅閰嶇疆锛�"; + log.info(message); + throw new Throwable(message); + } + DockingModelQueryVO dockingModelQueryVO = new DockingModelQueryVO(); + dockingModelQueryVO.setSysName(dockingApplySysName); + DockingQueryModelVO dockingQueryModelVO= mdmApplyGroupCodeProvider.queryMdmModel(dockingModelQueryVO); + if (dockingQueryModelVO != null) { + int code = dockingQueryModelVO.getCode(); + message = dockingQueryModelVO.getMsg(); + if (code == 1) { + List<DockingClassifyVO> dockingClassifyVOList=dockingQueryModelVO.getData(); + List<DockingPreClassify>dockingPreClassifyList=new ArrayList<>(); + dockingClassifyVOList.stream().forEach(dockingClassifyVO -> { + String id = StringUtils.isBlank(dockingClassifyVO.getId())?"":dockingClassifyVO.getId(); + String className = StringUtils.isBlank(dockingClassifyVO.getClassName())?"":dockingClassifyVO.getClassName(); + String classNumber = StringUtils.isBlank(dockingClassifyVO.getClassNumber())?"":dockingClassifyVO.getClassNumber(); + String nodeLink = StringUtils.isBlank(dockingClassifyVO.getNodeLink())?"":dockingClassifyVO.getNodeLink(); + String nodeLinkName = StringUtils.isBlank(dockingClassifyVO.getNodeLinkName())?"":dockingClassifyVO.getNodeLinkName(); + String pid = StringUtils.isBlank(dockingClassifyVO.getPid())?"":dockingClassifyVO.getPid(); + String version = StringUtils.isBlank(dockingClassifyVO.getVersion())?"":dockingClassifyVO.getVersion(); + DockingPreClassify dockingPreClassify= this.dockingPreClassifyService.getById(id); + + log.info("classify:-------------->闆嗗洟鍒嗙被涓绘満:"+id); + log.info("classify:-------------->闆嗗洟鍒嗙被鍚嶇О:"+className); + log.info("classify:--------------> 闆嗗洟鍒嗙被鐖惰妭鐐�:"+pid); + log.info("classify:-------------->閾炬帴:"+nodeLink); + log.info("classify:-------------->闆嗗洟鍒嗙被浠e彿:"+classNumber); + log.info("classify:-------------->閾炬帴鍚嶇О:"+nodeLinkName); + log.info("classify:-------------->閾炬帴鐗堟湰:"+version); + if (dockingPreClassify == null || StringUtils.isBlank(dockingPreClassify.getOid())) { + DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreClassify,MdmBtmTypeConstant.DOCKING_PRE_JCLASSIFY); + } else { + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreClassify); + } + dockingPreClassify.setOid(id); + dockingPreClassify.setName(className); + dockingPreClassify.setPid(pid); + dockingPreClassify.setId(classNumber); + dockingPreClassify.setNodeLink(nodeLink); + dockingPreClassify.setGetNodeLinkName(nodeLinkName); + dockingPreClassify.setClassName(className); + dockingPreClassify.setVersionValue(version); + dockingPreClassifyList.add(dockingPreClassify); + }); + boolean res= dockingPreClassifyService.saveOrUpdateBatch(dockingPreClassifyList); + if(res){ + R.success(message); + }else{ + message="淇濆瓨鍒嗙被涓绘ā鍨嬪け璐�"; + throw new Throwable(message); + } + } else { + log.info(message); + throw new Throwable(message); + } + }else{ + message="鏈幏浠庨泦鍥㈣幏鍙栧埌浠讳綍妯″瀷淇℃伅"; + log.info(message); + throw new Throwable(message); + } + return R.success(message); + }catch (Throwable e){ + e.printStackTrace();; + log.error("鑾峰彇鏁版嵁妯″瀷澶辫触"+e); + R.fail(message); + } + log.info("浠庨泦鍥㈣幏鍙栦富妯″瀷淇℃伅鎵ц淇濆瓨鎺ュ彛end"); + return R.success(message); + } + + + /*** + * 缁勭粐 淇濆瓨鏁版嵁鏂规硶 + * + * @param dockingQueryClassifyModelVO + * @return + * @throws Throwable + * @throws + * @throws Throwable + */ + private boolean saveDatas(DockingQueryClassModelVO dockingQueryClassifyModelVO) throws Throwable { + try { + DockingClassifyMainVO mainData = dockingQueryClassifyModelVO.getMainData(); + List<DockingClassifyVO> classList = mainData.getClassList(); + Map<String,List<DockingClassifyViewVO>>classInfoMap = mainData.getClassInfos(); + ////initVCIInvocationInfo("1"); + List<DockingPreClassify> dockingPreClassifyArrayList=new ArrayList<>(); + for (DockingClassifyVO jclassObject : classList) { + String id =StringUtils.isBlank(jclassObject.getId())?"":jclassObject.getId(); + String className = StringUtils.isBlank(jclassObject.getClassName())?"":jclassObject.getClassName(); + String pid = StringUtils.isBlank(jclassObject.getPid())?"":jclassObject.getPid(); + String nodeLink = StringUtils.isBlank(jclassObject.getNodeLink())?"":jclassObject.getNodeLink(); + String nodeLinkName = StringUtils.isBlank(jclassObject.getNodeLinkName())?"":jclassObject.getNodeLinkName(); + String classNumber = StringUtils.isBlank(jclassObject.getClassNumber())?"":jclassObject.getClassNumber(); + //鏍规嵁鍒嗙被鏌ヨ妯″瀷瑙嗗浘瀵硅薄 + DockingPreClassify dockingPreClassify = dockingPreClassifyService.getById(id); + log.info("classify:-------------->闆嗗洟鍒嗙被涓绘満:"+id); + log.info("classify:-------------->闆嗗洟鍒嗙被鍚嶇О:"+className); + log.info("classify:--------------> 闆嗗洟鍒嗙被鐖惰妭鐐�:"+pid); + log.info("classify:-------------->閾炬帴:"+nodeLink); + log.info("classify:-------------->閾炬帴鍚嶇О:"+nodeLinkName); + + if (dockingPreClassify == null || StringUtils.isBlank(dockingPreClassify.getOid())) { + DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreClassify,MdmBtmTypeConstant.DOCKING_PRE_JCLASSIFY); + } else { + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreClassify); + } + dockingPreClassify.setOid(id); + dockingPreClassify.setName(className); + dockingPreClassify.setPid(pid); + dockingPreClassify.setId(classNumber); + dockingPreClassify.setNodeLink(nodeLink); + dockingPreClassify.setGetNodeLinkName(nodeLinkName); + dockingPreClassify.setClassName(className); + dockingPreClassifyArrayList.add(dockingPreClassify); + // 鑾峰彇瀵瑰簲鐨勫垎绫昏鍥炬ā鍨� + if (classInfoMap.containsKey(id)) { + List<DockingClassifyViewVO> list = classInfoMap.get(id); + getVilewMode(jclassObject,list); + } + } + boolean res= dockingPreClassifyService.saveOrUpdateBatch(dockingPreClassifyArrayList); + return res; + } catch (Throwable e) { + e.printStackTrace(); + throw new Throwable("瀛樺偍瑙嗗浘妯″瀷鍑虹幇闂"); + } + } + + /*** + * 鑾峰彇鍒嗙被瑙嗗浘 + * + * @param jclassObject + * @throws Throwable + */ + private void getVilewMode(DockingClassifyVO jclassObject, List<DockingClassifyViewVO> list) + throws Throwable { + String nodeLinkName = jclassObject.getNodeLinkName(); + try { + String jclassId = com.alibaba.cloud.commons.lang.StringUtils.isBlank(jclassObject.getId())?"":jclassObject.getId(); + Map<String, DockingPreViewModel> jviewmodelMap = new HashMap<String, DockingPreViewModel>(); + //Map<String, String> condtionMa = new HashMap<String, String>(); + // condtionMa.put("jsourceclsfid", jclassId); + List<DockingPreViewModel> dockingPreViewModelList= dockingPreViewModelService.list(Wrappers.<DockingPreViewModel>query().lambda().eq(DockingPreViewModel::getSourceClassifyId,false));// 鏍规嵁鍒嗙被鏌ヨ妯″瀷瑙嗗浘瀵硅薄 + for (DockingPreViewModel dockingPreViewModel : dockingPreViewModelList) { + jviewmodelMap.put(dockingPreViewModel.getViewName(),dockingPreViewModel); + } + + for (DockingClassifyViewVO viewInfo : list) { + String viewName = com.alibaba.cloud.commons.lang.StringUtils.isBlank(viewInfo.getViewName())?"":viewInfo.getViewName(); + String impactList = com.alibaba.cloud.commons.lang.StringUtils.isBlank(viewInfo.getImpactList())?"":viewInfo.getImpactList(); + log.info("VilewMode:-------------->瑙嗗浘鍚嶇О:"+viewName); + log.info("VilewMode:-------------->褰卞搷缂栫爜椤�:"+impactList); + log.info("VilewMode:--------------> 闆嗗洟鍒嗙被涓婚敭:"+jclassId); + List<DockingClassifyMetaAttrVO> metaList = viewInfo.getMetaList(); + DockingPreViewModel jviewModelObject = null; + if (jviewmodelMap.containsKey(viewName)) { + jviewModelObject = jviewmodelMap.get(viewName); + //褰卞搷缂栫爜椤圭殑鏁版嵁 + jviewModelObject.setImpactList(impactList); + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(jviewModelObject); + } else { + jviewModelObject =new DockingPreViewModel(); + DefaultAttrAssimtUtil.addDefaultAttrAssimt(jviewModelObject,MdmBtmTypeConstant.DOCKING_PRE_JVIEWMODEL); + jviewModelObject.setSourceClassifyId(jclassId);// 闆嗗洟鍒嗙被id + jviewModelObject.setViewName(viewName);// 闆嗗洟瑙嗗浘鍚嶇О + //褰卞搷缂栫爜椤圭殑鏁版嵁 + jviewModelObject.setImpactList(impactList); + dockingPreViewModelList.add(jviewModelObject); + } + // 鑾峰彇妯″瀷瑙嗗浘涓嬬殑灞炴�ч泦 + // String oid = jviewModelObject.getOid(); + List<DockingPreMetaAttr>allDockingPreMetaAttrList=new ArrayList<>(); + getMetaAttrObject(metaList, jclassId, jviewModelObject, "root",allDockingPreMetaAttrList); + //淇濆瓨妯″瀷瑙嗗浘灞炴�� + dockingPreMetaAttrService.saveOrUpdateBatch(allDockingPreMetaAttrList); + //淇濆瓨妯″瀷瑙嗗浘 + dockingPreViewModelService.saveOrUpdateBatch(dockingPreViewModelList); + } + } catch (Throwable e) { + e.printStackTrace(); + throw new Throwable("缁勭粐鍒嗙被" + nodeLinkName + "妯″瀷瑙嗗浘瀛樺偍鍑虹幇闂"); + } + } + + + /*** + * 鑾峰彇妯″瀷瑙嗗浘灞炴�� + * @throws Throwable + */ + private void getMetaAttrObject(List<DockingClassifyMetaAttrVO> metaList, + String jclassId, DockingPreViewModel jviewModelObject, String pid,List<DockingPreMetaAttr>allDockingPreMetaAttrList)throws Throwable { + try { + //// 鏍规嵁鍒嗙被鏌ヨ妯″瀷瑙嗗浘瀵硅薄 + List<DockingPreMetaAttr> dockingPreMetaAttrList = dockingPreMetaAttrService.selectByWrapper(Wrappers.<DockingPreMetaAttr>query().lambda() + .eq(DockingPreMetaAttr::getSourceClassifyId,jclassId).eq(DockingPreMetaAttr::getViewModelId,jviewModelObject.getOid()) + .eq(DockingPreMetaAttr:: getPid,pid)); + Map<String,DockingPreMetaAttr> jmetaattrMap = dockingPreMetaAttrList.stream().filter( + s -> com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(s.getEnglishName())).collect(Collectors.toMap(s -> s.getEnglishName().toLowerCase(Locale.ROOT), t -> t)); + + for (DockingClassifyMetaAttrVO dockingClassifyMetaAttrVO : metaList) { + String chineseName = com.alibaba.cloud.commons.lang.StringUtils.isBlank(dockingClassifyMetaAttrVO.getChineseName())?"":dockingClassifyMetaAttrVO.getChineseName();// 灞炴�у悕绉� + String englishName = com.alibaba.cloud.commons.lang.StringUtils.isBlank(dockingClassifyMetaAttrVO.getEnglishName())?"":dockingClassifyMetaAttrVO.getEnglishName();// 鑻辨枃鍚嶇О + String defaultValue = com.alibaba.cloud.commons.lang.StringUtils.isBlank(dockingClassifyMetaAttrVO.getDefaultValue())?"":dockingClassifyMetaAttrVO.getDefaultValue(); + Integer metadataType =dockingClassifyMetaAttrVO.getMetadataType();// 绫诲瀷 + Integer necessaryConf = dockingClassifyMetaAttrVO.getNecessaryConf();// 鏄惁蹇呭~ + Map<String, String> range = dockingClassifyMetaAttrVO.getRange()==null?new HashMap<String, String>():dockingClassifyMetaAttrVO.getRange();// 鍙栧�艰寖鍥� + + log.info("metaAttr:-------------->灞炴�у悕绉�:"+chineseName); + log.info("metaAttr:-------------->鑻辨枃鍚嶇О:"+englishName); + log.info("metaAttr:-------------->榛樿鍊�:"+defaultValue); + log.info("metaAttr:--------------> 绫诲瀷:"+metadataType); + log.info("metaAttr:--------------> 鏄惁蹇呭~:"+necessaryConf); + DockingPreMetaAttr dockingPreMetaAttr = new DockingPreMetaAttr(); + if (jmetaattrMap.containsKey(englishName)) { + dockingPreMetaAttr = jmetaattrMap.get(englishName); + dockingPreMetaAttr.setChineseName(chineseName); + dockingPreMetaAttr.setDefaultValue(defaultValue); + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(dockingPreMetaAttr); + } else { + DefaultAttrAssimtUtil.addDefaultAttrAssimt(dockingPreMetaAttr,MdmBtmTypeConstant.DOCKING_PRE_JMETAATRR); + dockingPreMetaAttr.setSourceClassifyId(jclassId);// 闆嗗洟鍒嗙被id + dockingPreMetaAttr.setViewModelId(jviewModelObject.getOid());// 闆嗗洟瑙嗗浘妯″瀷id + dockingPreMetaAttr.setChineseName(chineseName);// 灞炴�у悕绉� + dockingPreMetaAttr.setEnglishName(englishName);// 灞炴�у瓧娈� + dockingPreMetaAttr.setDefaultValue(defaultValue);// 灞炴�у悕绉� + dockingPreMetaAttr.setMetaDataType(metadataType);// 灞炴�х被鍨� + dockingPreMetaAttr.setNecesSaryConf(necessaryConf);// 灞炴�у繀濉」 + dockingPreMetaAttr.setPid(pid);// 鐖惰妭鐐筰d + } + if(range!=null&&range.size()>0){ + // 鑾峰彇灞炴�у�煎煙 + getRange(dockingPreMetaAttr, range); + } + /*** + * 鑾峰彇瀛愯妭鐐� + */ + DockingClassifyMetaAttrVO compositeMeta = dockingClassifyMetaAttrVO.getCompositeMeta(); + if (compositeMeta != null) { + pid = com.alibaba.cloud.commons.lang.StringUtils.isBlank(dockingPreMetaAttr.getOid())?"":dockingPreMetaAttr.getOid();// 褰撳墠oid + List<DockingClassifyMetaAttrVO> childMetaList = new ArrayList<>(); + childMetaList.add(compositeMeta); + getMetaAttrObject(childMetaList, jclassId,jviewModelObject, pid,allDockingPreMetaAttrList); + } + + } + + } catch (Throwable e) { + e.printStackTrace(); + log.error("缁勭粐妯″瀷瑙嗗浘"+ jviewModelObject.getViewName() + + "灞炴�у瓨鍌ㄥ嚭鐜伴棶棰�" + e); + throw new Throwable("缁勭粐妯″瀷瑙嗗浘"+ jviewModelObject.getViewName() + + "灞炴�у瓨鍌ㄥ嚭鐜伴棶棰�" + e); + } + } + + /** + * @throws Throwable + * * 鑾峰彇鍊煎煙 + * @param metaAttrObject + * @param range + * @throws + */ + private void getRange(DockingPreMetaAttr metaAttrObject,Map<String, String> range) throws Throwable { + String metaAttrOid = com.alibaba.cloud.commons.lang.StringUtils.isBlank(metaAttrObject.getOid())?"":metaAttrObject.getOid();// 灞炴�х殑oid + String jchinesename = com.alibaba.cloud.commons.lang.StringUtils.isBlank(metaAttrObject.getChineseName())?"":metaAttrObject.getChineseName(); + Map<String, DockingPreAttrRange> rangeMap = new HashMap<>(); + try { + Map<String, String> condtionMa = new HashMap<String, String>(); + condtionMa.put("jmetalistid", metaAttrOid); + List<DockingPreAttrRange> jmetaattrList = dockingPreAttrRangeService.selectByWrapper(Wrappers.<DockingPreAttrRange>query().lambda() + .eq(DockingPreAttrRange::getMetaListId,metaAttrOid));// 鏍规嵁鍒嗙被鏌ヨ妯″瀷瑙嗗浘瀵硅薄 + rangeMap= jmetaattrList.stream().collect(Collectors.toMap(s -> com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(s.getNumText().toLowerCase(Locale.ROOT))?"":s.getNumText().toLowerCase(Locale.ROOT), t -> t)); + + for (String rangeKey : range.keySet()) { + DockingPreAttrRange rangeObject = new DockingPreAttrRange(); + String keyValue = com.alibaba.cloud.commons.lang.StringUtils.isBlank(range.get(rangeKey))?"":range.get(rangeKey); + log.info("range:-------------->鏄剧ず鍊�"+rangeKey+",鍐呴儴鍊�"+keyValue); + if (rangeMap.containsKey(rangeKey)) { + rangeObject = rangeMap.get(rangeKey); + rangeObject.setNumTextValue(keyValue); + rangeObject.setNumText(rangeKey); + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(rangeObject); + } else { + DefaultAttrAssimtUtil.addDefaultAttrAssimt(rangeObject,MdmBtmTypeConstant.DOCKING_PRE_JRANGE); + rangeObject.setNumTextValue(keyValue); + rangeObject.setNumText(rangeKey); + rangeObject.setTs(rangeObject.getLastModifyTime()); + rangeObject.setMetaListId(metaAttrOid); + log.info("range:-------------->灞炴�у唴閮ㄥ��:"+metaAttrOid); + log.info("range:-------------->鏃堕棿:"+rangeObject.getLastModifyTime()); + jmetaattrList.add(rangeObject); + } + } + dockingPreAttrRangeService.saveOrUpdateBatch(jmetaattrList); + } catch (Throwable e) { + e.printStackTrace(); + log.info("缁勭粐灞炴�э細銆�" + jchinesename + "銆戝�煎煙鍑虹幇闂"+ e); + throw new Throwable("缁勭粐灞炴�э細銆�" + jchinesename + "銆戝�煎煙鍑虹幇闂"+ e); + } + } + + /** @@ -376,7 +742,7 @@ } //鏍规嵁鏁版嵁妯″瀷锛岀粍缁囨墍闇�瑕佹暟鎹� DockingGroupDataVO postParameters=new DockingGroupDataVO(); - postParameters.setSysName("420-CODE");//绯荤粺鏍囪瘑 + postParameters.setSysName(dockingApplySysName);//绯荤粺鏍囪瘑 postParameters.setMainData(mainDataList);// return postParameters; } catch (Throwable e) { diff --git a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/resources/application-dev.yml b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/resources/application-dev.yml index 26ee9bb..26fed91 100644 --- a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/resources/application-dev.yml +++ b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/resources/application-dev.yml @@ -12,8 +12,13 @@ mybatis-plus: configuration: map-underscore-to-camel-case: false + #闆嗗洟闆嗘垚閰嶇疆淇℃伅 docking: apply: + #闆嗗洟鎻愪緵鐨勬帴鍙e湴鍧� jtInterUrl: http://116.205.176.185:8099 - unitCode: 410-MDM + #绯荤粺鍘傚鍗曚綅浠g爜 + unitCode: 131460 + #绯荤粺鏍囪瘑 + sysName: 410-MDM -- Gitblit v1.9.3