From 15178bafd7aa1827e6c48fda8e2cc3b8df0bbf5e Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期一, 19 一月 2026 15:24:25 +0800
Subject: [PATCH] 新增前后端

---
 service/src/main/java/com/ruoyi/cwgl/service/impl/FundFlowClaimDetailServiceImpl.java |  374 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 373 insertions(+), 1 deletions(-)

diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/FundFlowClaimDetailServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/FundFlowClaimDetailServiceImpl.java
index c0f7e38..a2d2646 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/impl/FundFlowClaimDetailServiceImpl.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/FundFlowClaimDetailServiceImpl.java
@@ -4,6 +4,8 @@
 
 import com.ruoyi.common.utils.DateUtils;
 import javax.annotation.Resource;
+
+import lombok.NonNull;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.stereotype.Service;
 import org.springframework.scheduling.annotation.Async;
@@ -16,9 +18,23 @@
 import com.ruoyi.common.core.service.BaseService;
 
 import com.ruoyi.cwgl.mapper.FundFlowClaimDetailMapper;
+import com.ruoyi.cwgl.mapper.FundFlowMapper;
 import com.ruoyi.cwgl.domain.FundFlowClaimDetail;
+import com.ruoyi.cwgl.domain.FundFlow;
+import com.ruoyi.cwgl.domain.FundFlowLog;
+import com.ruoyi.cwgl.domain.ReceivableBillSettlementDetail;
+import com.ruoyi.cwgl.domain.PayableBillSettlementDetail;
+import com.ruoyi.cwgl.domain.ReceivableBillManagement;
+import com.ruoyi.cwgl.domain.PayableBillManagement;
 import com.ruoyi.cwgl.service.IFundFlowClaimDetailService;
+import com.ruoyi.cwgl.service.IFundFlowLogService;
+import com.ruoyi.cwgl.service.IReceivableBillSettlementDetailService;
+import com.ruoyi.cwgl.service.IPayableBillSettlementDetailService;
+import com.ruoyi.cwgl.service.IReceivableBillManagementService;
+import com.ruoyi.cwgl.service.IPayableBillManagementService;
 import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.SecurityUtils;
