wujianwei
2026-03-20 b2e717310b8a177b435e0a3532f520839ec26402
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
package com.ruoyi.cwgl.service.impl;
 
import java.util.List;
 
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
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业务层处理
 *
 * @author ruoyi
 * @date 2026-01-12
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class FundFlowClaimDetailServiceImpl  extends BaseService<FundFlowClaimDetailMapper, FundFlowClaimDetail> implements IFundFlowClaimDetailService
{
    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;
 
 
    /**
     * 查询账单认领明细
     *
     * @param id 账单认领明细ID
     * @return 账单认领明细
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public FundFlowClaimDetail selectFundFlowClaimDetailById(Integer id)
    {
        return fundFlowClaimDetailMapper.selectFundFlowClaimDetailById(id);
    }
 
    /**
     * 查询账单认领明细 记录数
     *
     * @param fundFlowClaimDetail 账单认领明细
     * @return 账单认领明细集合
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public int selectFundFlowClaimDetailCount(FundFlowClaimDetail fundFlowClaimDetail)
    {
        return fundFlowClaimDetailMapper.selectFundFlowClaimDetailCount(fundFlowClaimDetail);
    }
 
    /**
     * 查询账单认领明细列表
     *
     * @param fundFlowClaimDetail 账单认领明细
     * @return 账单认领明细
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public List<FundFlowClaimDetail> selectFundFlowClaimDetailList(FundFlowClaimDetail fundFlowClaimDetail)
    {
        return fundFlowClaimDetailMapper.selectFundFlowClaimDetailList(fundFlowClaimDetail);
    }
 
    /**
     * 查询账单认领明细列表 异步 导出
     *
     * @param fundFlowClaimDetail 账单认领明细
     * @param exportKey 导出功能的唯一标识
     * @return 账单认领明细集合
     */
    @DataSource(DataSourceType.SLAVE)
    @Async
    @Override
    public void export(FundFlowClaimDetail fundFlowClaimDetail,String exportKey) {
 
        super.export(FundFlowClaimDetail.class,exportKey,"fundFlowClaimDetailData",(pageNum)->{
            PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE);
            return selectFundFlowClaimDetailList(fundFlowClaimDetail);
        });
    }
 
 
    /**
     * 新增账单认领明细
     *
     * @param fundFlowClaimDetail 账单认领明细
     * @return 结果
     */
    @Override
    public int insertFundFlowClaimDetail(FundFlowClaimDetail fundFlowClaimDetail)
    {
        fundFlowClaimDetail.setCreateTime(DateUtils.getNowDate());
        return fundFlowClaimDetailMapper.insertFundFlowClaimDetail(fundFlowClaimDetail);
    }
 
    /**
     * 新增账单认领明细[批量]
     *
     * @param fundFlowClaimDetails 账单认领明细
     * @return 结果
     */
    @Override
    public int insertFundFlowClaimDetailBatch(List<FundFlowClaimDetail> fundFlowClaimDetails)
    {
        int rows = fundFlowClaimDetailMapper.insertFundFlowClaimDetailBatch(fundFlowClaimDetails);
        return rows;
    }
 
    /**
     * 修改账单认领明细
     *
     * @param fundFlowClaimDetail 账单认领明细
     * @return 结果
     */
    @Override
    public int updateFundFlowClaimDetail(FundFlowClaimDetail fundFlowClaimDetail)
    {
        fundFlowClaimDetail.setUpdateTime(DateUtils.getNowDate());
        return fundFlowClaimDetailMapper.updateFundFlowClaimDetail(fundFlowClaimDetail);
    }
 
    /**
     * 修改账单认领明细[批量]
     *
     * @param fundFlowClaimDetails 账单认领明细
     * @return 结果
     */
    @Override
    public int updateFundFlowClaimDetailBatch(List<FundFlowClaimDetail> fundFlowClaimDetails){
        return fundFlowClaimDetailMapper.updateFundFlowClaimDetailBatch(fundFlowClaimDetails);
    }
 
    /**
     * 删除账单认领明细对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteFundFlowClaimDetailByIds(String ids)
    {
 
        return deleteFundFlowClaimDetailByIds(Convert.toIntArray(ids));
    }
 
    /**
     * 删除账单认领明细对象
     *
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteFundFlowClaimDetailByIds(Integer[] ids)
    {
        if (ids == null || ids.length == 0) {
            throw new RuntimeException("删除的认领明细ID不能为空");
        }
        
        // 由于删除只会有一条记录,取第一条进行处理
        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;
    }
 
    /**
     * 删除账单认领明细信息
     *
     * @param id 账单认领明细ID
     * @return 结果
     */
    @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("成功创建应收账单结算明细,账单编号:{},金额:{},认领明细ID:{}", 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("成功创建应付账单结算明细,账单编号:{},金额:{},认领明细ID:{}", 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("成功删除结算明细,认领明细ID:{}", claimDetailId);
        } catch (Exception e) {
            logger.error("删除结算明细失败,认领明细ID:{}", 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("成功删除应收账单结算明细,认领明细ID:{}", claimDetailId);
            }
        } catch (Exception e) {
            logger.error("删除应收账单结算明细失败,认领明细ID:{}", 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("成功删除应付账单结算明细,认领明细ID:{}", claimDetailId);
            }
        } catch (Exception e) {
            logger.error("删除应付账单结算明细失败,认领明细ID:{}", claimDetailId, e);
            throw e;
        }
    }
 
}