demand: TMS系统 - 客户账单管理 - 财务中心销账审核 -财务审核通过/总部驳回以后更新发票收款状态、已收金额
committer: heyu
This commit is contained in:
parent
39b60f53bf
commit
b562a81e7a
@ -1329,17 +1329,17 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按 invoice_no 分组处理开票记录
|
// 按 id 分组处理开票记录
|
||||||
Map<String, List<EmisSettleInvoiceRecord>> invoiceGroups = invoiceRecords.stream()
|
Map<Long, List<EmisSettleInvoiceRecord>> invoiceGroups = invoiceRecords.stream()
|
||||||
.filter(record -> StringUtil.isNotBlank(record.getInvoiceNo()))
|
.filter(record -> record.getId() != null)
|
||||||
.collect(java.util.stream.Collectors.groupingBy(EmisSettleInvoiceRecord::getInvoiceNo));
|
.collect(java.util.stream.Collectors.groupingBy(EmisSettleInvoiceRecord::getId));
|
||||||
|
|
||||||
for (Map.Entry<String, List<EmisSettleInvoiceRecord>> entry : invoiceGroups.entrySet()) {
|
for (Map.Entry<Long, List<EmisSettleInvoiceRecord>> entry : invoiceGroups.entrySet()) {
|
||||||
String invoiceNo = entry.getKey();
|
Long recordId = entry.getKey();
|
||||||
List<EmisSettleInvoiceRecord> invoiceList = entry.getValue();
|
List<EmisSettleInvoiceRecord> invoiceList = entry.getValue();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 计算该发票号对应的总申请金额
|
// 计算该开票记录对应的总申请金额
|
||||||
BigDecimal totalApplyMoney = detailList.stream()
|
BigDecimal totalApplyMoney = detailList.stream()
|
||||||
.filter(detail -> StringUtil.isNotBlank(detail.getBillCode()))
|
.filter(detail -> StringUtil.isNotBlank(detail.getBillCode()))
|
||||||
.map(detail -> detail.getApplyMoney() != null ? detail.getApplyMoney() : BigDecimal.ZERO)
|
.map(detail -> detail.getApplyMoney() != null ? detail.getApplyMoney() : BigDecimal.ZERO)
|
||||||
@ -1386,12 +1386,12 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("开票记录付款状态更新成功,发票号: {}, 更新记录数: {}, 新已收金额: {}, 付款状态: {}, 申请金额: {}, 开票金额: {}",
|
log.info("开票记录付款状态更新成功,记录ID: {}, 更新记录数: {}, 新已收金额: {}, 付款状态: {}, 申请金额: {}, 开票金额: {}",
|
||||||
invoiceNo, updateCount, newRecedMoney, paymentStatus, totalApplyMoney, applyMoney);
|
recordId, updateCount, newRecedMoney, paymentStatus, totalApplyMoney, applyMoney);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("更新开票记录付款状态失败,发票号: {}", invoiceNo, e);
|
log.error("更新开票记录付款状态失败,记录ID: {}", recordId, e);
|
||||||
// 继续处理其他发票,不抛出异常
|
// 继续处理其他记录,不抛出异常
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -235,7 +235,7 @@
|
|||||||
where a.del_flag = '0'
|
where a.del_flag = '0'
|
||||||
and exists (
|
and exists (
|
||||||
select 1 from emis_settle_invoice_rel rel
|
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.apply_seq_no = a.apply_seq_no
|
||||||
and rel.bill_no in
|
and rel.bill_no in
|
||||||
<foreach item="billCode" collection="billCodes" open="(" separator="," close=")">
|
<foreach item="billCode" collection="billCodes" open="(" separator="," close=")">
|
||||||
@ -468,6 +468,8 @@
|
|||||||
<if test="openMoneyMax != null">open_money_max = #{openMoneyMax},</if>
|
<if test="openMoneyMax != null">open_money_max = #{openMoneyMax},</if>
|
||||||
<if test="openMoney != null">open_money = #{openMoney},</if>
|
<if test="openMoney != null">open_money = #{openMoney},</if>
|
||||||
<if test="invoiceNo != null and invoiceNo != ''">invoice_no = #{invoiceNo},</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="invoiceStatus != null and invoiceStatus != ''">invoice_status = #{invoiceStatus},</if>
|
||||||
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''">invoice_status_desc = #{invoiceStatusDesc},</if>
|
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''">invoice_status_desc = #{invoiceStatusDesc},</if>
|
||||||
<if test="recieveAddress != null and recieveAddress != ''">recieve_address = #{recieveAddress},</if>
|
<if test="recieveAddress != null and recieveAddress != ''">recieve_address = #{recieveAddress},</if>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user