From b2e717310b8a177b435e0a3532f520839ec26402 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期五, 20 三月 2026 15:39:09 +0800
Subject: [PATCH] 新增日志

---
 service/src/main/java/com/ruoyi/cwgl/service/impl/PayableBillManagementServiceImpl.java |   76 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/PayableBillManagementServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/PayableBillManagementServiceImpl.java
index 0aa86b0..2986d3b 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/impl/PayableBillManagementServiceImpl.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/PayableBillManagementServiceImpl.java
@@ -4,6 +4,11 @@
 
 import com.ruoyi.common.utils.DateUtils;
 import javax.annotation.Resource;
+
+import com.ruoyi.cwgl.mapper.PayableFeeManagementMapper;
+import com.ruoyi.cwgl.service.IPayableBillManagementLogService;
+import com.ruoyi.cwgl.service.IPayableFeeManagementService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.stereotype.Service;
 import org.springframework.scheduling.annotation.Async;
@@ -17,8 +22,10 @@
 
 import com.ruoyi.cwgl.mapper.PayableBillManagementMapper;
 import com.ruoyi.cwgl.domain.PayableBillManagement;
+import com.ruoyi.cwgl.domain.PayableBillManagementLog;
 import com.ruoyi.cwgl.service.IPayableBillManagementService;
 import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.SecurityUtils;
 
 /**
  * 搴斾粯璐﹀崟绠$悊Service涓氬姟灞傚鐞�
@@ -33,7 +40,10 @@
     protected final Logger logger = LoggerFactory.getLogger(getClass());
     @Resource
     private PayableBillManagementMapper payableBillManagementMapper;
-
+    @Autowired
+    private IPayableBillManagementLogService logService;
+    @Resource
+    private PayableFeeManagementMapper payableFeeManagementMapper;
 
     /**
      * 鏌ヨ搴斾粯璐﹀崟绠$悊
@@ -129,7 +139,19 @@
     public int updatePayableBillManagement(PayableBillManagement payableBillManagement)
     {
         payableBillManagement.setUpdateTime(DateUtils.getNowDate());
-        return payableBillManagementMapper.updatePayableBillManagement(payableBillManagement);
+        int result = payableBillManagementMapper.updatePayableBillManagement(payableBillManagement);
+        
+        // 璁板綍鎿嶄綔鏃ュ織
+        if (result > 0) {
+            PayableBillManagementLog log = new PayableBillManagementLog();
+            log.setBillId(payableBillManagement.getId());
+            log.setCreateBy(SecurityUtils.getUsername());
+            log.setCreateTime(DateUtils.getNowDate());
+            log.setOperation("淇敼搴斾粯璐﹀崟锛岃处鍗曠紪鍙凤細" + payableBillManagement.getSystemNo());
+            logService.insertPayableBillManagementLog(log);
+        }
+        
+        return result;
     }
 
     /**
@@ -179,4 +201,54 @@
     {
         return payableBillManagementMapper.deletePayableBillManagementById(id);
     }
+    
+    /**
+     * 浣滃簾搴斾粯璐﹀崟绠$悊璁板綍
+     * 
+     * @param id 搴斾粯璐﹀崟绠$悊ID
+     * @return 缁撴灉
+     */
+    @Override
+    public int voidPayableBillManagement(Integer id)
+    {
+        // 鏌ヨ璐﹀崟淇℃伅
+        PayableBillManagement bill = selectPayableBillManagementById(id);
+        if (bill == null) {
+            throw new RuntimeException("搴斾粯璐﹀崟涓嶅瓨鍦�");
+        }
+        
+        // 妫�鏌ヨ处鍗曠姸鎬侊紝鍙湁鐘舵�佷负"0"锛堟湭缁撶畻锛夌殑璐﹀崟鍙互浣滃簾
+        if (!"0".equals(bill.getStatus())) {
+            throw new RuntimeException("鍙兘浣滃簾鐘舵�佷负鏈粨绠楃殑搴斾粯璐﹀崟");
+        }
+        
+        // 鏇存柊璐﹀崟鐘舵�佷负"2"锛堜綔搴燂級
+        bill.setStatus("2");
+        bill.setUpdateTime(DateUtils.getNowDate());
+        
+        int result = updatePayableBillManagement(bill);
+        
+        if (result > 0) {
+            // 浣滃簾搴斾粯璐﹀崟鍚庯紝闇�瑕佸皢鍏宠仈鐨勫簲浠樿垂鐢ㄨ褰曟仮澶嶄负寰呯敓鎴愯处鍗曠姸鎬�
+            String relatedBillNo = bill.getSystemNo();
+            if (relatedBillNo != null && !relatedBillNo.isEmpty()) {
+                payableFeeManagementMapper.updatePayableFeeManagementByRelatedBillNo(relatedBillNo);
+            }
+        }
+        
+        return result;
+    }
+    
+    /**
+     * 鏍规嵁绯荤粺缂栧彿鏌ヨ搴斾粯璐﹀崟绠$悊
+     * 
+     * @param systemNo 绯荤粺缂栧彿
+     * @return 搴斾粯璐﹀崟绠$悊
+     */
+    @DataSource(DataSourceType.SLAVE)
+    @Override
+    public PayableBillManagement selectPayableBillManagementBySystemNo(String systemNo)
+    {
+        return payableBillManagementMapper.selectPayableBillManagementBySystemNo(systemNo);
+    }
 }

--
Gitblit v1.8.0