优化计费任务列表状态过滤逻辑,更新计费重和客户确认重字段名称

This commit is contained in:
wuweihua
2026-11-17 10:13:09 +08:00
committed by caojia
parent ea62697b98
commit 7500728c1d
12 changed files with 85 additions and 75 deletions
@@ -33,16 +33,15 @@ public class BillingTaskMonitorController extends BaseController
@Autowired @Autowired
private IPrcBillingTaskService billingTaskService; private IPrcBillingTaskService billingTaskService;
/** 默认列表 = FAILED 异常任务。 */ /** 列表默认不过滤状态(全部);successStatus=ALL 同样不过滤。 */
@PreAuthorize("@ss.hasPermi('monitor:billingTask:list')") @PreAuthorize("@ss.hasPermi('monitor:billingTask:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(PrcBillingTask query) public TableDataInfo list(PrcBillingTask query)
{ {
if (query.getSuccessStatus() == null || query.getSuccessStatus().isEmpty()) // 空/全部:不过滤状态;仍可按 FAILED/WAITING/SUCCESS 筛选
{ if (query.getSuccessStatus() == null
query.setSuccessStatus(BillTaskSuccessStatus.FAILED.getCode()); || query.getSuccessStatus().isEmpty()
} || "ALL".equalsIgnoreCase(query.getSuccessStatus()))
else if ("ALL".equalsIgnoreCase(query.getSuccessStatus()))
{ {
query.setSuccessStatus(null); query.setSuccessStatus(null);
} }
@@ -33,9 +33,9 @@ public class PrcBillingBillListExportRow implements Serializable
private String countryName; private String countryName;
@Excel(name = "件数", width = 10) @Excel(name = "件数", width = 10)
private Integer pieces; private Integer pieces;
@Excel(name = "计费重", scale = 3, width = 12) @Excel(name = "客户确认重", scale = 3, width = 12)
private BigDecimal chargeWeight; private BigDecimal chargeWeight;
@Excel(name = "原计费重", scale = 3, width = 12) @Excel(name = "计费重", scale = 3, width = 12)
private BigDecimal weight; private BigDecimal weight;
@Excel(name = "收货重", scale = 3, width = 12) @Excel(name = "收货重", scale = 3, width = 12)
private BigDecimal receiveWeight; private BigDecimal receiveWeight;
@@ -35,6 +35,8 @@ public class PrcOrderBillListExportRow implements Serializable
private Integer pieces; private Integer pieces;
@Excel(name = "计费重", scale = 3, width = 12) @Excel(name = "计费重", scale = 3, width = 12)
private BigDecimal weight; private BigDecimal weight;
@Excel(name = "客户确认重", scale = 3, width = 12)
private BigDecimal chargeWeight;
@Excel(name = "体积重", scale = 3, width = 12) @Excel(name = "体积重", scale = 3, width = 12)
private BigDecimal volumeWeight; private BigDecimal volumeWeight;
@Excel(name = "实重", scale = 3, width = 12) @Excel(name = "实重", scale = 3, width = 12)
@@ -42,6 +42,8 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
private BigDecimal actualWeight; private BigDecimal actualWeight;
/** 上游 TAB_ORDER.WEIGHT(收货重量) */ /** 上游 TAB_ORDER.WEIGHT(收货重量) */
private BigDecimal receiveWeight; private BigDecimal receiveWeight;
/** 计费重覆盖:上游 CONFIRM_WEIGHT(客户确认重)或本地人工修改;无值则为 null */
private BigDecimal chargeWeight;
private BigDecimal volume; private BigDecimal volume;
private BigDecimal volumeWeight; private BigDecimal volumeWeight;
private BigDecimal pkgLength; private BigDecimal pkgLength;
@@ -49,9 +49,11 @@ public class OracleOrderBillMapper
String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY"); String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY");
req.setCountryName(countryName); req.setCountryName(countryName);
req.setDestPostcode(StringUtils.normalizePostcode(firstStr(row, "CONSIGNEE_POSTCODE"))); req.setDestPostcode(StringUtils.normalizePostcode(firstStr(row, "CONSIGNEE_POSTCODE")));
// 优先取 CONFIRM_WEIGHT(客户确认重量);回退取 DIMENSIONAL_WEIGHT_FACTOR(计费重量)。 // weight = 上游计费重 DIMENSIONAL_WEIGHT_FACTOR
BigDecimal weight = firstPositiveDecimal(row, "CONFIRM_WEIGHT", "DIMENSIONAL_WEIGHT_FACTOR"); BigDecimal weight = firstPositiveDecimal(row, "DIMENSIONAL_WEIGHT_FACTOR");
req.setWeight(weight); req.setWeight(weight);
// charge_weight 仅在客户确认重 CONFIRM_WEIGHT 有值时落库
req.setChargeWeight(firstPositiveDecimal(row, "CONFIRM_WEIGHT"));
// TAB_ORDER.WEIGHT = 收货重 // TAB_ORDER.WEIGHT = 收货重
req.setReceiveWeight(firstDecimal(row, "WEIGHT")); req.setReceiveWeight(firstDecimal(row, "WEIGHT"));
req.setActualWeight(firstPositiveDecimal(row, "ACTUAL_WEIGHT", "PUSH_WEIGHT", "WEIGHT")); req.setActualWeight(firstPositiveDecimal(row, "ACTUAL_WEIGHT", "PUSH_WEIGHT", "WEIGHT"));
@@ -2061,8 +2061,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
{ {
bill.setCountryName(result.getCountryName()); bill.setCountryName(result.getCountryName());
} }
// weight = 系统/上游原始重量;当 VOL_8000(或人工覆盖)提高/降低了计费重量时, // weight=上游计费重(DIMENSIONAL_WEIGHT_FACTOR);charge_weight=客户确认重/人工修改
// charge_weight 可能与之不同。
bill.setWeight(weight); bill.setWeight(weight);
bill.setBizDate(bizDate); bill.setBizDate(bizDate);
bill.setTmsId(request.getTmsId() == null ? null : Long.valueOf(request.getTmsId())); bill.setTmsId(request.getTmsId() == null ? null : Long.valueOf(request.getTmsId()));
@@ -2078,16 +2077,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
bill.setWeightMax(result.getWeightMax()); bill.setWeightMax(result.getWeightMax());
bill.setWeightLabel(result.getWeightLabel()); bill.setWeightLabel(result.getWeightLabel());
bill.setEffectiveDate(result.getEffectiveDate()); bill.setEffectiveDate(result.getEffectiveDate());
if (isUpstreamSyncRequest(request)) // charge_weight:仅上游客户确认重或本地人工修改有值时落库
{ bill.setChargeWeight(resolvePersistChargeWeight(request, existed));
// request.weight 已携带用于报价的规则/计算重量
BigDecimal cw = request.getWeight() != null ? request.getWeight() : weight;
bill.setChargeWeight(cw);
}
else
{
bill.setChargeWeight(resolvePersistChargeWeight(weight, result.getChargeWeight()));
}
Integer billingFailStatus = result.getBillingFailStatus(); Integer billingFailStatus = result.getBillingFailStatus();
if (billingFailStatus == null) if (billingFailStatus == null)
{ {
@@ -2838,6 +2829,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
} }
BigDecimal cw = chargeWeight.setScale(3, RoundingMode.HALF_UP); BigDecimal cw = chargeWeight.setScale(3, RoundingMode.HALF_UP);
TmsPriceBillRequest req = buildBillRequestFromBill(bill); TmsPriceBillRequest req = buildBillRequestFromBill(bill);
// 人工修改计费重:charge_weight 优先级最高
req.setChargeWeight(cw);
req.setWeight(cw); req.setWeight(cw);
Date bizDate = bill.getBizDate(); Date bizDate = bill.getBizDate();
if (bizDate == null) if (bizDate == null)
@@ -3085,55 +3078,54 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return request != null && request.getUpstreamRow() != null && !request.getUpstreamRow().isEmpty(); return request != null && request.getUpstreamRow() != null && !request.getUpstreamRow().isEmpty();
} }
/** charge_weight 与 weight 不同 => 视为人工覆盖。 */ /** charge_weight 有效值(上游客户确认重或本地人工修改)。 */
private static boolean isManualChargeWeight(PrcOrderBill bill) private static boolean hasChargeWeightOverride(BigDecimal chargeWeight)
{ {
if (bill == null || bill.getChargeWeight() == null || bill.getWeight() == null) return chargeWeight != null && chargeWeight.compareTo(BigDecimal.ZERO) > 0;
{
return false;
}
return bill.getChargeWeight().compareTo(bill.getWeight()) != 0;
} }
/** 存在人工 charge_weight 时优先使用,否则使用系统重量。 */ private static boolean hasChargeWeightOverride(PrcOrderBill bill)
private static BigDecimal resolveCalcWeight(PrcOrderBill existed, BigDecimal systemWeight)
{ {
if (isManualChargeWeight(existed)) return bill != null && hasChargeWeightOverride(bill.getChargeWeight());
{
return existed.getChargeWeight();
} }
return systemWeight;
private static BigDecimal positiveOrNull(BigDecimal value)
{
return hasChargeWeightOverride(value) ? value : null;
} }
/** /**
* 解析用于报价/持久化的重量。 * 计费取重:charge_weight 优先级最高;无则用系统 weight 再走业务规则。
* 上游:先取 TAB_ORDER 重量再按业务规则。本地:人工 charge_weight 优先,否则按业务规则。
*/ */
private BigDecimal resolveBillCalcWeight(TmsPriceBillRequest request, PrcOrderBill existed, private BigDecimal resolveBillCalcWeight(TmsPriceBillRequest request, PrcOrderBill existed,
BigDecimal systemWeight) BigDecimal systemWeight)
{ {
BigDecimal calcWeight = isUpstreamSyncRequest(request) BigDecimal preferred = positiveOrNull(request == null ? null : request.getChargeWeight());
? systemWeight if (preferred == null && !isUpstreamSyncRequest(request) && hasChargeWeightOverride(existed))
: resolveCalcWeight(existed, systemWeight);
if (isUpstreamSyncRequest(request) || !isManualChargeWeight(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) private void applyUpstreamWeightFields(PrcOrderBill bill, TmsPriceBillRequest request)
{ {
if (bill == null || request == null || request.getWeight() == null) if (bill == null || request == null)
{ {
return; return;
} }
BigDecimal systemWeight = request.getWeight(); if (request.getWeight() != null)
bill.setWeight(systemWeight); {
bill.setChargeWeight(applyBizRuleWeight(request, systemWeight)); 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 (isUpstreamSyncRequest(request))
if (systemWeight != null && resultChargeWeight != null
&& systemWeight.compareTo(resultChargeWeight) != 0)
{ {
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) 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())); req.setBizDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", bill.getBizDate()));
} }
BigDecimal w = bill.getChargeWeight() != null ? bill.getChargeWeight() : bill.getWeight(); // weight=系统重;charge_weight=覆盖重(计费优先)
req.setWeight(w); req.setWeight(bill.getWeight());
req.setChargeWeight(positiveOrNull(bill.getChargeWeight()));
return req; return req;
} }
@@ -147,6 +147,7 @@ public final class OrderBillExportSupport
row.setCountryName(bill.getCountryName()); row.setCountryName(bill.getCountryName());
row.setPieces(bill.getPieces()); row.setPieces(bill.getPieces());
row.setWeight(bill.getWeight()); row.setWeight(bill.getWeight());
row.setChargeWeight(bill.getChargeWeight());
row.setVolumeWeight(bill.getVolumeWeight()); row.setVolumeWeight(bill.getVolumeWeight());
row.setReceiveWeight(bill.getReceiveWeight()); row.setReceiveWeight(bill.getReceiveWeight());
row.setDestPostcode(bill.getDestPostcode()); row.setDestPostcode(bill.getDestPostcode());
+3 -2
View File
@@ -33,6 +33,7 @@ export const ORDER_BILL_EXPORT_FIELDS = [
{ prop: 'countryName', label: '国家/地区' }, { prop: 'countryName', label: '国家/地区' },
{ prop: 'pieces', label: '件数' }, { prop: 'pieces', label: '件数' },
{ prop: 'weight', label: '计费重' }, { prop: 'weight', label: '计费重' },
{ prop: 'chargeWeight', label: '客户确认重' },
{ prop: 'volumeWeight', label: '体积重' }, { prop: 'volumeWeight', label: '体积重' },
{ prop: 'receiveWeight', label: '实重' }, { prop: 'receiveWeight', label: '实重' },
{ prop: 'destPostcode', label: '收件人邮编' }, { prop: 'destPostcode', label: '收件人邮编' },
@@ -57,8 +58,8 @@ export const BILLING_BILL_EXPORT_FIELDS = [
{ prop: 'countryCode', label: '国家代码' }, { prop: 'countryCode', label: '国家代码' },
{ prop: 'countryName', label: '国家/地区' }, { prop: 'countryName', label: '国家/地区' },
{ prop: 'pieces', label: '件数' }, { prop: 'pieces', label: '件数' },
{ prop: 'chargeWeight', label: '计费重' }, { prop: 'chargeWeight', label: '客户确认重' },
{ prop: 'weight', label: '原计费重' }, { prop: 'weight', label: '计费重' },
{ prop: 'receiveWeight', label: '收货重' }, { prop: 'receiveWeight', label: '收货重' },
{ prop: 'incomeTotal', label: '应收总额' }, { prop: 'incomeTotal', label: '应收总额' },
{ prop: 'payTotal', label: '应付总额' }, { prop: 'payTotal', label: '应付总额' },
@@ -81,9 +81,6 @@ import { listBillingTask, retryBillingTask, retryBillingTaskBatch } from '@/api/
import BillingTaskDetailDrawer from './components/BillingTaskDetailDrawer.vue' import BillingTaskDetailDrawer from './components/BillingTaskDetailDrawer.vue'
import BillingTaskFilterRetryDialog from './components/BillingTaskFilterRetryDialog.vue' import BillingTaskFilterRetryDialog from './components/BillingTaskFilterRetryDialog.vue'
import { import {
statusOptions,
billTypeOptions,
failCodeOptions,
billTypeLabel, billTypeLabel,
statusLabel, statusLabel,
statusTag statusTag
@@ -97,16 +94,11 @@ const retryingId = ref(null)
const batchLoading = ref(false) const batchLoading = ref(false)
const retryFloat = ref(null) const retryFloat = ref(null)
const defaultParams = { successStatus: 'FAILED' } const defaultParams = {}
const searchColumns = [ 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: 'transferNo', component: 'input', placeholder: '转单号', width: '180px' },
{ label: '客户代码', prop: 'customerCode', component: 'input', placeholder: '客户代码', width: '160px' },
{ label: '计费时间', prop: 'dateRange', component: 'daterange', width: '308px' } { label: '计费时间', prop: 'dateRange', component: 'daterange', width: '308px' }
] ]
+9 -3
View File
@@ -106,6 +106,12 @@
<template #col-chargeWeight="{ row }"> <template #col-chargeWeight="{ row }">
{{ formatWeight(row.chargeWeight) }} {{ formatWeight(row.chargeWeight) }}
</template> </template>
<template #col-weight="{ row }">
{{ formatWeight(row.weight) }}
</template>
<template #col-receiveWeight="{ row }">
{{ formatWeight(row.receiveWeight) }}
</template>
<template #col-orderStatus="{ row }"> <template #col-orderStatus="{ row }">
{{ orderStatusLabel(row.orderStatus) }} {{ orderStatusLabel(row.orderStatus) }}
</template> </template>
@@ -577,9 +583,9 @@ const columns = [
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' }, { label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
{ label: '国家', prop: 'country', minWidth: 130, slot: 'country' }, { label: '国家', prop: 'country', minWidth: 130, slot: 'country' },
{ label: '件数', prop: 'pieces', align: 'center', width: 70 }, { label: '件数', prop: 'pieces', align: 'center', width: 70 },
{ label: '计费重', prop: 'chargeWeight', align: 'center', width: 90, slot: 'chargeWeight' }, { label: '客户确认重', prop: 'chargeWeight', align: 'center', width: 110, slot: 'chargeWeight' },
{ label: '原计费重', prop: 'weight', align: 'center', width: 100, slot: 'chargeWeight' }, { label: '计费重', prop: 'weight', align: 'center', width: 90, slot: 'weight' },
{ label: '收货重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'chargeWeight' }, { label: '收货重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'receiveWeight' },
{ label: '应收总额', prop: 'incomeTotal', align: 'right', width: 120, slot: 'incomeTotal' }, { label: '应收总额', prop: 'incomeTotal', align: 'right', width: 120, slot: 'incomeTotal' },
{ label: '应付总额', prop: 'payTotal', align: 'right', width: 120, slot: 'payTotal' }, { label: '应付总额', prop: 'payTotal', align: 'right', width: 120, slot: 'payTotal' },
{ label: '订单状态', prop: 'orderStatus', align: 'center', width: 110, slot: 'orderStatus' }, { label: '订单状态', prop: 'orderStatus', align: 'center', width: 110, slot: 'orderStatus' },
@@ -76,6 +76,7 @@
</div> </div>
<el-descriptions class="detail-desc" :column="2" border size="small"> <el-descriptions class="detail-desc" :column="2" border size="small">
<el-descriptions-item label="产品">{{ productLabel(detail) }}</el-descriptions-item> <el-descriptions-item label="产品">{{ productLabel(detail) }}</el-descriptions-item>
<el-descriptions-item label="客户确认重(kg)">{{ formatWeight(detail.chargeWeight) }}</el-descriptions-item>
<el-descriptions-item label="计费重量(kg)">{{ formatWeight(detail.chargeWeight ?? detail.weight) }}</el-descriptions-item> <el-descriptions-item label="计费重量(kg)">{{ formatWeight(detail.chargeWeight ?? detail.weight) }}</el-descriptions-item>
<el-descriptions-item label="原计费重(kg)">{{ formatWeight(detail.weight) }}</el-descriptions-item> <el-descriptions-item label="原计费重(kg)">{{ formatWeight(detail.weight) }}</el-descriptions-item>
<el-descriptions-item label="重量段">{{ detail.weightLabel || '-' }}</el-descriptions-item> <el-descriptions-item label="重量段">{{ detail.weightLabel || '-' }}</el-descriptions-item>
@@ -179,6 +179,9 @@
<template #col-weight="{ row }"> <template #col-weight="{ row }">
{{ formatWeight(row.weight) }} {{ formatWeight(row.weight) }}
</template> </template>
<template #col-chargeWeight="{ row }">
{{ formatWeight(row.chargeWeight) }}
</template>
<template #col-volumeWeight="{ row }"> <template #col-volumeWeight="{ row }">
{{ formatWeight(row.volumeWeight) }} {{ formatWeight(row.volumeWeight) }}
</template> </template>
@@ -599,6 +602,7 @@ const columns = [
{ label: '渠道', prop: 'channel', minWidth: 160, slot: 'channel' }, { label: '渠道', prop: 'channel', minWidth: 160, slot: 'channel' },
{ label: '国家', prop: 'country', minWidth: 130, slot: 'country' }, { label: '国家', prop: 'country', minWidth: 130, slot: 'country' },
{ label: '计费重', prop: 'weight', align: 'center', width: 90, slot: 'weight' }, { 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: 'volumeWeight', align: 'center', width: 90, slot: 'volumeWeight' },
{ label: '实重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'receiveWeight' }, { label: '实重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'receiveWeight' },
{ label: '收件人邮编', prop: 'destPostcode', minWidth: 120, showOverflowTooltip: true }, { label: '收件人邮编', prop: 'destPostcode', minWidth: 120, showOverflowTooltip: true },