修改计费规则
This commit is contained in:
@@ -3,11 +3,14 @@ package com.bms.price.enums;
|
||||
/**
|
||||
* Snapshot of prc_order_bill.order_status (aligned with upstream TAB_ORDER).
|
||||
* Fee refund sets {@link #REFUNDED} (9 / 已退件).
|
||||
* Upstream 9/10 trigger billType=REFUND when billing pulls Oracle.
|
||||
*/
|
||||
public enum BillOrderStatus
|
||||
{
|
||||
/** Upstream: returned package; also set after billing-list fee refund. */
|
||||
REFUNDED(9);
|
||||
REFUNDED(9),
|
||||
/** Upstream: cancelled / deleted. */
|
||||
CANCELLED(10);
|
||||
|
||||
private final int code;
|
||||
|
||||
@@ -31,6 +34,12 @@ public enum BillOrderStatus
|
||||
return status != null && status.intValue() == code;
|
||||
}
|
||||
|
||||
/** Upstream ORDER_STATUS 9/10 -> fee refund path. */
|
||||
public static boolean requiresFeeRefund(Integer status)
|
||||
{
|
||||
return REFUNDED.matches(status) || CANCELLED.matches(status);
|
||||
}
|
||||
|
||||
public static BillOrderStatus of(Integer status)
|
||||
{
|
||||
if (status == null)
|
||||
|
||||
+15
@@ -21,6 +21,7 @@ import com.bms.price.domain.vo.BillingTaskSubmitRequest;
|
||||
import com.bms.price.domain.vo.TmsPriceBillRequest;
|
||||
import com.bms.price.domain.vo.TmsPriceQuoteResult;
|
||||
import com.bms.price.enums.BillBillingFailStatus;
|
||||
import com.bms.price.enums.BillOrderStatus;
|
||||
import com.bms.price.enums.BillTaskFailCode;
|
||||
import com.bms.price.enums.BillTaskSuccessStatus;
|
||||
import com.bms.price.enums.BillTaskType;
|
||||
@@ -293,6 +294,20 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
{
|
||||
throw new ServiceException("Oracle order mapped orderNo empty");
|
||||
}
|
||||
// Upstream ORDER_STATUS 9/10 -> REFUND (even if task was submitted as PENDING/REBILL).
|
||||
if (BillOrderStatus.requiresFeeRefund(billReq.getOrderStatus()))
|
||||
{
|
||||
String refundOrderNo = StringUtils.isNotEmpty(billReq.getOrderNo())
|
||||
? billReq.getOrderNo().trim()
|
||||
: resolveRefundOrderNo(task);
|
||||
log.info("billing task upstream status {} -> REFUND path taskId={} orderNo={}",
|
||||
billReq.getOrderStatus(), taskId, refundOrderNo);
|
||||
task.setBillType(BillTaskType.REFUND.getCode());
|
||||
fillCustomerCodeFromBill(task, refundOrderNo);
|
||||
refundWithDbRetry(taskId, refundOrderNo);
|
||||
deleteTaskAfterBillSaved(task);
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(billReq.getCustomerCode()))
|
||||
{
|
||||
throw new ServiceException("Oracle order mapped customerCode empty");
|
||||
|
||||
@@ -511,9 +511,9 @@ public class TabOrderSyncAsyncRunner
|
||||
{
|
||||
req.setBillType(billType.trim());
|
||||
}
|
||||
else if (BillOrderStatus.REFUNDED.matches(row.getOrderStatus()))
|
||||
else if (BillOrderStatus.requiresFeeRefund(row.getOrderStatus()))
|
||||
{
|
||||
// Upstream 已退件 (ORDER_STATUS=9) -> fee refund task
|
||||
// Upstream 已退件(9) / 已取消(10) -> fee refund task
|
||||
req.setBillType(BillTaskType.REFUND.getCode());
|
||||
}
|
||||
return req;
|
||||
|
||||
Reference in New Issue
Block a user