+import java.math.BigDecimal;
 
 /**
  * 璐﹀崟璁ら鏄庣粏Service涓氬姟灞傚鐞�
@@ -33,6 +49,24 @@
     protected final Logger logger = LoggerFactory.getLogger(getClass());
     @Resource
     private FundFlowClaimDetailMapper fundFlowClaimDetailMapper;
+    
+    @Resource
+    private FundFlowMapper fundFlowMapper;
+    
+    @Resource
+    private IReceivableBillSettlementDetailService receivableBillSettlementDetailService;
+    
+    @Resource
+    private IPayableBillSettlementDetailService payableBillSettlementDetailService;
+    
+    @Resource
+    private IReceivableBillManagementService receivableBillManagementService;
+    
+    @Resource
+    private IPayableBillManagementService payableBillManagementService;
+    
+    @Resource
+    private IFundFlowLogService fundFlowLogService;
 
 
     /**
@@ -152,6 +186,7 @@
     @Override
     public int deleteFundFlowClaimDetailByIds(String ids)
     {
+
         return deleteFundFlowClaimDetailByIds(Convert.toIntArray(ids));
     }
 
@@ -165,7 +200,65 @@
     @Override
     public int deleteFundFlowClaimDetailByIds(Integer[] ids)
     {
-        return fundFlowClaimDetailMapper.deleteFundFlowClaimDetailByIds(ids);
+        if (ids == null || ids.length == 0) {
+            throw new RuntimeException("鍒犻櫎鐨勮棰嗘槑缁咺D涓嶈兘涓虹┖");
+        }
+        
+        // 鐢变簬鍒犻櫎鍙細鏈変竴鏉¤褰曪紝鍙栫涓�鏉¤繘琛屽鐞�
+        Integer id = ids[0];
+        FundFlowClaimDetail claimDetail = fundFlowClaimDetailMapper.selectFundFlowClaimDetailById(id);
+        if (claimDetail == null) {
+            throw new RuntimeException("鏈壘鍒拌鍒犻櫎鐨勮棰嗘槑缁嗚褰曪紝ID: " + id);
+        }
+        
+        Integer fundFlowId = claimDetail.getFundFlowId();
+        BigDecimal deleteAmount = claimDetail.getClaimAmount();
+        
+        // 鏌ヨ璧勯噾娴佹按淇℃伅
+        FundFlow fundFlow = fundFlowMapper.selectFundFlowById(fundFlowId);
+        if (fundFlow == null) {
+            throw new RuntimeException("璧勯噾娴佹按涓嶅瓨鍦紝ID: " + fundFlowId);
+        }
+        
+        // 鏇存柊璧勯噾娴佹按鐨勫凡璁ら閲戦
+        BigDecimal newClaimedAmount = fundFlow.getClaimedAmount().subtract(deleteAmount);
+        if (newClaimedAmount.compareTo(BigDecimal.ZERO) < 0) {
+            newClaimedAmount = BigDecimal.ZERO;
+        }
+        
+        // 鏍规嵁鏂扮殑璁ら閲戦璁剧疆鐘舵��
+        String newStatus =fundFlow.getStatus();
+        if (newClaimedAmount.compareTo(BigDecimal.ZERO) == 0) {
+            // 宸茶棰嗛噾棰濅负0锛岀姸鎬佹敼涓�1锛堟湭璁ら锛�
+            newStatus = "1";
+        } else if (newClaimedAmount.compareTo(fundFlow.getTransactionAmount()) < 0) {
+            // 宸茶棰嗛噾棰濆皬浜庝氦鏄撻噾棰濓紝鐘舵�佹敼涓�2锛堥儴鍒嗚棰嗭級
+            newStatus = "2";
+        }
+        
+        // 鏇存柊璧勯噾娴佹按鐘舵�佸拰宸茶棰嗛噾棰�
+        fundFlow.setStatus(newStatus);
+        fundFlow.setClaimedAmount(newClaimedAmount);
+        fundFlow.setUpdateTime(DateUtils.getNowDate());
+        int updateResult = fundFlowMapper.updateFundFlow(fundFlow);
+        if (updateResult <= 0) {
+            throw new RuntimeException("鏇存柊璧勯噾娴佹按鐘舵�佸け璐ワ紝ID: " + fundFlowId);
+        }
+        
+        // 鍒犻櫎缁撶畻鏄庣粏骞舵洿鏂拌处鍗曠姸鎬�
+        deleteSettlementDetailsAndUpdateBillStatus(claimDetail,fundFlow);
+        
+        int result = fundFlowClaimDetailMapper.deleteFundFlowClaimDetailByIds(ids);
+        
+        // 璁板綍鎿嶄綔鏃ュ織
+        if (result > 0) {
+            FundFlowLog log = new FundFlowLog();
+            log.setFlowId(fundFlowId);
+            log.setOperation("鍒犻櫎璐﹀崟璁ら鏄庣粏锛岃处鍗曠紪鍙凤細" + claimDetail.getBillNo() + "锛岃棰嗛噾棰濓細" + deleteAmount + "锛岃祫閲戞祦姘村彿锛�" + fundFlow.getBankFlowNo());
+            fundFlowLogService.insertFundFlowLog(log);
+        }
+        
+        return result;
     }
 
     /**
@@ -177,6 +270,285 @@
     @Override
     public int deleteFundFlowClaimDetailById(Integer id)
     {
+
         return fundFlowClaimDetailMapper.deleteFundFlowClaimDetailById(id);
     }
+
+    /**
+     * 璐﹀崟璁ら
+     *
+     * @param fundFlowId 璧勯噾娴佹按ID
+     * @param claimDetails 璐﹀崟璁ら鏄庣粏鍒楄〃
+     * @return 缁撴灉
+     */
+    @Override
+    public int claimBill(Integer fundFlowId, FundFlowClaimDetail claimDetail)
+    {
+        if (fundFlowId == null) {
+            throw new RuntimeException("璧勯噾娴佹按ID涓嶈兘涓虹┖");
+        }
+        
+        if (claimDetail == null ) {
+            throw new RuntimeException("璁ら鏄庣粏鍒楄〃涓嶈兘涓虹┖");
+        }
+
+        //閲戦
+        BigDecimal claimAmount = claimDetail.getClaimAmount();
+        if (claimAmount == null || claimAmount.compareTo(BigDecimal.ZERO) <= 0) {
+                throw new RuntimeException("璁ら閲戦蹇呴』澶т簬0");
+
+        }
+        
+        // 鏌ヨ璧勯噾娴佹按淇℃伅
+        FundFlow fundFlow = fundFlowMapper.selectFundFlowById(fundFlowId);
+        
+        // 鏍规嵁鎬昏棰嗛噾棰濅笌浜ゆ槗閲戦鐨勬瘮杈冭缃姸鎬�
+        String newStatus = getString(fundFlowId, claimDetail, fundFlow);
+
+        // 鏇存柊璧勯噾娴佹按鐘舵�佸拰宸茶棰嗛噾棰�
+        fundFlow.setStatus(newStatus);
+        fundFlow.setClaimedAmount(fundFlow.getClaimedAmount().add(claimAmount)); // 璁剧疆宸茶棰嗛噾棰�
+        fundFlow.setUpdateTime(DateUtils.getNowDate());
+        int updateResult = fundFlowMapper.updateFundFlow(fundFlow);
+        if (updateResult <= 0) {
+            throw new RuntimeException("鏇存柊璧勯噾娴佹按鐘舵�佸け璐ワ紝ID: " + fundFlowId);
+        }
+        
+
+
+
+            // 璁剧疆璧勯噾娴佹按ID
+            claimDetail.setFundFlowId(fundFlowId);
+            // 璁剧疆璁ら鏃ユ湡
+            claimDetail.setClaimDate(DateUtils.getNowDate());
+            // 璁剧疆鍒涘缓鏃堕棿
+            claimDetail.setCreateTime(DateUtils.getNowDate());
+
+        
+        int insertResult = fundFlowClaimDetailMapper.insertFundFlowClaimDetail(claimDetail);
+        
+        // 鏂板锛氬垱寤虹粨绠楁槑缁嗗苟鏇存柊璐﹀崟鐘舵��
+        if (insertResult > 0) {
+            
+            createSettlementDetailsAndUpdateBillStatus(claimDetail, fundFlow);
+            
+            // 璁板綍鎿嶄綔鏃ュ織
+            FundFlowLog log = new FundFlowLog();
+            log.setFlowId(fundFlowId);
+            log.setOperation("鏂板璐﹀崟璁ら鏄庣粏锛岃处鍗曠紪鍙凤細" + claimDetail.getBillNo() + "锛岃棰嗛噾棰濓細" + claimAmount + "锛岃祫閲戞祦姘村彿锛�" + fundFlow.getBankFlowNo());
+            fundFlowLogService.insertFundFlowLog(log);
+        }
+        
+        return insertResult;
+    }
+
+/**
+ * 鏍规嵁璧勯噾娴佹按ID銆佽棰嗚鎯呭垪琛ㄥ拰璧勯噾娴佹按瀵硅薄鑾峰彇鐘舵�佸瓧绗︿覆
+ * @param fundFlowId 璧勯噾娴佹按ID锛岀敤浜庢爣璇嗙壒瀹氱殑璧勯噾娴佹按璁板綍
+ * @param claimDetail 璁ら璇︽儏鍒楄〃锛屽寘鍚墍鏈夎棰嗛噾棰濅俊鎭�
+ * @param fundFlow 璧勯噾娴佹按瀵硅薄锛屽寘鍚氦鏄撻噾棰濈瓑鍏抽敭淇℃伅
+ * @return 杩斿洖澶勭悊鍚庣殑鐘舵�佸瓧绗︿覆
+ * @throws RuntimeException 褰撹祫閲戞祦姘村璞′负null鏃舵姏鍑哄紓甯�
+ */
+    private static @NonNull String getString(Integer fundFlowId, FundFlowClaimDetail claimDetail, FundFlow fundFlow) {
+    // 妫�鏌ヨ祫閲戞祦姘村璞℃槸鍚︿负绌猴紝濡傛灉涓虹┖鍒欐姏鍑哄紓甯�
+        if (fundFlow == null) {
+            throw new RuntimeException("璧勯噾娴佹按涓嶅瓨鍦紝ID: " + fundFlowId);
+        }
+
+        // 璁$畻鎬昏棰嗛噾棰�
+        BigDecimal totalClaimAmount = claimDetail.getClaimAmount();
+
+
+        // 楠岃瘉鎬昏棰嗛噾棰濅笉鑳借秴杩囦氦鏄撻噾棰�
+        return  getString(fundFlow, totalClaimAmount);
+
+    }
+
+    private static @NonNull String getString(FundFlow fundFlow, BigDecimal totalClaimAmount) {
+        BigDecimal transactionAmount = fundFlow.getTransactionAmount();
+        if (totalClaimAmount.compareTo(transactionAmount) > 0) {
+            throw new RuntimeException("鎬昏棰嗛噾棰濅笉鑳借秴杩囦氦鏄撻噾棰濄�備氦鏄撻噾棰�: " + transactionAmount + ", 鎬昏棰嗛噾棰�: " + totalClaimAmount);
+        }
+
+        // 鏍规嵁鎬昏棰嗛噾棰濅笌浜ゆ槗閲戦鐨勬瘮杈冭缃姸鎬�
+        String newStatus;
+        if (totalClaimAmount.compareTo(transactionAmount) < 0) {
+            // 鎬昏棰嗛噾棰濆皬浜庝氦鏄撻噾棰濓紝鐘舵�佹敼涓�2锛堥儴鍒嗚棰嗭級
+            newStatus = "2";
+        } else {
+            // 鎬昏棰嗛噾棰濈瓑浜庝氦鏄撻噾棰濓紝鐘舵�佹敼涓�3锛堝畬鍏ㄨ棰嗭級
+            newStatus = "3";
+        }
+        return newStatus;
+    }
+    
+    /**
+     * 鍒涘缓缁撶畻鏄庣粏骞舵洿鏂拌处鍗曠姸鎬�
+     */
+    private void createSettlementDetailsAndUpdateBillStatus(FundFlowClaimDetail claimDetail, FundFlow fundFlow) {
+
+            String billNo = claimDetail.getBillNo();
+            BigDecimal claimAmount = claimDetail.getClaimAmount();
+            Integer claimDetailId = claimDetail.getId();
+            
+            // 鏍规嵁鏀舵敮鏍囪瘑鍊熻捶鏍囧織鍒ゆ柇鏄簲鏀惰处鍗曡繕鏄簲浠樿处鍗�
+            if (fundFlow.getIncomeExpenseFlag().equals(0)) {
+                // 搴旀敹璐﹀崟
+                createReceivableSettlementDetail(billNo, claimAmount, fundFlow, claimDetailId);
+            } else  {
+                // 搴斾粯璐﹀崟
+                createPayableSettlementDetail(billNo, claimAmount, fundFlow, claimDetailId);
+
+        }
+    }
+    
+    /**
+     * 鍒涘缓搴旀敹璐﹀崟缁撶畻鏄庣粏
+     */
+    private void createReceivableSettlementDetail(String billNo, BigDecimal claimAmount, FundFlow fundFlow, Integer claimDetailId) {
+        try {
+            // 鏍规嵁璐﹀崟缂栧彿鏌ヨ搴旀敹璐﹀崟
+            ReceivableBillManagement bill = receivableBillManagementService.selectReceivableBillManagementBySystemNo(billNo);
+            if (bill != null) {
+                // 鍒涘缓缁撶畻鏄庣粏
+                ReceivableBillSettlementDetail settlementDetail = new ReceivableBillSettlementDetail();
+                settlementDetail.setBillId(bill.getId());
+                settlementDetail.setClaimDetailId(claimDetailId); // 璁剧疆璁ら鏄庣粏ID
+                settlementDetail.setReceiptAmount(claimAmount);
+                settlementDetail.setReceiptDate(fundFlow.getTransactionDate());
+                settlementDetail.setSettlementMethod("0"); // 鏍规嵁瀹為檯鎯呭喌璁剧疆
+                
+                // 璁剧疆閾惰璐︽埛淇℃伅
+                settlementDetail.setCustomerBank(fundFlow.getOurBankName()); // 瀹㈡埛寮�鎴疯锛堟湰鏂硅处鎴峰紑鎴疯锛�
+                settlementDetail.setCustomerBankAccount(fundFlow.getOurAccount()); // 瀹㈡埛閾惰璐﹀彿锛堟湰鏂硅处鍙凤級
+                settlementDetail.setReceivingBank(fundFlow.getCounterpartyName()); // 鏀舵璐︽埛寮�鎴疯锛堝鏂规埛鍚嶏級
+                settlementDetail.setReceivingBankAccount(fundFlow.getCounterpartyAccount()); // 鏀舵閾惰璐﹀彿锛堝鏂硅处鍙凤級
+                
+                settlementDetail.setCreateBy(SecurityUtils.getUsername());
+                settlementDetail.setCreateTime(DateUtils.getNowDate());
+                
+                // 鎻掑叆缁撶畻鏄庣粏锛堜細鑷姩鏇存柊璐﹀崟鐘舵�侊級
+                receivableBillSettlementDetailService.insertReceivableBillSettlementDetail(settlementDetail);
+                
+                logger.info("鎴愬姛鍒涘缓搴旀敹璐﹀崟缁撶畻鏄庣粏锛岃处鍗曠紪鍙凤細{}锛岄噾棰濓細{}锛岃棰嗘槑缁咺D锛歿}", billNo, claimAmount, claimDetailId);
+            } else {
+                logger.warn("鏈壘鍒板搴旂殑搴旀敹璐﹀崟锛岃处鍗曠紪鍙凤細{}", billNo);
+            }
+        } catch (Exception e) {
+            logger.error("鍒涘缓搴旀敹璐﹀崟缁撶畻鏄庣粏澶辫触锛岃处鍗曠紪鍙凤細{}", billNo, e);
+            // 杩欓噷鍙互閫夋嫨鎶涘嚭寮傚父鎴栬褰曟棩蹇楋紝浣嗕笉涓柇鏁翠釜璁ら娴佺▼
+        }
+    }
+    
+    /**
+     * 鍒涘缓搴斾粯璐﹀崟缁撶畻鏄庣粏
+     */
+    private void createPayableSettlementDetail(String billNo, BigDecimal claimAmount, FundFlow fundFlow, Integer claimDetailId) {
+        try {
+            // 鏍规嵁璐﹀崟缂栧彿鏌ヨ搴斾粯璐﹀崟
+            PayableBillManagement bill = payableBillManagementService.selectPayableBillManagementBySystemNo(billNo);
+            if (bill != null) {
+                // 鍒涘缓缁撶畻鏄庣粏
+                PayableBillSettlementDetail settlementDetail = new PayableBillSettlementDetail();
+                settlementDetail.setBillId(bill.getId());
+                settlementDetail.setClaimDetailId(claimDetailId); // 璁剧疆璁ら鏄庣粏ID
+                settlementDetail.setPaymentAmount(claimAmount);
+                settlementDetail.setPaymentDate(fundFlow.getTransactionDate());
+                settlementDetail.setSettlementMethod("0"); // 鏍规嵁瀹為檯鎯呭喌璁剧疆
+                
+                // 璁剧疆閾惰璐︽埛淇℃伅
+                settlementDetail.setPaymentBank(fundFlow.getOurBankName()); // 浠樻璐︽埛寮�鎴疯锛堟湰鏂硅处鎴峰紑鎴疯锛�
+                settlementDetail.setPaymentBankAccount(fundFlow.getOurAccount()); // 浠樻璐︽埛閾惰璐﹀彿锛堟湰鏂硅处鍙凤級
+                settlementDetail.setSupplierReceivingBank(fundFlow.getCounterpartyName()); // 渚涘簲鍟嗘敹娆捐处鎴峰紑鎴疯锛堝鏂规埛鍚嶏級
+                settlementDetail.setSupplierReceivingAccount(fundFlow.getCounterpartyAccount()); // 渚涘簲鍟嗘敹娆鹃摱琛岃处鎴凤紙瀵规柟璐﹀彿锛�
+                
+                settlementDetail.setCreateBy(SecurityUtils.getUsername());
+                settlementDetail.setCreateTime(DateUtils.getNowDate());
+                
+                // 鎻掑叆缁撶畻鏄庣粏锛堜細鑷姩鏇存柊璐﹀崟鐘舵�侊級
+                payableBillSettlementDetailService.insertPayableBillSettlementDetail(settlementDetail);
+                
+                logger.info("鎴愬姛鍒涘缓搴斾粯璐﹀崟缁撶畻鏄庣粏锛岃处鍗曠紪鍙凤細{}锛岄噾棰濓細{}锛岃棰嗘槑缁咺D锛歿}", billNo, claimAmount, claimDetailId);
+            } else {
+                logger.warn("鏈壘鍒板搴旂殑搴斾粯璐﹀崟锛岃处鍗曠紪鍙凤細{}", billNo);
+            }
+        } catch (Exception e) {
+            logger.error("鍒涘缓搴斾粯璐﹀崟缁撶畻鏄庣粏澶辫触锛岃处鍗曠紪鍙凤細{}", billNo, e);
+            // 杩欓噷鍙互閫夋嫨鎶涘嚭寮傚父鎴栬褰曟棩蹇楋紝浣嗕笉涓柇鏁翠釜璁ら娴佺▼
+        }
+    }
+    
+    /**
+     * 鍒犻櫎缁撶畻鏄庣粏骞舵洿鏂拌处鍗曠姸鎬�
+     */
+    private void deleteSettlementDetailsAndUpdateBillStatus(FundFlowClaimDetail claimDetail, FundFlow fundFlow) {
+        String billNo = claimDetail.getBillNo();
+        Integer claimDetailId = claimDetail.getId();
+        
+        try {
+
+            
+            // 鏍规嵁鏀舵敮鏍囪瘑鍊熻捶鏍囧織鍒ゆ柇鏄簲鏀惰处鍗曡繕鏄簲浠樿处鍗�
+            if (fundFlow.getIncomeExpenseFlag().equals(0)) {
+                // 搴旀敹璐﹀崟
+                deleteReceivableSettlementDetail(claimDetailId);
+            } else {
+                // 搴斾粯璐﹀崟
+                deletePayableSettlementDetail(claimDetailId);
+            }
+            
+            logger.info("鎴愬姛鍒犻櫎缁撶畻鏄庣粏锛岃棰嗘槑缁咺D锛歿}", claimDetailId);
+        } catch (Exception e) {
+            logger.error("鍒犻櫎缁撶畻鏄庣粏澶辫触锛岃棰嗘槑缁咺D锛歿}", claimDetailId, e);
+            // 杩欓噷鍙互閫夋嫨鎶涘嚭寮傚父鎴栬褰曟棩蹇楋紝浣嗕笉涓柇鏁翠釜鍒犻櫎娴佺▼
+        }
+    }
+    
+    /**
+     * 鍒犻櫎搴旀敹璐﹀崟缁撶畻鏄庣粏
+     */
+    private void deleteReceivableSettlementDetail(Integer claimDetailId) {
+        try {
+            // 鏍规嵁璁ら鏄庣粏ID鏌ヨ搴旀敹璐﹀崟缁撶畻鏄庣粏
+            ReceivableBillSettlementDetail receivableQuery = new ReceivableBillSettlementDetail();
+            receivableQuery.setClaimDetailId(claimDetailId);
+            List<ReceivableBillSettlementDetail> receivableDetails = receivableBillSettlementDetailService.selectReceivableBillSettlementDetailList(receivableQuery);
+            
+            if (!receivableDetails.isEmpty()) {
+                Integer[] receivableIds = receivableDetails.stream()
+                        .map(ReceivableBillSettlementDetail::getId)
+                        .toArray(Integer[]::new);
+                receivableBillSettlementDetailService.deleteReceivableBillSettlementDetailByIds(receivableIds);
+                logger.info("鎴愬姛鍒犻櫎搴旀敹璐﹀崟缁撶畻鏄庣粏锛岃棰嗘槑缁咺D锛歿}", claimDetailId);
+            }
+        } catch (Exception e) {
+            logger.error("鍒犻櫎搴旀敹璐﹀崟缁撶畻鏄庣粏澶辫触锛岃棰嗘槑缁咺D锛歿}", claimDetailId, e);
+            throw e;
+        }
+    }
+    
+    /**
+     * 鍒犻櫎搴斾粯璐﹀崟缁撶畻鏄庣粏
+     */
+    private void deletePayableSettlementDetail(Integer claimDetailId) {
+        try {
+            // 鏍规嵁璁ら鏄庣粏ID鏌ヨ搴斾粯璐﹀崟缁撶畻鏄庣粏
+            PayableBillSettlementDetail payableQuery = new PayableBillSettlementDetail();
+            payableQuery.setClaimDetailId(claimDetailId);
+            List<PayableBillSettlementDetail> payableDetails = payableBillSettlementDetailService.selectPayableBillSettlementDetailList(payableQuery);
+            
+            if (!payableDetails.isEmpty()) {
+                Integer[] payableIds = payableDetails.stream()
+                        .map(PayableBillSettlementDetail::getId)
+                        .toArray(Integer[]::new);
+                payableBillSettlementDetailService.deletePayableBillSettlementDetailByIds(payableIds);
+                logger.info("鎴愬姛鍒犻櫎搴斾粯璐﹀崟缁撶畻鏄庣粏锛岃棰嗘槑缁咺D锛歿}", claimDetailId);
+            }
+        } catch (Exception e) {
+            logger.error("鍒犻櫎搴斾粯璐﹀崟缁撶畻鏄庣粏澶辫触锛岃棰嗘槑缁咺D锛歿}", claimDetailId, e);
+            throw e;
+        }
+    }
+
 }

--
Gitblit v1.8.0