From 9ccc8bd3a53160a40cf60f14e5867f6ce9f6c58f Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期五, 26 十二月 2025 16:49:15 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
index 6589b2a..e751c03 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
@@ -55,14 +55,19 @@
         try {
             Customer customer = JSONObject.parseObject(JSONObject.toJSONString(object.get("customer")), Customer.class);
            if(customer!=null){
-               if (customer.getId()!=null && customer.getId()!=0){
-                   customerMapper.updateCustomer(customer);
-                   log.setFunction("insertCustomer淇敼");
-               }else{
-                   customerMapper.insertCustomer(customer);
-                   log.setFunction("insertCustomer鏂板");
+               Integer count = customerMapper.countByCustomerName(customer);
+               if (count > 0) {
+                   saveState = false;
+               }else {
+                   if (customer.getId()!=null && customer.getId()!=0){
+                       customerMapper.updateCustomer(customer);
+                       log.setFunction("insertCustomer淇敼");
+                   }else{
+                       customerMapper.insertCustomer(customer);
+                       log.setFunction("insertCustomer鏂板");
+                   }
+                   logService.saveLog(log);
                }
-               logService.saveLog(log);
            }
         } catch (Exception e) {
             TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);

--
Gitblit v1.8.0