fix: 修复收费失败错误 'element cannot be mapped to a null key' - 补充修复

- 修复 PaymentRecServiceImpl.java 第 2472 行 groupingBy(Account::getId)

- 修复 PaymentRecServiceImpl.java 第 264 行 groupingBy(ChargeItem::getAccountId)

- 修复 IChargeBillServiceImpl.java 多处 groupingBy 可能遇到的 null key 问题
This commit is contained in:
2026-04-02 18:44:06 +08:00
parent 4a8e9b5a22
commit 0a5f26e9c0
2 changed files with 15 additions and 5 deletions

View File

@@ -487,7 +487,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
return getMap(map);
}
Map<Long, List<PaymentRecDetail>> paymentDetailsKV
= paymentDetails.stream().collect(Collectors.groupingBy(PaymentRecDetail::getReconciliationId));
= paymentDetails.stream()
.filter(detail -> detail.getReconciliationId() != null)
.collect(Collectors.groupingBy(PaymentRecDetail::getReconciliationId));
// 声明变量,符合要求的付款记录
Collection<PaymentReconciliation> PaymentReconciliationList;
List<Account> accountList = new ArrayList<>();
@@ -568,7 +570,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
= chargeItemDefinitions.stream()
.filter(def -> def.getId() != null)
.collect(Collectors.groupingBy(ChargeItemDefinition::getId));
// 查询医保结算id
List<String> settleIds = new ArrayList<>();

View File

@@ -261,7 +261,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
// 账户id对应的账单列表
Map<Long, List<ChargeItem>> chargeItemMapByAccountId
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getAccountId));
= chargeItemList.stream()
.filter(item -> item.getAccountId() != null)
.collect(Collectors.groupingBy(ChargeItem::getAccountId));
// 查询合同信息
List<Contract> contractList = contractService.list();
@@ -2469,7 +2471,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
if (accountList.isEmpty()) {
throw new ServiceException("未查询到账户信息");
}
Map<Long, List<Account>> accountKVById = accountList.stream().collect(Collectors.groupingBy(Account::getId));
Map<Long, List<Account>> accountKVById = accountList.stream()
.filter(acc -> acc.getId() != null)
.collect(Collectors.groupingBy(Account::getId));
com.openhis.financial.model.PaymentResult paymentResult;
List<com.openhis.financial.model.PaymentResult> paymentResultList = new ArrayList<>();
@@ -2479,7 +2483,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
// <3>收费详情按照收费批次进行分组后结算
Map<Long, List<PaymentRecDetail>> payTransNoMap
= paymentRecDetails.stream().collect(Collectors.groupingBy(PaymentRecDetail::getAccountId));
= paymentRecDetails.stream()
.filter(detail -> detail.getAccountId() != null)
.collect(Collectors.groupingBy(PaymentRecDetail::getAccountId));
for (Map.Entry<Long, List<PaymentRecDetail>> stringListEntry : payTransNoMap.entrySet()) {
// paymentResult = new PaymentResult();