修改账单ID类型为Long,优化相关服务和Mapper逻辑
This commit is contained in:
+12
-12
@@ -253,7 +253,7 @@ public class BillingController extends BaseController
|
||||
/** 订单列表弹窗:按 billId 查询计费失败原因(受数据权限控制)。 */
|
||||
@PreAuthorize("@ss.hasPermi('price:orderBill:list')")
|
||||
@GetMapping("/orderBill/{billId}/failReason")
|
||||
public AjaxResult orderBillFailReason(@PathVariable("billId") String billId)
|
||||
public AjaxResult orderBillFailReason(@PathVariable("billId") Long billId)
|
||||
{
|
||||
return success(prcOrderBillService.getBillingFailReason(billId));
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public class BillingController extends BaseController
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill') or @ss.hasPermi('price:orderBill:list')")
|
||||
@GetMapping("/bill/{billId}")
|
||||
public AjaxResult getBill(@PathVariable String billId)
|
||||
public AjaxResult getBill(@PathVariable Long billId)
|
||||
{
|
||||
return success(prcOrderBillService.getBill(billId));
|
||||
}
|
||||
@@ -391,13 +391,13 @@ public class BillingController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill') or @ss.hasPermi('price:orderBill:list')")
|
||||
@GetMapping("/bill/{billId}/history")
|
||||
public TableDataInfo billHistory(@PathVariable("billId") String billId)
|
||||
public TableDataInfo billHistory(@PathVariable("billId") Long billId)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
return getDataTable(new ArrayList<BillSyncSnapshot>());
|
||||
}
|
||||
TmsPriceQuoteResult bill = prcOrderBillService.getBill(billId.trim());
|
||||
TmsPriceQuoteResult bill = prcOrderBillService.getBill(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
TableDataInfo empty = new TableDataInfo();
|
||||
@@ -482,13 +482,13 @@ public class BillingController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:refund')")
|
||||
@Log(title = "Billing refund", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/bill/{billId}/refund")
|
||||
public AjaxResult refundBill(@PathVariable("billId") String billId)
|
||||
public AjaxResult refundBill(@PathVariable("billId") Long billId)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
return error("billId required");
|
||||
}
|
||||
TmsPriceQuoteResult bill = prcOrderBillService.getBill(billId.trim());
|
||||
TmsPriceQuoteResult bill = prcOrderBillService.getBill(billId);
|
||||
if (bill == null || StringUtils.isEmpty(bill.getOrderNo()))
|
||||
{
|
||||
return error("bill not found");
|
||||
@@ -519,7 +519,7 @@ public class BillingController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:arrearsUpdate')")
|
||||
@Log(title = "Billing credit arrears", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/bill/creditArrears")
|
||||
public AjaxResult updateCreditArrears(@RequestBody java.util.List<String> billIds)
|
||||
public AjaxResult updateCreditArrears(@RequestBody java.util.List<Long> billIds)
|
||||
{
|
||||
if (billIds == null || billIds.isEmpty())
|
||||
{
|
||||
@@ -527,7 +527,7 @@ public class BillingController extends BaseController
|
||||
}
|
||||
int success = 0;
|
||||
java.util.List<String> fails = new java.util.ArrayList<String>();
|
||||
for (String billId : billIds)
|
||||
for (Long billId : billIds)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -541,7 +541,7 @@ public class BillingController extends BaseController
|
||||
{
|
||||
msg = e.getClass().getSimpleName();
|
||||
}
|
||||
fails.add((billId == null ? "" : billId) + ": " + msg);
|
||||
fails.add((billId == null ? "" : String.valueOf(billId)) + ": " + msg);
|
||||
}
|
||||
}
|
||||
if (fails.isEmpty())
|
||||
@@ -664,7 +664,7 @@ public class BillingController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:feeRemove')")
|
||||
@Log(title = "Billing income fee", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/bill/fee/{feeId}")
|
||||
public AjaxResult deleteIncomeFee(@PathVariable String feeId)
|
||||
public AjaxResult deleteIncomeFee(@PathVariable Long feeId)
|
||||
{
|
||||
return success(prcOrderBillService.deleteIncomeFee(feeId));
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class PayProductController extends BaseController
|
||||
@PreAuthorize("@ss.hasAnyPermi('price:billing:bill,price:pay:edit')")
|
||||
@Log(title = "应付账单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/order/{billId}")
|
||||
public AjaxResult generateOrderCost(@PathVariable String billId)
|
||||
public AjaxResult generateOrderCost(@PathVariable Long billId)
|
||||
{
|
||||
payOrderCostService.generate(billId);
|
||||
return success("操作成功");
|
||||
|
||||
@@ -29,6 +29,8 @@ bms:
|
||||
# UUID -> bigint shadow sync. Toggle on monitor page (no cron).
|
||||
mig:
|
||||
uuid-to-new:
|
||||
# disabled after Long PK cutover; do not enable
|
||||
enabled: false
|
||||
batch-size: 200
|
||||
# 1~16 (same ceiling as local-rebill default); 4c8g often 2~4
|
||||
thread-count: 2
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.springframework.stereotype.Component;
|
||||
@ConfigurationProperties(prefix = "bms.mig.uuid-to-new")
|
||||
public class UuidToNewProperties
|
||||
{
|
||||
/** Master switch; default false after Long PK cutover. */
|
||||
private boolean enabled = false;
|
||||
/** 每轮抓取订单数(1~1000) */
|
||||
private int batchSize = 200;
|
||||
/**
|
||||
@@ -21,6 +23,16 @@ public class UuidToNewProperties
|
||||
/** 无待处理订单时空转睡眠毫秒(开关仍为开时) */
|
||||
private long idleSleepMs = 3000L;
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public int getBatchSize()
|
||||
{
|
||||
return batchSize;
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PayOrderCostResult
|
||||
{
|
||||
private String billId;
|
||||
private Long billId;
|
||||
|
||||
private String channelId;
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ public class PrcBillingTask extends BaseEntity
|
||||
/** 移动端传入的计费时间(非 Oracle 订单时间;回写时不会被覆盖) */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date billTime;
|
||||
private String billId;
|
||||
/** 对应 prc_order_bill.bill_id */
|
||||
private Long orderId;
|
||||
/** 用于查询的稳定失败码,例如 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 String incomeBillId;
|
||||
private Long incomeBillId;
|
||||
/** 计费订单ID */
|
||||
private String billId;
|
||||
private Long billId;
|
||||
/** 币种 */
|
||||
private String currency;
|
||||
/** 产品价合计 */
|
||||
|
||||
@@ -12,10 +12,10 @@ public class PrcIncomeBillFee implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String feeId;
|
||||
private String billId;
|
||||
private Long feeId;
|
||||
private Long billId;
|
||||
/** 应收主表ID */
|
||||
private String incomeBillId;
|
||||
private Long 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 String billId;
|
||||
private Long billId;
|
||||
/** 批量查询:多个账单ID精确匹配(仅查询用,非表字段) */
|
||||
private List<String> billIds;
|
||||
private List<Long> billIds;
|
||||
private String billKey;
|
||||
private String orderNo;
|
||||
/** 批量查询:多个订单号精确匹配(仅查询用,非表字段) */
|
||||
|
||||
@@ -12,7 +12,7 @@ public class PrcOrderBillExt implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String billId;
|
||||
private Long billId;
|
||||
private String orderNo;
|
||||
private String upstreamId;
|
||||
private String lineNo;
|
||||
|
||||
+2
-3
@@ -2,7 +2,6 @@ package com.bms.price.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,8 +11,8 @@ public class AddIncomeBillFeeRequest implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank(message = "billId required")
|
||||
private String billId;
|
||||
@NotNull(message = "billId required")
|
||||
private Long billId;
|
||||
|
||||
/** 附加费配置ID(prc_surcharge.sc_id)。 */
|
||||
@NotNull(message = "scId required")
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class BatchAddIncomeBillFeeRequest implements Serializable
|
||||
private String scopeMode;
|
||||
|
||||
/** scopeMode=SELECTED 时选中的账单ID。 */
|
||||
private List<String> billIds;
|
||||
private List<Long> billIds;
|
||||
|
||||
/** 与计费列表搜索相同的筛选条件。 */
|
||||
private List<String> orderNos;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class LocalRebillRequest implements Serializable
|
||||
|
||||
/** ALL | SELECTED */
|
||||
private String scopeMode;
|
||||
private List<String> billIds;
|
||||
private List<Long> billIds;
|
||||
private List<String> orderNos;
|
||||
private List<String> trackingNos;
|
||||
private List<String> transferNos;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class OrderBillFailReasonVo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String billId;
|
||||
private Long billId;
|
||||
private String orderNo;
|
||||
private String transferNo;
|
||||
private String trackingNo;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class RecalcBillPriceRequest implements Serializable
|
||||
|
||||
/** ALL = 筛选条件;SELECTED = billIds。 */
|
||||
private String scopeMode;
|
||||
private List<String> billIds;
|
||||
private List<Long> billIds;
|
||||
private List<String> orderNos;
|
||||
private List<String> trackingNos;
|
||||
private List<String> transferNos;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class TmsOrderBillStatusResult {
|
||||
/**
|
||||
* 计费订单标识,仅在唯一命中时返回。
|
||||
*/
|
||||
private String billId;
|
||||
private Long billId;
|
||||
|
||||
private String orderNo;
|
||||
private String trackingNo;
|
||||
|
||||
@@ -10,7 +10,7 @@ public class TmsPriceQuoteFeeLine implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String feeId;
|
||||
private Long feeId;
|
||||
private String feeType;
|
||||
private String feeName;
|
||||
/** 附加费配置ID,运费/挂号费为 0 */
|
||||
|
||||
@@ -82,7 +82,7 @@ public class TmsPriceQuoteResult implements Serializable
|
||||
/** 应付费用明细 */
|
||||
private List<TmsPriceQuoteFeeLine> payFeeDetails;
|
||||
private String quoteId;
|
||||
private String billId;
|
||||
private Long billId;
|
||||
private String orderNo;
|
||||
private String trackingNo;
|
||||
/** 转单号 */
|
||||
|
||||
+2
-3
@@ -3,7 +3,6 @@ package com.bms.price.domain.vo;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -13,8 +12,8 @@ public class UpdateChargeWeightRequest implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank(message = "billId is required")
|
||||
private String billId;
|
||||
@NotNull(message = "billId is required")
|
||||
private Long billId;
|
||||
|
||||
@NotNull(message = "chargeWeight is required")
|
||||
@DecimalMin(value = "0.001", message = "chargeWeight must be > 0")
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ package com.bms.price.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/** 修改计费明细上的手工应收费用行。 */
|
||||
@@ -11,8 +11,8 @@ public class UpdateIncomeBillFeeRequest implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank(message = "feeId required")
|
||||
private String feeId;
|
||||
@NotNull(message = "feeId required")
|
||||
private Long feeId;
|
||||
|
||||
/** 可选:更换附加费配置。 */
|
||||
private Long scId;
|
||||
|
||||
+12
-12
@@ -7,22 +7,22 @@ import com.bms.price.domain.PrcIncomeBillFee;
|
||||
/** 应收账单费用 mapper */
|
||||
public interface PrcIncomeBillFeeMapper
|
||||
{
|
||||
public List<PrcIncomeBillFee> selectByBillId(String billId);
|
||||
public List<PrcIncomeBillFee> selectByBillId(Long billId);
|
||||
|
||||
public List<PrcIncomeBillFee> selectByBillIds(@Param("billIds") List<String> billIds);
|
||||
public List<PrcIncomeBillFee> selectByBillIds(@Param("billIds") List<Long> billIds);
|
||||
|
||||
/** 查询指定计费订单中尚未生成应收账单的费用。 */
|
||||
public List<PrcIncomeBillFee> selectUnbilledByBillIds(@Param("billIds") List<String> billIds,
|
||||
public List<PrcIncomeBillFee> selectUnbilledByBillIds(@Param("billIds") List<Long> billIds,
|
||||
@Param("arBillStatus") String arBillStatus);
|
||||
|
||||
public PrcIncomeBillFee selectByFeeId(String feeId);
|
||||
public PrcIncomeBillFee selectByFeeId(Long feeId);
|
||||
|
||||
/** 按唯一键 uk_bill_fee_item(bill_id、fee_type、sc_id)查询。 */
|
||||
public PrcIncomeBillFee selectByBillIdAndFeeTypeAndScId(@Param("billId") String billId,
|
||||
public PrcIncomeBillFee selectByBillIdAndFeeTypeAndScId(@Param("billId") Long billId,
|
||||
@Param("feeType") String feeType, @Param("scId") Long scId);
|
||||
|
||||
/** 统计某账单在指定 ar_bill_status 和 fee_type 下的费用数(例如 BILLED + BASIC_FREIGHT)。 */
|
||||
public int countByBillIdAndArBillStatusAndFeeType(@Param("billId") String billId,
|
||||
public int countByBillIdAndArBillStatusAndFeeType(@Param("billId") Long 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<String> billIds,
|
||||
public int updateArBillStatusByBillIds(@Param("billIds") List<Long> billIds,
|
||||
@Param("fromStatus") String fromStatus, @Param("toStatus") String toStatus);
|
||||
|
||||
/** 按费用明细 ID 精确更新状态,避免误更新同一订单的历史费用。 */
|
||||
public int updateArBillStatusByFeeIds(@Param("feeIds") List<String> feeIds,
|
||||
public int updateArBillStatusByFeeIds(@Param("feeIds") List<Long> feeIds,
|
||||
@Param("fromStatus") String fromStatus, @Param("toStatus") String toStatus);
|
||||
|
||||
/** 作废或失败清理后,仅在不存在其他有效账单关联时恢复为未出账。 */
|
||||
public int restoreUnbilledIfNoActiveArBill(@Param("feeIds") List<String> feeIds);
|
||||
public int restoreUnbilledIfNoActiveArBill(@Param("feeIds") List<Long> feeIds);
|
||||
|
||||
/** 按应收账单批量恢复其关联费用,避免大账单组装超大的费用 ID 列表。 */
|
||||
public int restoreUnbilledIfNoActiveArBillByArBillId(@Param("arBillId") Long arBillId);
|
||||
|
||||
public int deleteByFeeId(String feeId);
|
||||
public int deleteByFeeId(Long feeId);
|
||||
|
||||
public int deleteByBillId(String billId);
|
||||
public int deleteByBillId(Long billId);
|
||||
|
||||
/** 重新出账:只删除自动费用;保留 manual_flag=1 的行。 */
|
||||
public int deleteAutoFeesByBillId(String billId);
|
||||
public int deleteAutoFeesByBillId(Long billId);
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import org.apache.ibatis.annotations.Param;
|
||||
/** 应收账单 prc_income_bill 的 mapper */
|
||||
public interface PrcIncomeBillMapper
|
||||
{
|
||||
PrcIncomeBill selectByBillId(String billId);
|
||||
PrcIncomeBill selectByBillId(Long billId);
|
||||
|
||||
List<PrcIncomeBill> selectByBillIds(@Param("billIds") List<String> billIds);
|
||||
List<PrcIncomeBill> selectByBillIds(@Param("billIds") List<Long> billIds);
|
||||
|
||||
PrcIncomeBill selectByIncomeBillId(String incomeBillId);
|
||||
PrcIncomeBill selectByIncomeBillId(Long incomeBillId);
|
||||
|
||||
int insertPrcIncomeBill(PrcIncomeBill row);
|
||||
|
||||
@@ -19,5 +19,5 @@ public interface PrcIncomeBillMapper
|
||||
|
||||
int upsertPrcIncomeBill(PrcIncomeBill row);
|
||||
|
||||
int deleteByBillId(String billId);
|
||||
int deleteByBillId(Long billId);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.bms.price.domain.PrcOrderBillExt;
|
||||
/** 订单账单扩展 prc_order_bill_ext 的 mapper */
|
||||
public interface PrcOrderBillExtMapper
|
||||
{
|
||||
public PrcOrderBillExt selectByBillId(String billId);
|
||||
public PrcOrderBillExt selectByBillId(Long billId);
|
||||
|
||||
public PrcOrderBillExt selectByOrderNo(String orderNo);
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ public interface PrcOrderBillMapper
|
||||
/** TMS 状态查询:按订单号、运单号或转单号精确匹配,最多返回两条用于识别歧义。 */
|
||||
List<PrcOrderBill> selectPrcOrderBillByTmsIdentifier(@Param("identifier") String identifier);
|
||||
|
||||
public PrcOrderBill selectPrcOrderBillById(String billId);
|
||||
public PrcOrderBill selectPrcOrderBillById(Long billId);
|
||||
|
||||
public List<PrcOrderBill> selectPrcOrderBillList(PrcOrderBill bill);
|
||||
|
||||
/** 只取 bill_id(筛选条件/数据权限与列表一致),用于本地大批量重新出账。 */
|
||||
List<String> selectPrcOrderBillIds(PrcOrderBill bill);
|
||||
List<Long> 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<String> excludedBillIds);
|
||||
@Param("excludedBillIds") List<Long> 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") String lastSourceBillId, @Param("billIds") List<String> billIds,
|
||||
@Param("excludedBillIds") List<String> excludedBillIds,
|
||||
@Param("lastSourceBillId") Long lastSourceBillId, @Param("billIds") List<Long> billIds,
|
||||
@Param("excludedBillIds") List<Long> 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<String> billIds, @Param("excludedBillIds") List<String> excludedBillIds,
|
||||
@Param("billIds") List<Long> billIds, @Param("excludedBillIds") List<Long> 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<String> billIds,
|
||||
@Param("currency") String currency, @Param("billIds") List<Long> billIds,
|
||||
@Param("arBillStatuses") List<String> arBillStatuses, @Param("feeArBillStatus") String feeArBillStatus);
|
||||
|
||||
/** 原子占用订单,防止同一订单被并发生成到多张应收账单。 */
|
||||
public int claimArBillOrders(@Param("billIds") List<String> billIds, @Param("operator") String operator,
|
||||
public int claimArBillOrders(@Param("billIds") List<Long> billIds, @Param("operator") String operator,
|
||||
@Param("arBillStatuses") List<String> arBillStatuses, @Param("toStatus") String toStatus);
|
||||
|
||||
/** 作废账单后释放订单,允许后续重新生成新版本账单。 */
|
||||
public int releaseArBillOrders(@Param("billIds") List<String> billIds, @Param("operator") String operator,
|
||||
public int releaseArBillOrders(@Param("billIds") List<Long> 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<String> billIds);
|
||||
int refreshArBillStatusByBillIds(@Param("billIds") List<Long> billIds);
|
||||
|
||||
/** 清理或作废时批量释放来源订单;无费用失败订单的占用判断排除当前账单。 */
|
||||
int refreshArBillStatusByArBillId(@Param("arBillId") Long arBillId);
|
||||
@@ -126,20 +126,20 @@ public interface PrcOrderBillMapper
|
||||
@Param("creditArrearsStatus") String creditArrearsStatus);
|
||||
|
||||
/** 更新订单额度欠费状态 */
|
||||
int updateCreditArrearsStatus(@Param("billId") String billId,
|
||||
int updateCreditArrearsStatus(@Param("billId") Long billId,
|
||||
@Param("creditArrearsStatus") String creditArrearsStatus,
|
||||
@Param("updateBy") String updateBy);
|
||||
|
||||
public int updateOrderBillAmounts(@Param("billId") String billId,
|
||||
public int updateOrderBillAmounts(@Param("billId") Long billId,
|
||||
@Param("surchargeAmount") BigDecimal surchargeAmount,
|
||||
@Param("incomeTotal") BigDecimal incomeTotal,
|
||||
@Param("payTotal") BigDecimal payTotal);
|
||||
|
||||
/** 只更新应付合计,不改应收。 */
|
||||
int updatePayTotal(@Param("billId") String billId, @Param("payTotal") BigDecimal payTotal);
|
||||
int updatePayTotal(@Param("billId") Long billId, @Param("payTotal") BigDecimal payTotal);
|
||||
|
||||
/** 按未删除应付明细合计回写订单上的应付总额。单次不超过 1000 个订单。 */
|
||||
int refreshPayTotalFromFees(@Param("billIds") List<String> billIds);
|
||||
int refreshPayTotalFromFees(@Param("billIds") List<Long> billIds);
|
||||
|
||||
/** 统计引用该销售套餐版本的订单账单数。 */
|
||||
int countByPsvId(@Param("psvId") Long psvId);
|
||||
|
||||
+2
-2
@@ -69,9 +69,9 @@ public class UuidToNewMonitorServiceImpl implements IUuidToNewMonitorService
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
applyConfig(threadCount, batchSize);
|
||||
throw new ServiceException("切主后 UuidToNew 已停用,不允许开启连续同步");
|
||||
}
|
||||
syncRunner.setEnabled(enabled);
|
||||
syncRunner.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ public interface IPayOrderCostService
|
||||
* @param billId 计费订单ID,对应 prc_order_bill.bill_id
|
||||
* @return 本次算出的产品、版本、币种和费用明细
|
||||
*/
|
||||
PayOrderCostResult generate(String billId);
|
||||
PayOrderCostResult generate(Long billId);
|
||||
|
||||
/**
|
||||
* 单独提交一票尾程。失败时只回滚这一票,不影响外面的对账单事务。
|
||||
@@ -21,7 +21,7 @@ public interface IPayOrderCostService
|
||||
* @param billId 计费订单ID
|
||||
* @return 本次算出的产品、版本、币种和费用明细
|
||||
*/
|
||||
PayOrderCostResult generateIsolated(String billId);
|
||||
PayOrderCostResult generateIsolated(Long billId);
|
||||
|
||||
/**
|
||||
* 这票订单当前尾程价卡上的归属供应商名称。没有价卡时返回空字符串。
|
||||
@@ -29,5 +29,5 @@ public interface IPayOrderCostService
|
||||
* @param billId 计费订单ID
|
||||
* @return 价卡归属名称
|
||||
*/
|
||||
String cardSupplierName(String billId);
|
||||
String cardSupplierName(Long billId);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface IPrcOrderBillService
|
||||
* @param upstreamRow Oracle TAB_ORDER 整行数据
|
||||
* @return billId
|
||||
*/
|
||||
String syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow);
|
||||
Long syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow);
|
||||
|
||||
/**
|
||||
* 计费无法生成报价时,仍然落库 prc_order_bill 及其扩展表。
|
||||
@@ -59,10 +59,10 @@ public interface IPrcOrderBillService
|
||||
/** 转单号下拉搜索选项(模糊匹配,去重限量,带数据权限) */
|
||||
List<String> listTransferNoOptions(PrcOrderBill query);
|
||||
|
||||
TmsPriceQuoteResult getBill(String billId);
|
||||
TmsPriceQuoteResult getBill(Long billId);
|
||||
|
||||
/** 订单列表弹窗使用的计费失败原因(带数据权限)。 */
|
||||
OrderBillFailReasonVo getBillingFailReason(String billId);
|
||||
OrderBillFailReasonVo getBillingFailReason(Long billId);
|
||||
|
||||
TmsPriceQuoteResult getBillByOrderNo(String orderNo);
|
||||
|
||||
@@ -73,7 +73,7 @@ public interface IPrcOrderBillService
|
||||
TmsPriceQuoteResult updateIncomeFee(UpdateIncomeBillFeeRequest request);
|
||||
|
||||
/** 删除手工录入的 UNBILLED 收入费用;同时刷新应收合计。 */
|
||||
TmsPriceQuoteResult deleteIncomeFee(String feeId);
|
||||
TmsPriceQuoteResult deleteIncomeFee(Long feeId);
|
||||
|
||||
/** 预览批量添加费用命中的账单(带数据权限)。 */
|
||||
BatchAddIncomeBillFeePreview previewBatchAddIncomeFee(BatchAddIncomeBillFeeRequest request);
|
||||
@@ -103,7 +103,7 @@ public interface IPrcOrderBillService
|
||||
* @param billId 订单计费ID
|
||||
* @return 更新后的计费结果
|
||||
*/
|
||||
TmsPriceQuoteResult updateCreditArrearsStatus(String billId);
|
||||
TmsPriceQuoteResult updateCreditArrearsStatus(Long billId);
|
||||
|
||||
/**
|
||||
* 更新 charge_weight(手工覆盖),保留原重量,并重新计费。
|
||||
@@ -112,12 +112,12 @@ public interface IPrcOrderBillService
|
||||
* @param billId 账单 ID
|
||||
* @param chargeWeight 新的计费重量(kg)
|
||||
*/
|
||||
TmsPriceQuoteResult updateChargeWeight(String billId, BigDecimal chargeWeight);
|
||||
TmsPriceQuoteResult updateChargeWeight(Long billId, BigDecimal chargeWeight);
|
||||
|
||||
/**
|
||||
* 更新 charge_weight,不做数据权限校验(供已校验的异步导入使用)。
|
||||
*/
|
||||
TmsPriceQuoteResult updateChargeWeightByBillId(String billId, BigDecimal chargeWeight);
|
||||
TmsPriceQuoteResult updateChargeWeightByBillId(Long billId, BigDecimal chargeWeight);
|
||||
|
||||
/**
|
||||
* 提交 charge_weight 更新的异步导入;返回 taskId。
|
||||
@@ -151,7 +151,7 @@ public interface IPrcOrderBillService
|
||||
* 按模式(PRODUCT/REDLINE)重算并落库 product_amount 或 redline_amount。
|
||||
* 要求 prc_order_bill 已存在;跳过应收可编辑校验。
|
||||
*/
|
||||
void recalcBillPriceByBillId(String billId, String mode);
|
||||
void recalcBillPriceByBillId(Long 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(String billId);
|
||||
TmsPriceQuoteResult rebillLocalByBillId(Long billId);
|
||||
|
||||
/**
|
||||
* 按选中的 billId 或列表筛选条件做异步本地重算。返回 taskId 用于进度轮询。
|
||||
@@ -174,7 +174,7 @@ public interface IPrcOrderBillService
|
||||
BatchAddIncomeBillFeeTask cancelLocalRebill(String taskId);
|
||||
|
||||
/** 本地重算用的带数据权限的 bill_id 列表(筛选条件与订单账单列表一致)。 */
|
||||
List<String> selectBillIdsForLocalRebill(PrcOrderBill query);
|
||||
List<Long> selectBillIdsForLocalRebill(PrcOrderBill query);
|
||||
|
||||
/** 本地重算的带数据权限的数量统计。 */
|
||||
int countBillIdsForLocalRebill(PrcOrderBill query);
|
||||
|
||||
+4
-2
@@ -164,7 +164,8 @@ public class PayBillServiceImpl implements IPayBillService
|
||||
}
|
||||
try
|
||||
{
|
||||
PayOrderCostResult cost = payOrderCostService.generateIsolated(order.getBillId());
|
||||
PayOrderCostResult cost = payOrderCostService.generateIsolated(
|
||||
order.getBillId() == null ? null : Long.valueOf(order.getBillId()));
|
||||
if (cost != null)
|
||||
{
|
||||
versions.put(order.getBillId(), cost.getVersionNo());
|
||||
@@ -1152,7 +1153,8 @@ public class PayBillServiceImpl implements IPayBillService
|
||||
{
|
||||
return "人工费用没有付款对象,未并入";
|
||||
}
|
||||
String card = cards.computeIfAbsent(fee.getBillId(), payOrderCostService::cardSupplierName);
|
||||
String card = cards.computeIfAbsent(fee.getBillId(),
|
||||
id -> payOrderCostService.cardSupplierName(id == null ? null : Long.valueOf(id)));
|
||||
if (card == null || card.isBlank())
|
||||
{
|
||||
return "价卡没有归属供应商,未并入";
|
||||
|
||||
+11
-11
@@ -84,20 +84,20 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
public PayOrderCostResult generateIsolated(String billId)
|
||||
public PayOrderCostResult generateIsolated(Long billId)
|
||||
{
|
||||
return generate(billId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PayOrderCostResult generate(String billId)
|
||||
public PayOrderCostResult generate(Long billId)
|
||||
{
|
||||
if (billId == null || billId.isBlank())
|
||||
if (billId == null)
|
||||
{
|
||||
throw PaymentMesEnum.BMS_PAY_PICK_ORDER.exception();
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
throw PaymentMesEnum.BMS_PAY_ORDER_MISS.exception();
|
||||
@@ -132,25 +132,25 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
}
|
||||
String operator = SecurityUtils.getUsername();
|
||||
PrcPayBill payBill = saveBill(bill, result, operator);
|
||||
saveFees(bill.getBillId(), payBill.getPayBillId(), result.getFees());
|
||||
saveFees(String.valueOf(bill.getBillId()), payBill.getPayBillId(), result.getFees());
|
||||
String channelName = channel.getChannelName() == null ? channel.getChannelCode() : channel.getChannelName();
|
||||
String end = product.getTermEnd() == null ? "不限" : day(product.getTermEnd());
|
||||
result.setMessage("渠道「" + channelName + "」" + product.getProductName() + " 第 " + product.getVersionNo()
|
||||
+ " 版(" + day(product.getTermStart()) + " 至 " + end + ")," + result.getMessage());
|
||||
paySettleSupport.stampCalc(bill.getBillId(), product.getSupplierName());
|
||||
paySettleSupport.stampCalc(String.valueOf(bill.getBillId()), product.getSupplierName());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cardSupplierName(String billId)
|
||||
public String cardSupplierName(Long billId)
|
||||
{
|
||||
if (billId == null || billId.isBlank())
|
||||
if (billId == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
try
|
||||
{
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
return "";
|
||||
@@ -551,12 +551,12 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
*/
|
||||
private PrcPayBill saveBill(PrcOrderBill bill, PayOrderCostResult result, String operator)
|
||||
{
|
||||
PrcPayBill existed = payBillMapper.selectByBillId(bill.getBillId());
|
||||
PrcPayBill existed = payBillMapper.selectByBillId(String.valueOf(bill.getBillId()));
|
||||
PrcPayBill row = existed == null ? new PrcPayBill() : existed;
|
||||
if (existed == null)
|
||||
{
|
||||
row.setPayBillId(UUID.randomUUID().toString());
|
||||
row.setBillId(bill.getBillId());
|
||||
row.setBillId(String.valueOf(bill.getBillId()));
|
||||
row.setCreateBy(operator);
|
||||
}
|
||||
row.setCurrency(result.getCurrency());
|
||||
|
||||
+6
-6
@@ -524,7 +524,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
PrcBillingTask reset = new PrcBillingTask();
|
||||
reset.setTaskId(taskId);
|
||||
reset.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
|
||||
reset.setBillId(null);
|
||||
reset.setOrderId(null);
|
||||
reset.setFailCode(null);
|
||||
reset.setErrorMessage(null);
|
||||
billingTaskMapper.updateBillingResult(reset);
|
||||
@@ -622,7 +622,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
return existed == null ? BillTaskType.PENDING : BillTaskType.REBILL;
|
||||
}
|
||||
|
||||
/** 仅回写 status/billId/failCode/error;入参的 transfer/tracking/order/billTime 保持不变。 */
|
||||
/** 仅回写 status/orderId/failCode/error;入参的 transfer/tracking/order/billTime 保持不变。 */
|
||||
/** 任务无客户编码时优先使用已有账单的客户(REFUND 路径)。 */
|
||||
private void fillCustomerCodeFromBill(PrcBillingTask task, String orderNo)
|
||||
{
|
||||
@@ -635,9 +635,9 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
{
|
||||
bill = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo.trim());
|
||||
}
|
||||
if (bill == null && StringUtils.isNotEmpty(task.getBillId()))
|
||||
if (bill == null && task.getOrderId() != null)
|
||||
{
|
||||
bill = orderBillMapper.selectPrcOrderBillById(task.getBillId());
|
||||
bill = orderBillMapper.selectPrcOrderBillById(task.getOrderId());
|
||||
}
|
||||
if (bill != null && StringUtils.isNotEmpty(bill.getCustomerCode()))
|
||||
{
|
||||
@@ -645,13 +645,13 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
}
|
||||
}
|
||||
|
||||
private void writeback(PrcBillingTask task, BillTaskSuccessStatus status, String billId,
|
||||
private void writeback(PrcBillingTask task, BillTaskSuccessStatus status, Long orderId,
|
||||
String errorMessage, String failCode)
|
||||
{
|
||||
PrcBillingTask upd = new PrcBillingTask();
|
||||
upd.setTaskId(task.getTaskId());
|
||||
upd.setSuccessStatus(status.getCode());
|
||||
upd.setBillId(billId);
|
||||
upd.setOrderId(orderId);
|
||||
if (StringUtils.isNotEmpty(task.getCustomerCode()))
|
||||
{
|
||||
upd.setCustomerCode(task.getCustomerCode());
|
||||
|
||||
+83
-72
@@ -297,7 +297,6 @@ 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;
|
||||
@@ -407,6 +406,24 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
/**
|
||||
* 批量编码归一化:逐个 trim、拆开误传的逗号/分号/空白分隔串、去空去重
|
||||
*/
|
||||
|
||||
private List<Long> normalizeLongIdList(List<Long> ids)
|
||||
{
|
||||
if (ids == null || ids.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
LinkedHashSet<Long> set = new LinkedHashSet<Long>();
|
||||
for (Long id : ids)
|
||||
{
|
||||
if (id != null)
|
||||
{
|
||||
set.add(id);
|
||||
}
|
||||
}
|
||||
return set.isEmpty() ? null : new ArrayList<Long>(set);
|
||||
}
|
||||
|
||||
private List<String> normalizeCodeList(List<String> codes)
|
||||
{
|
||||
if (codes == null || codes.isEmpty())
|
||||
@@ -435,14 +452,14 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
}
|
||||
|
||||
@Override
|
||||
public TmsPriceQuoteResult getBill(String billId)
|
||||
public TmsPriceQuoteResult getBill(Long billId)
|
||||
{
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcOrderBill query = new PrcOrderBill();
|
||||
query.setBillId(billId.trim());
|
||||
query.setBillId(billId);
|
||||
// 走 selectBillList,复用销售员/结算员数据权限,避免越权查详情
|
||||
List<PrcOrderBill> list = self.selectBillList(query);
|
||||
if (list == null || list.isEmpty())
|
||||
@@ -451,19 +468,19 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
}
|
||||
PrcOrderBill bill = list.get(0);
|
||||
return toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()),
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId())));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OrderBillFailReasonVo getBillingFailReason(String billId)
|
||||
public OrderBillFailReasonVo getBillingFailReason(Long billId)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcOrderBill query = new PrcOrderBill();
|
||||
query.setBillId(billId.trim());
|
||||
query.setBillId(billId);
|
||||
List<PrcOrderBill> list = self.selectBillList(query);
|
||||
if (list == null || list.isEmpty())
|
||||
{
|
||||
@@ -680,14 +697,14 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
}
|
||||
return toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()),
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TmsPriceQuoteResult addIncomeFee(AddIncomeBillFeeRequest request)
|
||||
{
|
||||
if (request == null || StringUtils.isEmpty(request.getBillId()))
|
||||
if (request == null || request.getBillId() == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
@@ -695,7 +712,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.fee.scIdRequired"));
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(request.getBillId().trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(request.getBillId());
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
@@ -734,7 +751,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
: surcharge.getRoundMode());
|
||||
existing.setRemark(request.getRemark());
|
||||
existing.setManualFlag("1");
|
||||
if (incomeBill != null && StringUtils.isEmpty(existing.getIncomeBillId()))
|
||||
if (incomeBill != null && existing.getIncomeBillId() == null)
|
||||
{
|
||||
existing.setIncomeBillId(incomeBill.getIncomeBillId());
|
||||
}
|
||||
@@ -743,7 +760,6 @@ 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);
|
||||
@@ -766,11 +782,11 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TmsPriceQuoteResult updateIncomeFee(UpdateIncomeBillFeeRequest request)
|
||||
{
|
||||
if (request == null || StringUtils.isEmpty(request.getFeeId()))
|
||||
if (request == null || request.getFeeId() == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.fee.idRequired"));
|
||||
}
|
||||
PrcIncomeBillFee fee = requireEditableManualFee(request.getFeeId().trim());
|
||||
PrcIncomeBillFee fee = requireEditableManualFee(request.getFeeId());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(fee.getBillId());
|
||||
if (bill == null)
|
||||
{
|
||||
@@ -813,13 +829,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TmsPriceQuoteResult deleteIncomeFee(String feeId)
|
||||
public TmsPriceQuoteResult deleteIncomeFee(Long feeId)
|
||||
{
|
||||
if (StringUtils.isEmpty(feeId))
|
||||
if (feeId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.fee.idRequired"));
|
||||
}
|
||||
PrcIncomeBillFee fee = requireEditableManualFee(feeId.trim());
|
||||
PrcIncomeBillFee fee = requireEditableManualFee(feeId);
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(fee.getBillId());
|
||||
if (bill == null)
|
||||
{
|
||||
@@ -858,10 +874,10 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
throw new ServiceException(MessageUtils.message("price.bill.fee.batch.tooMany",
|
||||
Integer.valueOf(BATCH_ADD_FEE_MAX)));
|
||||
}
|
||||
List<String> billIds = new ArrayList<String>();
|
||||
List<Long> billIds = new ArrayList<Long>();
|
||||
for (PrcOrderBill bill : bills)
|
||||
{
|
||||
if (bill != null && StringUtils.isNotEmpty(bill.getBillId()))
|
||||
if (bill != null && bill.getBillId() != null)
|
||||
{
|
||||
billIds.add(bill.getBillId());
|
||||
}
|
||||
@@ -913,10 +929,10 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
throw new ServiceException(MessageUtils.message("price.bill.recalc.tooMany",
|
||||
Integer.valueOf(RECALC_PRICE_MAX)));
|
||||
}
|
||||
List<String> billIds = new ArrayList<String>();
|
||||
List<Long> billIds = new ArrayList<Long>();
|
||||
for (PrcOrderBill bill : bills)
|
||||
{
|
||||
if (bill != null && StringUtils.isNotEmpty(bill.getBillId()))
|
||||
if (bill != null && bill.getBillId() != null)
|
||||
{
|
||||
billIds.add(bill.getBillId());
|
||||
}
|
||||
@@ -944,14 +960,14 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void recalcBillPriceByBillId(String billId, String mode)
|
||||
public void recalcBillPriceByBillId(Long billId, String mode)
|
||||
{
|
||||
boolean productMode = "PRODUCT".equals(normalizeRecalcMode(mode));
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
@@ -980,13 +996,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
* 其他情况走正常的 {@link #bill}。
|
||||
*/
|
||||
@Override
|
||||
public TmsPriceQuoteResult rebillLocalByBillId(String billId)
|
||||
public TmsPriceQuoteResult rebillLocalByBillId(Long billId)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
@@ -1012,7 +1028,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return refundLocalWithDbRetry(bill.getOrderNo().trim());
|
||||
}
|
||||
TmsPriceBillRequest req = buildBillRequestFromBill(bill);
|
||||
return billLocalWithDbRetry(billId.trim(), req);
|
||||
return billLocalWithDbRetry(billId, req);
|
||||
}
|
||||
|
||||
/** order_status 为 9/10 或 refund_status=REFUNDED。 */
|
||||
@@ -1029,9 +1045,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return BillRefundStatus.REFUNDED.getCode().equalsIgnoreCase(bill.getRefundStatus());
|
||||
}
|
||||
|
||||
private boolean hasRefundFeeLine(String billId)
|
||||
private boolean hasRefundFeeLine(Long billId)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1050,7 +1066,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return false;
|
||||
}
|
||||
|
||||
private TmsPriceQuoteResult billLocalWithDbRetry(String billId, TmsPriceBillRequest billReq)
|
||||
private TmsPriceQuoteResult billLocalWithDbRetry(Long billId, TmsPriceBillRequest billReq)
|
||||
{
|
||||
RuntimeException last = null;
|
||||
for (int attempt = 1; attempt <= LOCAL_REBILL_DB_RETRY_MAX; attempt++)
|
||||
@@ -1170,7 +1186,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
Integer.valueOf(LOCAL_REBILL_MAX)));
|
||||
}
|
||||
// 仅取 ID:大数据量任务避免加载完整的 prc_order_bill 行。
|
||||
List<String> billIds = self.selectBillIdsForLocalRebill(query);
|
||||
List<Long> billIds = self.selectBillIdsForLocalRebill(query);
|
||||
if (billIds == null || billIds.isEmpty())
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.recalc.noMatch"));
|
||||
@@ -1292,15 +1308,15 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "su", userField = "user_id", permission = "price:billing:bill")
|
||||
public List<String> selectBillIdsForLocalRebill(PrcOrderBill query)
|
||||
public List<Long> selectBillIdsForLocalRebill(PrcOrderBill query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
return new ArrayList<String>();
|
||||
return new ArrayList<Long>();
|
||||
}
|
||||
normalizeLocalRebillQuery(query);
|
||||
List<String> ids = orderBillMapper.selectPrcOrderBillIds(query);
|
||||
return ids == null ? new ArrayList<String>() : ids;
|
||||
List<Long> ids = orderBillMapper.selectPrcOrderBillIds(query);
|
||||
return ids == null ? new ArrayList<Long>() : ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1321,7 +1337,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
PrcOrderBill query = new PrcOrderBill();
|
||||
if ("SELECTED".equals(scopeMode))
|
||||
{
|
||||
List<String> billIds = normalizeCodeList(request.getBillIds());
|
||||
List<Long> billIds = normalizeLongIdList(request.getBillIds());
|
||||
if (billIds == null || billIds.isEmpty())
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.recalc.selectedRequired"));
|
||||
@@ -1400,7 +1416,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
query.setTrackingNos(normalizeCodeList(query.getTrackingNos()));
|
||||
query.setTransferNos(normalizeCodeList(query.getTransferNos()));
|
||||
query.setOrderIdentifiers(normalizeOrderIdentifiers(query.getOrderIdentifiers()));
|
||||
query.setBillIds(normalizeCodeList(query.getBillIds()));
|
||||
query.setBillIds(normalizeLongIdList(query.getBillIds()));
|
||||
}
|
||||
|
||||
private static String normalizeRecalcMode(String mode)
|
||||
@@ -1421,7 +1437,6 @@ 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()));
|
||||
@@ -1507,7 +1522,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
* scopeMode:SELECTED 使用 billIds;ALL 使用筛选条件(至少需要一个)。
|
||||
* 仅传 orderStatuses 不算有效筛选(与导出规则一致)。
|
||||
*/
|
||||
private List<PrcOrderBill> resolveListScopedBills(String scopeModeRaw, List<String> billIdsRaw,
|
||||
private List<PrcOrderBill> resolveListScopedBills(String scopeModeRaw, List<Long> 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,
|
||||
@@ -1556,7 +1571,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
PrcOrderBill query = new PrcOrderBill();
|
||||
if ("SELECTED".equals(scopeMode))
|
||||
{
|
||||
List<String> billIds = normalizeCodeList(billIdsRaw);
|
||||
List<Long> billIds = normalizeLongIdList(billIdsRaw);
|
||||
if (billIds == null || billIds.isEmpty())
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message(msgSelected));
|
||||
@@ -1624,7 +1639,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return surcharge;
|
||||
}
|
||||
|
||||
private PrcIncomeBillFee requireEditableManualFee(String feeId)
|
||||
private PrcIncomeBillFee requireEditableManualFee(Long feeId)
|
||||
{
|
||||
PrcIncomeBillFee fee = incomeBillFeeMapper.selectByFeeId(feeId);
|
||||
if (fee == null)
|
||||
@@ -1691,7 +1706,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
bill.setRefundStatus(refundStatus);
|
||||
orderBillMapper.updatePrcOrderBill(bill);
|
||||
orderBillMapper.refreshArBillStatusByBillIds(Arrays.asList(bill.getBillId()));
|
||||
return toResult(bill, fees, payBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||
return toResult(bill, fees, payBillFeeMapper.selectByBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId())));
|
||||
}
|
||||
|
||||
private static String resolveRefundStatus(List<PrcIncomeBillFee> fees)
|
||||
@@ -1832,13 +1847,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TmsPriceQuoteResult updateCreditArrearsStatus(String billId)
|
||||
public TmsPriceQuoteResult updateCreditArrearsStatus(Long billId)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
@@ -1868,7 +1883,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
bill.setCreditArrearsStatus(normal);
|
||||
saveManualArrearsUpdateEsLog(bill, true, null);
|
||||
return toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()),
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId())));
|
||||
}
|
||||
|
||||
private void saveManualArrearsUpdateEsLog(PrcOrderBill bill, boolean success, String errorMessage)
|
||||
@@ -2001,7 +2016,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
PrcOrderBill bill = existed == null ? new PrcOrderBill() : existed;
|
||||
if (existed == null)
|
||||
{
|
||||
bill.setBillId(UUID.randomUUID().toString());
|
||||
// billId filled by useGeneratedKeys after insert
|
||||
}
|
||||
bill.setBillKey(billKey);
|
||||
bill.setOrderNo(orderNo);
|
||||
@@ -2236,9 +2251,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
* 丢弃在 uk_bill_fee_item(bill_id, fee_type, sc_id)上与保留的人工行冲突的自动费用行。
|
||||
* 重算时以人工费用优先。
|
||||
*/
|
||||
private List<PrcIncomeBillFee> filterAutoFeesAgainstManual(String billId, List<PrcIncomeBillFee> autoFees)
|
||||
private List<PrcIncomeBillFee> filterAutoFeesAgainstManual(Long billId, List<PrcIncomeBillFee> autoFees)
|
||||
{
|
||||
if (autoFees == null || autoFees.isEmpty() || StringUtils.isEmpty(billId))
|
||||
if (autoFees == null || autoFees.isEmpty() || billId == null)
|
||||
{
|
||||
return autoFees == null ? new ArrayList<PrcIncomeBillFee>() : autoFees;
|
||||
}
|
||||
@@ -2439,7 +2454,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
|
||||
private boolean isAlreadyInArBill(PrcOrderBill existed)
|
||||
{
|
||||
if (existed == null || StringUtils.isEmpty(existed.getBillId()))
|
||||
if (existed == null || existed.getBillId() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -2462,7 +2477,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return v == null ? BigDecimal.ZERO : v;
|
||||
}
|
||||
|
||||
private List<PrcIncomeBillFee> toFeeRows(String billId, String incomeBillId, TmsPriceQuoteResult result)
|
||||
private List<PrcIncomeBillFee> toFeeRows(Long billId, Long incomeBillId, TmsPriceQuoteResult result)
|
||||
{
|
||||
List<PrcIncomeBillFee> fees = new ArrayList<PrcIncomeBillFee>();
|
||||
if (result.getFeeDetails() == null)
|
||||
@@ -2472,7 +2487,6 @@ 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());
|
||||
@@ -2494,7 +2508,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
/** 应收主表与订单计费一对一落库;销售价=套餐计费,产品价=产品目录价,红线价=红线目录价(含 REDLINE 附加费)。 */
|
||||
private PrcIncomeBill persistIncomeBill(PrcOrderBill bill, TmsPriceQuoteResult result)
|
||||
{
|
||||
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||
if (bill == null || bill.getBillId() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -2503,7 +2517,6 @@ 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());
|
||||
}
|
||||
@@ -2560,16 +2573,16 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
/** 应付主表与订单计费一对一落库;product_amount 取产品目录价、redline_amount 取红线价;应付/成本价留空待接入真实成本源。 */
|
||||
private PrcPayBill persistPayBill(PrcOrderBill bill, TmsPriceQuoteResult result)
|
||||
{
|
||||
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||
if (bill == null || bill.getBillId() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
PrcPayBill existed = payBillMapper.selectByBillId(bill.getBillId());
|
||||
PrcPayBill existed = payBillMapper.selectByBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId()));
|
||||
PrcPayBill row = existed == null ? new PrcPayBill() : existed;
|
||||
if (existed == null)
|
||||
{
|
||||
row.setPayBillId(UUID.randomUUID().toString());
|
||||
row.setBillId(bill.getBillId());
|
||||
row.setBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId()));
|
||||
row.setCreateBy(bill.getCreateBy());
|
||||
}
|
||||
row.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
|
||||
@@ -2655,7 +2668,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 || StringUtils.isEmpty(bill.getBillId()))
|
||||
if (bill == null || bill.getBillId() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2792,26 +2805,26 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TmsPriceQuoteResult updateChargeWeight(String billId, BigDecimal chargeWeight)
|
||||
public TmsPriceQuoteResult updateChargeWeight(Long billId, BigDecimal chargeWeight)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
// 通过列表查询做数据范围校验
|
||||
self.getBill(billId.trim());
|
||||
return self.updateChargeWeightByBillId(billId.trim(), chargeWeight);
|
||||
self.getBill(billId);
|
||||
return self.updateChargeWeightByBillId(billId, chargeWeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TmsPriceQuoteResult updateChargeWeightByBillId(String billId, BigDecimal chargeWeight)
|
||||
public TmsPriceQuoteResult updateChargeWeightByBillId(Long billId, BigDecimal chargeWeight)
|
||||
{
|
||||
if (StringUtils.isEmpty(billId))
|
||||
if (billId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.billIdRequired"));
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
@@ -3058,7 +3071,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return rows;
|
||||
}
|
||||
|
||||
private TmsPriceQuoteResult toResult(String billId)
|
||||
private TmsPriceQuoteResult toResult(Long billId)
|
||||
{
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId);
|
||||
if (bill == null)
|
||||
@@ -3066,7 +3079,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
throw new ServiceException(MessageUtils.message("price.bill.notFound"));
|
||||
}
|
||||
return toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()),
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||
payBillFeeMapper.selectByBillId(bill.getBillId() == null ? null : String.valueOf(bill.getBillId())));
|
||||
}
|
||||
|
||||
/** 存在上游 Oracle 行 => 同步/计费路径会同时覆盖 weight 与 charge_weight。 */
|
||||
@@ -3220,7 +3233,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
return name;
|
||||
}
|
||||
if (StringUtils.isEmpty(bill.getBillId()) || orderBillExtMapper == null)
|
||||
if (bill.getBillId() == null || orderBillExtMapper == null)
|
||||
{
|
||||
return StringUtils.isNotEmpty(name) ? name : null;
|
||||
}
|
||||
@@ -3264,7 +3277,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow)
|
||||
public Long syncUpstreamOverwrite(java.util.Map<String, Object> upstreamRow)
|
||||
{
|
||||
if (upstreamRow == null || upstreamRow.isEmpty())
|
||||
{
|
||||
@@ -3312,7 +3325,6 @@ 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,7 +3442,6 @@ 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());
|
||||
}
|
||||
|
||||
+19
-1
@@ -90,7 +90,25 @@ public class PrcPayBillFeeServiceImpl implements IPrcPayBillFeeService
|
||||
payBillMapper.insertMissingPayBills(chunk, operator);
|
||||
payBillFeeMapper.bindPayBillId(chunk);
|
||||
payBillMapper.refreshPayTotal(chunk);
|
||||
orderBillMapper.refreshPayTotalFromFees(chunk);
|
||||
List<Long> longIds = new ArrayList<>(chunk.size());
|
||||
for (String id : chunk)
|
||||
{
|
||||
if (id == null || id.isBlank())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
longIds.add(Long.valueOf(id.trim()));
|
||||
}
|
||||
catch (NumberFormatException ignore)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (!longIds.isEmpty())
|
||||
{
|
||||
orderBillMapper.refreshPayTotalFromFees(longIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ public class PrcBatchAddIncomeFeeAsyncRunner
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Async("threadPoolTaskExecutor")
|
||||
public void run(String taskId, List<String> billIds, Long scId, String feeType, BigDecimal amount,
|
||||
public void run(String taskId, List<Long> 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++)
|
||||
{
|
||||
String billId = billIds.get(i);
|
||||
Long billId = billIds.get(i);
|
||||
try
|
||||
{
|
||||
AddIncomeBillFeeRequest req = new AddIncomeBillFeeRequest();
|
||||
|
||||
+4
-4
@@ -200,7 +200,7 @@ public class PrcChargeWeightImportAsyncRunner
|
||||
public static class ChargeWeightImportWorkItem implements java.io.Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String billId;
|
||||
private Long billId;
|
||||
private String orderNo;
|
||||
private BigDecimal chargeWeight;
|
||||
|
||||
@@ -208,19 +208,19 @@ public class PrcChargeWeightImportAsyncRunner
|
||||
{
|
||||
}
|
||||
|
||||
public ChargeWeightImportWorkItem(String billId, String orderNo, BigDecimal chargeWeight)
|
||||
public ChargeWeightImportWorkItem(Long billId, String orderNo, BigDecimal chargeWeight)
|
||||
{
|
||||
this.billId = billId;
|
||||
this.orderNo = orderNo;
|
||||
this.chargeWeight = chargeWeight;
|
||||
}
|
||||
|
||||
public String getBillId()
|
||||
public Long getBillId()
|
||||
{
|
||||
return billId;
|
||||
}
|
||||
|
||||
public void setBillId(String billId)
|
||||
public void setBillId(Long billId)
|
||||
{
|
||||
this.billId = billId;
|
||||
}
|
||||
|
||||
+21
-11
@@ -74,13 +74,13 @@ public class PrcOrderBillLocalRebillAsyncRunner
|
||||
private PrcOrderBillMapper orderBillMapper;
|
||||
|
||||
@Async("threadPoolTaskExecutor")
|
||||
public void run(String taskId, List<String> billIds)
|
||||
public void run(String taskId, List<Long> billIds)
|
||||
{
|
||||
run(taskId, billIds, null);
|
||||
}
|
||||
|
||||
@Async("threadPoolTaskExecutor")
|
||||
public void run(String taskId, List<String> billIds, LocalRebillRequest request)
|
||||
public void run(String taskId, List<Long> 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<String> ids = billIds;
|
||||
final List<Long> 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;
|
||||
}
|
||||
String one = ids.get(i);
|
||||
Long one = ids.get(i);
|
||||
try
|
||||
{
|
||||
TmsPriceQuoteResult result = orderBillService.rebillLocalByBillId(one);
|
||||
@@ -131,10 +131,10 @@ public class PrcOrderBillLocalRebillAsyncRunner
|
||||
{
|
||||
fail.incrementAndGet();
|
||||
String tip = softFailMessage(result);
|
||||
String transferLabel = failTransferLabel(one,
|
||||
String transferLabel = failTransferLabel(String.valueOf(one),
|
||||
result == null ? null : result.getTransferNo());
|
||||
appendFail(failTips, transferLabel, tip);
|
||||
collectFailDetail(failDetails, one, tip);
|
||||
collectFailDetail(failDetails, String.valueOf(one), tip);
|
||||
log.warn("local rebill soft-fail taskId={} billId={} transferNo={} status={} msg={}",
|
||||
taskId, one, transferLabel,
|
||||
result == null ? null : result.getBillingFailStatus(), tip);
|
||||
@@ -147,9 +147,9 @@ public class PrcOrderBillLocalRebillAsyncRunner
|
||||
catch (Exception e)
|
||||
{
|
||||
fail.incrementAndGet();
|
||||
String transferLabel = failTransferLabel(one, null);
|
||||
String transferLabel = failTransferLabel(String.valueOf(one), null);
|
||||
appendFail(failTips, transferLabel, e);
|
||||
collectFailDetail(failDetails, one, e);
|
||||
collectFailDetail(failDetails, String.valueOf(one), e);
|
||||
log.warn("local rebill failed taskId={} billId={} transferNo={} msg={}",
|
||||
taskId, one, transferLabel, e.getMessage());
|
||||
}
|
||||
@@ -293,8 +293,18 @@ public class PrcOrderBillLocalRebillAsyncRunner
|
||||
String trackingNo = null;
|
||||
try
|
||||
{
|
||||
PrcOrderBill bill = orderBillMapper == null || StringUtils.isEmpty(billId)
|
||||
? null : orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = null;
|
||||
if (orderBillMapper != null && StringUtils.isNotEmpty(billId))
|
||||
{
|
||||
try
|
||||
{
|
||||
bill = orderBillMapper.selectPrcOrderBillById(Long.valueOf(billId.trim()));
|
||||
}
|
||||
catch (NumberFormatException ignore)
|
||||
{
|
||||
bill = null;
|
||||
}
|
||||
}
|
||||
if (bill != null)
|
||||
{
|
||||
orderNo = bill.getOrderNo();
|
||||
@@ -487,7 +497,7 @@ public class PrcOrderBillLocalRebillAsyncRunner
|
||||
}
|
||||
try
|
||||
{
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(billId.trim());
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillById(Long.valueOf(billId.trim()));
|
||||
if (bill != null)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(bill.getTransferNo()))
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ public class PrcRecalcBillPriceAsyncRunner
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Async("threadPoolTaskExecutor")
|
||||
public void run(String taskId, String mode, List<String> billIds)
|
||||
public void run(String taskId, String mode, List<Long> 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++)
|
||||
{
|
||||
String billId = billIds.get(i);
|
||||
Long 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, String billId, Exception e)
|
||||
private static void appendFail(StringBuilder failTips, Long billId, Exception e)
|
||||
{
|
||||
if (failTips.length() >= 800)
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ public class TabOrderSyncAsyncRunner
|
||||
item.put("transferOrderId", vo == null ? null : vo.getTransferOrderId());
|
||||
try
|
||||
{
|
||||
String billId = overwriteOne(one);
|
||||
Long billId = overwriteOne(one);
|
||||
item.put("successStatus", "SUCCESS");
|
||||
item.put("billId", billId);
|
||||
ok.incrementAndGet();
|
||||
@@ -317,7 +317,7 @@ public class TabOrderSyncAsyncRunner
|
||||
}
|
||||
|
||||
/** 解析出 Oracle 行后覆盖本地账单及其扩展信息(不计费)。 */
|
||||
private String overwriteOne(com.bms.price.oracle.TabOrderRow row)
|
||||
private Long overwriteOne(com.bms.price.oracle.TabOrderRow row)
|
||||
{
|
||||
Map<String, Object> raw = row == null ? null : row.getRaw();
|
||||
TabOrderMonitorVo vo = row == null ? null : row.getVo();
|
||||
|
||||
@@ -5,8 +5,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.bms.common.core.redis.RedisCache;
|
||||
@@ -15,14 +13,12 @@ import com.bms.price.migration.domain.UuidToNewBatchResult;
|
||||
import com.bms.price.migration.service.IUuidToNewSyncService;
|
||||
|
||||
/**
|
||||
* UUID 阴影同步运行器:监控页开关控制;
|
||||
* 开启后跑批;全失败会退避并自动关闭,避免把库打满。
|
||||
* 开关/线程/批次落 Redis,服务重启后按 Redis 状态恢复。
|
||||
* 抓取游标由 SyncService 维护(bms:mig:uuid-to-new:cursor-time / cursor-bill-id)。
|
||||
* UUID 阴影同步运行器:已默认停用(bms.mig.uuid-to-new.enabled=false)。
|
||||
* 不再实现 ApplicationRunner;setEnabled(true) 为 no-op,避免误开同步。
|
||||
*/
|
||||
@Component
|
||||
@Order(100)
|
||||
public class UuidToNewSyncRunner implements ApplicationRunner
|
||||
public class UuidToNewSyncRunner
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(UuidToNewSyncRunner.class);
|
||||
|
||||
@@ -62,23 +58,20 @@ public class UuidToNewSyncRunner implements ApplicationRunner
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开:立即启动连续批循环;关闭:标记停止(当前批跑完)。
|
||||
* 同步落 Redis,供重启恢复。
|
||||
* Enabling is disabled after Long PK cutover; only OFF is accepted.
|
||||
*/
|
||||
public synchronized void setEnabled(boolean enabled)
|
||||
{
|
||||
wantRun.set(enabled);
|
||||
persistEnabled(enabled);
|
||||
if (enabled)
|
||||
{
|
||||
consecutiveAllFail.set(0);
|
||||
persistRuntimeConfig();
|
||||
startLoopIfNeeded();
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info("uuid-to-new switch OFF, will stop after current batch");
|
||||
log.warn("uuid-to-new enable refused: migration runner disabled after Long PK cutover");
|
||||
wantRun.set(false);
|
||||
persistEnabled(false);
|
||||
return;
|
||||
}
|
||||
wantRun.set(false);
|
||||
persistEnabled(false);
|
||||
log.info("uuid-to-new switch OFF, will stop after current batch");
|
||||
}
|
||||
|
||||
/** 将当前线程/批次写入 Redis(无过期) */
|
||||
@@ -115,107 +108,9 @@ public class UuidToNewSyncRunner implements ApplicationRunner
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args)
|
||||
{
|
||||
restoreFromRedis();
|
||||
}
|
||||
|
||||
/** 启动时从 Redis 恢复线程/批次与开关 */
|
||||
private void restoreFromRedis()
|
||||
{
|
||||
if (redisCache == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
Object threadObj = redisCache.getCacheObject(REDIS_KEY_THREAD_COUNT);
|
||||
Object batchObj = redisCache.getCacheObject(REDIS_KEY_BATCH_SIZE);
|
||||
if (properties != null)
|
||||
{
|
||||
Integer threads = toInteger(threadObj);
|
||||
if (threads != null)
|
||||
{
|
||||
properties.setThreadCount(threads.intValue());
|
||||
}
|
||||
Integer batch = toInteger(batchObj);
|
||||
if (batch != null)
|
||||
{
|
||||
properties.setBatchSize(batch.intValue());
|
||||
}
|
||||
}
|
||||
Object enabledObj = redisCache.getCacheObject(REDIS_KEY_ENABLED);
|
||||
boolean on = toBoolean(enabledObj);
|
||||
if (on)
|
||||
{
|
||||
log.info("uuid-to-new restore from redis: enabled=true, threads={}, batch={}",
|
||||
properties == null ? null : properties.resolvedThreadCount(),
|
||||
properties == null ? null : properties.resolvedBatchSize());
|
||||
wantRun.set(true);
|
||||
consecutiveAllFail.set(0);
|
||||
startLoopIfNeeded();
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info("uuid-to-new restore from redis: enabled=false");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warn("uuid-to-new restore from redis failed: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean toBoolean(Object v)
|
||||
{
|
||||
if (v == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (v instanceof Boolean)
|
||||
{
|
||||
return ((Boolean) v).booleanValue();
|
||||
}
|
||||
if (v instanceof Number)
|
||||
{
|
||||
return ((Number) v).intValue() != 0;
|
||||
}
|
||||
return "true".equalsIgnoreCase(String.valueOf(v).trim())
|
||||
|| "1".equals(String.valueOf(v).trim());
|
||||
}
|
||||
|
||||
private static Integer toInteger(Object v)
|
||||
{
|
||||
if (v == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (v instanceof Number)
|
||||
{
|
||||
return Integer.valueOf(((Number) v).intValue());
|
||||
}
|
||||
try
|
||||
{
|
||||
return Integer.valueOf(String.valueOf(v).trim());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void startLoopIfNeeded()
|
||||
{
|
||||
if (!loopActive.compareAndSet(false, true))
|
||||
{
|
||||
log.info("uuid-to-new loop already running");
|
||||
return;
|
||||
}
|
||||
Thread t = new Thread(this::runLoop, "uuid-to-new-sync");
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
log.info("uuid-to-new loop started");
|
||||
log.warn("uuid-to-new startLoop ignored: runner disabled after Long PK cutover");
|
||||
}
|
||||
|
||||
private void runLoop()
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ArBillGenerateTask implements Serializable {
|
||||
/**
|
||||
* 按 bill_id 字典序处理的游标。
|
||||
*/
|
||||
private String lastSourceBillId;
|
||||
private Long lastSourceBillId;
|
||||
/**
|
||||
* 待处理总数;全选模式统计完成前使用 -1。
|
||||
*/
|
||||
|
||||
+2
-2
@@ -29,11 +29,11 @@ public class ArBillGenerateRequest
|
||||
/** 截止日筛选字段:BIZ_DATE=计费时间,PICKUP_DATE=收货时间;历史任务默认计费时间。 */
|
||||
private String dateType = "BIZ_DATE";
|
||||
/** 手动模式选中的来源订单 ID;全选模式为空。 */
|
||||
private List<String> sourceBillIds;
|
||||
private List<Long> sourceBillIds;
|
||||
/** 选择模式:EXPLICIT 手动选择,ALL_MATCHED 全选查询结果。 */
|
||||
private String selectionMode = ArBillSelectionMode.EXPLICIT.getCode();
|
||||
/** 全选模式中用户明确排除的来源订单 ID。 */
|
||||
private List<String> excludedSourceBillIds;
|
||||
private List<Long> 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<String> sourceBillIds);
|
||||
@Param("sourceBillIds") List<Long> sourceBillIds);
|
||||
|
||||
List<ArBillDetail> selectExportPage(@Param("arBillId") Long arBillId,
|
||||
@Param("lastDetailNo") Integer lastDetailNo, @Param("pageSize") Integer pageSize);
|
||||
|
||||
+1
-1
@@ -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") String lastSourceBillId,
|
||||
int updateProgress(@Param("taskId") Long taskId, @Param("lastSourceBillId") Long 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<String> sourceIds);
|
||||
int countCustomerSourceBills(@Param("customerId") Long customerId, @Param("sourceIds") List<Long> sourceIds);
|
||||
|
||||
int countAccessibleBill(@Param("arBillId") Long arBillId, @Param("scope") ArBillRowScope scope);
|
||||
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ public class ArBillScopeResolver {
|
||||
return mapper.selectCustomerOptions(values, resolve());
|
||||
}
|
||||
|
||||
public void requireCustomerSourceBills(Long customerId, List<String> sourceIds) {
|
||||
public void requireCustomerSourceBills(Long customerId, List<Long> sourceIds) {
|
||||
if (!sourceIds.isEmpty() && withoutPagination(() -> mapper.countCustomerSourceBills(customerId, sourceIds)) != sourceIds.size()) {
|
||||
throw new ServiceException("所选订单不存在或不属于当前客户");
|
||||
}
|
||||
|
||||
+20
-20
@@ -419,8 +419,8 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
}
|
||||
String selectionMode = selectionModeEnum.getCode();
|
||||
boolean allMatched = selectionModeEnum == ArBillSelectionMode.ALL_MATCHED;
|
||||
List<String> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
|
||||
List<String> excludedSourceBillIds = normalizeSourceBillIds(request.getExcludedSourceBillIds());
|
||||
List<Long> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
|
||||
List<Long> 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<String> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
|
||||
List<String> excludedSourceBillIds = normalizeSourceBillIds(request.getExcludedSourceBillIds());
|
||||
List<Long> sourceBillIds = normalizeSourceBillIds(request.getSourceBillIds());
|
||||
List<Long> 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<String> sourceBillIds, List<String> excludedSourceBillIds,
|
||||
List<Long> sourceBillIds, List<Long> excludedSourceBillIds,
|
||||
List<String> excludedOrderIdentifiers) {
|
||||
ArBillSelectionMode selectionMode = ArBillSelectionMode.of(task.getSelectionMode());
|
||||
if (selectionMode == null) {
|
||||
throw new ServiceException("账单生成任务的订单选择模式无效");
|
||||
}
|
||||
List<String> explicitIds = selectionMode == ArBillSelectionMode.EXPLICIT
|
||||
List<Long> 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<String> currentSourceBillIds = new ArrayList<>();
|
||||
List<Long> 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<String, PrcIncomeBill> sourceIncomeBillsByBillId = new HashMap<>();
|
||||
Map<Long, 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<String, Integer> sourceFeeCounts = new HashMap<>();
|
||||
List<String> sourceFeeIds = new ArrayList<>(sourceFees.size());
|
||||
Map<Long, Integer> sourceFeeCounts = new HashMap<>();
|
||||
List<Long> sourceFeeIds = new ArrayList<>(sourceFees.size());
|
||||
for (PrcIncomeBillFee sourceFee : sourceFees) {
|
||||
sourceFeeCounts.merge(sourceFee.getBillId(), 1, Integer::sum);
|
||||
sourceFeeIds.add(sourceFee.getFeeId());
|
||||
@@ -862,10 +862,10 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
}
|
||||
|
||||
List<ArBillDetailFee> detailFees = new ArrayList<>(sourceFees == null ? 0 : sourceFees.size());
|
||||
Map<String, Integer> feeNumbers = new HashMap<>();
|
||||
Map<Long, Integer> feeNumbers = new HashMap<>();
|
||||
if (sourceFees != null) {
|
||||
for (PrcIncomeBillFee sourceFee : sourceFees) {
|
||||
ArBillDetail detail = detailsBySourceBill.get(sourceFee.getBillId());
|
||||
ArBillDetail detail = detailsBySourceBill.get(String.valueOf(sourceFee.getBillId()));
|
||||
if (detail == null) {
|
||||
throw new ServiceException("来源费用找不到对应的账单明细:" + 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());
|
||||
String lastSourceBillId = sources.get(sources.size() - 1).getBillId();
|
||||
Long lastSourceBillId = sources.get(sources.size() - 1).getBillId();
|
||||
if (generateTaskMapper.updateProgress(task.getTaskId(), lastSourceBillId, processedCount,
|
||||
processedCount, totalAmount, new Date()) != 1) {
|
||||
throw new ServiceException("账单生成任务状态已发生变化,请稍后重试");
|
||||
@@ -1268,7 +1268,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
int detailNo, String operator) {
|
||||
ArBillDetail detail = new ArBillDetail();
|
||||
detail.setArBillId(bill.getArBillId());
|
||||
detail.setPrcOrderBillId(source.getBillId());
|
||||
detail.setPrcOrderBillId(String.valueOf(source.getBillId()));
|
||||
detail.setDetailNo(detailNo);
|
||||
detail.setOrderNo(source.getOrderNo());
|
||||
detail.setTrackingNo(source.getTrackingNo());
|
||||
@@ -1304,7 +1304,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
private ArBillDetailFee toDetailFee(ArBillDetail detail, PrcIncomeBillFee source, int feeNo, String operator) {
|
||||
ArBillDetailFee fee = new ArBillDetailFee();
|
||||
fee.setDetailId(detail.getDetailId());
|
||||
fee.setPrcIncomeBillFeeId(source.getFeeId());
|
||||
fee.setPrcIncomeBillFeeId(String.valueOf(source.getFeeId()));
|
||||
fee.setFeeNo(feeNo);
|
||||
fee.setFeeType(source.getFeeType());
|
||||
fee.setFeeName(source.getFeeName());
|
||||
@@ -2312,12 +2312,12 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
return type.getCode();
|
||||
}
|
||||
|
||||
private List<String> normalizeSourceBillIds(List<String> sourceBillIds) {
|
||||
LinkedHashSet<String> uniqueIds = new LinkedHashSet<>();
|
||||
private List<Long> normalizeSourceBillIds(List<Long> sourceBillIds) {
|
||||
LinkedHashSet<Long> uniqueIds = new LinkedHashSet<>();
|
||||
if (sourceBillIds != null) {
|
||||
for (String billId : sourceBillIds) {
|
||||
if (!StringUtils.isEmpty(billId) && billId.trim().length() <= 36) {
|
||||
uniqueIds.add(billId.trim());
|
||||
for (Long billId : sourceBillIds) {
|
||||
if (billId != null) {
|
||||
uniqueIds.add(billId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="billType" column="bill_type" />
|
||||
<result property="successStatus" column="success_status" />
|
||||
<result property="billTime" column="bill_time" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="failCode" column="fail_code" />
|
||||
<result property="errorMessage" column="error_message" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectPrcBillingTaskVo">
|
||||
select task_id, transfer_no, tracking_no, order_no, customer_code, bill_type, success_status,
|
||||
bill_time, bill_id, fail_code, error_message, create_by, create_time, update_by, update_time
|
||||
bill_time, order_id, fail_code, error_message, create_by, create_time, update_by, update_time
|
||||
from prc_billing_task
|
||||
</sql>
|
||||
|
||||
@@ -111,10 +111,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertPrcBillingTask" parameterType="PrcBillingTask" useGeneratedKeys="true" keyProperty="taskId">
|
||||
insert into prc_billing_task (
|
||||
transfer_no, tracking_no, order_no, customer_code, bill_type, success_status,
|
||||
bill_time, bill_id, fail_code, error_message, create_by, create_time
|
||||
bill_time, order_id, fail_code, error_message, create_by, create_time
|
||||
) values (
|
||||
#{transferNo}, #{trackingNo}, #{orderNo}, #{customerCode}, #{billType}, #{successStatus},
|
||||
#{billTime}, #{billId}, #{failCode}, #{errorMessage}, #{createBy}, sysdate()
|
||||
#{billTime}, #{orderId}, #{failCode}, #{errorMessage}, #{createBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -128,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="billType != null">bill_type = #{billType},</if>
|
||||
<if test="successStatus != null">success_status = #{successStatus},</if>
|
||||
<if test="billTime != null">bill_time = #{billTime},</if>
|
||||
<if test="billId != null">bill_id = #{billId},</if>
|
||||
<if test="orderId != null">order_id = #{orderId},</if>
|
||||
<if test="failCode != null">fail_code = #{failCode},</if>
|
||||
<if test="errorMessage != null">error_message = #{errorMessage},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
@@ -141,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateBillingResult" parameterType="PrcBillingTask">
|
||||
update prc_billing_task
|
||||
set success_status = #{successStatus},
|
||||
bill_id = #{billId},
|
||||
order_id = #{orderId},
|
||||
fail_code = #{failCode},
|
||||
error_message = #{errorMessage},
|
||||
<if test="customerCode != null">
|
||||
|
||||
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
||||
<select id="selectByBillId" 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="String" resultMap="PrcIncomeBillFeeResult">
|
||||
<select id="selectByFeeId" 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">
|
||||
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee" useGeneratedKeys="true" keyProperty="feeId" keyColumn="fee_id">
|
||||
insert into prc_income_bill_fee (
|
||||
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
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 (
|
||||
#{feeId}, #{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{roundMode}, #{remark},
|
||||
#{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{roundMode}, #{remark},
|
||||
#{arBillStatus}, #{manualFlag}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="feeId" keyColumn="fee_id">
|
||||
insert into prc_income_bill_fee (
|
||||
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
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.feeId}, #{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
(#{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="String">
|
||||
<delete id="deleteByFeeId">
|
||||
delete from prc_income_bill_fee where fee_id = #{feeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
<delete id="deleteByBillId">
|
||||
delete from prc_income_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAutoFeesByBillId" parameterType="String">
|
||||
<delete id="deleteAutoFeesByBillId">
|
||||
delete from prc_income_bill_fee
|
||||
where bill_id = #{billId}
|
||||
and (manual_flag is null or manual_flag <> '1')
|
||||
|
||||
@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from prc_income_bill
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||
<select id="selectByBillId" 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="String" resultMap="PrcIncomeBillResult">
|
||||
<select id="selectByIncomeBillId" resultMap="PrcIncomeBillResult">
|
||||
<include refid="selectPrcIncomeBillVo"/>
|
||||
where income_bill_id = #{incomeBillId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill" useGeneratedKeys="true" keyProperty="incomeBillId" keyColumn="income_bill_id">
|
||||
insert into prc_income_bill (
|
||||
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
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 (
|
||||
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{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">
|
||||
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill" useGeneratedKeys="true" keyProperty="incomeBillId" keyColumn="income_bill_id">
|
||||
insert into prc_income_bill (
|
||||
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
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 (
|
||||
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{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="String">
|
||||
<delete id="deleteByBillId">
|
||||
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="String" resultMap="PrcOrderBillExtResult">
|
||||
<select id="selectByBillId" 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="String" resultMap="PrcOrderBillResult">
|
||||
<select id="selectPrcOrderBillById" 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="string">
|
||||
<select id="selectPrcOrderBillIds" parameterType="PrcOrderBill" resultType="long">
|
||||
select p.bill_id
|
||||
from prc_order_bill p
|
||||
<where>
|
||||
@@ -829,9 +829,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill" useGeneratedKeys="true" keyProperty="billId" keyColumn="bill_id">
|
||||
insert into prc_order_bill (
|
||||
bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||
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 (
|
||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||
#{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
|
||||
#{customerId}, #{customerCode}, #{customerName},
|
||||
#{pieces}, #{actualWeight}, #{receiveWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
|
||||
|
||||
@@ -283,10 +283,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where order_bill_id = #{oldBillId}
|
||||
</update>
|
||||
|
||||
<!-- bill_id dropped; order_id is the live FK. No-op for legacy sync. -->
|
||||
<update id="updateBillingTaskOrderId">
|
||||
update prc_billing_task
|
||||
set order_id = #{newBillId}
|
||||
where bill_id = #{oldBillId}
|
||||
where 1 = 0
|
||||
</update>
|
||||
|
||||
<update id="updateArGenTaskOrderId">
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
-- 切主:1) 阴影表升为正式表名,旧 UUID 表改为 *_old
|
||||
-- 2) prc_billing_task 用 order_id(bigint)替代 bill_id
|
||||
-- 执行前必须:停应用、关闭 UuidToNew 连续同步
|
||||
-- 可重入
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- ========== 1. RENAME shadow -> primary ==========
|
||||
SET @has_old := (
|
||||
SELECT COUNT(*) FROM information_schema.tables
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_order_bill_old'
|
||||
);
|
||||
SET @has_new := (
|
||||
SELECT COUNT(*) FROM information_schema.tables
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_order_bill_new'
|
||||
);
|
||||
SET @has_live := (
|
||||
SELECT COUNT(*) FROM information_schema.tables
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_order_bill'
|
||||
);
|
||||
|
||||
SET @sql := IF(@has_old = 0 AND @has_new = 1 AND @has_live = 1,
|
||||
'RENAME TABLE prc_order_bill TO prc_order_bill_old, prc_order_bill_new TO prc_order_bill, prc_order_bill_ext TO prc_order_bill_ext_old, prc_order_bill_ext_new TO prc_order_bill_ext, prc_income_bill TO prc_income_bill_old, prc_income_bill_new TO prc_income_bill, prc_income_bill_fee TO prc_income_bill_fee_old, prc_income_bill_fee_new TO prc_income_bill_fee',
|
||||
'SELECT ''rename_shadow_to_primary skipped (already done or missing *_new)''');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- ========== 2. prc_billing_task: order_id replaces bill_id ==========
|
||||
SET @has_order_id := (
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_billing_task' AND column_name = 'order_id'
|
||||
);
|
||||
SET @sql := IF(@has_order_id = 0,
|
||||
'ALTER TABLE `prc_billing_task` ADD COLUMN `order_id` bigint DEFAULT NULL COMMENT ''order bill_id'', ADD KEY `idx_billing_task_order_id` (`order_id`)',
|
||||
'SELECT ''order_id already exists''');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_bill_id := (
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_billing_task' AND column_name = 'bill_id'
|
||||
);
|
||||
SET @sql := IF(@has_bill_id > 0,
|
||||
'UPDATE `prc_billing_task` SET `order_id` = CAST(`bill_id` AS SIGNED) WHERE `order_id` IS NULL AND `bill_id` REGEXP ''^[0-9]+$''',
|
||||
'SELECT ''bill_id already dropped, skip backfill''');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_bill_id := (
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_billing_task' AND column_name = 'bill_id'
|
||||
);
|
||||
SET @sql := IF(@has_bill_id > 0,
|
||||
'ALTER TABLE `prc_billing_task` DROP COLUMN `bill_id`',
|
||||
'SELECT ''bill_id already dropped''');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @has_idx := (
|
||||
SELECT COUNT(*) FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE() AND table_name = 'prc_billing_task' AND index_name = 'idx_billing_task_order_id'
|
||||
);
|
||||
SET @sql := IF(@has_idx = 0,
|
||||
'ALTER TABLE `prc_billing_task` ADD KEY `idx_billing_task_order_id` (`order_id`)',
|
||||
'SELECT ''idx_billing_task_order_id already exists''');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
@@ -14,7 +14,7 @@
|
||||
<el-descriptions-item label="订单号">{{ detail.orderNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="运单号">{{ detail.trackingNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="转单号">{{ detail.transferNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计费订单ID">{{ detail.billId || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计费订单ID">{{ detail.orderId || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="失败码">{{ detail.failCode || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ detail.createTime || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">{{ detail.updateTime || '-' }}</el-descriptions-item>
|
||||
|
||||
Reference in New Issue
Block a user