From 4c505d326600d0e5d96ad6107b2a62242db4f3c7 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 23 七月 2025 15:12:20 +0800
Subject: [PATCH] yys  释放javaWork资源路径

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

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 017cda9..b6c43ed 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -16,6 +16,8 @@
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.other.mapper.TempFileMapper;
 import com.ruoyi.other.pojo.TempFile;
+import com.ruoyi.production.mapper.SalesLedgerSchedulingMapper;
+import com.ruoyi.production.pojo.SalesLedgerScheduling;
 import com.ruoyi.project.system.domain.SysDept;
 import com.ruoyi.project.system.mapper.SysDeptMapper;
 import com.ruoyi.sales.dto.MonthlyAmountDto;
@@ -75,6 +77,8 @@
 
     private final InvoiceLedgerMapper invoiceLedgerMapper;
 
+    private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
+
     @Autowired
     private SysDeptMapper sysDeptMapper;
 
@@ -111,7 +115,7 @@
             product.setTempnoInvoiceAmount(product.getNoInvoiceAmount());
             product.setTempNoInvoiceNum(product.getNoInvoiceNum());
             product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
-            product.setRegisterDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+            product.setRegisterDate(LocalDateTime.now());
         }
 
         // 3.鏌ヨ涓婁紶鏂囦欢
@@ -312,15 +316,23 @@
         List<Long> idList = Arrays.stream(ids)
                 .filter(Objects::nonNull)
                 .collect(Collectors.toList());
-
         if (CollectionUtils.isEmpty(idList)) {
             return 0;
+        }
+        // 鐢熶骇璁㈠崟鏈夊緟鎺掍骇鏁版嵁锛屽彴璐︿笉鍙垹闄�
+        LambdaQueryWrapper<SalesLedgerScheduling> salesLedgerSchedulingLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerScheduling>()
+                .in(SalesLedgerScheduling::getSalesLedgerId, idList);
+        if (salesLedgerSchedulingMapper.selectCount(salesLedgerSchedulingLambdaQueryWrapper) > 0) {
+            throw new BaseException("鏈夋帓浜ф暟鎹紝涓嶅彲鍒犻櫎");
         }
         // 1. 鍏堝垹闄ゅ瓙琛ㄦ暟鎹�
         LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
         productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList);
         salesLedgerProductMapper.delete(productWrapper);
-
+        // 鍒犻櫎鐢熶骇璁㈠崟鏁版嵁
+        LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>()
+                .in(SalesLedgerScheduling::getSalesLedgerId, idList);
+        salesLedgerSchedulingMapper.delete(in);
         // 2. 鍐嶅垹闄や富琛ㄦ暟鎹�
         return salesLedgerMapper.deleteBatchIds(idList);
     }

--
Gitblit v1.9.3