修改计费文档,加上客户代码
This commit is contained in:
@@ -17,6 +17,8 @@ public class PrcBillingTask extends BaseEntity
|
||||
private String transferNo;
|
||||
private String trackingNo;
|
||||
private String orderNo;
|
||||
/** Customer code snapshot for filter / rebill */
|
||||
private String customerCode;
|
||||
/** PENDING / REBILL / REFUND */
|
||||
private String billType;
|
||||
/** WAITING / SUCCESS / FAILED */
|
||||
|
||||
+2
@@ -18,6 +18,8 @@ public class BillingTaskSubmitRequest implements Serializable
|
||||
private String transferNo;
|
||||
private String trackingNo;
|
||||
private String orderNo;
|
||||
/** Optional customer code; also filled from Oracle when task runs */
|
||||
private String customerCode;
|
||||
/** Billing time from mobile; persisted to prc_billing_task.bill_time */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date billTime;
|
||||
|
||||
+31
-2
@@ -86,6 +86,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
task.setTransferNo(transferNo);
|
||||
task.setTrackingNo(trackingNo);
|
||||
task.setOrderNo(orderNo);
|
||||
task.setCustomerCode(trim(request.getCustomerCode()));
|
||||
task.setBillTime(billTime);
|
||||
task.setBillType(type.getCode());
|
||||
task.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
|
||||
@@ -93,8 +94,8 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
billingTaskMapper.insertPrcBillingTask(task);
|
||||
|
||||
billingTaskMqPublisher.publish(new BillingTaskMessage(task.getTaskId()));
|
||||
log.info("billing task submitted taskId={} type={} billTime={} transferNo={} trackingNo={} orderNo={}",
|
||||
task.getTaskId(), task.getBillType(), billTime, transferNo, trackingNo, orderNo);
|
||||
log.info("billing task submitted taskId={} type={} billTime={} customerCode={} transferNo={} trackingNo={} orderNo={}",
|
||||
task.getTaskId(), task.getBillType(), billTime, task.getCustomerCode(), transferNo, trackingNo, orderNo);
|
||||
return task;
|
||||
}
|
||||
|
||||
@@ -130,6 +131,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
{
|
||||
String refundOrderNo = resolveRefundOrderNo(task);
|
||||
log.info("billing task REFUND path taskId={} orderNo={}", taskId, refundOrderNo);
|
||||
fillCustomerCodeFromBill(task, refundOrderNo);
|
||||
TmsPriceQuoteResult result = refundWithDbRetry(taskId, refundOrderNo);
|
||||
writeback(task, BillTaskSuccessStatus.SUCCESS, result == null ? null : result.getBillId(),
|
||||
null);
|
||||
@@ -175,6 +177,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
}
|
||||
// Billing date from task.bill_time (mobile), not Oracle CREATE_DATE.
|
||||
billReq.setBizDate(new SimpleDateFormat("yyyy-MM-dd").format(task.getBillTime()));
|
||||
task.setCustomerCode(billReq.getCustomerCode());
|
||||
|
||||
TmsPriceQuoteResult result = billWithDbRetry(taskId, billReq);
|
||||
writeback(task, BillTaskSuccessStatus.SUCCESS, result == null ? null : result.getBillId(),
|
||||
@@ -381,6 +384,28 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
}
|
||||
|
||||
/** Write back status/billId/failCode/error only; keep inbound transfer/tracking/order/billTime untouched. */
|
||||
/** Prefer existing bill customer when task has none (REFUND path). */
|
||||
private void fillCustomerCodeFromBill(PrcBillingTask task, String orderNo)
|
||||
{
|
||||
if (task == null || StringUtils.isNotEmpty(task.getCustomerCode()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
PrcOrderBill bill = null;
|
||||
if (StringUtils.isNotEmpty(orderNo))
|
||||
{
|
||||
bill = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo.trim());
|
||||
}
|
||||
if (bill == null && StringUtils.isNotEmpty(task.getBillId()))
|
||||
{
|
||||
bill = orderBillMapper.selectPrcOrderBillById(task.getBillId());
|
||||
}
|
||||
if (bill != null && StringUtils.isNotEmpty(bill.getCustomerCode()))
|
||||
{
|
||||
task.setCustomerCode(bill.getCustomerCode().trim());
|
||||
}
|
||||
}
|
||||
|
||||
private void writeback(PrcBillingTask task, BillTaskSuccessStatus status, String billId,
|
||||
String errorMessage)
|
||||
{
|
||||
@@ -388,6 +413,10 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
|
||||
upd.setTaskId(task.getTaskId());
|
||||
upd.setSuccessStatus(status.getCode());
|
||||
upd.setBillId(billId);
|
||||
if (StringUtils.isNotEmpty(task.getCustomerCode()))
|
||||
{
|
||||
upd.setCustomerCode(task.getCustomerCode());
|
||||
}
|
||||
if (BillTaskSuccessStatus.FAILED == status)
|
||||
{
|
||||
upd.setFailCode(BillTaskFailCode.resolveCode(errorMessage));
|
||||
|
||||
@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="transferNo" column="transfer_no" />
|
||||
<result property="trackingNo" column="tracking_no" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="billType" column="bill_type" />
|
||||
<result property="successStatus" column="success_status" />
|
||||
<result property="billTime" column="bill_time" />
|
||||
@@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcBillingTaskVo">
|
||||
select task_id, transfer_no, tracking_no, order_no, bill_type, success_status,
|
||||
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
|
||||
from prc_billing_task
|
||||
</sql>
|
||||
@@ -44,6 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
AND order_no like concat('%', #{orderNo}, '%')
|
||||
</if>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
AND customer_code like concat('%', #{customerCode}, '%')
|
||||
</if>
|
||||
<if test="billType != null and billType != ''">
|
||||
AND bill_type = #{billType}
|
||||
</if>
|
||||
@@ -65,10 +69,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, bill_type, success_status,
|
||||
transfer_no, tracking_no, order_no, customer_code, bill_type, success_status,
|
||||
bill_time, bill_id, fail_code, error_message, create_by, create_time
|
||||
) values (
|
||||
#{transferNo}, #{trackingNo}, #{orderNo}, #{billType}, #{successStatus},
|
||||
#{transferNo}, #{trackingNo}, #{orderNo}, #{customerCode}, #{billType}, #{successStatus},
|
||||
#{billTime}, #{billId}, #{failCode}, #{errorMessage}, #{createBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
@@ -79,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="transferNo != null">transfer_no = #{transferNo},</if>
|
||||
<if test="trackingNo != null">tracking_no = #{trackingNo},</if>
|
||||
<if test="orderNo != null">order_no = #{orderNo},</if>
|
||||
<if test="customerCode != null">customer_code = #{customerCode},</if>
|
||||
<if test="billType != null">bill_type = #{billType},</if>
|
||||
<if test="successStatus != null">success_status = #{successStatus},</if>
|
||||
<if test="billTime != null">bill_time = #{billTime},</if>
|
||||
@@ -91,13 +96,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<!-- Keep inbound transfer/tracking/order/bill_time; only write status result. -->
|
||||
<!-- Keep inbound identity keys/bill_time; write status + optional customer_code snapshot. -->
|
||||
<update id="updateBillingResult" parameterType="PrcBillingTask">
|
||||
update prc_billing_task
|
||||
set success_status = #{successStatus},
|
||||
bill_id = #{billId},
|
||||
fail_code = #{failCode},
|
||||
error_message = #{errorMessage},
|
||||
<if test="customerCode != null">
|
||||
customer_code = #{customerCode},
|
||||
</if>
|
||||
update_time = sysdate()
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
@@ -812,6 +812,7 @@ CREATE TABLE `prc_billing_task` (
|
||||
`transfer_no` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '转单号',
|
||||
`tracking_no` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '运单号',
|
||||
`order_no` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单号',
|
||||
`customer_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客户代码',
|
||||
`bill_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '计费类型:PENDING待计费 REBILL重计费 REFUND退费',
|
||||
`success_status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'WAITING' COMMENT '是否计费成功:WAITING待处理 SUCCESS成功 FAILED失败',
|
||||
`bill_time` datetime DEFAULT NULL COMMENT '计费时间',
|
||||
@@ -826,6 +827,7 @@ CREATE TABLE `prc_billing_task` (
|
||||
KEY `idx_billing_task_transfer` (`transfer_no`),
|
||||
KEY `idx_billing_task_tracking` (`tracking_no`),
|
||||
KEY `idx_billing_task_order` (`order_no`),
|
||||
KEY `idx_billing_task_customer` (`customer_code`),
|
||||
KEY `idx_billing_task_status` (`success_status`,`create_time`),
|
||||
KEY `idx_billing_task_type` (`bill_type`),
|
||||
KEY `idx_billing_task_fail_code` (`fail_code`)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
-- prc_billing_task add customer_code for customer filter / rebill
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @col := (
|
||||
SELECT COLUMN_NAME FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'prc_billing_task'
|
||||
AND COLUMN_NAME = 'customer_code'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(
|
||||
@col IS NULL,
|
||||
CONCAT(
|
||||
'ALTER TABLE prc_billing_task ADD COLUMN customer_code varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ',
|
||||
CHAR(39), '客户代码', CHAR(39),
|
||||
' AFTER order_no, ADD KEY idx_billing_task_customer (customer_code)'
|
||||
),
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
UPDATE prc_billing_task t
|
||||
INNER JOIN prc_order_bill b ON b.bill_id = t.bill_id
|
||||
SET t.customer_code = b.customer_code
|
||||
WHERE (t.customer_code IS NULL OR t.customer_code = '')
|
||||
AND b.customer_code IS NOT NULL AND b.customer_code <> '';
|
||||
@@ -55,6 +55,7 @@
|
||||
</div>
|
||||
<el-descriptions :column="1" border size="small" class="detail-desc">
|
||||
<el-descriptions-item label="任务ID">{{ detail.taskId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客户代码">{{ detail.customerCode || '-' }}</el-descriptions-item>
|
||||
<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>
|
||||
@@ -128,6 +129,7 @@ const searchColumns = [
|
||||
{ label: '状态', prop: 'successStatus', component: 'select', options: statusOptions, placeholder: '请选择状态', width: '140px', props: { clearable: true } },
|
||||
{ label: '计费类型', prop: 'billType', component: 'select', options: billTypeOptions, placeholder: '请选择类型', width: '140px', props: { clearable: true } },
|
||||
{ label: '失败码', prop: 'failCode', component: 'select', options: failCodeOptions, placeholder: '请选择失败码', width: '220px', props: { clearable: true, filterable: true } },
|
||||
{ label: '客户代码', prop: 'customerCode', component: 'input', placeholder: '客户代码', width: '160px' },
|
||||
{ label: '订单号', prop: 'orderNo', component: 'input', placeholder: '订单号', width: '180px' },
|
||||
{ label: '运单号', prop: 'trackingNo', component: 'input', placeholder: '运单号', width: '180px' },
|
||||
{ label: '转单号', prop: 'transferNo', component: 'input', placeholder: '转单号', width: '180px' },
|
||||
@@ -136,6 +138,7 @@ const searchColumns = [
|
||||
|
||||
const columns = [
|
||||
{ label: '任务ID', prop: 'taskId', align: 'center', width: 100 },
|
||||
{ label: '客户代码', prop: 'customerCode', minWidth: 120, showOverflowTooltip: true },
|
||||
{ label: '订单号', prop: 'orderNo', minWidth: 160, showOverflowTooltip: true },
|
||||
{ label: '运单号', prop: 'trackingNo', minWidth: 150, showOverflowTooltip: true },
|
||||
{ label: '转单号', prop: 'transferNo', minWidth: 160, showOverflowTooltip: true },
|
||||
|
||||
Reference in New Issue
Block a user