回退 UUID 转 bigint 相关改动(已迁至 feature/uuid-to-bigint)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuweihua
2026-11-14 08:08:49 +08:00
parent 359c3c18e4
commit 87ae3e6674
71 changed files with 351 additions and 915 deletions
@@ -12,7 +12,7 @@ public class SrvBillAirAllocOrder
private String orderNo;
/** 计费订单 ID,对应 prc_order_bill.bill_id */
private Long billId;
private String billId;
/** 计费重,没有计费重时依次取实际重量、收货重量 */
private BigDecimal chargeWeight;
@@ -15,7 +15,7 @@ public class PayBillDiff
private Long lineId;
private Long feeId;
private String feeId;
private BigDecimal ourAmount;
@@ -28,7 +28,7 @@ public class PayBillDiff
/** OPEN ACCEPT_OURS ACCEPT_THEIRS */
private String handleType;
private Long adjustFeeId;
private String adjustFeeId;
private String createBy;
@@ -13,9 +13,9 @@ public class PayBillLine
private Long billId;
private Long feeId;
private String feeId;
private Long orderBillId;
private String orderBillId;
private String orderNo;
@@ -19,7 +19,7 @@ public class PayBillLog
private Long lineId;
private Long feeId;
private String feeId;
private String operationType;
@@ -9,7 +9,7 @@ import lombok.Data;
@Data
public class PayBillOrder
{
private Long billId;
private String billId;
private String orderNo;
@@ -8,7 +8,7 @@ import lombok.Data;
@Data
public class PayOrderCostResult
{
private Long billId;
private String billId;
private String channelId;
@@ -26,7 +26,7 @@ public class PrcBillingTask extends BaseEntity
/** 移动端传入的计费时间(非 Oracle 订单时间;回写时不会被覆盖) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date billTime;
private Long billId;
private String billId;
/** 用于查询的稳定失败码,例如 NO_CUSTOMER_PACKAGE */
private String failCode;
private String errorMessage;
@@ -13,9 +13,9 @@ public class PrcIncomeBill implements Serializable
private static final long serialVersionUID = 1L;
/** 应收主表ID */
private Long incomeBillId;
private String incomeBillId;
/** 计费订单ID */
private Long billId;
private String billId;
/** 币种 */
private String currency;
/** 产品价合计 */
@@ -12,10 +12,10 @@ public class PrcIncomeBillFee implements Serializable
{
private static final long serialVersionUID = 1L;
private Long feeId;
private Long billId;
private String feeId;
private String billId;
/** 应收主表ID */
private Long incomeBillId;
private String incomeBillId;
private String feeType;
private String feeName;
private Long scId;
@@ -15,9 +15,9 @@ public class PrcOrderBill extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long billId;
private String billId;
/** 批量查询:多个账单ID精确匹配(仅查询用,非表字段) */
private List<Long> billIds;
private List<String> billIds;
private String billKey;
private String orderNo;
/** 批量查询:多个订单号精确匹配(仅查询用,非表字段) */
@@ -12,7 +12,7 @@ public class PrcOrderBillExt implements Serializable
{
private static final long serialVersionUID = 1L;
private Long billId;
private String billId;
private String orderNo;
private String upstreamId;
private String lineNo;
@@ -13,9 +13,9 @@ public class PrcPayBill implements Serializable
private static final long serialVersionUID = 1L;
/** 应付主表ID */
private Long payBillId;
private String payBillId;
/** 计费订单ID */
private Long billId;
private String billId;
/** 币种 */
private String currency;
/** 产品价合计 */
@@ -12,10 +12,10 @@ public class PrcPayBillFee implements Serializable
{
private static final long serialVersionUID = 1L;
private Long feeId;
private Long billId;
private String feeId;
private String billId;
/** 应付主表ID */
private Long payBillId;
private String payBillId;
private String feeType;
private String feeName;
private Long scId;
@@ -13,7 +13,7 @@ public class AddIncomeBillFeeRequest implements Serializable
private static final long serialVersionUID = 1L;
@NotBlank(message = "billId required")
private Long billId;
private String billId;
/** 附加费配置ID(prc_surcharge.sc_id)。 */
@NotNull(message = "scId required")
@@ -19,7 +19,7 @@ public class BatchAddIncomeBillFeeRequest implements Serializable
private String scopeMode;
/** scopeMode=SELECTED 时选中的账单ID。 */
private List<Long> billIds;
private List<String> billIds;
/** 与计费列表搜索相同的筛选条件。 */
private List<String> orderNos;
@@ -15,7 +15,7 @@ public class LocalRebillRequest implements Serializable
/** ALL | SELECTED */
private String scopeMode;
private List<Long> billIds;
private List<String> billIds;
private List<String> orderNos;
private List<String> trackingNos;
private List<String> transferNos;
@@ -14,7 +14,7 @@ public class OrderBillFailReasonVo implements Serializable
{
private static final long serialVersionUID = 1L;
private Long billId;
private String billId;
private String orderNo;
private String transferNo;
private String trackingNo;
@@ -15,7 +15,7 @@ public class RecalcBillPriceRequest implements Serializable
/** ALL = 筛选条件;SELECTED = billIds。 */
private String scopeMode;
private List<Long> billIds;
private List<String> billIds;
private List<String> orderNos;
private List<String> trackingNos;
private List<String> transferNos;
@@ -27,7 +27,7 @@ public class TmsOrderBillStatusResult {
/**
* 计费订单标识,仅在唯一命中时返回。
*/
private Long billId;
private String billId;
private String orderNo;
private String trackingNo;
@@ -82,7 +82,7 @@ public class TmsPriceQuoteResult implements Serializable
/** 应付费用明细 */
private List<TmsPriceQuoteFeeLine> payFeeDetails;
private String quoteId;
private Long billId;
private String billId;
private String orderNo;
private String trackingNo;
/** 转单号 */
@@ -14,7 +14,7 @@ public class UpdateChargeWeightRequest implements Serializable
private static final long serialVersionUID = 1L;
@NotBlank(message = "billId is required")
private Long billId;
private String billId;
@NotNull(message = "chargeWeight is required")
@DecimalMin(value = "0.001", message = "chargeWeight must be > 0")
@@ -12,7 +12,7 @@ public class UpdateIncomeBillFeeRequest implements Serializable
private static final long serialVersionUID = 1L;
@NotBlank(message = "feeId required")
private Long feeId;
private String feeId;
/** 可选:更换附加费配置。 */
private Long scId;
@@ -65,7 +65,7 @@ public interface PayBillMapper
* @param billIds 计费订单ID
* @return 订单应付费用
*/
List<PrcPayBillFee> selectOrderFees(@Param("billIds") List<Long> billIds);
List<PrcPayBillFee> selectOrderFees(@Param("billIds") List<String> billIds);
/**
* 读取还没被未作废账单占用的费用。旧账单没有费用行号时,整票视为已占用。
@@ -73,7 +73,7 @@ public interface PayBillMapper
* @param billIds 计费订单ID
* @return 可抄进本次账单的费用
*/
List<PrcPayBillFee> selectFreeFees(@Param("billIds") List<Long> billIds);
List<PrcPayBillFee> selectFreeFees(@Param("billIds") List<String> billIds);
/**
* 这票订单还有没有未删除的计算费用。
@@ -81,7 +81,7 @@ public interface PayBillMapper
* @param billId 计费订单ID
* @return 计算费用条数
*/
int countCalcFees(@Param("billId") Long billId);
int countCalcFees(@Param("billId") String billId);
/**
* 插入一张草稿应付账单。
@@ -122,7 +122,7 @@ public interface PayBillMapper
* @param lineId 账单行ID
* @return 影响行数
*/
int bindFeeLine(@Param("feeId") Long feeId, @Param("lineId") Long lineId);
int bindFeeLine(@Param("feeId") String feeId, @Param("lineId") Long lineId);
/**
* 释放一张账单占用的费用明细。
@@ -22,7 +22,7 @@ public interface PayFinanceMapper
Long selectLadingSupplier(@Param("ladingNo") String ladingNo);
int stampFee(@Param("feeId") Long feeId, @Param("supplierId") Long supplierId, @Param("supplierName") String supplierName);
int stampFee(@Param("feeId") String feeId, @Param("supplierId") Long supplierId, @Param("supplierName") String supplierName);
int stampCalc(@Param("billId") Long billId, @Param("supplierId") Long supplierId, @Param("supplierName") String supplierName);
int stampCalc(@Param("billId") String billId, @Param("supplierId") Long supplierId, @Param("supplierName") String supplierName);
}
@@ -7,22 +7,22 @@ import com.bms.price.domain.PrcIncomeBillFee;
/** 应收账单费用 mapper */
public interface PrcIncomeBillFeeMapper
{
public List<PrcIncomeBillFee> selectByBillId(Long billId);
public List<PrcIncomeBillFee> selectByBillId(String billId);
public List<PrcIncomeBillFee> selectByBillIds(@Param("billIds") List<Long> billIds);
public List<PrcIncomeBillFee> selectByBillIds(@Param("billIds") List<String> billIds);
/** 查询指定计费订单中尚未生成应收账单的费用。 */
public List<PrcIncomeBillFee> selectUnbilledByBillIds(@Param("billIds") List<Long> billIds,
public List<PrcIncomeBillFee> selectUnbilledByBillIds(@Param("billIds") List<String> billIds,
@Param("arBillStatus") String arBillStatus);
public PrcIncomeBillFee selectByFeeId(Long feeId);
public PrcIncomeBillFee selectByFeeId(String feeId);
/** 按唯一键 uk_bill_fee_item(bill_id、fee_type、sc_id)查询。 */
public PrcIncomeBillFee selectByBillIdAndFeeTypeAndScId(@Param("billId") Long billId,
public PrcIncomeBillFee selectByBillIdAndFeeTypeAndScId(@Param("billId") String billId,
@Param("feeType") String feeType, @Param("scId") Long scId);
/** 统计某账单在指定 ar_bill_status 和 fee_type 下的费用数(例如 BILLED + BASIC_FREIGHT)。 */
public int countByBillIdAndArBillStatusAndFeeType(@Param("billId") Long billId,
public int countByBillIdAndArBillStatusAndFeeType(@Param("billId") String billId,
@Param("arBillStatus") String arBillStatus, @Param("feeType") String feeType);
public int insertPrcIncomeBillFee(PrcIncomeBillFee fee);
@@ -31,23 +31,23 @@ public interface PrcIncomeBillFeeMapper
public int updatePrcIncomeBillFee(PrcIncomeBillFee fee);
public int updateArBillStatusByBillIds(@Param("billIds") List<Long> billIds,
public int updateArBillStatusByBillIds(@Param("billIds") List<String> billIds,
@Param("fromStatus") String fromStatus, @Param("toStatus") String toStatus);
/** 按费用明细 ID 精确更新状态,避免误更新同一订单的历史费用。 */
public int updateArBillStatusByFeeIds(@Param("feeIds") List<Long> feeIds,
public int updateArBillStatusByFeeIds(@Param("feeIds") List<String> feeIds,
@Param("fromStatus") String fromStatus, @Param("toStatus") String toStatus);
/** 作废或失败清理后,仅在不存在其他有效账单关联时恢复为未出账。 */
public int restoreUnbilledIfNoActiveArBill(@Param("feeIds") List<Long> feeIds);
public int restoreUnbilledIfNoActiveArBill(@Param("feeIds") List<String> feeIds);
/** 按应收账单批量恢复其关联费用,避免大账单组装超大的费用 ID 列表。 */
public int restoreUnbilledIfNoActiveArBillByArBillId(@Param("arBillId") Long arBillId);
public int deleteByFeeId(Long feeId);
public int deleteByFeeId(String feeId);
public int deleteByBillId(Long billId);
public int deleteByBillId(String billId);
/** 重新出账:只删除自动费用;保留 manual_flag=1 的行。 */
public int deleteAutoFeesByBillId(Long billId);
public int deleteAutoFeesByBillId(String billId);
}
@@ -7,11 +7,11 @@ import org.apache.ibatis.annotations.Param;
/** 应收账单 prc_income_bill 的 mapper */
public interface PrcIncomeBillMapper
{
PrcIncomeBill selectByBillId(Long billId);
PrcIncomeBill selectByBillId(String billId);
List<PrcIncomeBill> selectByBillIds(@Param("billIds") List<Long> billIds);
List<PrcIncomeBill> selectByBillIds(@Param("billIds") List<String> billIds);
PrcIncomeBill selectByIncomeBillId(Long incomeBillId);
PrcIncomeBill selectByIncomeBillId(String incomeBillId);
int insertPrcIncomeBill(PrcIncomeBill row);
@@ -19,5 +19,5 @@ public interface PrcIncomeBillMapper
int upsertPrcIncomeBill(PrcIncomeBill row);
int deleteByBillId(Long billId);
int deleteByBillId(String billId);
}
@@ -5,7 +5,7 @@ import com.bms.price.domain.PrcOrderBillExt;
/** 订单账单扩展 prc_order_bill_ext 的 mapper */
public interface PrcOrderBillExtMapper
{
public PrcOrderBillExt selectByBillId(Long billId);
public PrcOrderBillExt selectByBillId(String billId);
public PrcOrderBillExt selectByOrderNo(String orderNo);
@@ -17,12 +17,12 @@ public interface PrcOrderBillMapper
/** TMS 状态查询:按订单号、运单号或转单号精确匹配,最多返回两条用于识别歧义。 */
List<PrcOrderBill> selectPrcOrderBillByTmsIdentifier(@Param("identifier") String identifier);
public PrcOrderBill selectPrcOrderBillById(Long billId);
public PrcOrderBill selectPrcOrderBillById(String billId);
public List<PrcOrderBill> selectPrcOrderBillList(PrcOrderBill bill);
/** 只取 bill_id(筛选条件/数据权限与列表一致),用于本地大批量重新出账。 */
List<Long> selectPrcOrderBillIds(PrcOrderBill bill);
List<String> selectPrcOrderBillIds(PrcOrderBill bill);
/** 统计匹配的账单数(筛选条件/数据权限与列表一致)。 */
int countPrcOrderBillIds(PrcOrderBill bill);
@@ -65,7 +65,7 @@ public interface PrcOrderBillMapper
@Param("excludeOrderIdentifiers") List<String> excludeOrderIdentifiers,
@Param("cutoffDate") Date cutoffDate, @Param("dateType") String dateType, @Param("currency") String currency,
@Param("arBillStatuses") List<String> arBillStatuses, @Param("feeArBillStatus") String feeArBillStatus,
@Param("excludedBillIds") List<Long> excludedBillIds);
@Param("excludedBillIds") List<String> excludedBillIds);
/** 统计应收账单预览结果金额,供全选模式展示。 */
BigDecimal sumPrcOrderBillIncomeByCustomerPeriod(@Param("customerId") Long customerId,
@@ -80,8 +80,8 @@ public interface PrcOrderBillMapper
@Param("cutoffDate") Date cutoffDate, @Param("dateType") String dateType, @Param("currency") String currency,
@Param("arBillStatuses") List<String> arBillStatuses, @Param("feeArBillStatus") String feeArBillStatus,
@Param("snapshotCreateTime") Date snapshotCreateTime,
@Param("lastSourceBillId") Long lastSourceBillId, @Param("billIds") List<Long> billIds,
@Param("excludedBillIds") List<Long> excludedBillIds,
@Param("lastSourceBillId") String lastSourceBillId, @Param("billIds") List<String> billIds,
@Param("excludedBillIds") List<String> excludedBillIds,
@Param("excludedOrderIdentifiers") List<String> excludedOrderIdentifiers, @Param("limit") int limit);
int countPrcOrderBillByCustomerPeriod(@Param("customerId") Long customerId,
@@ -89,29 +89,29 @@ public interface PrcOrderBillMapper
@Param("cutoffDate") Date cutoffDate, @Param("dateType") String dateType, @Param("currency") String currency,
@Param("arBillStatuses") List<String> arBillStatuses, @Param("feeArBillStatus") String feeArBillStatus,
@Param("snapshotCreateTime") Date snapshotCreateTime,
@Param("billIds") List<Long> billIds, @Param("excludedBillIds") List<Long> excludedBillIds,
@Param("billIds") List<String> billIds, @Param("excludedBillIds") List<String> excludedBillIds,
@Param("excludedOrderIdentifiers") List<String> excludedOrderIdentifiers);
/** 按生成账单时用户勾选的订单读取,并再次校验账单筛选条件。 */
public List<PrcOrderBill> selectPrcOrderBillByCustomerCutoffAndIds(@Param("customerId") Long customerId,
@Param("customerCode") String customerCode, @Param("orderIdentifiers") List<String> orderIdentifiers,
@Param("cutoffDate") Date cutoffDate, @Param("dateType") String dateType,
@Param("currency") String currency, @Param("billIds") List<Long> billIds,
@Param("currency") String currency, @Param("billIds") List<String> billIds,
@Param("arBillStatuses") List<String> arBillStatuses, @Param("feeArBillStatus") String feeArBillStatus);
/** 原子占用订单,防止同一订单被并发生成到多张应收账单。 */
public int claimArBillOrders(@Param("billIds") List<Long> billIds, @Param("operator") String operator,
public int claimArBillOrders(@Param("billIds") List<String> billIds, @Param("operator") String operator,
@Param("arBillStatuses") List<String> arBillStatuses, @Param("toStatus") String toStatus);
/** 作废账单后释放订单,允许后续重新生成新版本账单。 */
public int releaseArBillOrders(@Param("billIds") List<Long> billIds, @Param("operator") String operator,
public int releaseArBillOrders(@Param("billIds") List<String> billIds, @Param("operator") String operator,
@Param("fromStatus") String fromStatus, @Param("toStatus") String toStatus);
int releaseArBillOrdersByArBillId(@Param("arBillId") Long arBillId, @Param("operator") String operator,
@Param("fromStatus") String fromStatus, @Param("toStatus") String toStatus);
/** 根据费用明细状态及无费用失败订单的有效账单快照汇总订单出账状态。 */
int refreshArBillStatusByBillIds(@Param("billIds") List<Long> billIds);
int refreshArBillStatusByBillIds(@Param("billIds") List<String> billIds);
/** 清理或作废时批量释放来源订单;无费用失败订单的占用判断排除当前账单。 */
int refreshArBillStatusByArBillId(@Param("arBillId") Long arBillId);
@@ -126,20 +126,20 @@ public interface PrcOrderBillMapper
@Param("creditArrearsStatus") String creditArrearsStatus);
/** 更新订单额度欠费状态 */
int updateCreditArrearsStatus(@Param("billId") Long billId,
int updateCreditArrearsStatus(@Param("billId") String billId,
@Param("creditArrearsStatus") String creditArrearsStatus,
@Param("updateBy") String updateBy);
public int updateOrderBillAmounts(@Param("billId") Long billId,
public int updateOrderBillAmounts(@Param("billId") String billId,
@Param("surchargeAmount") BigDecimal surchargeAmount,
@Param("incomeTotal") BigDecimal incomeTotal,
@Param("payTotal") BigDecimal payTotal);
/** 只更新应付合计,不改应收。 */
int updatePayTotal(@Param("billId") Long billId, @Param("payTotal") BigDecimal payTotal);
int updatePayTotal(@Param("billId") String billId, @Param("payTotal") BigDecimal payTotal);
/** 按未删除应付明细合计回写订单上的应付总额。单次不超过 1000 个订单。 */
int refreshPayTotalFromFees(@Param("billIds") List<Long> billIds);
int refreshPayTotalFromFees(@Param("billIds") List<String> billIds);
/** 统计引用该销售套餐版本的订单账单数。 */
int countByPsvId(@Param("psvId") Long psvId);
@@ -13,7 +13,7 @@ public interface PrcPayBillFeeMapper
* @param billId 计费订单ID
* @return 费用明细
*/
public List<PrcPayBillFee> selectByBillId(Long billId);
public List<PrcPayBillFee> selectByBillId(String billId);
/**
* 插入一条订单应付费用。
@@ -32,7 +32,7 @@ public interface PrcPayBillFeeMapper
public int insertBatch(@Param("list") List<PrcPayBillFee> fees);
/** 把还没标明来源的费用,关联到本行主键 id。 */
public int fillSourceIdByFeeIds(@Param("feeIds") List<Long> feeIds);
public int fillSourceIdByFeeIds(@Param("feeIds") List<String> feeIds);
/**
* 删除一票订单上来源为计算的费用。提单分摊和人工费用保留。
@@ -40,7 +40,7 @@ public interface PrcPayBillFeeMapper
* @param billId 计费订单ID
* @return 影响行数
*/
public int deleteByBillId(Long billId);
public int deleteByBillId(String billId);
/**
* 逻辑删除某一条提单费用分摊到订单上的明细。
@@ -51,10 +51,10 @@ public interface PrcPayBillFeeMapper
public int markLadingFeeDeleted(@Param("feeId") Long feeId);
/** 这条提单费用已经分摊到的订单。作废前取出,用来重算应付总额。 */
public List<Long> selectBillIdsByLadingFee(@Param("feeId") Long feeId);
public List<String> selectBillIdsByLadingFee(@Param("feeId") Long feeId);
/** 明细还没挂上应付主表时,按订单补上主表 ID。单次不超过 1000 个订单。 */
public int bindPayBillId(@Param("billIds") List<Long> billIds);
public int bindPayBillId(@Param("billIds") List<String> billIds);
/**
* 这条提单费用分摊到的订单里,取一个已经生成应付账单的订单号。
@@ -13,7 +13,7 @@ public interface PrcPayBillMapper
* @param billId 计费订单ID
* @return 订单应付,没有时为 null
*/
PrcPayBill selectByBillId(Long billId);
PrcPayBill selectByBillId(String billId);
/**
* 按应付主表ID读取。
@@ -21,7 +21,7 @@ public interface PrcPayBillMapper
* @param payBillId 订单应付ID
* @return 订单应付,没有时为 null
*/
PrcPayBill selectByPayBillId(Long payBillId);
PrcPayBill selectByPayBillId(String payBillId);
/**
* 新增一票订单的应付主表。
@@ -53,7 +53,7 @@ public interface PrcPayBillMapper
* @param billId 计费订单ID
* @return 影响行数
*/
int deleteByBillId(Long billId);
int deleteByBillId(String billId);
/**
* 按未删除的应付明细合计,回写这些订单的应付总额。
@@ -61,8 +61,8 @@ public interface PrcPayBillMapper
* @param billIds 计费订单 ID,单次不超过 1000 个
* @return 影响行数
*/
int refreshPayTotal(@Param("billIds") List<Long> billIds);
int refreshPayTotal(@Param("billIds") List<String> billIds);
/** 订单还没有应付主表时补一行,总额随后按明细重算。单次不超过 1000 个订单。 */
int insertMissingPayBills(@Param("billIds") List<Long> billIds, @Param("operator") String operator);
int insertMissingPayBills(@Param("billIds") List<String> billIds, @Param("operator") String operator);
}
@@ -34,7 +34,7 @@ public interface SrvBillAirAllocMapper
* @param billIds 计费订单 ID
* @return 应付主表编号
*/
List<PrcPayBill> selectPayBills(@Param("billIds") List<Long> billIds);
List<PrcPayBill> selectPayBills(@Param("billIds") List<String> billIds);
/**
* 把仍是未分摊的费用改为已分摊。已经不是未分摊的行不会被改到。
@@ -24,10 +24,10 @@ public class PaySettleSupport
* @param billId 计费订单ID
* @param cardName 价卡归属名称
*/
public void stampCalc(Long billId, String cardName)
public void stampCalc(String billId, String cardName)
{
BmsSupplier supplier = match(cardName);
if (supplier == null || billId == null)
if (supplier == null || billId == null || billId.isBlank())
{
return;
}
@@ -13,7 +13,7 @@ public interface IPayOrderCostService
* @param billId 计费订单ID,对应 prc_order_bill.bill_id
* @return 本次算出的产品、版本、币种和费用明细
*/
PayOrderCostResult generate(Long billId);
PayOrderCostResult generate(String billId);
/**
* 单独提交一票尾程。失败时只回滚这一票,不影响外面的对账单事务。
@@ -21,7 +21,7 @@ public interface IPayOrderCostService
* @param billId 计费订单ID
* @return 本次算出的产品、版本、币种和费用明细
*/
PayOrderCostResult generateIsolated(Long billId);
PayOrderCostResult generateIsolated(String billId);
/**
* 这票订单当前尾程价卡上的归属供应商名称。没有价卡时返回空字符串。
@@ -29,5 +29,5 @@ public interface IPayOrderCostService
* @param billId 计费订单ID
* @return 价卡归属名称
*/
String cardSupplierName(Long billId);
String cardSupplierName(String billId);
}
@@ -33,7 +33,7 @@ public interface IPrcOrderBillService
* @param upstreamRow Oracle TAB_ORDER 整行数据
* @return billId
*/
Long syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow);
String syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow);
/**
* 计费无法生成报价时,仍然落库 prc_order_bill 及其扩展表。
@@ -59,10 +59,10 @@ public interface IPrcOrderBillService
/** 转单号下拉搜索选项(模糊匹配,去重限量,带数据权限) */
List<String> listTransferNoOptions(PrcOrderBill query);
TmsPriceQuoteResult getBill(Long billId);
TmsPriceQuoteResult getBill(String billId);
/** 订单列表弹窗使用的计费失败原因(带数据权限)。 */
OrderBillFailReasonVo getBillingFailReason(Long billId);
OrderBillFailReasonVo getBillingFailReason(String billId);
TmsPriceQuoteResult getBillByOrderNo(String orderNo);
@@ -73,7 +73,7 @@ public interface IPrcOrderBillService
TmsPriceQuoteResult updateIncomeFee(UpdateIncomeBillFeeRequest request);
/** 删除手工录入的 UNBILLED 收入费用;同时刷新应收合计。 */
TmsPriceQuoteResult deleteIncomeFee(Long feeId);
TmsPriceQuoteResult deleteIncomeFee(String feeId);
/** 预览批量添加费用命中的账单(带数据权限)。 */
BatchAddIncomeBillFeePreview previewBatchAddIncomeFee(BatchAddIncomeBillFeeRequest request);
@@ -103,7 +103,7 @@ public interface IPrcOrderBillService
* @param billId 订单计费ID
* @return 更新后的计费结果
*/
TmsPriceQuoteResult updateCreditArrearsStatus(Long billId);
TmsPriceQuoteResult updateCreditArrearsStatus(String billId);
/**
* 更新 charge_weight(手工覆盖),保留原重量,并重新计费。
@@ -112,12 +112,12 @@ public interface IPrcOrderBillService
* @param billId 账单 ID
* @param chargeWeight 新的计费重量(kg)
*/
TmsPriceQuoteResult updateChargeWeight(Long billId, BigDecimal chargeWeight);
TmsPriceQuoteResult updateChargeWeight(String billId, BigDecimal chargeWeight);
/**
* 更新 charge_weight,不做数据权限校验(供已校验的异步导入使用)。
*/
TmsPriceQuoteResult updateChargeWeightByBillId(Long billId, BigDecimal chargeWeight);
TmsPriceQuoteResult updateChargeWeightByBillId(String billId, BigDecimal chargeWeight);
/**
* 提交 charge_weight 更新的异步导入;返回 taskId。
@@ -151,7 +151,7 @@ public interface IPrcOrderBillService
* 按模式(PRODUCT/REDLINE)重算并落库 product_amount 或 redline_amount。
* 要求 prc_order_bill 已存在;跳过应收可编辑校验。
*/
void recalcBillPriceByBillId(Long billId, String mode);
void recalcBillPriceByBillId(String billId, String mode);
/**
* 仅基于本地 prc_order_bill 做完整重算(不调 Oracle 上游)。
@@ -159,7 +159,7 @@ public interface IPrcOrderBillService
* 若 prc_income_bill_fee 已有 fee_type=REFUND 则跳过,否则走 {@link #refund}。
* 其余情况用账单行重建请求后走 {@link #bill}。
*/
TmsPriceQuoteResult rebillLocalByBillId(Long billId);
TmsPriceQuoteResult rebillLocalByBillId(String billId);
/**
* 按选中的 billId 或列表筛选条件做异步本地重算。返回 taskId 用于进度轮询。
@@ -174,7 +174,7 @@ public interface IPrcOrderBillService
BatchAddIncomeBillFeeTask cancelLocalRebill(String taskId);
/** 本地重算用的带数据权限的 bill_id 列表(筛选条件与订单账单列表一致)。 */
List<Long> selectBillIdsForLocalRebill(PrcOrderBill query);
List<String> selectBillIdsForLocalRebill(PrcOrderBill query);
/** 本地重算的带数据权限的数量统计。 */
int countBillIdsForLocalRebill(PrcOrderBill query);
@@ -21,5 +21,5 @@ public interface IPrcPayBillFeeService
*
* @param billIds 计费订单 ID
*/
void refreshTotals(List<Long> billIds);
void refreshTotals(List<String> billIds);
}
@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
@@ -151,9 +152,9 @@ public class PayBillServiceImpl implements IPayBillService
throw new ServiceException(preview.getMissingNos().isEmpty() ? PaymentMesEnum.BMS_PAY_NO_GEN.getCnMes() : "订单号没有对上:" + String.join("、", preview.getMissingNos()));
}
String currency = currencyOf(orders);
Map<Long, Integer> versions = new HashMap<>();
Map<String, Integer> versions = new HashMap<>();
List<String> skipped = new ArrayList<>();
List<Long> billIds = new ArrayList<>();
List<String> billIds = new ArrayList<>();
for (PayBillOrder order : orders)
{
billIds.add(order.getBillId());
@@ -227,7 +228,7 @@ public class PayBillServiceImpl implements IPayBillService
bill.setSourceType(mode(command));
bill.setPeriodStart(parseDay(command.getBeginDate()));
bill.setPeriodEnd(parseDay(command.getEndDate()));
Set<Long> orderIds = new HashSet<>();
Set<String> orderIds = new HashSet<>();
for (PayBillLine line : lines)
{
if (line.getOrderBillId() != null)
@@ -259,7 +260,7 @@ public class PayBillServiceImpl implements IPayBillService
{
line.setBillId(bill.getBillId());
payBillMapper.insertLine(line);
if (line.getFeeId() != null && payBillMapper.bindFeeLine(line.getFeeId(), line.getLineId()) != 1)
if (line.getFeeId() != null && !line.getFeeId().isBlank() && payBillMapper.bindFeeLine(line.getFeeId(), line.getLineId()) != 1)
{
throw PaymentMesEnum.BMS_PAY_FEE_TAKEN.exception();
}
@@ -573,6 +574,7 @@ public class PayBillServiceImpl implements IPayBillService
}
}
PrcPayBillFee adjust = new PrcPayBillFee();
adjust.setFeeId(UUID.randomUUID().toString());
adjust.setBillId(line.getOrderBillId());
adjust.setPayBillId(source == null ? null : source.getPayBillId());
adjust.setFeeType("对账调整");
@@ -582,7 +584,7 @@ public class PayBillServiceImpl implements IPayBillService
adjust.setAmount(delta);
adjust.setCurrency(line.getCurrency());
adjust.setFeeSource("MANUAL");
adjust.setSourceId(source != null && source.getFeeId() != null ? String.valueOf(source.getFeeId()) : null);
adjust.setSourceId(source != null && source.getId() != null ? String.valueOf(source.getId()) : null);
adjust.setRemark(open.getReason());
adjust.setSettleSupplierId(bill.getSupplierId());
adjust.setSettleSupplierName(bill.getSupplierName());
@@ -945,7 +947,7 @@ public class PayBillServiceImpl implements IPayBillService
* @param billId 计费订单ID
* @return 订单;对不上时返回 null
*/
private PayBillOrder findOrder(List<PayBillOrder> orders, Long billId)
private PayBillOrder findOrder(List<PayBillOrder> orders, String billId)
{
for (PayBillOrder order : orders)
{
@@ -1109,11 +1111,11 @@ public class PayBillServiceImpl implements IPayBillService
{
List<PrcPayBillFee> kept = new ArrayList<>();
Set<String> notes = new LinkedHashSet<>();
Map<Long, String> cards = new HashMap<>();
Map<String, String> cards = new HashMap<>();
for (PrcPayBillFee fee : fees)
{
PayBillOrder order = findOrder(orders, fee.getBillId());
String orderNo = order == null || order.getOrderNo() == null ? String.valueOf(fee.getBillId()) : order.getOrderNo();
String orderNo = order == null || order.getOrderNo() == null ? fee.getBillId() : order.getOrderNo();
String why = partyReason(fee, order, supplier, cards);
if (why == null)
{
@@ -1129,7 +1131,7 @@ public class PayBillServiceImpl implements IPayBillService
return kept;
}
private String partyReason(PrcPayBillFee fee, PayBillOrder order, BmsSupplier supplier, Map<Long, String> cards)
private String partyReason(PrcPayBillFee fee, PayBillOrder order, BmsSupplier supplier, Map<String, String> cards)
{
if (fee.getSettleSupplierId() != null)
{
@@ -1265,7 +1267,7 @@ public class PayBillServiceImpl implements IPayBillService
List<PayBillLine> lines = payBillMapper.selectLines(billId);
BigDecimal total = BigDecimal.ZERO;
BigDecimal supplier = BigDecimal.ZERO;
Set<Long> orders = new HashSet<>();
Set<String> orders = new HashSet<>();
for (PayBillLine line : lines)
{
BigDecimal amount = line.getAmount() == null ? BigDecimal.ZERO : line.getAmount();
@@ -84,20 +84,20 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public PayOrderCostResult generateIsolated(Long billId)
public PayOrderCostResult generateIsolated(String billId)
{
return generate(billId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public PayOrderCostResult generate(Long billId)
public PayOrderCostResult generate(String billId)
{
if (billId == null)
if (billId == null || billId.isBlank())
{
throw PaymentMesEnum.BMS_PAY_PICK_ORDER.exception();
}
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill == null)
{
throw PaymentMesEnum.BMS_PAY_ORDER_MISS.exception();
@@ -142,15 +142,15 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
}
@Override
public String cardSupplierName(Long billId)
public String cardSupplierName(String billId)
{
if (billId == null)
if (billId == null || billId.isBlank())
{
return "";
}
try
{
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill == null)
{
return "";
@@ -555,6 +555,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
PrcPayBill row = existed == null ? new PrcPayBill() : existed;
if (existed == null)
{
row.setPayBillId(UUID.randomUUID().toString());
row.setBillId(bill.getBillId());
row.setCreateBy(operator);
}
@@ -584,7 +585,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
* @param payBillId 订单应付主表ID
* @param fees 本次算出的费用
*/
private void saveFees(Long billId, Long payBillId, List<PayCostLine> fees)
private void saveFees(String billId, String payBillId, List<PayCostLine> fees)
{
payBillFeeMapper.deleteByBillId(billId);
List<PrcPayBillFee> rows = new java.util.ArrayList<>();
@@ -592,6 +593,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
for (PayCostLine fee : fees)
{
PrcPayBillFee row = new PrcPayBillFee();
row.setFeeId(UUID.randomUUID().toString());
row.setBillId(billId);
row.setPayBillId(payBillId);
row.setFeeType(fee.getFeeType());
@@ -635,7 +635,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
{
bill = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo.trim());
}
if (bill == null && task.getBillId() != null)
if (bill == null && StringUtils.isNotEmpty(task.getBillId()))
{
bill = orderBillMapper.selectPrcOrderBillById(task.getBillId());
}
@@ -645,7 +645,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
}
}
private void writeback(PrcBillingTask task, BillTaskSuccessStatus status, Long billId,
private void writeback(PrcBillingTask task, BillTaskSuccessStatus status, String billId,
String errorMessage, String failCode)
{
PrcBillingTask upd = new PrcBillingTask();
@@ -12,6 +12,7 @@ import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
@@ -296,6 +297,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
}
PrcIncomeBillFee refundFee = new PrcIncomeBillFee();
refundFee.setFeeId(UUID.randomUUID().toString());
refundFee.setBillId(bill.getBillId());
refundFee.setIncomeBillId(incomeBill == null ? null : incomeBill.getIncomeBillId());
String refundFeeType = FEE_TYPE_REFUND;
@@ -421,19 +423,6 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return cleaned.isEmpty() ? null : cleaned;
}
/** 账单ID去空去重。 */
private List<Long> normalizeIdList(List<Long> ids)
{
if (ids == null || ids.isEmpty())
{
return null;
}
List<Long> cleaned = ids.stream().filter(java.util.Objects::nonNull).distinct()
.collect(Collectors.toList());
return cleaned.isEmpty() ? null : cleaned;
}
/** 单号筛选按去重后的订单号/运单号/转单号数量限制,避免过大的 IN 参数。 */
private List<String> normalizeOrderIdentifiers(List<String> identifiers)
{
@@ -446,14 +435,14 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
}
@Override
public TmsPriceQuoteResult getBill(Long billId)
public TmsPriceQuoteResult getBill(String billId)
{
if (billId == null)
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
PrcOrderBill query = new PrcOrderBill();
query.setBillId(billId);
query.setBillId(billId.trim());
// 走 selectBillList,复用销售员/结算员数据权限,避免越权查详情
List<PrcOrderBill> list = self.selectBillList(query);
if (list == null || list.isEmpty())
@@ -467,14 +456,14 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Override
public OrderBillFailReasonVo getBillingFailReason(Long billId)
public OrderBillFailReasonVo getBillingFailReason(String billId)
{
if (billId == null)
if (StringUtils.isEmpty(billId))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
PrcOrderBill query = new PrcOrderBill();
query.setBillId(billId);
query.setBillId(billId.trim());
List<PrcOrderBill> list = self.selectBillList(query);
if (list == null || list.isEmpty())
{
@@ -698,7 +687,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult addIncomeFee(AddIncomeBillFeeRequest request)
{
if (request == null || request.getBillId() == null)
if (request == null || StringUtils.isEmpty(request.getBillId()))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
@@ -706,7 +695,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
{
throw new ServiceException(MessageUtils.message("price.bill.fee.scIdRequired"));
}
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(request.getBillId());
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(request.getBillId().trim());
if (bill == null)
{
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
@@ -745,7 +734,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
: surcharge.getRoundMode());
existing.setRemark(request.getRemark());
existing.setManualFlag("1");
if (incomeBill != null && existing.getIncomeBillId() == null)
if (incomeBill != null && StringUtils.isEmpty(existing.getIncomeBillId()))
{
existing.setIncomeBillId(incomeBill.getIncomeBillId());
}
@@ -754,6 +743,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
else
{
PrcIncomeBillFee fee = new PrcIncomeBillFee();
fee.setFeeId(UUID.randomUUID().toString());
fee.setBillId(bill.getBillId());
fee.setIncomeBillId(incomeBill == null ? null : incomeBill.getIncomeBillId());
fee.setFeeType(feeType);
@@ -776,11 +766,11 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult updateIncomeFee(UpdateIncomeBillFeeRequest request)
{
if (request == null || request.getFeeId() == null)
if (request == null || StringUtils.isEmpty(request.getFeeId()))
{
throw new ServiceException(MessageUtils.message("price.bill.fee.idRequired"));
}
PrcIncomeBillFee fee = requireEditableManualFee(request.getFeeId());
PrcIncomeBillFee fee = requireEditableManualFee(request.getFeeId().trim());
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(fee.getBillId());
if (bill == null)
{
@@ -823,13 +813,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Override
@Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult deleteIncomeFee(Long feeId)
public TmsPriceQuoteResult deleteIncomeFee(String feeId)
{
if (feeId == null)
if (StringUtils.isEmpty(feeId))
{
throw new ServiceException(MessageUtils.message("price.bill.fee.idRequired"));
}
PrcIncomeBillFee fee = requireEditableManualFee(feeId);
PrcIncomeBillFee fee = requireEditableManualFee(feeId.trim());
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(fee.getBillId());
if (bill == null)
{
@@ -868,10 +858,10 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
throw new ServiceException(MessageUtils.message("price.bill.fee.batch.tooMany",
Integer.valueOf(BATCH_ADD_FEE_MAX)));
}
List<Long> billIds = new ArrayList<Long>();
List<String> billIds = new ArrayList<String>();
for (PrcOrderBill bill : bills)
{
if (bill != null && bill.getBillId() != null)
if (bill != null && StringUtils.isNotEmpty(bill.getBillId()))
{
billIds.add(bill.getBillId());
}
@@ -923,10 +913,10 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
throw new ServiceException(MessageUtils.message("price.bill.recalc.tooMany",
Integer.valueOf(RECALC_PRICE_MAX)));
}
List<Long> billIds = new ArrayList<Long>();
List<String> billIds = new ArrayList<String>();
for (PrcOrderBill bill : bills)
{
if (bill != null && bill.getBillId() != null)
if (bill != null && StringUtils.isNotEmpty(bill.getBillId()))
{
billIds.add(bill.getBillId());
}
@@ -954,14 +944,14 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Override
@Transactional(rollbackFor = Exception.class)
public void recalcBillPriceByBillId(Long billId, String mode)
public void recalcBillPriceByBillId(String billId, String mode)
{
boolean productMode = "PRODUCT".equals(normalizeRecalcMode(mode));
if (billId == null)
if (StringUtils.isEmpty(billId))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill == null)
{
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
@@ -990,13 +980,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
* 其他情况走正常的 {@link #bill}。
*/
@Override
public TmsPriceQuoteResult rebillLocalByBillId(Long billId)
public TmsPriceQuoteResult rebillLocalByBillId(String billId)
{
if (billId == null)
if (StringUtils.isEmpty(billId))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill == null)
{
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
@@ -1022,7 +1012,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return refundLocalWithDbRetry(bill.getOrderNo().trim());
}
TmsPriceBillRequest req = buildBillRequestFromBill(bill);
return billLocalWithDbRetry(billId, req);
return billLocalWithDbRetry(billId.trim(), req);
}
/** order_status 为 9/10 或 refund_status=REFUNDED。 */
@@ -1039,9 +1029,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return BillRefundStatus.REFUNDED.getCode().equalsIgnoreCase(bill.getRefundStatus());
}
private boolean hasRefundFeeLine(Long billId)
private boolean hasRefundFeeLine(String billId)
{
if (billId == null)
if (StringUtils.isEmpty(billId))
{
return false;
}
@@ -1060,7 +1050,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return false;
}
private TmsPriceQuoteResult billLocalWithDbRetry(Long billId, TmsPriceBillRequest billReq)
private TmsPriceQuoteResult billLocalWithDbRetry(String billId, TmsPriceBillRequest billReq)
{
RuntimeException last = null;
for (int attempt = 1; attempt <= LOCAL_REBILL_DB_RETRY_MAX; attempt++)
@@ -1180,7 +1170,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
Integer.valueOf(LOCAL_REBILL_MAX)));
}
// 仅取 ID:大数据量任务避免加载完整的 prc_order_bill 行。
List<Long> billIds = self.selectBillIdsForLocalRebill(query);
List<String> billIds = self.selectBillIdsForLocalRebill(query);
if (billIds == null || billIds.isEmpty())
{
throw new ServiceException(MessageUtils.message("price.bill.recalc.noMatch"));
@@ -1302,15 +1292,15 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Override
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "su", userField = "user_id", permission = "price:billing:bill")
public List<Long> selectBillIdsForLocalRebill(PrcOrderBill query)
public List<String> selectBillIdsForLocalRebill(PrcOrderBill query)
{
if (query == null)
{
return new ArrayList<Long>();
return new ArrayList<String>();
}
normalizeLocalRebillQuery(query);
List<Long> ids = orderBillMapper.selectPrcOrderBillIds(query);
return ids == null ? new ArrayList<Long>() : ids;
List<String> ids = orderBillMapper.selectPrcOrderBillIds(query);
return ids == null ? new ArrayList<String>() : ids;
}
@Override
@@ -1331,7 +1321,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
PrcOrderBill query = new PrcOrderBill();
if ("SELECTED".equals(scopeMode))
{
List<Long> billIds = normalizeIdList(request.getBillIds());
List<String> billIds = normalizeCodeList(request.getBillIds());
if (billIds == null || billIds.isEmpty())
{
throw new ServiceException(MessageUtils.message("price.bill.recalc.selectedRequired"));
@@ -1410,7 +1400,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
query.setTrackingNos(normalizeCodeList(query.getTrackingNos()));
query.setTransferNos(normalizeCodeList(query.getTransferNos()));
query.setOrderIdentifiers(normalizeOrderIdentifiers(query.getOrderIdentifiers()));
query.setBillIds(normalizeIdList(query.getBillIds()));
query.setBillIds(normalizeCodeList(query.getBillIds()));
}
private static String normalizeRecalcMode(String mode)
@@ -1431,6 +1421,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
if (insert)
{
incomeBill = new PrcIncomeBill();
incomeBill.setIncomeBillId(UUID.randomUUID().toString());
incomeBill.setBillId(bill.getBillId());
incomeBill.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
incomeBill.setSalesAmount(nz(bill.getIncomeTotal()));
@@ -1516,7 +1507,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
* scopeMode:SELECTED 使用 billIds;ALL 使用筛选条件(至少需要一个)。
* 仅传 orderStatuses 不算有效筛选(与导出规则一致)。
*/
private List<PrcOrderBill> resolveListScopedBills(String scopeModeRaw, List<Long> billIdsRaw,
private List<PrcOrderBill> resolveListScopedBills(String scopeModeRaw, List<String> billIdsRaw,
List<String> orderNosRaw, List<String> trackingNosRaw, List<String> transferNosRaw, List<String> orderIdentifiersRaw,
List<String> customerCodesRaw, List<String> productCodesRaw, String countryCodeRaw,
String creditArrearsStatusRaw, List<Integer> orderStatusesRaw, List<Integer> billingFailStatusesRaw,
@@ -1565,7 +1556,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
PrcOrderBill query = new PrcOrderBill();
if ("SELECTED".equals(scopeMode))
{
List<Long> billIds = normalizeIdList(billIdsRaw);
List<String> billIds = normalizeCodeList(billIdsRaw);
if (billIds == null || billIds.isEmpty())
{
throw new ServiceException(MessageUtils.message(msgSelected));
@@ -1633,7 +1624,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return surcharge;
}
private PrcIncomeBillFee requireEditableManualFee(Long feeId)
private PrcIncomeBillFee requireEditableManualFee(String feeId)
{
PrcIncomeBillFee fee = incomeBillFeeMapper.selectByFeeId(feeId);
if (fee == null)
@@ -1841,13 +1832,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
*/
@Override
@Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult updateCreditArrearsStatus(Long billId)
public TmsPriceQuoteResult updateCreditArrearsStatus(String billId)
{
if (billId == null)
if (StringUtils.isEmpty(billId))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill == null)
{
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
@@ -2008,6 +1999,10 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
assertOrderBillEditable(existed);
BigDecimal previousIncome = existed == null ? BigDecimal.ZERO : nz(existed.getIncomeTotal());
PrcOrderBill bill = existed == null ? new PrcOrderBill() : existed;
if (existed == null)
{
bill.setBillId(UUID.randomUUID().toString());
}
bill.setBillKey(billKey);
bill.setOrderNo(orderNo);
// 上游表头覆盖(不做校验)。
@@ -2145,6 +2140,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
{
bill.setRefundStatus(BillRefundStatus.NONE.getCode());
}
result.setBillId(bill.getBillId());
result.setOrderNo(orderNo);
result.setTransferNo(bill.getTransferNo());
result.setCustomerId(bill.getCustomerId());
@@ -2179,7 +2175,6 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
// 应付暂不在范围内:跳过 prc_pay_bill_fee 的清理/写入。
// payBillFeeMapper.deleteByBillId(bill.getBillId());
}
result.setBillId(bill.getBillId());
PrcIncomeBill incomeBill = null;
if (storeIncome)
{
@@ -2241,9 +2236,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
* 丢弃在 uk_bill_fee_item(bill_id, fee_type, sc_id)上与保留的人工行冲突的自动费用行。
* 重算时以人工费用优先。
*/
private List<PrcIncomeBillFee> filterAutoFeesAgainstManual(Long billId, List<PrcIncomeBillFee> autoFees)
private List<PrcIncomeBillFee> filterAutoFeesAgainstManual(String billId, List<PrcIncomeBillFee> autoFees)
{
if (autoFees == null || autoFees.isEmpty() || billId == null)
if (autoFees == null || autoFees.isEmpty() || StringUtils.isEmpty(billId))
{
return autoFees == null ? new ArrayList<PrcIncomeBillFee>() : autoFees;
}
@@ -2444,7 +2439,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
private boolean isAlreadyInArBill(PrcOrderBill existed)
{
if (existed == null || existed.getBillId() == null)
if (existed == null || StringUtils.isEmpty(existed.getBillId()))
{
return false;
}
@@ -2467,7 +2462,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return v == null ? BigDecimal.ZERO : v;
}
private List<PrcIncomeBillFee> toFeeRows(Long billId, Long incomeBillId, TmsPriceQuoteResult result)
private List<PrcIncomeBillFee> toFeeRows(String billId, String incomeBillId, TmsPriceQuoteResult result)
{
List<PrcIncomeBillFee> fees = new ArrayList<PrcIncomeBillFee>();
if (result.getFeeDetails() == null)
@@ -2477,6 +2472,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
for (TmsPriceQuoteFeeLine line : result.getFeeDetails())
{
PrcIncomeBillFee fee = new PrcIncomeBillFee();
fee.setFeeId(UUID.randomUUID().toString());
fee.setBillId(billId);
fee.setIncomeBillId(incomeBillId);
fee.setFeeType(line.getFeeType());
@@ -2498,7 +2494,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
/** 应收主表与订单计费一对一落库;销售价=套餐计费,产品价=产品目录价,红线价=红线目录价(含 REDLINE 附加费)。 */
private PrcIncomeBill persistIncomeBill(PrcOrderBill bill, TmsPriceQuoteResult result)
{
if (bill == null || bill.getBillId() == null)
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
{
return null;
}
@@ -2507,6 +2503,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
PrcIncomeBill row = existed == null ? new PrcIncomeBill() : existed;
if (existed == null)
{
row.setIncomeBillId(UUID.randomUUID().toString());
row.setBillId(bill.getBillId());
row.setCreateBy(bill.getCreateBy());
}
@@ -2535,7 +2532,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
}
private List<PrcPayBillFee> toPayFeeRows(Long billId, Long payBillId, TmsPriceQuoteResult result)
private List<PrcPayBillFee> toPayFeeRows(String billId, String payBillId, TmsPriceQuoteResult result)
{
List<PrcPayBillFee> fees = new ArrayList<PrcPayBillFee>();
if (result.getPayFeeDetails() == null)
@@ -2545,6 +2542,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
for (TmsPriceQuoteFeeLine line : result.getPayFeeDetails())
{
PrcPayBillFee fee = new PrcPayBillFee();
fee.setFeeId(UUID.randomUUID().toString());
fee.setBillId(billId);
fee.setPayBillId(payBillId);
fee.setFeeType(line.getFeeType());
@@ -2562,7 +2560,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
/** 应付主表与订单计费一对一落库;product_amount 取产品目录价、redline_amount 取红线价;应付/成本价留空待接入真实成本源。 */
private PrcPayBill persistPayBill(PrcOrderBill bill, TmsPriceQuoteResult result)
{
if (bill == null || bill.getBillId() == null)
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
{
return null;
}
@@ -2570,6 +2568,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
PrcPayBill row = existed == null ? new PrcPayBill() : existed;
if (existed == null)
{
row.setPayBillId(UUID.randomUUID().toString());
row.setBillId(bill.getBillId());
row.setCreateBy(bill.getCreateBy());
}
@@ -2656,7 +2655,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
/** 仅在存在上游 TAB_ORDER 行时写入 prc_order_bill_ext。 */
private void persistBillExt(PrcOrderBill bill, java.util.Map<String, Object> upstreamRow)
{
if (bill == null || bill.getBillId() == null)
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
{
return;
}
@@ -2681,7 +2680,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
for (PrcIncomeBillFee fee : fees)
{
TmsPriceQuoteFeeLine line = new TmsPriceQuoteFeeLine();
line.setFeeId(fee.getFeeId() == null ? null : String.valueOf(fee.getFeeId()));
line.setFeeId(fee.getFeeId());
line.setFeeType(fee.getFeeType());
line.setFeeName(fee.getFeeName());
line.setScId(fee.getScId());
@@ -2793,26 +2792,26 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
@Override
@Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult updateChargeWeight(Long billId, BigDecimal chargeWeight)
public TmsPriceQuoteResult updateChargeWeight(String billId, BigDecimal chargeWeight)
{
if (billId == null)
if (StringUtils.isEmpty(billId))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
// 通过列表查询做数据范围校验
self.getBill(billId);
return self.updateChargeWeightByBillId(billId, chargeWeight);
self.getBill(billId.trim());
return self.updateChargeWeightByBillId(billId.trim(), chargeWeight);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult updateChargeWeightByBillId(Long billId, BigDecimal chargeWeight)
public TmsPriceQuoteResult updateChargeWeightByBillId(String billId, BigDecimal chargeWeight)
{
if (billId == null)
if (StringUtils.isEmpty(billId))
{
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
}
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill == null)
{
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
@@ -3059,7 +3058,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return rows;
}
private TmsPriceQuoteResult toResult(Long billId)
private TmsPriceQuoteResult toResult(String billId)
{
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
if (bill == null)
@@ -3221,7 +3220,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
{
return name;
}
if (bill.getBillId() == null || orderBillExtMapper == null)
if (StringUtils.isEmpty(bill.getBillId()) || orderBillExtMapper == null)
{
return StringUtils.isNotEmpty(name) ? name : null;
}
@@ -3265,7 +3264,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Long syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow)
public String syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow)
{
if (upstreamRow == null || upstreamRow.isEmpty())
{
@@ -3313,6 +3312,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
PrcOrderBill bill = creating ? new PrcOrderBill() : existed;
if (creating)
{
bill.setBillId(UUID.randomUUID().toString());
bill.setArBillStatus(ArOrderBillStatus.UNBILLED.getCode());
bill.setRefundStatus(BillRefundStatus.NONE.getCode());
// 仅订单来源同步:在报价/计费执行前标记为未计费。
@@ -3430,6 +3430,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
PrcOrderBill bill = existed == null ? new PrcOrderBill() : existed;
if (existed == null)
{
bill.setBillId(UUID.randomUUID().toString());
bill.setArBillStatus(ArOrderBillStatus.UNBILLED.getCode());
bill.setRefundStatus(BillRefundStatus.NONE.getCode());
}
@@ -38,15 +38,15 @@ public class PrcPayBillFeeServiceImpl implements IPrcPayBillFeeService
{
return;
}
LinkedHashSet<Long> billIds = new LinkedHashSet<>();
LinkedHashSet<String> billIds = new LinkedHashSet<>();
for (int from = 0; from < fees.size(); from += BATCH_SIZE)
{
List<PrcPayBillFee> chunk = fees.subList(from, Math.min(from + BATCH_SIZE, fees.size()));
payBillFeeMapper.insertBatch(chunk);
List<Long> ownIds = new ArrayList<>();
List<String> ownIds = new ArrayList<>();
for (PrcPayBillFee fee : chunk)
{
if (fee != null && fee.getFeeId() != null
if (fee != null && fee.getFeeId() != null && !fee.getFeeId().isBlank()
&& (fee.getSourceId() == null || fee.getSourceId().isBlank()))
{
ownIds.add(fee.getFeeId());
@@ -58,9 +58,9 @@ public class PrcPayBillFeeServiceImpl implements IPrcPayBillFeeService
}
for (PrcPayBillFee fee : chunk)
{
if (fee != null && fee.getBillId() != null)
if (fee != null && fee.getBillId() != null && !fee.getBillId().isBlank())
{
billIds.add(fee.getBillId());
billIds.add(fee.getBillId().trim());
}
}
}
@@ -68,25 +68,25 @@ public class PrcPayBillFeeServiceImpl implements IPrcPayBillFeeService
}
@Override
public void refreshTotals(List<Long> billIds)
public void refreshTotals(List<String> billIds)
{
if (billIds == null || billIds.isEmpty())
{
return;
}
LinkedHashSet<Long> unique = new LinkedHashSet<>();
for (Long billId : billIds)
LinkedHashSet<String> unique = new LinkedHashSet<>();
for (String billId : billIds)
{
if (billId != null)
if (billId != null && !billId.isBlank())
{
unique.add(billId);
unique.add(billId.trim());
}
}
List<Long> ids = new ArrayList<>(unique);
List<String> ids = new ArrayList<>(unique);
String operator = currentOperator();
for (int from = 0; from < ids.size(); from += BATCH_SIZE)
{
List<Long> chunk = ids.subList(from, Math.min(from + BATCH_SIZE, ids.size()));
List<String> chunk = ids.subList(from, Math.min(from + BATCH_SIZE, ids.size()));
payBillMapper.insertMissingPayBills(chunk, operator);
payBillFeeMapper.bindPayBillId(chunk);
payBillMapper.refreshPayTotal(chunk);
@@ -8,6 +8,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -94,7 +95,7 @@ public class SrvBillAirAllocServiceImpl implements ISrvBillAirAllocService
throw new ServiceException(fee.getBillCode() + " " + blankName(fee) + ":" + reason);
}
}
Map<Long, Long> payBillIds = payBillIds(orders);
Map<String, String> payBillIds = payBillIds(orders);
List<PrcPayBillFee> batch = new ArrayList<>(BATCH_SIZE);
int lineCount = 0;
for (SrvBillAirAllocFee fee : fees)
@@ -167,7 +168,7 @@ public class SrvBillAirAllocServiceImpl implements ISrvBillAirAllocService
Map<String, List<SrvBillAirAllocOrder>> grouped = new LinkedHashMap<>();
for (SrvBillAirAllocOrder order : allocMapper.selectOrders(codes))
{
if (order.getBillId() == null)
if (order.getBillId() == null || order.getBillId().isBlank())
{
continue;
}
@@ -176,9 +177,9 @@ public class SrvBillAirAllocServiceImpl implements ISrvBillAirAllocService
return grouped;
}
private Map<Long, Long> payBillIds(Map<String, List<SrvBillAirAllocOrder>> orders)
private Map<String, String> payBillIds(Map<String, List<SrvBillAirAllocOrder>> orders)
{
List<Long> billIds = new ArrayList<>();
List<String> billIds = new ArrayList<>();
for (List<SrvBillAirAllocOrder> rows : orders.values())
{
for (SrvBillAirAllocOrder order : rows)
@@ -186,10 +187,10 @@ public class SrvBillAirAllocServiceImpl implements ISrvBillAirAllocService
billIds.add(order.getBillId());
}
}
Map<Long, Long> payIds = new LinkedHashMap<>();
Map<String, String> payIds = new LinkedHashMap<>();
for (int from = 0; from < billIds.size(); from += BATCH_SIZE)
{
List<Long> chunk = billIds.subList(from, Math.min(from + BATCH_SIZE, billIds.size()));
List<String> chunk = billIds.subList(from, Math.min(from + BATCH_SIZE, billIds.size()));
for (PrcPayBill payBill : allocMapper.selectPayBills(chunk))
{
if (payBill.getBillId() != null && payBill.getPayBillId() != null)
@@ -230,9 +231,10 @@ public class SrvBillAirAllocServiceImpl implements ISrvBillAirAllocService
return "";
}
private PrcPayBillFee toOrderFee(SrvBillAirAllocFee fee, SrvBillAirAllocOrder order, BigDecimal amount, Map<Long, Long> payBillIds)
private PrcPayBillFee toOrderFee(SrvBillAirAllocFee fee, SrvBillAirAllocOrder order, BigDecimal amount, Map<String, String> payBillIds)
{
PrcPayBillFee row = new PrcPayBillFee();
row.setFeeId(UUID.randomUUID().toString());
row.setBillId(order.getBillId());
row.setPayBillId(payBillIds.get(order.getBillId()));
String name = blankName(fee);
@@ -409,7 +409,7 @@ public class SrvBillAirFeeServiceImpl implements ISrvBillAirFeeService
}
Operator operator = operator();
Date now = DateUtils.getNowDate();
List<Long> affectedBills = payBillFeeMapper.selectBillIdsByLadingFee(feeId);
List<String> affectedBills = payBillFeeMapper.selectBillIdsByLadingFee(feeId);
payBillFeeMapper.markLadingFeeDeleted(feeId);
payBillFeeService.refreshTotals(affectedBills);
if (feeMapper.voidFee(feeId, code, operator.account, now) != 1)
@@ -34,7 +34,7 @@ public class PrcBatchAddIncomeFeeAsyncRunner
private RedisCache redisCache;
@Async("threadPoolTaskExecutor")
public void run(String taskId, List<Long> billIds, Long scId, String feeType, BigDecimal amount,
public void run(String taskId, List<String> billIds, Long scId, String feeType, BigDecimal amount,
String currency, String remark)
{
int total = billIds == null ? 0 : billIds.size();
@@ -51,7 +51,7 @@ public class PrcBatchAddIncomeFeeAsyncRunner
}
for (int i = 0; i < total; i++)
{
Long billId = billIds.get(i);
String billId = billIds.get(i);
try
{
AddIncomeBillFeeRequest req = new AddIncomeBillFeeRequest();
@@ -200,7 +200,7 @@ public class PrcChargeWeightImportAsyncRunner
public static class ChargeWeightImportWorkItem implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
private Long billId;
private String billId;
private String orderNo;
private BigDecimal chargeWeight;
@@ -208,19 +208,19 @@ public class PrcChargeWeightImportAsyncRunner
{
}
public ChargeWeightImportWorkItem(Long billId, String orderNo, BigDecimal chargeWeight)
public ChargeWeightImportWorkItem(String billId, String orderNo, BigDecimal chargeWeight)
{
this.billId = billId;
this.orderNo = orderNo;
this.chargeWeight = chargeWeight;
}
public Long getBillId()
public String getBillId()
{
return billId;
}
public void setBillId(Long billId)
public void setBillId(String billId)
{
this.billId = billId;
}
@@ -74,13 +74,13 @@ public class PrcOrderBillLocalRebillAsyncRunner
private PrcOrderBillMapper orderBillMapper;
@Async("threadPoolTaskExecutor")
public void run(String taskId, List<Long> billIds)
public void run(String taskId, List<String> billIds)
{
run(taskId, billIds, null);
}
@Async("threadPoolTaskExecutor")
public void run(String taskId, List<Long> billIds, LocalRebillRequest request)
public void run(String taskId, List<String> billIds, LocalRebillRequest request)
{
int total = billIds == null ? 0 : billIds.size();
AtomicInteger success = new AtomicInteger(0);
@@ -110,7 +110,7 @@ public class PrcOrderBillLocalRebillAsyncRunner
return;
}
// 连续拉取:N 个工作线程取下一个 billId —— 没有分页屏障式空等。
final List<Long> ids = billIds;
final List<String> ids = billIds;
List<Callable<Boolean>> workers = new ArrayList<Callable<Boolean>>(threads);
for (int w = 0; w < threads; w++)
{
@@ -122,7 +122,7 @@ public class PrcOrderBillLocalRebillAsyncRunner
{
return Boolean.TRUE;
}
Long one = ids.get(i);
String one = ids.get(i);
try
{
TmsPriceQuoteResult result = orderBillService.rebillLocalByBillId(one);
@@ -269,12 +269,12 @@ public class PrcOrderBillLocalRebillAsyncRunner
TabOrderSyncEsLog.save(billSearchStore, taskId, "LOCAL_REBILL_DONE", request, resp, status, errorMessage);
}
private void collectFailDetail(List<Map<String, Object>> failDetails, Long billId, Exception e)
private void collectFailDetail(List<Map<String, Object>> failDetails, String billId, Exception e)
{
collectFailDetail(failDetails, billId, errorMessage(e));
}
private void collectFailDetail(List<Map<String, Object>> failDetails, Long billId, String message)
private void collectFailDetail(List<Map<String, Object>> failDetails, String billId, String message)
{
if (failDetails == null)
{
@@ -293,8 +293,8 @@ public class PrcOrderBillLocalRebillAsyncRunner
String trackingNo = null;
try
{
PrcOrderBill bill = orderBillMapper == null || billId == null
? null : orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper == null || StringUtils.isEmpty(billId)
? null : orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill != null)
{
orderNo = bill.getOrderNo();
@@ -475,19 +475,19 @@ public class PrcOrderBillLocalRebillAsyncRunner
}
/** UI 提示优先用 transferNo;没有则退回 orderNo,再退回 billId。 */
private String failTransferLabel(Long billId, String transferNoHint)
private String failTransferLabel(String billId, String transferNoHint)
{
if (StringUtils.isNotEmpty(transferNoHint))
{
return transferNoHint.trim();
}
if (billId == null || orderBillMapper == null)
if (StringUtils.isEmpty(billId) || orderBillMapper == null)
{
return billId == null ? null : String.valueOf(billId);
return billId;
}
try
{
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
if (bill != null)
{
if (StringUtils.isNotEmpty(bill.getTransferNo()))
@@ -504,7 +504,7 @@ public class PrcOrderBillLocalRebillAsyncRunner
{
// 提示标签尽力而为
}
return billId == null ? null : String.valueOf(billId);
return billId;
}
private static String softFailMessage(TmsPriceQuoteResult result)
@@ -29,7 +29,7 @@ public class PrcRecalcBillPriceAsyncRunner
private RedisCache redisCache;
@Async("threadPoolTaskExecutor")
public void run(String taskId, String mode, List<Long> billIds)
public void run(String taskId, String mode, List<String> billIds)
{
int total = billIds == null ? 0 : billIds.size();
int success = 0;
@@ -45,7 +45,7 @@ public class PrcRecalcBillPriceAsyncRunner
}
for (int i = 0; i < total; i++)
{
Long billId = billIds.get(i);
String billId = billIds.get(i);
try
{
orderBillService.recalcBillPriceByBillId(billId, mode);
@@ -94,7 +94,7 @@ public class PrcRecalcBillPriceAsyncRunner
return redisCache.getCacheObject(CACHE_KEY_PREFIX + taskId);
}
private static void appendFail(StringBuilder failTips, Long billId, Exception e)
private static void appendFail(StringBuilder failTips, String billId, Exception e)
{
if (failTips.length() >= 800)
{
@@ -250,7 +250,7 @@ public class TabOrderSyncAsyncRunner
item.put("transferOrderId", vo == null ? null : vo.getTransferOrderId());
try
{
Long billId = overwriteOne(one);
String billId = overwriteOne(one);
item.put("successStatus", "SUCCESS");
item.put("billId", billId);
ok.incrementAndGet();
@@ -317,7 +317,7 @@ public class TabOrderSyncAsyncRunner
}
/** 解析出 Oracle 行后覆盖本地账单及其扩展信息(不计费)。 */
private Long overwriteOne(com.bms.price.oracle.TabOrderRow row)
private String overwriteOne(com.bms.price.oracle.TabOrderRow row)
{
Map<String, Object> raw = row == null ? null : row.getRaw();
TabOrderMonitorVo vo = row == null ? null : row.getVo();
@@ -17,7 +17,7 @@ public class ArBillDetail implements Serializable {
private Long detailId;
private Long arBillId;
private Long prcOrderBillId;
private String prcOrderBillId;
private Integer detailNo;
private String orderNo;
private String trackingNo;
@@ -16,7 +16,7 @@ public class ArBillDetailFee implements Serializable {
private Long detailFeeId;
private Long detailId;
private Long prcIncomeBillFeeId;
private String prcIncomeBillFeeId;
private Integer feeNo;
private String feeType;
private String feeName;
@@ -42,7 +42,7 @@ public class ArBillGenerateTask implements Serializable {
/**
* 按 bill_id 字典序处理的游标。
*/
private Long lastSourceBillId;
private String lastSourceBillId;
/**
* 待处理总数;全选模式统计完成前使用 -1。
*/
@@ -29,11 +29,11 @@ public class ArBillGenerateRequest
/** 截止日筛选字段:BIZ_DATE=计费时间,PICKUP_DATE=收货时间;历史任务默认计费时间。 */
private String dateType = "BIZ_DATE";
/** 手动模式选中的来源订单 ID;全选模式为空。 */
private List<Long> sourceBillIds;
private List<String> sourceBillIds;
/** 选择模式:EXPLICIT 手动选择,ALL_MATCHED 全选查询结果。 */
private String selectionMode = ArBillSelectionMode.EXPLICIT.getCode();
/** 全选模式中用户明确排除的来源订单 ID。 */
private List<Long> excludedSourceBillIds;
private List<String> excludedSourceBillIds;
/** 全选模式下按订单号、运单号或转单号排除;后台生成任务按批次应用该条件。 */
private String excludedOrderOrTrackingNo;
@JsonFormat(pattern = "yyyy-MM-dd")
@@ -14,7 +14,7 @@ public interface ArBillDetailMapper {
List<ArBillDetail> selectByBillId(Long arBillId);
List<ArBillDetail> selectByBillIdAndSourceIds(@Param("arBillId") Long arBillId,
@Param("sourceBillIds") List<Long> sourceBillIds);
@Param("sourceBillIds") List<String> sourceBillIds);
List<ArBillDetail> selectExportPage(@Param("arBillId") Long arBillId,
@Param("lastDetailNo") Integer lastDetailNo, @Param("pageSize") Integer pageSize);
@@ -27,7 +27,7 @@ public interface ArBillGenerateTaskMapper {
int updateTotalCount(@Param("taskId") Long taskId, @Param("totalCount") Integer totalCount);
int updateProgress(@Param("taskId") Long taskId, @Param("lastSourceBillId") Long lastSourceBillId,
int updateProgress(@Param("taskId") Long taskId, @Param("lastSourceBillId") String lastSourceBillId,
@Param("processedCount") Integer processedCount, @Param("successCount") Integer successCount,
@Param("totalAmount") java.math.BigDecimal totalAmount, @Param("heartbeatTime") Date heartbeatTime);
@@ -6,7 +6,7 @@ import com.bms.receivable.security.ArBillRowScope;
import com.bms.customer.customerinfo.domain.BmsCustomerOption;
public interface ArBillScopeMapper {
int countCustomerSourceBills(@Param("customerId") Long customerId, @Param("sourceIds") List<Long> sourceIds);
int countCustomerSourceBills(@Param("customerId") Long customerId, @Param("sourceIds") List<String> sourceIds);
int countAccessibleBill(@Param("arBillId") Long arBillId, @Param("scope") ArBillRowScope scope);
@@ -86,7 +86,7 @@ public class ArBillScopeResolver {
return mapper.selectCustomerOptions(values, resolve());
}
public void requireCustomerSourceBills(Long customerId, List<Long> sourceIds) {
public void requireCustomerSourceBills(Long customerId, List<String> sourceIds) {
if (!sourceIds.isEmpty() && withoutPagination(() -> mapper.countCustomerSourceBills(customerId, sourceIds)) != sourceIds.size()) {
throw new ServiceException("所选订单不存在或不属于当前客户");
}
@@ -419,8 +419,8 @@ public class ArBillServiceImpl implements IArBillService {
}
String selectionMode = selectionModeEnum.getCode();
boolean allMatched = selectionModeEnum == ArBillSelectionMode.ALL_MATCHED;
List<Long> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
List<Long> excludedSourceBillIds = normalizeSourceBillIds(request.getExcludedSourceBillIds());
List<String> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
List<String> excludedSourceBillIds = normalizeSourceBillIds(request.getExcludedSourceBillIds());
if (!allMatched && sourceBillIds.isEmpty()) {
throw failure(null, ArLogObjectType.BILL, "", ArLogOperationType.GENERATE,
null, "请至少选择一条有效订单", operator, requestId);
@@ -638,8 +638,8 @@ public class ArBillServiceImpl implements IArBillService {
log.info("开始执行应收账单生成任务,taskId={}, arBillId={}, selectionMode={}",
taskId, task.getArBillId(), task.getSelectionMode());
ArBillGenerateRequest request = JSON.parseObject(task.getRequestPayload(), ArBillGenerateRequest.class);
List<Long> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
List<Long> excludedSourceBillIds = normalizeSourceBillIds(request.getExcludedSourceBillIds());
List<String> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
List<String> excludedSourceBillIds = normalizeSourceBillIds(request.getExcludedSourceBillIds());
List<String> excludedOrderIdentifiers = ArBillSelectionMode.ALL_MATCHED.getCode().equals(task.getSelectionMode())
? normalizeOrderIdentifiers(request.getExcludedOrderOrTrackingNo()) : new ArrayList<>();
TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
@@ -766,13 +766,13 @@ public class ArBillServiceImpl implements IArBillService {
* 每批最多 GENERATE_PAGE_SIZE 条,成功后原子更新任务进度。
*/
private GenerateBatchResult processGenerateBatch(ArBillGenerateTask task, ArBillGenerateRequest request,
List<Long> sourceBillIds, List<Long> excludedSourceBillIds,
List<String> sourceBillIds, List<String> excludedSourceBillIds,
List<String> excludedOrderIdentifiers) {
ArBillSelectionMode selectionMode = ArBillSelectionMode.of(task.getSelectionMode());
if (selectionMode == null) {
throw new ServiceException("账单生成任务的订单选择模式无效");
}
List<Long> explicitIds = selectionMode == ArBillSelectionMode.EXPLICIT
List<String> explicitIds = selectionMode == ArBillSelectionMode.EXPLICIT
? sourceBillIds : null;
List<PrcOrderBill> sources = sourceBillMapper.selectPrcOrderBillByCustomerPeriodCursor(
request.getCustomerId(), request.getCustomerCode(),
@@ -792,7 +792,7 @@ public class ArBillServiceImpl implements IArBillService {
if (bill == null) {
throw new ServiceException("应收账单不存在");
}
List<Long> currentSourceBillIds = new ArrayList<>();
List<String> currentSourceBillIds = new ArrayList<>();
for (PrcOrderBill source : sources) {
currentSourceBillIds.add(source.getBillId());
if (source.getCurrency() != null && !bill.getCurrency().equalsIgnoreCase(source.getCurrency())) {
@@ -800,7 +800,7 @@ public class ArBillServiceImpl implements IArBillService {
}
}
Map<Long, PrcIncomeBill> sourceIncomeBillsByBillId = new HashMap<>();
Map<String, PrcIncomeBill> sourceIncomeBillsByBillId = new HashMap<>();
List<PrcIncomeBill> sourceIncomeBills = sourceIncomeBillMapper.selectByBillIds(currentSourceBillIds);
if (sourceIncomeBills != null) {
for (PrcIncomeBill sourceIncomeBill : sourceIncomeBills) {
@@ -814,8 +814,8 @@ public class ArBillServiceImpl implements IArBillService {
if (sourceFees == null) {
sourceFees = new ArrayList<>();
}
Map<Long, Integer> sourceFeeCounts = new HashMap<>();
List<Long> sourceFeeIds = new ArrayList<>(sourceFees.size());
Map<String, Integer> sourceFeeCounts = new HashMap<>();
List<String> sourceFeeIds = new ArrayList<>(sourceFees.size());
for (PrcIncomeBillFee sourceFee : sourceFees) {
sourceFeeCounts.merge(sourceFee.getBillId(), 1, Integer::sum);
sourceFeeIds.add(sourceFee.getFeeId());
@@ -853,7 +853,7 @@ public class ArBillServiceImpl implements IArBillService {
// 失败订单先落快照,再汇总占用状态,避免无费用订单被错误恢复为 UNBILLED。
sourceBillMapper.refreshArBillStatusByBillIds(currentSourceBillIds);
Map<Long, ArBillDetail> detailsBySourceBill = new HashMap<>();
Map<String, ArBillDetail> detailsBySourceBill = new HashMap<>();
for (ArBillDetail detail : detailMapper.selectByBillIdAndSourceIds(bill.getArBillId(), currentSourceBillIds)) {
detailsBySourceBill.put(detail.getPrcOrderBillId(), detail);
}
@@ -862,7 +862,7 @@ public class ArBillServiceImpl implements IArBillService {
}
List<ArBillDetailFee> detailFees = new ArrayList<>(sourceFees == null ? 0 : sourceFees.size());
Map<Long, Integer> feeNumbers = new HashMap<>();
Map<String, Integer> feeNumbers = new HashMap<>();
if (sourceFees != null) {
for (PrcIncomeBillFee sourceFee : sourceFees) {
ArBillDetail detail = detailsBySourceBill.get(sourceFee.getBillId());
@@ -886,7 +886,7 @@ public class ArBillServiceImpl implements IArBillService {
Date periodStart = earliestDate(sources, request.getDateType());
billMapper.updateArBillProgress(bill.getArBillId(), processedCount, totalAmount, totalAmount,
periodStart, task.getCreateBy());
Long lastSourceBillId = sources.get(sources.size() - 1).getBillId();
String lastSourceBillId = sources.get(sources.size() - 1).getBillId();
if (generateTaskMapper.updateProgress(task.getTaskId(), lastSourceBillId, processedCount,
processedCount, totalAmount, new Date()) != 1) {
throw new ServiceException("账单生成任务状态已发生变化,请稍后重试");
@@ -2312,12 +2312,12 @@ public class ArBillServiceImpl implements IArBillService {
return type.getCode();
}
private List<Long> normalizeSourceBillIds(List<Long> sourceBillIds) {
LinkedHashSet<Long> uniqueIds = new LinkedHashSet<>();
private List<String> normalizeSourceBillIds(List<String> sourceBillIds) {
LinkedHashSet<String> uniqueIds = new LinkedHashSet<>();
if (sourceBillIds != null) {
for (Long billId : sourceBillIds) {
if (billId != null) {
uniqueIds.add(billId);
for (String billId : sourceBillIds) {
if (!StringUtils.isEmpty(billId) && billId.trim().length() <= 36) {
uniqueIds.add(billId.trim());
}
}
}
@@ -70,7 +70,7 @@
select 1 from pay_bill_line l
inner join pay_bill b on b.bill_id = l.bill_id
where l.order_bill_id = o.bill_id
and l.fee_id is null
and (l.fee_id is null or l.fee_id = '')
and b.status not in ('VOID', 'RED')
)) as unbilledCount,
(select b.bill_no from pay_bill_line l
@@ -240,7 +240,7 @@
select 1 from pay_bill_line l
inner join pay_bill b on b.bill_id = l.bill_id
where l.order_bill_id = f.bill_id
and l.fee_id is null
and (l.fee_id is null or l.fee_id = '')
and b.status not in ('VOID', 'RED')
)
order by f.bill_id, f.fee_id
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
</resultMap>
<select id="selectByBillId" parameterType="Long" resultMap="PrcIncomeBillFeeResult">
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
ar_bill_status, manual_flag, create_time
from prc_income_bill_fee
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by bill_id, field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
</select>
<select id="selectByFeeId" parameterType="Long" resultMap="PrcIncomeBillFeeResult">
<select id="selectByFeeId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
ar_bill_status, manual_flag, create_time
from prc_income_bill_fee
@@ -78,23 +78,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and fee_type = #{feeType}
</select>
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee" useGeneratedKeys="true" keyProperty="feeId">
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee">
insert into prc_income_bill_fee (
bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
ar_bill_status, manual_flag, create_time
) values (
#{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{roundMode}, #{remark},
#{feeId}, #{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{roundMode}, #{remark},
#{arBillStatus}, #{manualFlag}, sysdate()
)
</insert>
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="feeId">
<insert id="insertBatch" parameterType="java.util.List">
insert into prc_income_bill_fee (
bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
ar_bill_status, manual_flag, create_time
) values
<foreach collection="list" item="item" separator=",">
(#{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
(#{item.feeId}, #{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
#{item.productAmount}, #{item.redlineAmount},
#{item.currency}, #{item.roundMode}, #{item.remark},
#{item.arBillStatus}, #{item.manualFlag}, sysdate())
@@ -173,15 +173,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</update>
<delete id="deleteByFeeId" parameterType="Long">
<delete id="deleteByFeeId" parameterType="String">
delete from prc_income_bill_fee where fee_id = #{feeId}
</delete>
<delete id="deleteByBillId" parameterType="Long">
<delete id="deleteByBillId" parameterType="String">
delete from prc_income_bill_fee where bill_id = #{billId}
</delete>
<delete id="deleteAutoFeesByBillId" parameterType="Long">
<delete id="deleteAutoFeesByBillId" parameterType="String">
delete from prc_income_bill_fee
where bill_id = #{billId}
and (manual_flag is null or manual_flag &lt;&gt; '1')
@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from prc_income_bill
</sql>
<select id="selectByBillId" parameterType="Long" resultMap="PrcIncomeBillResult">
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillResult">
<include refid="selectPrcIncomeBillVo"/>
where bill_id = #{billId}
</select>
@@ -44,19 +44,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="selectByIncomeBillId" parameterType="Long" resultMap="PrcIncomeBillResult">
<select id="selectByIncomeBillId" parameterType="String" resultMap="PrcIncomeBillResult">
<include refid="selectPrcIncomeBillVo"/>
where income_bill_id = #{incomeBillId}
</select>
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill" useGeneratedKeys="true" keyProperty="incomeBillId">
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill">
insert into prc_income_bill (
bill_id, currency, product_amount, redline_amount,
income_bill_id, bill_id, currency, product_amount, redline_amount,
sales_amount, income_total, refund_status,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time
) values (
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{salesAmount}, #{incomeTotal}, #{refundStatus},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
#{createBy}, sysdate()
@@ -80,14 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where bill_id = #{billId}
</update>
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill" useGeneratedKeys="true" keyProperty="incomeBillId">
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill">
insert into prc_income_bill (
bill_id, currency, product_amount, redline_amount,
income_bill_id, bill_id, currency, product_amount, redline_amount,
sales_amount, income_total, refund_status,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time
) values (
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{salesAmount}, #{incomeTotal}, #{refundStatus},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
#{createBy}, sysdate()
@@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = sysdate()
</insert>
<delete id="deleteByBillId" parameterType="Long">
<delete id="deleteByBillId" parameterType="String">
delete from prc_income_bill where bill_id = #{billId}
</delete>
</mapper>
@@ -189,7 +189,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from prc_order_bill_ext
</sql>
<select id="selectByBillId" parameterType="Long" resultMap="PrcOrderBillExtResult">
<select id="selectByBillId" parameterType="String" resultMap="PrcOrderBillExtResult">
<include refid="selectPrcOrderBillExtVo"/>
where bill_id = #{billId}
</select>
@@ -157,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
limit 2
</select>
<select id="selectPrcOrderBillById" parameterType="Long" resultMap="PrcOrderBillResult">
<select id="selectPrcOrderBillById" parameterType="String" resultMap="PrcOrderBillResult">
<include refid="selectPrcOrderBillVo"/>
where bill_id = #{billId}
</select>
@@ -578,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!-- Id-only for large local rebill (avoid loading full rows into memory). -->
<select id="selectPrcOrderBillIds" parameterType="PrcOrderBill" resultType="java.lang.Long">
<select id="selectPrcOrderBillIds" parameterType="PrcOrderBill" resultType="string">
select p.bill_id
from prc_order_bill p
<where>
@@ -785,7 +785,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPrcOrderBillByCustomerPeriodCursor" resultMap="PrcOrderBillArSourceResult">
<include refid="selectArBillSourceVo"/>
<include refid="customerPeriodConditions"/>
<if test="lastSourceBillId != null">
<if test="lastSourceBillId != null and lastSourceBillId != ''">
and p.bill_id &gt; #{lastSourceBillId}
</if>
order by p.bill_id
@@ -829,9 +829,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</choose>
</select>
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill" useGeneratedKeys="true" keyProperty="billId">
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
insert into prc_order_bill (
bill_key, order_no, tracking_no, transfer_no,
bill_id, bill_key, order_no, tracking_no, transfer_no,
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_id, customer_code, customer_name,
pieces, actual_weight, receive_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
@@ -845,7 +845,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, error_message, round_mode,
create_time
) values (
#{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
#{customerId}, #{customerCode}, #{customerName},
#{pieces}, #{actualWeight}, #{receiveWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
</resultMap>
<select id="selectByBillId" parameterType="Long" resultMap="PrcPayBillFeeResult">
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillFeeResult">
select fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
fee_source, source_id, is_deleted, create_time
from prc_pay_bill_fee
@@ -31,23 +31,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
</select>
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee" useGeneratedKeys="true" keyProperty="feeId">
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee">
insert into prc_pay_bill_fee (
bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
fee_source, source_id, is_deleted, create_time
) values (
#{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{feeLevel}, #{amount}, #{currency}, #{roundMode}, #{remark},
#{feeId}, #{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{feeLevel}, #{amount}, #{currency}, #{roundMode}, #{remark},
ifnull(#{feeSource}, 'CALC'), #{sourceId}, ifnull(#{isDeleted}, '0'), sysdate()
)
</insert>
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="feeId">
<insert id="insertBatch" parameterType="java.util.List">
insert into prc_pay_bill_fee (
bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
fee_source, source_id, is_deleted, create_time
) values
<foreach collection="list" item="item" separator=",">
(#{item.billId}, #{item.payBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.feeLevel},
(#{item.feeId}, #{item.billId}, #{item.payBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.feeLevel},
#{item.amount}, #{item.currency}, #{item.roundMode}, #{item.remark}, ifnull(#{item.feeSource}, 'CALC'),
#{item.sourceId}, ifnull(#{item.isDeleted}, '0'), sysdate())
</foreach>
@@ -69,18 +69,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update prc_pay_bill_fee f
inner join prc_pay_bill b on b.bill_id = f.bill_id
set f.pay_bill_id = b.pay_bill_id
where f.pay_bill_id is null
where (f.pay_bill_id is null or f.pay_bill_id = '')
and f.bill_id in
<foreach collection="billIds" item="billId" open="(" separator="," close=")">#{billId}</foreach>
</update>
<select id="selectBillIdsByLadingFee" resultType="java.lang.Long">
<select id="selectBillIdsByLadingFee" resultType="String">
select distinct bill_id
from prc_pay_bill_fee
where fee_source = 'LADING'
and sc_id = #{feeId}
and ifnull(is_deleted, '0') = '0'
and bill_id is not null
and bill_id != ''
</select>
<update id="markLadingFeeDeleted">
@@ -93,13 +94,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="fillSourceIdByFeeIds">
update prc_pay_bill_fee
set source_id = cast(fee_id as char)
set source_id = id
where (source_id is null or source_id = '')
and fee_id in
<foreach collection="feeIds" item="feeId" open="(" separator="," close=")">#{feeId}</foreach>
</update>
<delete id="deleteByBillId" parameterType="Long">
<delete id="deleteByBillId" parameterType="String">
delete from prc_pay_bill_fee
where bill_id = #{billId}
and (fee_source is null or fee_source = '' or fee_source = 'CALC')
@@ -30,24 +30,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from prc_pay_bill
</sql>
<select id="selectByBillId" parameterType="Long" resultMap="PrcPayBillResult">
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillResult">
<include refid="selectPrcPayBillVo"/>
where bill_id = #{billId}
</select>
<select id="selectByPayBillId" parameterType="Long" resultMap="PrcPayBillResult">
<select id="selectByPayBillId" parameterType="String" resultMap="PrcPayBillResult">
<include refid="selectPrcPayBillVo"/>
where pay_bill_id = #{payBillId}
</select>
<insert id="insertPrcPayBill" parameterType="PrcPayBill" useGeneratedKeys="true" keyProperty="payBillId">
<insert id="insertPrcPayBill" parameterType="PrcPayBill">
insert into prc_pay_bill (
bill_id, currency, product_amount, redline_amount,
pay_bill_id, bill_id, currency, product_amount, redline_amount,
cost_amount, pay_total,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time
) values (
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{costAmount}, #{payTotal},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
#{createBy}, sysdate()
@@ -70,14 +70,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where bill_id = #{billId}
</update>
<insert id="upsertPrcPayBill" parameterType="PrcPayBill" useGeneratedKeys="true" keyProperty="payBillId">
<insert id="upsertPrcPayBill" parameterType="PrcPayBill">
insert into prc_pay_bill (
bill_id, currency, product_amount, redline_amount,
pay_bill_id, bill_id, currency, product_amount, redline_amount,
cost_amount, pay_total,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time
) values (
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{costAmount}, #{payTotal},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
#{createBy}, sysdate()
@@ -98,11 +98,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertMissingPayBills">
insert into prc_pay_bill (
bill_id, currency, pay_total,
pay_bill_id, bill_id, currency, pay_total,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time, update_by, update_time
)
select o.bill_id, ifnull(nullif(o.currency, ''), 'CNY'), 0,
select replace(uuid(), '-', ''), o.bill_id, ifnull(nullif(o.currency, ''), 'CNY'), 0,
o.belong_saler, o.belong_saler_code, o.settlement_man, o.settlement_man_code,
#{operator}, sysdate(), #{operator}, sysdate()
from prc_order_bill o
@@ -129,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach collection="billIds" item="billId" open="(" separator="," close=")">#{billId}</foreach>
</update>
<delete id="deleteByBillId" parameterType="Long">
<delete id="deleteByBillId" parameterType="String">
delete from prc_pay_bill where bill_id = #{billId}
</delete>
</mapper>