From 7aee7498acadfa6225c55493b869acc554441268 Mon Sep 17 00:00:00 2001 From: gaorl Date: Thu, 8 Jun 2023 15:58:48 +0800 Subject: [PATCH] =?UTF-8?q?feature=EF=BC=9A=E8=B4=AD=E6=96=B9=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../buyer/service/impl/BuyerServiceImpl.java | 72 ++++++++++--------- .../resources/mybatis/mapper/BuyerMapper.xml | 3 + 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java index 75665efe..31f66925 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java @@ -207,7 +207,7 @@ public class BuyerServiceImpl implements BuyerService { } if (StringUtils.isNotEmpty(buyerEntity.getEntId())&&StringUtils.isNotEmpty(buyerEntity.getBuyerCode())) { param = new HashMap<>(5); - param.put("ent_id", buyerEntity.getEntId()); + param.put("entId", buyerEntity.getEntId()); param.put("buyerCode", buyerEntity.getBuyerCode()); int i = buyerMapper.selectBuyerByName(param, shList); if (i > 0) { @@ -245,44 +245,46 @@ public class BuyerServiceImpl implements BuyerService { // .put(OrderManagementConstant.MESSAGE, "上传失败"); // } else { importSuccessCount = buyerEntitys.size(); - for (BuyerEntity buyerEntity : buyerEntitys) { - //数据重复性校验 - buyerEntity.setId(baseService.getGenerateShotKey()); - if (StringUtils.isBlank(buyerEntity.getBuyerCode())) { - buyerEntity.setBuyerCode(baseService.getGenerateShotKey()); - } - List buyerEntityDetail = new ArrayList<>(); - BuyerEntityDetail buyerEntityDetail1 = new BuyerEntityDetail(); - buyerEntityDetail1.setBuyerManageId(buyerEntity.getId()); - buyerEntityDetail1.setBankAccount(buyerEntity.getBankNumber()); - buyerEntityDetail1.setBankName(buyerEntity.getBankOfDeposit()); - buyerEntityDetail1.setAddress(buyerEntity.getAddress()); - buyerEntityDetail1.setPhone(buyerEntity.getPhone()); - buyerEntityDetail1.setCreateTime(new Date()); - buyerEntityDetail1.setDefaultMark("0"); - try { - buyerEntityDetail1.setCreateUser(userInfoService.getUser().getUserId().toString()); - } catch (Exception e) { - buyerEntityDetail1.setCreateUser(""); - } - buyerEntityDetail.add(buyerEntityDetail1); - buyerMapper.batchInsertBuyerDetail(buyerEntityDetail); - } - if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) { - buyerMapper.insertBuyerByList(buyerEntitys); - } else { - List insertBuyerList = new ArrayList<>(); - int i = 0; + if (importSuccessCount > 0){ for (BuyerEntity buyerEntity : buyerEntitys) { - if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) { - buyerMapper.insertBuyerByList(insertBuyerList); - insertBuyerList = new ArrayList<>(); + //数据重复性校验 + buyerEntity.setId(baseService.getGenerateShotKey()); + if (StringUtils.isBlank(buyerEntity.getBuyerCode())) { + buyerEntity.setBuyerCode(baseService.getGenerateShotKey()); } - insertBuyerList.add(buyerEntity); - i++; + List buyerEntityDetail = new ArrayList<>(); + BuyerEntityDetail buyerEntityDetail1 = new BuyerEntityDetail(); + buyerEntityDetail1.setBuyerManageId(buyerEntity.getId()); + buyerEntityDetail1.setBankAccount(buyerEntity.getBankNumber()); + buyerEntityDetail1.setBankName(buyerEntity.getBankOfDeposit()); + buyerEntityDetail1.setAddress(buyerEntity.getAddress()); + buyerEntityDetail1.setPhone(buyerEntity.getPhone()); + buyerEntityDetail1.setCreateTime(new Date()); + buyerEntityDetail1.setDefaultMark("0"); + try { + buyerEntityDetail1.setCreateUser(userInfoService.getUser().getUserId().toString()); + } catch (Exception e) { + buyerEntityDetail1.setCreateUser(""); + } + buyerEntityDetail.add(buyerEntityDetail1); + buyerMapper.batchInsertBuyerDetail(buyerEntityDetail); } - if (buyerEntitys.size() > 0) { + if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) { buyerMapper.insertBuyerByList(buyerEntitys); + } else { + List insertBuyerList = new ArrayList<>(); + int i = 0; + for (BuyerEntity buyerEntity : buyerEntitys) { + if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) { + buyerMapper.insertBuyerByList(insertBuyerList); + insertBuyerList = new ArrayList<>(); + } + insertBuyerList.add(buyerEntity); + i++; + } + if (buyerEntitys.size() > 0) { + buyerMapper.insertBuyerByList(buyerEntitys); + } } } resultMap.put("list", list); diff --git a/order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml b/order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml index ab704b04..470570c2 100644 --- a/order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml +++ b/order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml @@ -908,6 +908,9 @@ AND buyer_code =#{map.buyerCode,jdbcType=VARCHAR} + + AND ent_id =#{map.entId,jdbcType=VARCHAR} +