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 53101889..1f6c26d7 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 @@ -314,7 +314,7 @@ public class BuyerServiceImpl implements BuyerService { buyerEntity1.setBuyerCode(buyerCode); List entities = buyerMapper.selectBuyerByBuyerEntity(buyerEntity1, shList1); if(entities != null && entities.size() > 0){ - return buyerEntities.get(0); + return entities.get(0); } return null; } @@ -413,6 +413,11 @@ public class BuyerServiceImpl implements BuyerService { /** * 根据入参进行判断是新增还是修改 */ + buyerEntity.setAddress(""); + buyerEntity.setPhone(""); + buyerEntity.setBankNumber(""); + buyerEntity.setBankOfDeposit(""); + Boolean isAdd = false; if(StringUtils.isBlank(buyerEntity.getId())){ isAdd = true; @@ -433,7 +438,9 @@ public class BuyerServiceImpl implements BuyerService { } // 处理MDM默认银行账户等信息 //判断是否存在默认银行信息 - Boolean isDefaultMark = true; + if(isAdd && existBuyer != null){ + return r.put("message", "客户编码已存在").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999); + } String buyerId = baseService.getGenerateShotKey(); if (CollectionUtil.isNotEmpty(buyerEntity.getBuyerEntityDetail())) { for (BuyerEntityDetail t : buyerEntity.getBuyerEntityDetail()) { @@ -451,27 +458,19 @@ public class BuyerServiceImpl implements BuyerService { buyerEntity.setPhone(t.getPhone()); buyerEntity.setBankNumber(t.getBankAccount()); buyerEntity.setBankOfDeposit(t.getBankName()); - isDefaultMark = false; } } } + buyerMapper.deleteBuyerDetail(buyerEntity.getId()); if(buyerEntity.getBuyerEntityDetail() != null && buyerEntity.getBuyerEntityDetail().size()>0){ buyerMapper.batchInsertBuyerDetail(buyerEntity.getBuyerEntityDetail()); } - if(isAdd && existBuyer != null){ - return r.put("message", "客户编码已存在").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999); - } - if (existBuyer != null) {//StringUtils.isNotBlank(buyerEntity.getId()) + if (existBuyer != null) {//StringUtils.isNotBlank(buyerEntity.getId())修改客户信息 buyerEntity.setModifyTime(new Date()); - if(isDefaultMark){ - buyerEntity.setAddress(""); - buyerEntity.setPhone(""); - buyerEntity.setBankNumber(""); - buyerEntity.setBankOfDeposit(""); - } + //更新明细表,最好的办法是先删除后新增 int i = buyerMapper.updateBuyer(buyerEntity, shList); @@ -479,8 +478,7 @@ public class BuyerServiceImpl implements BuyerService { r.put("message", "修改失败").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999); } - } else { - //新增购方信息 + } else { //新增购方信息 if (StringUtils.isBlank(buyerEntity.getBuyerCode())) { buyerEntity.setBuyerCode(baseService.getGenerateShotKey()); } @@ -621,6 +619,7 @@ public class BuyerServiceImpl implements BuyerService { queryBuyerEntity.setTaxpayerCode(buyerEntity.getTaxpayerCode()); queryBuyerEntity.setPurchaseName(buyerEntity.getPurchaseName()); } + queryBuyerEntity.setEntId(buyerEntity.getDeptId()); List shList = new ArrayList<>(); shList.add(buyerEntity.getXhfNsrsbh()); diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java index d280b604..a29213f3 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java @@ -622,7 +622,7 @@ public class CommodityServiceImpl implements CommodityService { Map map = new HashMap<>(); // map.put("productName", xmmc); map.put("zxbm", receiveSpxxReq.getZxbm()); - map.put("entId",commodityCodeCheckQuery.getDeptId()); + map.put("entId",receiveSpxxReq.getEntId()); log.debug("{}校验名称是否存在 参数:{}", LOGGER_MSG, map); List commodityCodeEntityList = commodityMapper.queryProductList(map, null); 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 e8e5faa5..153a9d7f 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 @@ -906,33 +906,45 @@