diff --git a/bms-back/bms-admin/src/main/java/com/bms/web/controller/monitor/BillingTaskMonitorController.java b/bms-back/bms-admin/src/main/java/com/bms/web/controller/monitor/BillingTaskMonitorController.java index c875f667..d00803ea 100644 --- a/bms-back/bms-admin/src/main/java/com/bms/web/controller/monitor/BillingTaskMonitorController.java +++ b/bms-back/bms-admin/src/main/java/com/bms/web/controller/monitor/BillingTaskMonitorController.java @@ -86,6 +86,7 @@ public class BillingTaskMonitorController extends BaseController { PrcBillingTask task = billingTaskService.retryTask(taskId); row.put("successStatus", task == null ? null : task.getSuccessStatus()); + row.put("failCode", task == null ? null : task.getFailCode()); row.put("errorMessage", task == null ? null : task.getErrorMessage()); if (task != null && BillTaskSuccessStatus.SUCCESS.getCode().equals(task.getSuccessStatus())) { diff --git a/bms-back/bms-admin/src/main/resources/i18n/messages.properties b/bms-back/bms-admin/src/main/resources/i18n/messages.properties index 7a70d8cc..4b1a3385 100644 --- a/bms-back/bms-admin/src/main/resources/i18n/messages.properties +++ b/bms-back/bms-admin/src/main/resources/i18n/messages.properties @@ -144,6 +144,7 @@ price.quote.bizDateInvalid=业务日期格式必须为yyyy-MM-dd price.quote.fixedPackageNoDetails=套餐固定价格没有明细,使用产品默认价格 price.quote.noCustomerPackageOverride=没有客户套餐覆盖,使用产品默认运费/挂号费 price.quote.noCustomerPackage=客户未绑定套餐,无法试算 +price.quote.noActivePackageVersion=计费日无生效套餐版本,无法试算 price.quote.quoteIdRequired=报价ID为空 price.quote.hitCustomerFixedPackageDetail=命中客户套餐固定价格明细 @@ -155,6 +156,7 @@ price.bill.customerRequired=订单同步缺少有效客户 price.bill.alreadyInArBill=订单{0}已生成应收账单,作废后方可重新计费 price.bill.bizDateRequired=业务日期为空 price.bill.noCustomerPackage=客户未绑定套餐,无法计费 +price.bill.noActivePackageVersion=计费日无生效套餐版本,无法计费 price.bill.fee.scIdRequired=附加费不能为空 price.bill.fee.surchargeNotFound=附加费配置不存在或已停用 price.bill.fee.notFound=费用明细不存在 diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/PrcBillingTask.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/PrcBillingTask.java index bdb023a4..1fee332d 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/PrcBillingTask.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/PrcBillingTask.java @@ -25,5 +25,7 @@ public class PrcBillingTask extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date billTime; private String billId; + /** Stable fail code for search, e.g. NO_CUSTOMER_PACKAGE */ + private String failCode; private String errorMessage; } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/enums/BillTaskFailCode.java b/bms-back/bms-system/src/main/java/com/bms/price/enums/BillTaskFailCode.java new file mode 100644 index 00000000..42ab88c6 --- /dev/null +++ b/bms-back/bms-system/src/main/java/com/bms/price/enums/BillTaskFailCode.java @@ -0,0 +1,143 @@ +package com.bms.price.enums; + +import com.bms.common.utils.StringUtils; + +/** + * Stable fail codes for prc_billing_task.fail_code (search / ops). + * Resolved from exception message when task writeback is FAILED. + */ +public enum BillTaskFailCode +{ + NO_CUSTOMER_PACKAGE("NO_CUSTOMER_PACKAGE"), + NO_ACTIVE_PACKAGE_VERSION("NO_ACTIVE_PACKAGE_VERSION"), + ALREADY_IN_AR_BILL("ALREADY_IN_AR_BILL"), + PRODUCT_ARCHIVE_MISSING("PRODUCT_ARCHIVE_MISSING"), + PRICE_NOT_HIT("PRICE_NOT_HIT"), + ZONE_PRICE_NOT_HIT("ZONE_PRICE_NOT_HIT"), + POSTCODE_REQUIRED("POSTCODE_REQUIRED"), + POSTCODE_ZONE_NOT_FOUND("POSTCODE_ZONE_NOT_FOUND"), + ORACLE_ORDER_NOT_FOUND("ORACLE_ORDER_NOT_FOUND"), + ORACLE_ORDERNO_EMPTY("ORACLE_ORDERNO_EMPTY"), + ORACLE_CUSTOMER_EMPTY("ORACLE_CUSTOMER_EMPTY"), + ORACLE_PRODUCT_EMPTY("ORACLE_PRODUCT_EMPTY"), + ORACLE_WEIGHT_INVALID("ORACLE_WEIGHT_INVALID"), + BILL_TIME_EMPTY("BILL_TIME_EMPTY"), + REFUND_ORDER_UNRESOLVED("REFUND_ORDER_UNRESOLVED"), + CUSTOMER_CODE_REQUIRED("CUSTOMER_CODE_REQUIRED"), + CUSTOMER_DISABLED("CUSTOMER_DISABLED"), + FREIGHT_MISSING("FREIGHT_MISSING"), + UNKNOWN("UNKNOWN"); + + private final String code; + + BillTaskFailCode(String code) + { + this.code = code; + } + + public String getCode() + { + return code; + } + + /** + * Map free-text error message to a stable fail code for search. + */ + public static String resolveCode(String errorMessage) + { + if (StringUtils.isEmpty(errorMessage)) + { + return null; + } + String msg = errorMessage.trim(); + if (containsAny(msg, "\u672a\u7ed1\u5b9a\u5957\u9910", "noCustomerPackage", "NO_CUSTOMER_PACKAGE")) + { + return NO_CUSTOMER_PACKAGE.code; + } + if (containsAny(msg, "\u65e0\u751f\u6548\u5957\u9910\u7248\u672c", "noActivePackageVersion", "NO_ACTIVE_PACKAGE_VERSION")) + { + return NO_ACTIVE_PACKAGE_VERSION.code; + } + if (containsAny(msg, "\u5df2\u751f\u6210\u5e94\u6536\u8d26\u5355", "alreadyInArBill", "ALREADY_IN_AR_BILL")) + { + return ALREADY_IN_AR_BILL.code; + } + if (containsAny(msg, "\u672a\u627e\u5230\u6709\u6548\u4ea7\u54c1\u6863\u6848", "PRODUCT_ARCHIVE_MISSING")) + { + return PRODUCT_ARCHIVE_MISSING.code; + } + if (containsAny(msg, "\u8be5\u5206\u533a\u65e0\u5bf9\u5e94\u4ea7\u54c1\u91cd\u91cf\u6bb5", "zonePriceNotHit", "ZONE_PRICE_NOT_HIT")) + { + return ZONE_PRICE_NOT_HIT.code; + } + if (containsAny(msg, "\u6ca1\u6709\u4ea7\u54c1/\u56fd\u5bb6/\u91cd\u91cf\u6bb5", "priceNotHit", "PRICE_NOT_HIT")) + { + return PRICE_NOT_HIT.code; + } + if (containsAny(msg, "\u8bf7\u586b\u5199\u76ee\u7684\u90ae\u7f16", "postcodeRequired", "POSTCODE_REQUIRED")) + { + return POSTCODE_REQUIRED.code; + } + if (containsAny(msg, "\u90ae\u7f16\u672a\u5339\u914d\u5230\u5206\u533a", "postcodeZoneNotFound", "POSTCODE_ZONE_NOT_FOUND")) + { + return POSTCODE_ZONE_NOT_FOUND.code; + } + if (containsAny(msg, "Oracle main order not found", "ORACLE_ORDER_NOT_FOUND")) + { + return ORACLE_ORDER_NOT_FOUND.code; + } + if (containsAny(msg, "mapped orderNo empty", "ORACLE_ORDERNO_EMPTY")) + { + return ORACLE_ORDERNO_EMPTY.code; + } + if (containsAny(msg, "mapped customerCode empty", "ORACLE_CUSTOMER_EMPTY")) + { + return ORACLE_CUSTOMER_EMPTY.code; + } + if (containsAny(msg, "mapped productCode empty", "ORACLE_PRODUCT_EMPTY")) + { + return ORACLE_PRODUCT_EMPTY.code; + } + if (containsAny(msg, "mapped weight invalid", "ORACLE_WEIGHT_INVALID")) + { + return ORACLE_WEIGHT_INVALID.code; + } + if (containsAny(msg, "billTime empty", "billTime required", "BILL_TIME_EMPTY")) + { + return BILL_TIME_EMPTY.code; + } + if (containsAny(msg, "\u9000\u8d39\u8ba2\u5355\u53f7\u65e0\u6cd5\u89e3\u6790", "REFUND_ORDER_UNRESOLVED")) + { + return REFUND_ORDER_UNRESOLVED.code; + } + if (containsAny(msg, "\u5ba2\u6237\u4ee3\u7801\u4e0d\u80fd\u4e3a\u7a7a", "customerCodeRequired", "CUSTOMER_CODE_REQUIRED")) + { + return CUSTOMER_CODE_REQUIRED.code; + } + if (containsAny(msg, "\u5ba2\u6237\u5df2\u505c\u7528", "customerDisabled", "CUSTOMER_DISABLED")) + { + return CUSTOMER_DISABLED.code; + } + if (containsAny(msg, "\u8fd0\u8d39\u4e3a\u7a7a", "freightMissing", "FREIGHT_MISSING")) + { + return FREIGHT_MISSING.code; + } + return UNKNOWN.code; + } + + private static boolean containsAny(String msg, String... markers) + { + if (msg == null || markers == null) + { + return false; + } + for (String marker : markers) + { + if (StringUtils.isNotEmpty(marker) && msg.indexOf(marker) >= 0) + { + return true; + } + } + return false; + } +} diff --git a/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcCustomerPriceSetMapper.java b/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcCustomerPriceSetMapper.java index 71e73c68..9fe2486f 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcCustomerPriceSetMapper.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/mapper/PrcCustomerPriceSetMapper.java @@ -40,13 +40,11 @@ public interface PrcCustomerPriceSetMapper @Param("endDate") java.util.Date endDate); /** - * Customer binds valid on bizDate; package not stopped. Version match is done in quote service. + * Customer package binds (package not stopped). Temporal match uses version effective_time in quote/bill. */ public java.util.List selectEffectiveByCustomer( - @Param("customerId") Long customerId, - @Param("bizDate") java.util.Date bizDate); + @Param("customerId") Long customerId); public java.util.List selectEffectiveByCustomerCode( - @Param("customerCode") String customerCode, - @Param("bizDate") java.util.Date bizDate); + @Param("customerCode") String customerCode); } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/ITmsPriceQuoteService.java b/bms-back/bms-system/src/main/java/com/bms/price/service/ITmsPriceQuoteService.java index 726ab391..1475ebcf 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/ITmsPriceQuoteService.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/ITmsPriceQuoteService.java @@ -9,10 +9,10 @@ import java.util.List; * TMS freight quote / bill calc service (shared by console trial and upstream bill). * * Match order: - * 1) Customer binds (not stopped), bind_priority ASC - * 2) Active package version at bill-time end-of-day (effective_time / expire_time) + * 1) Customer binds (package not stopped), bind_priority ASC; bind date range is not used for billing + * 2) Active package version at bill-time end-of-day (version effective_time / expire_time) * 3) FIXED detail override, else DISCOUNT on that version - * 4) Else bms_product_country default + * 4) Else product default only when a version existed but detail missed * Package hit uses version surcharge snapshot when present; else product library. * * @author bms diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcBillingTaskServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcBillingTaskServiceImpl.java index 5f46f177..bffb8b9a 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcBillingTaskServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcBillingTaskServiceImpl.java @@ -17,6 +17,7 @@ import com.bms.price.domain.PrcOrderBill; 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.BillTaskFailCode; import com.bms.price.enums.BillTaskSuccessStatus; import com.bms.price.enums.BillTaskType; import com.bms.price.mapper.PrcBillingTaskMapper; @@ -351,6 +352,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService reset.setTaskId(taskId); reset.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode()); reset.setBillId(null); + reset.setFailCode(null); reset.setErrorMessage(null); billingTaskMapper.updateBillingResult(reset); @@ -382,7 +384,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService return existed == null ? BillTaskType.PENDING : BillTaskType.REBILL; } - /** Write back status/billId/error only; keep inbound transfer/tracking/order/billTime untouched. */ + /** Write back status/billId/failCode/error only; keep inbound transfer/tracking/order/billTime untouched. */ private void writeback(PrcBillingTask task, BillTaskSuccessStatus status, String billId, String errorMessage) { @@ -390,6 +392,14 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService upd.setTaskId(task.getTaskId()); upd.setSuccessStatus(status.getCode()); upd.setBillId(billId); + if (BillTaskSuccessStatus.FAILED == status) + { + upd.setFailCode(BillTaskFailCode.resolveCode(errorMessage)); + } + else + { + upd.setFailCode(null); + } upd.setErrorMessage(errorMessage); billingTaskMapper.updateBillingResult(upd); } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/TmsPriceQuoteServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/TmsPriceQuoteServiceImpl.java index 1329a6af..0458a81c 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/TmsPriceQuoteServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/TmsPriceQuoteServiceImpl.java @@ -56,9 +56,9 @@ import com.bms.price.search.IBillSearchStore; import com.bms.price.service.ITmsPriceQuoteService; /** - * Shared quote/bill calc: bound set + active version by bizDate. - * No customer package bind: quote and bill both fail hard (no PRODUCT_DEFAULT). - * Bill path: no persist; billing task marked FAILED (abnormal order). + * Shared quote/bill calc: customer bind + package version by bizDate (version effective_time). + * Bind pr_begindate/pr_enddate is not used for billing time gate. + * No bind / no active version at bill time: quote and bill both fail hard (no PRODUCT_DEFAULT). * * @author bms */ @@ -261,15 +261,14 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService List binds; if (StringUtils.isNotEmpty(request.getCustomerCode())) { - binds = customerPriceSetMapper.selectEffectiveByCustomerCode( - request.getCustomerCode(), bizDate); + binds = customerPriceSetMapper.selectEffectiveByCustomerCode(request.getCustomerCode()); } else { - binds = customerPriceSetMapper.selectEffectiveByCustomer( - request.getCustomerId(), bizDate); + binds = customerPriceSetMapper.selectEffectiveByCustomer(request.getCustomerId()); } + boolean anyActiveVersion = false; if (binds != null) { Date asOf = endOfDay(bizDate); @@ -280,12 +279,13 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService { continue; } + // Temporal gate: prc_price_set_version.effective_time / expire_time (not bind pr_begindate) PrcPriceSetVersion version = versionMapper.selectActiveByPriceSetAt(set.getPriceSetId(), asOf); if (version == null || version.getPsvId() == null) { - // Bound package but no version effective at bill time -> try next bind / default continue; } + anyActiveVersion = true; String setType = StringUtils.isEmpty(set.getSetType()) ? TYPE_FIXED : set.getSetType(); if (TYPE_FIXED.equals(setType)) { @@ -308,13 +308,22 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService } } - // No customer package bind: do not use PRODUCT_DEFAULT (quote and bill). - // Bill: no persist; billing task catches and writes success_status=FAILED. - if (binds == null || binds.isEmpty()) + // No bind, or bind exists but no version effective at bill time. + if (binds == null || binds.isEmpty() || !anyActiveVersion) { - String msgKey = request instanceof TmsPriceBillRequest - ? "price.bill.noCustomerPackage" - : "price.quote.noCustomerPackage"; + String msgKey; + if (binds == null || binds.isEmpty()) + { + msgKey = request instanceof TmsPriceBillRequest + ? "price.bill.noCustomerPackage" + : "price.quote.noCustomerPackage"; + } + else + { + msgKey = request instanceof TmsPriceBillRequest + ? "price.bill.noActivePackageVersion" + : "price.quote.noActivePackageVersion"; + } throw new ServiceException(MessageUtils.message(msgKey)); } diff --git a/bms-back/bms-system/src/main/resources/mapper/price/PrcBillingTaskMapper.xml b/bms-back/bms-system/src/main/resources/mapper/price/PrcBillingTaskMapper.xml index a32d1650..33ec8a3a 100644 --- a/bms-back/bms-system/src/main/resources/mapper/price/PrcBillingTaskMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/price/PrcBillingTaskMapper.xml @@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select task_id, transfer_no, tracking_no, order_no, bill_type, success_status, - bill_time, bill_id, error_message, create_by, create_time, update_by, update_time + bill_time, bill_id, fail_code, error_message, create_by, create_time, update_by, update_time from prc_billing_task @@ -49,6 +50,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND success_status = #{successStatus} + + AND fail_code = #{failCode} + AND create_time >= #{params.beginTime} @@ -62,10 +66,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into prc_billing_task ( transfer_no, tracking_no, order_no, bill_type, success_status, - bill_time, bill_id, error_message, create_by, create_time + bill_time, bill_id, fail_code, error_message, create_by, create_time ) values ( #{transferNo}, #{trackingNo}, #{orderNo}, #{billType}, #{successStatus}, - #{billTime}, #{billId}, #{errorMessage}, #{createBy}, sysdate() + #{billTime}, #{billId}, #{failCode}, #{errorMessage}, #{createBy}, sysdate() ) @@ -79,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" success_status = #{successStatus}, bill_time = #{billTime}, bill_id = #{billId}, + fail_code = #{failCode}, error_message = #{errorMessage}, update_by = #{updateBy}, update_time = sysdate() @@ -91,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update prc_billing_task set success_status = #{successStatus}, bill_id = #{billId}, + fail_code = #{failCode}, error_message = #{errorMessage}, update_time = sysdate() where task_id = #{taskId} diff --git a/bms-back/bms-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml b/bms-back/bms-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml index 61d989e0..e440e26b 100644 --- a/bms-back/bms-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml @@ -98,8 +98,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" inner join prc_price_set s on s.price_set_id = c.price_set_id where c.customer_id = #{customerId} and ifnull(s.status, 'D') <> 'S' - and (c.pr_begindate is null or c.pr_begindate <= #{bizDate}) - and ifnull(c.pr_enddate, '9999-12-31') >= #{bizDate} order by c.bind_priority asc, c.pr_begindate desc, c.customer_priceset_id asc @@ -111,8 +109,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" inner join prc_price_set s on s.price_set_id = c.price_set_id where c.customer_code = #{customerCode} and ifnull(s.status, 'D') <> 'S' - and (c.pr_begindate is null or c.pr_begindate <= #{bizDate}) - and ifnull(c.pr_enddate, '9999-12-31') >= #{bizDate} order by c.bind_priority asc, c.pr_begindate desc, c.customer_priceset_id asc diff --git a/bms-back/sql/bms_init.sql b/bms-back/sql/bms_init.sql index 86cc97a0..dc5fa3aa 100644 --- a/bms-back/sql/bms_init.sql +++ b/bms-back/sql/bms_init.sql @@ -814,6 +814,7 @@ CREATE TABLE `prc_billing_task` ( `success_status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'WAITING' COMMENT '是否计费成功:WAITING待处理 SUCCESS成功 FAILED失败', `bill_time` datetime DEFAULT NULL COMMENT '计费时间', `bill_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '计费订单ID prc_order_bill.bill_id', + `fail_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '失败码', `error_message` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '失败原因', `create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', `create_time` datetime NOT NULL COMMENT '创建时间', @@ -824,7 +825,8 @@ CREATE TABLE `prc_billing_task` ( KEY `idx_billing_task_tracking` (`tracking_no`), KEY `idx_billing_task_order` (`order_no`), KEY `idx_billing_task_status` (`success_status`,`create_time`), - KEY `idx_billing_task_type` (`bill_type`) + KEY `idx_billing_task_type` (`bill_type`), + KEY `idx_billing_task_fail_code` (`fail_code`) ) ENGINE=InnoDB AUTO_INCREMENT=7885 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='计费任务表'; -- ---------------------------- diff --git a/bms-back/sql/price/billing_task_fail_code_alter.sql b/bms-back/sql/price/billing_task_fail_code_alter.sql new file mode 100644 index 00000000..c8851ae8 --- /dev/null +++ b/bms-back/sql/price/billing_task_fail_code_alter.sql @@ -0,0 +1,23 @@ +-- prc_billing_task add fail_code for abnormal-task search +ALTER TABLE prc_billing_task + ADD COLUMN fail_code varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '失败码' AFTER bill_id, + ADD KEY idx_billing_task_fail_code (fail_code); + +-- backfill known historical FAILED rows +UPDATE prc_billing_task SET fail_code = 'NO_CUSTOMER_PACKAGE' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%未绑定套餐%'; +UPDATE prc_billing_task SET fail_code = 'ALREADY_IN_AR_BILL' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%已生成应收账单%'; +UPDATE prc_billing_task SET fail_code = 'PRODUCT_ARCHIVE_MISSING' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%未找到有效产品档案%'; +UPDATE prc_billing_task SET fail_code = 'ZONE_PRICE_NOT_HIT' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%该分区无对应产品重量段%'; +UPDATE prc_billing_task SET fail_code = 'PRICE_NOT_HIT' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%没有产品/国家/重量段%'; +UPDATE prc_billing_task SET fail_code = 'POSTCODE_REQUIRED' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%请填写目的邮编%'; +UPDATE prc_billing_task SET fail_code = 'POSTCODE_ZONE_NOT_FOUND' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%邮编未匹配到分区%'; +UPDATE prc_billing_task SET fail_code = 'ORACLE_ORDER_NOT_FOUND' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%Oracle main order not found%'; +UPDATE prc_billing_task SET fail_code = 'ORACLE_ORDERNO_EMPTY' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%mapped orderNo empty%'; +UPDATE prc_billing_task SET fail_code = 'ORACLE_CUSTOMER_EMPTY' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%mapped customerCode empty%'; +UPDATE prc_billing_task SET fail_code = 'ORACLE_PRODUCT_EMPTY' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%mapped productCode empty%'; +UPDATE prc_billing_task SET fail_code = 'ORACLE_WEIGHT_INVALID' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%mapped weight invalid%'; +UPDATE prc_billing_task SET fail_code = 'BILL_TIME_EMPTY' WHERE success_status = 'FAILED' AND fail_code IS NULL AND (error_message LIKE '%billTime empty%' OR error_message LIKE '%billTime required%'); +UPDATE prc_billing_task SET fail_code = 'REFUND_ORDER_UNRESOLVED' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%退费订单号无法解析%'; +UPDATE prc_billing_task SET fail_code = 'CUSTOMER_DISABLED' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%客户已停用%'; +UPDATE prc_billing_task SET fail_code = 'FREIGHT_MISSING' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message LIKE '%运费为空%'; +UPDATE prc_billing_task SET fail_code = 'UNKNOWN' WHERE success_status = 'FAILED' AND fail_code IS NULL AND error_message IS NOT NULL AND error_message <> ''; diff --git a/bms-front/src/views/monitor/billingTask/index.vue b/bms-front/src/views/monitor/billingTask/index.vue index 586d9f3f..e56e7343 100644 --- a/bms-front/src/views/monitor/billingTask/index.vue +++ b/bms-front/src/views/monitor/billingTask/index.vue @@ -60,6 +60,7 @@ {{ detail.trackingNo || '-' }} {{ detail.transferNo || '-' }} {{ detail.billId || '-' }} + {{ detail.failCode || '-' }} {{ detail.createTime || '-' }} {{ detail.updateTime || '-' }} @@ -97,6 +98,27 @@ const statusOptions = [ { label: '全部', value: 'ALL' } ] +const failCodeOptions = [ + { label: 'NO_CUSTOMER_PACKAGE', value: 'NO_CUSTOMER_PACKAGE' }, + { label: 'NO_ACTIVE_PACKAGE_VERSION', value: 'NO_ACTIVE_PACKAGE_VERSION' }, + { label: 'ALREADY_IN_AR_BILL', value: 'ALREADY_IN_AR_BILL' }, + { label: 'PRODUCT_ARCHIVE_MISSING', value: 'PRODUCT_ARCHIVE_MISSING' }, + { label: 'PRICE_NOT_HIT', value: 'PRICE_NOT_HIT' }, + { label: 'ZONE_PRICE_NOT_HIT', value: 'ZONE_PRICE_NOT_HIT' }, + { label: 'POSTCODE_REQUIRED', value: 'POSTCODE_REQUIRED' }, + { label: 'POSTCODE_ZONE_NOT_FOUND', value: 'POSTCODE_ZONE_NOT_FOUND' }, + { label: 'ORACLE_ORDER_NOT_FOUND', value: 'ORACLE_ORDER_NOT_FOUND' }, + { label: 'ORACLE_ORDERNO_EMPTY', value: 'ORACLE_ORDERNO_EMPTY' }, + { label: 'ORACLE_CUSTOMER_EMPTY', value: 'ORACLE_CUSTOMER_EMPTY' }, + { label: 'ORACLE_PRODUCT_EMPTY', value: 'ORACLE_PRODUCT_EMPTY' }, + { label: 'ORACLE_WEIGHT_INVALID', value: 'ORACLE_WEIGHT_INVALID' }, + { label: 'BILL_TIME_EMPTY', value: 'BILL_TIME_EMPTY' }, + { label: 'REFUND_ORDER_UNRESOLVED', value: 'REFUND_ORDER_UNRESOLVED' }, + { label: 'CUSTOMER_CODE_REQUIRED', value: 'CUSTOMER_CODE_REQUIRED' }, + { label: 'CUSTOMER_DISABLED', value: 'CUSTOMER_DISABLED' }, + { label: 'FREIGHT_MISSING', value: 'FREIGHT_MISSING' }, + { label: 'UNKNOWN', value: 'UNKNOWN' } +] const billTypeOptions = [ { label: '待计费', value: 'PENDING' }, { label: '重计费', value: 'REBILL' }, @@ -106,6 +128,7 @@ const billTypeOptions = [ 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: 'orderNo', component: 'input', placeholder: '订单号', width: '180px' }, { label: '运单号', prop: 'trackingNo', component: 'input', placeholder: '运单号', width: '180px' }, { label: '转单号', prop: 'transferNo', component: 'input', placeholder: '转单号', width: '180px' } @@ -120,6 +143,7 @@ const columns = [ { label: '状态', prop: 'successStatus', align: 'center', width: 100, slot: 'successStatus' }, { label: '计费时间', prop: 'billTime', align: 'center', width: 170 }, { label: '失败原因', prop: 'errorMessage', minWidth: 220, slot: 'errorMessage', showOverflowTooltip: true }, + { label: '失败码', prop: 'failCode', align: 'center', width: 180, showOverflowTooltip: true }, { label: '创建时间', prop: 'createTime', align: 'center', width: 170 }, { label: '操作', prop: 'action', align: 'center', width: 180, fixed: 'right', slot: 'action', showInToolbar: false } ]