From b6eb0258afe03ac7625fa926f1f221a12efbf102 Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Wed, 3 Sep 2025 17:03:05 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20oms\=E5=B0=8F=E7=A8=8B=E5=BA=8F-?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=BD=95=E5=85=A5=E6=94=AF=E6=8C=81=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E4=BC=81=E4=B8=9A=E5=90=8D=E7=A7=B0=E3=80=81=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E7=A8=8E=E5=8F=B7=20=20oms\=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F-=E6=9F=A5=E8=AF=A2=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81=E6=9F=A5=E8=AF=A2=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E3=80=81=E4=BC=81=E4=B8=9A=E7=A8=8E=E5=8F=B7?= =?UTF-8?q?=20=20oms\=E5=B0=8F=E7=A8=8B=E5=BA=8F-=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=9C=B0=E5=9D=80=E6=94=AF=E6=8C=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BC=81=E4=B8=9A=E5=90=8D=E7=A7=B0=E3=80=81=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E7=A8=8E=E5=8F=B7=20=20oms\=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F-=E6=96=B0=E5=A2=9E/=E4=BF=AE=E6=94=B9=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=9C=B0=E5=9D=80=E6=94=AF=E6=8C=81=E6=96=B0=E5=A2=9E?= =?UTF-8?q?/=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E3=80=81=E4=BC=81=E4=B8=9A=E7=A8=8E=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: heyu --- .../erp/emis/service/EmisBaseService.java | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java index 585eb4ec5..6cf66c627 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java @@ -3561,29 +3561,56 @@ public class EmisBaseService { public int createCustomerAddressNew(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError { checkAdress(emisCustomerAddressNew); - List emisCustomerAddressList = emisCustomerAddressMapper.checkAndQuery(emisCustomerAddressNew); + List emisCustomerAddressList = emisCustomerAddressMapper + .checkAndQuery(emisCustomerAddressNew); if (CollectionUtil.isEmpty(emisCustomerAddressList)) { // 不重复的情况则 创建地址 return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew); } else { - if ("1".equals(emisCustomerAddressNew.getAddressType()) && "0086".equals(emisCustomerAddressNew.getCountry())) { - List emisCustomerAddressIds = emisCustomerAddressList.stream().filter(i -> (!emisCustomerAddressNew.getEnterpriseTaxId().equals(i.getEnterpriseTaxId()) || !emisCustomerAddressNew.getEnterpriseName().equals(i.getEnterpriseName()))).map(EmisCustomerAddress::getId).collect(Collectors.toList()); + if ("1".equals(emisCustomerAddressNew.getAddressType()) + && "0086".equals(emisCustomerAddressNew.getCountry())) { + String newEnterpriseTaxId = emisCustomerAddressNew.getEnterpriseTaxId(); + String newEnterpriseName = emisCustomerAddressNew.getEnterpriseName(); + + List emisCustomerAddressIds = emisCustomerAddressList.stream() + .filter(i -> { + String existingTaxId = i.getEnterpriseTaxId(); + String existingName = i.getEnterpriseName(); + + // 如果新数据为空,则过滤掉企业信息不匹配的记录 + if (StringUtil.isBlank(newEnterpriseTaxId) || StringUtil.isBlank(newEnterpriseName)) { + return false; + } + + // 如果现有数据为空,则包含在更新列表中 + if (StringUtil.isBlank(existingTaxId) || StringUtil.isBlank(existingName)) { + return true; + } + + // 比较企业信息是否不匹配 + return !newEnterpriseTaxId.equals(existingTaxId) || !newEnterpriseName.equals(existingName); + }) + .map(EmisCustomerAddress::getId) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(emisCustomerAddressIds)) { return 1; } + if (emisCustomerAddressNew.getId() != null) { EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress(); emisCustomerAddress.setId(emisCustomerAddressNew.getId()); - emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId()); - emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName()); + emisCustomerAddress.setEnterpriseTaxId(newEnterpriseTaxId); + emisCustomerAddress.setEnterpriseName(newEnterpriseName); emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress); return 1; } + for (Long id : emisCustomerAddressIds) { EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress(); emisCustomerAddress.setId(id); - emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId()); - emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName()); + emisCustomerAddress.setEnterpriseTaxId(newEnterpriseTaxId); + emisCustomerAddress.setEnterpriseName(newEnterpriseName); emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress); } }