From a472fa1f44b9976ce7e2b502814b130ec72e0f29 Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期三, 19 七月 2023 11:31:11 +0800 Subject: [PATCH] 1、主要解决在批量插入的时候通过业务类型去获取字段信息,对比字段没有的则不进行插入。 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java index ecb1dc6..eb7a13d 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java @@ -400,7 +400,6 @@ public String addSaveCode(CodeOrderDTO orderDTO) throws Exception { VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭", orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�"); - VciSystemVarConstants.getSystemVarValueMap(); CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid()); CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid()); CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid()); @@ -918,7 +917,7 @@ // baseModels.stream().forEach(model-> { try { - map = VciBaseUtil.convertBean2Map(cbo); + map = VciBaseUtil.convertBean2Map(cbo,null); } catch (Exception e) { throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage()); } @@ -3254,11 +3253,19 @@ if (!listR.isSuccess() || listR.getData().size() == 0) { throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); } - //灏哹ean杞负map,mybatis缁熶竴澶勭悊 + //鑾峰彇褰撳墠涓氬姟绫诲瀷鎵�鏈夊瓧娈电敤鏉ュ仛瀵规瘮 + R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType); + if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) { + throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲瀛楁淇℃伅锛岃妫�鏌ワ紒"); + } + Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> { + return btmTypeAttributeVO.getId(); + }).collect(Collectors.toSet()); + //灏哹ean杞负map,mybatis缁熶竴澶勭悊 List<Map<String, String>> maps = new ArrayList<>(); baseModels.stream().forEach(model -> { try { - maps.add(VciBaseUtil.convertBean2Map(model)); + maps.add(VciBaseUtil.convertBean2Map(model,existFild)); } catch (Exception e) { throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.toString()); } @@ -3409,12 +3416,20 @@ if (!listR.isSuccess() || listR.getData().size() == 0) { throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); } + //鑾峰彇褰撳墠涓氬姟绫诲瀷鎵�鏈夊瓧娈电敤鏉ュ仛瀵规瘮 + R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType); + if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) { + throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲瀛楁淇℃伅锛岃妫�鏌ワ紒"); + } + Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> { + return btmTypeAttributeVO.getId(); + }).collect(Collectors.toSet()); //灏哹ean杞负map,mybatis缁熶竴澶勭悊 List<Map<String, String>> maps = new ArrayList<>(); baseModels.stream().forEach(model -> { try { - maps.add(VciBaseUtil.convertBean2Map(model)); + maps.add(VciBaseUtil.convertBean2Map(model,existFild)); } catch (Exception e) { throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage()); } -- Gitblit v1.9.3