From c58c05fa307754061c9264758eff668105f89625 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 09 三月 2026 14:14:41 +0800
Subject: [PATCH] yys 商机管理优化

---
 src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java |    8 ++++++++
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java       |   14 +++++++++++++-
 src/main/resources/application-prod.yml                                      |   10 +++++-----
 src/main/java/com/ruoyi/sales/pojo/BusinessOpportunity.java                  |    3 +++
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
index 04acb23..7a9acab 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -27,9 +27,11 @@
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.system.mapper.SysUserMapper;
 import com.ruoyi.purchase.dto.PurchaseLedgerDto;
+import com.ruoyi.purchase.mapper.PaymentRegistrationMapper;
 import com.ruoyi.purchase.mapper.ProductRecordMapper;
 import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
 import com.ruoyi.purchase.mapper.TicketRegistrationMapper;
+import com.ruoyi.purchase.pojo.PaymentRegistration;
 import com.ruoyi.purchase.pojo.ProductRecord;
 import com.ruoyi.purchase.pojo.PurchaseLedger;
 import com.ruoyi.purchase.pojo.TicketRegistration;
@@ -97,6 +99,8 @@
     private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
 
     private final StringRedisTemplate redisTemplate;
+
+    private final PaymentRegistrationMapper  paymentRegistrationMapper;
 
     @Value("${file.upload-dir}")
     private String uploadDir;
@@ -359,6 +363,10 @@
         LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
         productRecordLambdaQueryWrapper.in(ProductRecord::getPurchaseLedgerId,ids);
         productRecordMapper.delete(productRecordLambdaQueryWrapper);
+        // 鍒犻櫎浠樻璁板綍
+        LambdaQueryWrapper<PaymentRegistration> paymentRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        paymentRegistrationLambdaQueryWrapper.in(PaymentRegistration::getPurchaseLedgerId,ids);
+        paymentRegistrationMapper.delete(paymentRegistrationLambdaQueryWrapper);
         // 鎵归噺鍒犻櫎閲囪喘鍙拌处
         return purchaseLedgerMapper.deleteBatchIds(Arrays.asList(ids));
     }
diff --git a/src/main/java/com/ruoyi/sales/pojo/BusinessOpportunity.java b/src/main/java/com/ruoyi/sales/pojo/BusinessOpportunity.java
index 7da6242..43c9419 100644
--- a/src/main/java/com/ruoyi/sales/pojo/BusinessOpportunity.java
+++ b/src/main/java/com/ruoyi/sales/pojo/BusinessOpportunity.java
@@ -72,6 +72,9 @@
     @TableField(exist = false)
     private String description;
 
+    @ApiModelProperty(value = "鏀归�犲唴瀹�")
+    private String renContent;
+
     @ApiModelProperty(value = "鍚堝悓閲戦")
     private BigDecimal contractAmount;
 
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index d49c2aa..49b7a7d 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -83,6 +83,10 @@
 
     private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
 
+    private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
+
+    private final InvoiceRegistrationMapper invoiceRegistrationMapper;
+
     @Autowired
     private SysDeptMapper sysDeptMapper;
 
@@ -348,6 +352,13 @@
         if (CollectionUtils.isEmpty(idList)) {
             return 0;
         }
+        // 鍒ゆ柇鏄惁鏈夊紑绁ㄨ褰�
+        LambdaQueryWrapper<InvoiceRegistrationProduct> invoiceLedgerQuery = new LambdaQueryWrapper<>();
+        invoiceLedgerQuery.in(InvoiceRegistrationProduct::getSalesLedgerId, idList);
+        List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(invoiceLedgerQuery);
+        if (CollectionUtils.isNotEmpty(invoiceRegistrationProducts)) {
+            throw new BaseException("鏈夊紑绁ㄨ褰曪紝涓嶅彲鍒犻櫎");
+        }
         // 鐢熶骇璁㈠崟鏈夊緟鎺掍骇鏁版嵁锛屽彴璐︿笉鍙垹闄�
         LambdaQueryWrapper<SalesLedgerScheduling> salesLedgerSchedulingLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerScheduling>()
                 .in(SalesLedgerScheduling::getSalesLedgerId, idList);
@@ -356,7 +367,8 @@
         }
         // 1. 鍏堝垹闄ゅ瓙琛ㄦ暟鎹�
         LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
-        productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList);
+        productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList)
+                .eq(SalesLedgerProduct::getType,1);
         salesLedgerProductMapper.delete(productWrapper);
         // 鍒犻櫎鐢熶骇璁㈠崟鏁版嵁
         LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>()
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index 534ffac..b69aa25 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -143,16 +143,16 @@
   # redis 閰嶇疆
   redis:
     # 鍦板潃
-    host: 127.0.0.1
+#    host: 127.0.0.1
 #    host: localhost
-#    host: 172.17.0.1
+    host: 172.17.0.1
     # 绔彛锛岄粯璁や负6379
     port: 6379
     # 鏁版嵁搴撶储寮�
-    database: 0
+    database: 15
     # 瀵嗙爜
-    password: root2022!
-#    password:
+#    password: root2022!
+    password:
 
     # 杩炴帴瓒呮椂鏃堕棿
     timeout: 10s

--
Gitblit v1.9.3