From 2a658f5db16ec4ea269a9c27c06879b0c4252ead Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期二, 16 十二月 2025 14:13:51 +0800
Subject: [PATCH] 修改客户新增

---
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java
index 6d97e25..4391324 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java
@@ -19,6 +19,8 @@
 import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.core.service.BaseService;
 
+import com.ruoyi.cwgl.service.IBankAccountConfigService;
+import com.ruoyi.cwgl.service.IInvoiceInfoService;
 import com.ruoyi.tms.mapper.TmsCustomerInfoMapper;
 import com.ruoyi.tms.domain.TmsCustomerInfo;
 import com.ruoyi.tms.service.ITmsCustomerInfoService;
@@ -39,6 +41,12 @@
     private TmsCustomerInfoMapper tmsCustomerInfoMapper;
     @Autowired
     ISystemDataNoService systemDataNoService;
+    
+    @Autowired
+    IInvoiceInfoService invoiceInfoService;
+    
+    @Autowired
+    IBankAccountConfigService bankAccountConfigService;
 
     /**
      * 鏌ヨ瀹㈡埛淇℃伅
@@ -109,7 +117,33 @@
     {
         tmsCustomerInfo.setCustomerCode(systemDataNoService.getNoByKey(SystemDataNoEnum.CUST));
         tmsCustomerInfo.setCreateTime(DateUtils.getNowDate());
-        return tmsCustomerInfoMapper.insertTmsCustomerInfo(tmsCustomerInfo);
+        
+        // 淇濆瓨瀹㈡埛淇℃伅
+        int result = tmsCustomerInfoMapper.insertTmsCustomerInfo(tmsCustomerInfo);
+        
+        // 鑾峰彇瀹㈡埛ID鍜屽鎴峰悕绉�
+        Integer customerId = tmsCustomerInfo.getId();
+        String customerName = tmsCustomerInfo.getCustomerFullName();
+        
+        // 淇濆瓨鍙戠エ淇℃伅鍒楄〃
+        if (tmsCustomerInfo.getInvoiceInfoList() != null && !tmsCustomerInfo.getInvoiceInfoList().isEmpty()) {
+            tmsCustomerInfo.getInvoiceInfoList().forEach(invoiceInfo -> {
+                invoiceInfo.setCustomerId(customerId);
+                invoiceInfo.setCustomerName(customerName);
+            });
+            invoiceInfoService.insertInvoiceInfoBatch(tmsCustomerInfo.getInvoiceInfoList());
+        }
+        
+        // 淇濆瓨閾惰璐﹀彿閰嶇疆鍒楄〃
+        if (tmsCustomerInfo.getBankAccountConfigList() != null && !tmsCustomerInfo.getBankAccountConfigList().isEmpty()) {
+            tmsCustomerInfo.getBankAccountConfigList().forEach(bankAccountConfig -> {
+                bankAccountConfig.setCustomerId(customerId);
+                bankAccountConfig.setCustomerName(customerName);
+            });
+            bankAccountConfigService.insertBankAccountConfigBatch(tmsCustomerInfo.getBankAccountConfigList());
+        }
+        
+        return result;
     }
 
     /**

--
Gitblit v1.8.0