From adc2160c918247202601dd290c48e408246f6ed5 Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Sat, 10 Oct 2026 16:44:56 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=BA=94=E6=94=B6=E8=B4=A6?= =?UTF-8?q?=E5=8D=95=E5=BF=AB=E7=85=A7=E4=BF=9D=E5=AD=98=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E4=BB=B7=E5=92=8C=E7=BA=A2=E7=BA=BF=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/bms/ar/domain/ArBillDetail.java | 4 ++ .../com/bms/ar/domain/ArBillDetailFee.java | 4 ++ .../ar/service/impl/ArBillServiceImpl.java | 24 ++++++- .../bms/price/mapper/PrcIncomeBillMapper.java | 4 ++ .../mapper/ar/ArBillDetailFeeMapper.xml | 18 ++++-- .../mapper/ar/ArBillDetailMapper.xml | 21 ++++--- .../mapper/price/PrcIncomeBillMapper.xml | 8 +++ ..._ar_bill_detail_product_redline_amount.sql | 63 +++++++++++++++++++ bms-back/sql/bms_init.sql | 4 ++ .../views/ar/bill/components/BillDetail.vue | 5 ++ 10 files changed, 141 insertions(+), 14 deletions(-) create mode 100644 bms-back/sql/20261010_add_ar_bill_detail_product_redline_amount.sql diff --git a/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java b/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java index f16c5606..eb3aa8b2 100644 --- a/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java +++ b/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetail.java @@ -43,6 +43,10 @@ public class ArBillDetail implements Serializable { private BigDecimal pkgHeight; private String currency; private BigDecimal totalAmount; + /** 来源应收主表中的整单产品价合计快照。 */ + private BigDecimal productAmount; + /** 来源应收主表中的整单红线价合计快照。 */ + private BigDecimal redlineAmount; private String remark; private String createBy; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") diff --git a/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetailFee.java b/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetailFee.java index 8c47158d..ca8f69ea 100644 --- a/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetailFee.java +++ b/bms-back/bms-system/src/main/java/com/bms/ar/domain/ArBillDetailFee.java @@ -25,6 +25,10 @@ public class ArBillDetailFee implements Serializable { private String unit; private BigDecimal unitPrice; private BigDecimal amount; + /** 来源费用明细中的产品价快照。 */ + private BigDecimal productAmount; + /** 来源费用明细中的红线价快照。 */ + private BigDecimal redlineAmount; private String currency; private String calculationFormula; private String roundMode; diff --git a/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java index dabbb42d..35c4ea57 100644 --- a/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java @@ -80,8 +80,10 @@ import com.bms.common.utils.StringUtils; import com.bms.common.utils.file.FileUtils; import com.bms.common.utils.file.FileUploadUtils; import com.bms.common.utils.uuid.IdUtils; +import com.bms.price.domain.PrcIncomeBill; import com.bms.price.domain.PrcIncomeBillFee; import com.bms.price.domain.PrcOrderBill; +import com.bms.price.mapper.PrcIncomeBillMapper; import com.bms.price.mapper.PrcIncomeBillFeeMapper; import com.bms.price.mapper.PrcOrderBillMapper; @@ -174,6 +176,8 @@ public class ArBillServiceImpl implements IArBillService { @Autowired private PrcIncomeBillFeeMapper sourceFeeMapper; @Autowired + private PrcIncomeBillMapper sourceIncomeBillMapper; + @Autowired private PlatformTransactionManager transactionManager; /** @@ -665,6 +669,14 @@ public class ArBillServiceImpl implements IArBillService { } } + Map sourceIncomeBillsByBillId = new HashMap<>(); + List sourceIncomeBills = sourceIncomeBillMapper.selectByBillIds(currentSourceBillIds); + if (sourceIncomeBills != null) { + for (PrcIncomeBill sourceIncomeBill : sourceIncomeBills) { + sourceIncomeBillsByBillId.put(sourceIncomeBill.getBillId(), sourceIncomeBill); + } + } + // 先抓取本批次的未出账费用快照,后续只更新和复制这些费用,避免把同订单已有 BILLED 费用重复带入新账单。 List sourceFees = sourceFeeMapper.selectUnbilledByBillIds( currentSourceBillIds, ArIncomeBillFeeStatus.UNBILLED.getCode()); @@ -698,7 +710,8 @@ public class ArBillServiceImpl implements IArBillService { int detailNo = (task.getProcessedCount() == null ? 0 : task.getProcessedCount()) + 1; List details = new ArrayList<>(sources.size()); for (PrcOrderBill source : sources) { - details.add(toDetail(bill, source, detailNo++, task.getCreateBy())); + details.add(toDetail(bill, source, sourceIncomeBillsByBillId.get(source.getBillId()), + detailNo++, task.getCreateBy())); } detailMapper.insertBatch(details); @@ -1137,7 +1150,8 @@ public class ArBillServiceImpl implements IArBillService { return !details.isEmpty() && detailTotal.compareTo(nvl(billTotal)) == 0; } - private ArBillDetail toDetail(ArBill bill, PrcOrderBill source, int detailNo, String operator) { + private ArBillDetail toDetail(ArBill bill, PrcOrderBill source, PrcIncomeBill sourceIncomeBill, + int detailNo, String operator) { ArBillDetail detail = new ArBillDetail(); detail.setArBillId(bill.getArBillId()); detail.setPrcOrderBillId(source.getBillId()); @@ -1162,6 +1176,10 @@ public class ArBillServiceImpl implements IArBillService { detail.setPkgHeight(source.getPkgHeight()); detail.setCurrency(source.getCurrency() == null ? bill.getCurrency() : source.getCurrency()); detail.setTotalAmount(nvl(source.getIncomeTotal())); + if (sourceIncomeBill != null) { + detail.setProductAmount(sourceIncomeBill.getProductAmount()); + detail.setRedlineAmount(sourceIncomeBill.getRedlineAmount()); + } detail.setRemark(source.getOrderRemark()); detail.setCreateBy(operator); return detail; @@ -1176,6 +1194,8 @@ public class ArBillServiceImpl implements IArBillService { fee.setFeeName(source.getFeeName()); fee.setScId(source.getScId()); fee.setAmount(nvl(source.getAmount())); + fee.setProductAmount(source.getProductAmount()); + fee.setRedlineAmount(source.getRedlineAmount()); fee.setCurrency(source.getCurrency() == null ? detail.getCurrency() : source.getCurrency()); fee.setRoundMode(source.getRoundMode()); fee.setRemark(source.getRemark()); diff --git a/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcIncomeBillMapper.java b/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcIncomeBillMapper.java index ad0436c8..4be5f03b 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcIncomeBillMapper.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcIncomeBillMapper.java @@ -1,12 +1,16 @@ package com.bms.price.mapper; +import java.util.List; import com.bms.price.domain.PrcIncomeBill; +import org.apache.ibatis.annotations.Param; /** prc_income_bill mapper */ public interface PrcIncomeBillMapper { PrcIncomeBill selectByBillId(String billId); + List selectByBillIds(@Param("billIds") List billIds); + PrcIncomeBill selectByIncomeBillId(String incomeBillId); int insertPrcIncomeBill(PrcIncomeBill row); diff --git a/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailFeeMapper.xml b/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailFeeMapper.xml index ee78100f..a4347a19 100644 --- a/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailFeeMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/ar/ArBillDetailFeeMapper.xml @@ -16,6 +16,8 @@ + + @@ -36,6 +38,8 @@ unit, unit_price, amount, + product_amount, + redline_amount, currency, calculation_formula, round_mode, @@ -59,6 +63,8 @@ f.unit, f.unit_price, f.amount, + f.product_amount, + f.redline_amount, f.currency, f.calculation_formula, f.round_mode, @@ -84,6 +90,8 @@ unit, unit_price, amount, + product_amount, + redline_amount, currency, calculation_formula, round_mode, @@ -97,7 +105,7 @@ @@ -46,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time, product_code, product_name, goods_description, country_code, country_name, dest_postcode, actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, - currency, total_amount, remark, create_by, create_time + currency, total_amount, product_amount, redline_amount, remark, create_by, create_time from ar_bill_detail where ar_bill_id = #{arBillId} and prc_order_bill_id in @@ -69,6 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -82,11 +86,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select d.detail_id, d.ar_bill_id, d.prc_order_bill_id, d.detail_no, d.order_no, d.tracking_no, d.transfer_no, d.receive_time, d.product_code, d.product_name, d.goods_description, d.country_code, d.country_name, d.dest_postcode, d.actual_weight, d.volume_weight, d.charge_weight, d.freight_rate, d.registration_fee, d.pkg_length, d.pkg_width, d.pkg_height, - d.currency, d.total_amount, d.remark, d.create_by, d.create_time, + d.currency, d.total_amount, d.product_amount, d.redline_amount, d.remark, d.create_by, d.create_time, f.detail_fee_id as fee_detail_id, f.detail_id as fee_parent_detail_id, f.prc_income_bill_fee_id as fee_prc_income_bill_fee_id, f.fee_no, f.fee_type, f.fee_name, f.sc_id as fee_sc_id, f.quantity as fee_quantity, f.unit as fee_unit, f.unit_price as fee_unit_price, f.amount as fee_amount, + f.product_amount as fee_product_amount, f.redline_amount as fee_redline_amount, f.currency as fee_currency, f.calculation_formula as fee_calculation_formula, f.round_mode as fee_round_mode, f.remark as fee_remark, f.create_by as fee_create_by, f.create_time as fee_create_time @@ -100,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time, product_code, product_name, goods_description, country_code, country_name, dest_postcode, actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, - currency, total_amount, remark, create_by, create_time + currency, total_amount, product_amount, redline_amount, remark, create_by, create_time from ar_bill_detail where ar_bill_id = #{arBillId} and detail_no > #{lastDetailNo} order by detail_no @@ -113,12 +118,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" product_name, goods_description, country_code, country_name, dest_postcode, actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency, - total_amount, + total_amount, product_amount, redline_amount, remark, create_by, create_time) values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{transferNo}, #{receiveTime}, #{productCode}, #{productName}, #{goodsDescription}, #{countryCode}, #{countryName}, #{destPostcode}, #{actualWeight}, #{volumeWeight}, #{chargeWeight}, #{freightRate}, #{registrationFee}, #{pkgLength}, #{pkgWidth}, - #{pkgHeight}, #{currency}, #{totalAmount}, #{remark}, #{createBy}, sysdate()) + #{pkgHeight}, #{currency}, #{totalAmount}, #{productAmount}, #{redlineAmount}, #{remark}, #{createBy}, sysdate()) @@ -126,6 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time, product_code, product_name, goods_description, country_code, country_name, dest_postcode, actual_weight, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency, total_amount, + product_amount, redline_amount, remark, create_by, create_time ) values @@ -133,7 +139,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item.transferNo}, #{item.receiveTime}, #{item.productCode}, #{item.productName}, #{item.goodsDescription}, #{item.countryCode}, #{item.countryName}, #{item.destPostcode}, #{item.actualWeight}, #{item.volumeWeight}, #{item.chargeWeight}, #{item.freightRate}, #{item.registrationFee}, #{item.pkgLength}, #{item.pkgWidth}, #{item.pkgHeight}, - #{item.currency}, #{item.totalAmount}, #{item.remark}, #{item.createBy}, sysdate()) + #{item.currency}, #{item.totalAmount}, #{item.productAmount}, #{item.redlineAmount}, + #{item.remark}, #{item.createBy}, sysdate()) diff --git a/bms-back/bms-system/src/main/resources/mapper/price/PrcIncomeBillMapper.xml b/bms-back/bms-system/src/main/resources/mapper/price/PrcIncomeBillMapper.xml index 62d7ca23..01d367ba 100644 --- a/bms-back/bms-system/src/main/resources/mapper/price/PrcIncomeBillMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/price/PrcIncomeBillMapper.xml @@ -35,6 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where bill_id = #{billId} + +