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 4cf30505..e6ea92ba 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 @@ -33,16 +33,15 @@ public class BillingTaskMonitorController extends BaseController @Autowired private IPrcBillingTaskService billingTaskService; - /** 默认列表 = FAILED 异常任务。 */ + /** 列表默认不过滤状态(全部);successStatus=ALL 同样不过滤。 */ @PreAuthorize("@ss.hasPermi('monitor:billingTask:list')") @GetMapping("/list") public TableDataInfo list(PrcBillingTask query) { - if (query.getSuccessStatus() == null || query.getSuccessStatus().isEmpty()) - { - query.setSuccessStatus(BillTaskSuccessStatus.FAILED.getCode()); - } - else if ("ALL".equalsIgnoreCase(query.getSuccessStatus())) + // 空/全部:不过滤状态;仍可按 FAILED/WAITING/SUCCESS 筛选 + if (query.getSuccessStatus() == null + || query.getSuccessStatus().isEmpty() + || "ALL".equalsIgnoreCase(query.getSuccessStatus())) { query.setSuccessStatus(null); } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcBillingBillListExportRow.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcBillingBillListExportRow.java index 1af13d50..b5efd48c 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcBillingBillListExportRow.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcBillingBillListExportRow.java @@ -33,9 +33,9 @@ public class PrcBillingBillListExportRow implements Serializable private String countryName; @Excel(name = "件数", width = 10) private Integer pieces; - @Excel(name = "计费重", scale = 3, width = 12) + @Excel(name = "客户确认重", scale = 3, width = 12) private BigDecimal chargeWeight; - @Excel(name = "原计费重", scale = 3, width = 12) + @Excel(name = "计费重", scale = 3, width = 12) private BigDecimal weight; @Excel(name = "收货重", scale = 3, width = 12) private BigDecimal receiveWeight; diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcOrderBillListExportRow.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcOrderBillListExportRow.java index d626a3d0..21904280 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcOrderBillListExportRow.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcOrderBillListExportRow.java @@ -35,6 +35,8 @@ public class PrcOrderBillListExportRow implements Serializable private Integer pieces; @Excel(name = "计费重", scale = 3, width = 12) private BigDecimal weight; + @Excel(name = "客户确认重", scale = 3, width = 12) + private BigDecimal chargeWeight; @Excel(name = "体积重", scale = 3, width = 12) private BigDecimal volumeWeight; @Excel(name = "实重", scale = 3, width = 12) diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/TmsPriceBillRequest.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/TmsPriceBillRequest.java index 0cffe5be..9a84d629 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/TmsPriceBillRequest.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/TmsPriceBillRequest.java @@ -42,6 +42,8 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest private BigDecimal actualWeight; /** 上游 TAB_ORDER.WEIGHT(收货重量) */ private BigDecimal receiveWeight; + /** 计费重覆盖:上游 CONFIRM_WEIGHT(客户确认重)或本地人工修改;无值则为 null */ + private BigDecimal chargeWeight; private BigDecimal volume; private BigDecimal volumeWeight; private BigDecimal pkgLength; diff --git a/bms-back/bms-system/src/main/java/com/bms/price/oracle/OracleOrderBillMapper.java b/bms-back/bms-system/src/main/java/com/bms/price/oracle/OracleOrderBillMapper.java index 3e4171dd..ccbeec9d 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/oracle/OracleOrderBillMapper.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/oracle/OracleOrderBillMapper.java @@ -49,9 +49,11 @@ public class OracleOrderBillMapper String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY"); req.setCountryName(countryName); req.setDestPostcode(StringUtils.normalizePostcode(firstStr(row, "CONSIGNEE_POSTCODE"))); - // 优先取 CONFIRM_WEIGHT(客户确认重量);回退取 DIMENSIONAL_WEIGHT_FACTOR(计费重量)。 - BigDecimal weight = firstPositiveDecimal(row, "CONFIRM_WEIGHT", "DIMENSIONAL_WEIGHT_FACTOR"); + // weight = 上游计费重 DIMENSIONAL_WEIGHT_FACTOR + BigDecimal weight = firstPositiveDecimal(row, "DIMENSIONAL_WEIGHT_FACTOR"); req.setWeight(weight); + // charge_weight 仅在客户确认重 CONFIRM_WEIGHT 有值时落库 + req.setChargeWeight(firstPositiveDecimal(row, "CONFIRM_WEIGHT")); // TAB_ORDER.WEIGHT = 收货重 req.setReceiveWeight(firstDecimal(row, "WEIGHT")); req.setActualWeight(firstPositiveDecimal(row, "ACTUAL_WEIGHT", "PUSH_WEIGHT", "WEIGHT")); diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcOrderBillServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcOrderBillServiceImpl.java index 15b283ac..c2d9146d 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcOrderBillServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcOrderBillServiceImpl.java @@ -2061,9 +2061,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService { bill.setCountryName(result.getCountryName()); } - // weight = 系统/上游原始重量;当 VOL_8000(或人工覆盖)提高/降低了计费重量时, - // charge_weight 可能与之不同。 - bill.setWeight(weight); + // weight=上游计费重(DIMENSIONAL_WEIGHT_FACTOR);charge_weight=客户确认重/人工修改 +bill.setWeight(weight); bill.setBizDate(bizDate); bill.setTmsId(request.getTmsId() == null ? null : Long.valueOf(request.getTmsId())); bill.setPriceSetId(result.getPriceSetId()); @@ -2078,16 +2077,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService bill.setWeightMax(result.getWeightMax()); bill.setWeightLabel(result.getWeightLabel()); bill.setEffectiveDate(result.getEffectiveDate()); - if (isUpstreamSyncRequest(request)) - { - // request.weight 已携带用于报价的规则/计算重量 - BigDecimal cw = request.getWeight() != null ? request.getWeight() : weight; - bill.setChargeWeight(cw); - } - else - { - bill.setChargeWeight(resolvePersistChargeWeight(weight, result.getChargeWeight())); - } + // charge_weight:仅上游客户确认重或本地人工修改有值时落库 + bill.setChargeWeight(resolvePersistChargeWeight(request, existed)); Integer billingFailStatus = result.getBillingFailStatus(); if (billingFailStatus == null) { @@ -2838,6 +2829,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService } BigDecimal cw = chargeWeight.setScale(3, RoundingMode.HALF_UP); TmsPriceBillRequest req = buildBillRequestFromBill(bill); + // 人工修改计费重:charge_weight 优先级最高 + req.setChargeWeight(cw); req.setWeight(cw); Date bizDate = bill.getBizDate(); if (bizDate == null) @@ -3085,55 +3078,54 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService return request != null && request.getUpstreamRow() != null && !request.getUpstreamRow().isEmpty(); } - /** charge_weight 与 weight 不同 => 视为人工覆盖。 */ - private static boolean isManualChargeWeight(PrcOrderBill bill) + /** charge_weight 有效值(上游客户确认重或本地人工修改)。 */ + private static boolean hasChargeWeightOverride(BigDecimal chargeWeight) { - if (bill == null || bill.getChargeWeight() == null || bill.getWeight() == null) - { - return false; - } - return bill.getChargeWeight().compareTo(bill.getWeight()) != 0; + return chargeWeight != null && chargeWeight.compareTo(BigDecimal.ZERO) > 0; } - /** 存在人工 charge_weight 时优先使用,否则使用系统重量。 */ - private static BigDecimal resolveCalcWeight(PrcOrderBill existed, BigDecimal systemWeight) + private static boolean hasChargeWeightOverride(PrcOrderBill bill) { - if (isManualChargeWeight(existed)) - { - return existed.getChargeWeight(); - } - return systemWeight; + return bill != null && hasChargeWeightOverride(bill.getChargeWeight()); + } + + private static BigDecimal positiveOrNull(BigDecimal value) + { + return hasChargeWeightOverride(value) ? value : null; } /** - * 解析用于报价/持久化的重量。 - * 上游:先取 TAB_ORDER 重量再按业务规则。本地:人工 charge_weight 优先,否则按业务规则。 + * 计费取重:charge_weight 优先级最高;无则用系统 weight 再走业务规则。 */ private BigDecimal resolveBillCalcWeight(TmsPriceBillRequest request, PrcOrderBill existed, BigDecimal systemWeight) { - BigDecimal calcWeight = isUpstreamSyncRequest(request) - ? systemWeight - : resolveCalcWeight(existed, systemWeight); - if (isUpstreamSyncRequest(request) || !isManualChargeWeight(existed)) + BigDecimal preferred = positiveOrNull(request == null ? null : request.getChargeWeight()); + if (preferred == null && !isUpstreamSyncRequest(request) && hasChargeWeightOverride(existed)) { - calcWeight = applyBizRuleWeight(request, calcWeight); + preferred = existed.getChargeWeight(); } - return calcWeight; + if (preferred != null) + { + return preferred; + } + return applyBizRuleWeight(request, systemWeight); } /** - * 上游同步/软失败:保留原始重量,charge_weight 可按业务规则计算。 + * 上游同步/软失败:weight=上游计费重;charge_weight=客户确认重(无值则 null)。 */ private void applyUpstreamWeightFields(PrcOrderBill bill, TmsPriceBillRequest request) { - if (bill == null || request == null || request.getWeight() == null) + if (bill == null || request == null) { return; } - BigDecimal systemWeight = request.getWeight(); - bill.setWeight(systemWeight); - bill.setChargeWeight(applyBizRuleWeight(request, systemWeight)); + if (request.getWeight() != null) + { + bill.setWeight(request.getWeight()); + } + bill.setChargeWeight(positiveOrNull(request.getChargeWeight())); } /** @@ -3151,18 +3143,25 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService } /** - * 持久化 charge_weight:当计算重量 != 系统重量, - * 或已有账单本就是人工覆盖时,保留人工覆盖值。 + * 落库 charge_weight:仅上游客户确认重或本地人工修改有值时保留。 + * 业务规则推出的重量不写入 charge_weight。 */ - private static BigDecimal resolvePersistChargeWeight(BigDecimal systemWeight, BigDecimal resultChargeWeight) + private static BigDecimal resolvePersistChargeWeight(TmsPriceBillRequest request, PrcOrderBill existed) { - // 计算重量 != 系统重量 => 将结果作为人工 charge_weight 保留 - if (systemWeight != null && resultChargeWeight != null - && systemWeight.compareTo(resultChargeWeight) != 0) + if (isUpstreamSyncRequest(request)) { - return resultChargeWeight; + return positiveOrNull(request.getChargeWeight()); } - return resultChargeWeight; + BigDecimal reqCw = positiveOrNull(request == null ? null : request.getChargeWeight()); + if (reqCw != null) + { + return reqCw; + } + if (hasChargeWeightOverride(existed)) + { + return existed.getChargeWeight(); + } + return null; } private TmsPriceBillRequest buildBillRequestFromBill(PrcOrderBill bill) @@ -3210,8 +3209,9 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService { req.setBizDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", bill.getBizDate())); } - BigDecimal w = bill.getChargeWeight() != null ? bill.getChargeWeight() : bill.getWeight(); - req.setWeight(w); + // weight=系统重;charge_weight=覆盖重(计费优先) + req.setWeight(bill.getWeight()); + req.setChargeWeight(positiveOrNull(bill.getChargeWeight())); return req; } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/support/OrderBillExportSupport.java b/bms-back/bms-system/src/main/java/com/bms/price/service/support/OrderBillExportSupport.java index 03a26976..83d5b868 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/support/OrderBillExportSupport.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/support/OrderBillExportSupport.java @@ -147,6 +147,7 @@ public final class OrderBillExportSupport row.setCountryName(bill.getCountryName()); row.setPieces(bill.getPieces()); row.setWeight(bill.getWeight()); + row.setChargeWeight(bill.getChargeWeight()); row.setVolumeWeight(bill.getVolumeWeight()); row.setReceiveWeight(bill.getReceiveWeight()); row.setDestPostcode(bill.getDestPostcode()); diff --git a/bms-front/src/utils/exportFieldDefs.js b/bms-front/src/utils/exportFieldDefs.js index 0284e6d0..6acbf005 100644 --- a/bms-front/src/utils/exportFieldDefs.js +++ b/bms-front/src/utils/exportFieldDefs.js @@ -33,6 +33,7 @@ export const ORDER_BILL_EXPORT_FIELDS = [ { prop: 'countryName', label: '国家/地区' }, { prop: 'pieces', label: '件数' }, { prop: 'weight', label: '计费重' }, + { prop: 'chargeWeight', label: '客户确认重' }, { prop: 'volumeWeight', label: '体积重' }, { prop: 'receiveWeight', label: '实重' }, { prop: 'destPostcode', label: '收件人邮编' }, @@ -57,8 +58,8 @@ export const BILLING_BILL_EXPORT_FIELDS = [ { prop: 'countryCode', label: '国家代码' }, { prop: 'countryName', label: '国家/地区' }, { prop: 'pieces', label: '件数' }, - { prop: 'chargeWeight', label: '计费重' }, - { prop: 'weight', label: '原计费重' }, + { prop: 'chargeWeight', label: '客户确认重' }, + { prop: 'weight', label: '计费重' }, { prop: 'receiveWeight', label: '收货重' }, { prop: 'incomeTotal', label: '应收总额' }, { prop: 'payTotal', label: '应付总额' }, diff --git a/bms-front/src/views/monitor/billingTask/index.vue b/bms-front/src/views/monitor/billingTask/index.vue index 524080b6..464a7aa6 100644 --- a/bms-front/src/views/monitor/billingTask/index.vue +++ b/bms-front/src/views/monitor/billingTask/index.vue @@ -81,9 +81,6 @@ import { listBillingTask, retryBillingTask, retryBillingTaskBatch } from '@/api/ import BillingTaskDetailDrawer from './components/BillingTaskDetailDrawer.vue' import BillingTaskFilterRetryDialog from './components/BillingTaskFilterRetryDialog.vue' import { - statusOptions, - billTypeOptions, - failCodeOptions, billTypeLabel, statusLabel, statusTag @@ -97,16 +94,11 @@ const retryingId = ref(null) const batchLoading = ref(false) const retryFloat = ref(null) -const defaultParams = { successStatus: 'FAILED' } +const defaultParams = {} 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' }, + { label: '客户代码', prop: 'customerCode', component: 'input', placeholder: '客户代码', width: '160px' }, { label: '计费时间', prop: 'dateRange', component: 'daterange', width: '308px' } ] diff --git a/bms-front/src/views/price/billing/bill.vue b/bms-front/src/views/price/billing/bill.vue index f45bc889..447554da 100644 --- a/bms-front/src/views/price/billing/bill.vue +++ b/bms-front/src/views/price/billing/bill.vue @@ -106,6 +106,12 @@ + + @@ -577,9 +583,9 @@ const columns = [ { label: '产品', prop: 'product', minWidth: 160, slot: 'product' }, { label: '国家', prop: 'country', minWidth: 130, slot: 'country' }, { label: '件数', prop: 'pieces', align: 'center', width: 70 }, - { label: '计费重', prop: 'chargeWeight', align: 'center', width: 90, slot: 'chargeWeight' }, - { label: '原计费重', prop: 'weight', align: 'center', width: 100, slot: 'chargeWeight' }, - { label: '收货重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'chargeWeight' }, + { label: '客户确认重', prop: 'chargeWeight', align: 'center', width: 110, slot: 'chargeWeight' }, + { label: '计费重', prop: 'weight', align: 'center', width: 90, slot: 'weight' }, + { label: '收货重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'receiveWeight' }, { label: '应收总额', prop: 'incomeTotal', align: 'right', width: 120, slot: 'incomeTotal' }, { label: '应付总额', prop: 'payTotal', align: 'right', width: 120, slot: 'payTotal' }, { label: '订单状态', prop: 'orderStatus', align: 'center', width: 110, slot: 'orderStatus' }, diff --git a/bms-front/src/views/price/billing/components/BillDetail.vue b/bms-front/src/views/price/billing/components/BillDetail.vue index 8fe1bbf0..556584bd 100644 --- a/bms-front/src/views/price/billing/components/BillDetail.vue +++ b/bms-front/src/views/price/billing/components/BillDetail.vue @@ -76,6 +76,7 @@ {{ productLabel(detail) }} + {{ formatWeight(detail.chargeWeight) }} {{ formatWeight(detail.chargeWeight ?? detail.weight) }} {{ formatWeight(detail.weight) }} {{ detail.weightLabel || '-' }} diff --git a/bms-front/src/views/price/orderBill/index.vue b/bms-front/src/views/price/orderBill/index.vue index 3b6eb4ee..9899e104 100644 --- a/bms-front/src/views/price/orderBill/index.vue +++ b/bms-front/src/views/price/orderBill/index.vue @@ -179,6 +179,9 @@ + @@ -599,6 +602,7 @@ const columns = [ { label: '渠道', prop: 'channel', minWidth: 160, slot: 'channel' }, { label: '国家', prop: 'country', minWidth: 130, slot: 'country' }, { label: '计费重', prop: 'weight', align: 'center', width: 90, slot: 'weight' }, + { label: '客户确认重', prop: 'chargeWeight', align: 'center', width: 110, slot: 'chargeWeight' }, { label: '体积重', prop: 'volumeWeight', align: 'center', width: 90, slot: 'volumeWeight' }, { label: '实重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'receiveWeight' }, { label: '收件人邮编', prop: 'destPostcode', minWidth: 120, showOverflowTooltip: true },