From 880fc56d1342d873a8ed17de3a61afcb194c365e Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期二, 23 十二月 2025 10:41:13 +0800
Subject: [PATCH] 新增作废

---
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsCustomerInfoServiceImpl.java |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 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 6815ccd..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
@@ -2,8 +2,12 @@
 
 import java.util.List;
 
+import com.ruoyi.common.enums.SystemDataNoEnum;
 import com.ruoyi.common.utils.DateUtils;
 import javax.annotation.Resource;
+
+import com.ruoyi.system.service.ISystemDataNoService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.stereotype.Service;
 import org.springframework.scheduling.annotation.Async;
@@ -15,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;
@@ -33,7 +39,14 @@
     protected final Logger logger = LoggerFactory.getLogger(getClass());
     @Resource
     private TmsCustomerInfoMapper tmsCustomerInfoMapper;
-
+    @Autowired
+    ISystemDataNoService systemDataNoService;
+    
+    @Autowired
+    IInvoiceInfoService invoiceInfoService;
+    
+    @Autowired
+    IBankAccountConfigService bankAccountConfigService;
 
     /**
      * 鏌ヨ瀹㈡埛淇℃伅
@@ -102,8 +115,35 @@
     @Override
     public int insertTmsCustomerInfo(TmsCustomerInfo tmsCustomerInfo)
     {
+        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