demand: TMS系统 - 客户账单管理 - 财务中心销账审核 -财务审核通过/总部驳回以后更新发票收款状态、已收金额

committer: heyu
This commit is contained in:
aike 2025-09-22 11:26:45 +08:00
parent 39b60f53bf
commit b562a81e7a
2 changed files with 14 additions and 12 deletions

View File

@ -1329,17 +1329,17 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
return;
}
// 按 invoice_no 分组处理开票记录
Map<String, List<EmisSettleInvoiceRecord>> invoiceGroups = invoiceRecords.stream()
.filter(record -> StringUtil.isNotBlank(record.getInvoiceNo()))
.collect(java.util.stream.Collectors.groupingBy(EmisSettleInvoiceRecord::getInvoiceNo));
// 按 id 分组处理开票记录
Map<Long, List<EmisSettleInvoiceRecord>> invoiceGroups = invoiceRecords.stream()
.filter(record -> record.getId() != null)
.collect(java.util.stream.Collectors.groupingBy(EmisSettleInvoiceRecord::getId));
for (Map.Entry<String, List<EmisSettleInvoiceRecord>> entry : invoiceGroups.entrySet()) {
String invoiceNo = entry.getKey();
for (Map.Entry<Long, List<EmisSettleInvoiceRecord>> entry : invoiceGroups.entrySet()) {
Long recordId = entry.getKey();
List<EmisSettleInvoiceRecord> invoiceList = entry.getValue();
try {
// 计算该发票号对应的总申请金额
// 计算该开票记录对应的总申请金额
BigDecimal totalApplyMoney = detailList.stream()
.filter(detail -> StringUtil.isNotBlank(detail.getBillCode()))
.map(detail -> detail.getApplyMoney() != null ? detail.getApplyMoney() : BigDecimal.ZERO)
@ -1386,12 +1386,12 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
}
}
log.info("开票记录付款状态更新成功,发票号: {}, 更新记录数: {}, 新已收金额: {}, 付款状态: {}, 申请金额: {}, 开票金额: {}",
invoiceNo, updateCount, newRecedMoney, paymentStatus, totalApplyMoney, applyMoney);
log.info("开票记录付款状态更新成功,记录ID: {}, 更新记录数: {}, 新已收金额: {}, 付款状态: {}, 申请金额: {}, 开票金额: {}",
recordId, updateCount, newRecedMoney, paymentStatus, totalApplyMoney, applyMoney);
} catch (Exception e) {
log.error("更新开票记录付款状态失败,发票号: {}", invoiceNo, e);
// 继续处理其他发票,不抛出异常
log.error("更新开票记录付款状态失败,记录ID: {}", recordId, e);
// 继续处理其他记录,不抛出异常
}
}

View File

@ -235,7 +235,7 @@
where a.del_flag = '0'
and exists (
select 1 from emis_settle_invoice_rel rel
where rel.del_flag = '0'
where rel.del_flag = '0'
and rel.apply_seq_no = a.apply_seq_no
and rel.bill_no in
<foreach item="billCode" collection="billCodes" open="(" separator="," close=")">
@ -468,6 +468,8 @@
<if test="openMoneyMax != null">open_money_max = #{openMoneyMax},</if>
<if test="openMoney != null">open_money = #{openMoney},</if>
<if test="invoiceNo != null and invoiceNo != ''">invoice_no = #{invoiceNo},</if>
<if test="recedMoney != null">reced_money = #{recedMoney},</if>
<if test="paymentStatus != null and paymentStatus != ''">payment_status = #{paymentStatus},</if>
<if test="invoiceStatus != null and invoiceStatus != ''">invoice_status = #{invoiceStatus},</if>
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''">invoice_status_desc = #{invoiceStatusDesc},</if>
<if test="recieveAddress != null and recieveAddress != ''">recieve_address = #{recieveAddress},</if>