修改计费时间类型

This commit is contained in:
wuweihua
2026-10-12 11:05:24 +08:00
parent 9dcf1b201c
commit b68cefd8d0
11 changed files with 27 additions and 22 deletions
@@ -67,7 +67,8 @@ public class PrcOrderBill extends BaseEntity
private String countryCode; private String countryCode;
private String countryName; private String countryName;
private BigDecimal weight; private BigDecimal weight;
@JsonFormat(pattern = "yyyy-MM-dd") /** 计费时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bizDate; private Date bizDate;
private Long tmsId; private Long tmsId;
@@ -32,7 +32,7 @@ public class TmsPriceQuoteRequest implements Serializable
@NotNull(message = "weight is required") @NotNull(message = "weight is required")
private BigDecimal weight; private BigDecimal weight;
/** yyyy-MM-dd,默认今天 */ /** yyyy-MM-dd or yyyy-MM-dd HH:mm:ss; quote defaults today; bill required */
private String bizDate; private String bizDate;
private Integer tmsId; private Integer tmsId;
/** Header X-Api-Code 优先;Body 兜底 */ /** Header X-Api-Code 优先;Body 兜底 */
@@ -62,7 +62,7 @@ public class OracleOrderBillMapper
req.setConsigneeName(firstStr(row, "CONSIGNEE_NAME")); req.setConsigneeName(firstStr(row, "CONSIGNEE_NAME"));
req.setWarehouseCode(firstStr(row, "REGISTER_SITE_CODE")); req.setWarehouseCode(firstStr(row, "REGISTER_SITE_CODE"));
req.setOrderRemark(firstStr(row, "TRACK_REMARK", "EXCEPTION_REMARK", "ORDER_CUSTOMNOTE")); req.setOrderRemark(firstStr(row, "TRACK_REMARK", "EXCEPTION_REMARK", "ORDER_CUSTOMNOTE"));
// CREATE_DATE is order place time only; bizDate (billing date) comes from mobile inbound task. // CREATE_DATE is order place time only; bizDate (billing datetime) comes from task.bill_time.
Date createDate = firstDate(row, "CREATE_DATE"); Date createDate = firstDate(row, "CREATE_DATE");
if (createDate != null) if (createDate != null)
{ {
@@ -182,8 +182,8 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
{ {
billReq.setOrderNo(task.getOrderNo()); billReq.setOrderNo(task.getOrderNo());
} }
// Billing date from task.bill_time (mobile), not Oracle CREATE_DATE. // Billing datetime from task.bill_time (keep HH:mm:ss), not Oracle CREATE_DATE.
billReq.setBizDate(new SimpleDateFormat("yyyy-MM-dd").format(task.getBillTime())); billReq.setBizDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(task.getBillTime()));
task.setCustomerCode(billReq.getCustomerCode()); task.setCustomerCode(billReq.getCustomerCode());
TmsPriceQuoteResult result = billWithDbRetry(taskId, billReq); TmsPriceQuoteResult result = billWithDbRetry(taskId, billReq);
@@ -2,8 +2,6 @@ package com.bms.price.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Arrays; import java.util.Arrays;
@@ -27,6 +25,7 @@ import com.bms.ar.enums.ArOrderBillStatus;
import com.bms.common.annotation.DataScope; import com.bms.common.annotation.DataScope;
import com.bms.common.core.domain.entity.SysUser; import com.bms.common.core.domain.entity.SysUser;
import com.bms.common.exception.ServiceException; import com.bms.common.exception.ServiceException;
import com.bms.common.utils.DateUtils;
import com.bms.common.utils.DictUtils; import com.bms.common.utils.DictUtils;
import com.bms.common.utils.MessageUtils; import com.bms.common.utils.MessageUtils;
import com.bms.common.utils.SecurityUtils; import com.bms.common.utils.SecurityUtils;
@@ -1709,13 +1708,11 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
{ {
throw new ServiceException(MessageUtils.message("price.bill.bizDateRequired")); throw new ServiceException(MessageUtils.message("price.bill.bizDateRequired"));
} }
try Date parsed = DateUtils.parseDate(bizDate.trim());
{ if (parsed == null)
return new SimpleDateFormat("yyyy-MM-dd").parse(bizDate.trim());
}
catch (ParseException e)
{ {
throw new ServiceException(MessageUtils.message("price.quote.bizDateInvalid")); throw new ServiceException(MessageUtils.message("price.quote.bizDateInvalid"));
} }
return parsed;
} }
} }
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.bms.common.exception.ServiceException; import com.bms.common.exception.ServiceException;
import com.bms.common.utils.DateUtils;
import com.bms.common.utils.MessageUtils; import com.bms.common.utils.MessageUtils;
import com.bms.common.utils.StringUtils; import com.bms.common.utils.StringUtils;
import com.bms.common.utils.sign.Md5Utils; import com.bms.common.utils.sign.Md5Utils;
@@ -1630,14 +1631,12 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
return new Date(); return new Date();
} }
} }
try Date parsed = DateUtils.parseDate(bizDate.trim());
{ if (parsed == null)
return new SimpleDateFormat("yyyy-MM-dd").parse(bizDate.trim());
}
catch (ParseException e)
{ {
throw new ServiceException(MessageUtils.message("price.quote.bizDateInvalid")); throw new ServiceException(MessageUtils.message("price.quote.bizDateInvalid"));
} }
return parsed;
} }
/** Use end of bill day so same-day version activate still matches that day's quote. */ /** Use end of bill day so same-day version activate still matches that day's quote. */
+1 -1
View File
@@ -1019,7 +1019,7 @@ CREATE TABLE `prc_order_bill` (
`country_code` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国家二字码', `country_code` char(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国家二字码',
`country_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国家名称', `country_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国家名称',
`weight` decimal(10,3) NOT NULL COMMENT '计费重量KG', `weight` decimal(10,3) NOT NULL COMMENT '计费重量KG',
`biz_date` date NOT NULL COMMENT '计费日期', `biz_date` datetime NOT NULL COMMENT '计费时间',
`tms_id` bigint(20) DEFAULT NULL COMMENT '多租户系统ID', `tms_id` bigint(20) DEFAULT NULL COMMENT '多租户系统ID',
`match_source` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '命中来源', `match_source` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '命中来源',
`match_message` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '命中说明', `match_message` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '命中说明',
@@ -0,0 +1,3 @@
-- prc_order_bill.biz_date: date -> datetime (keep hour/minute/second)
ALTER TABLE prc_order_bill
MODIFY COLUMN `biz_date` datetime NOT NULL COMMENT '计费时间';
@@ -69,7 +69,7 @@
<el-table-column prop="trackingNo" label="运单号" min-width="140" show-overflow-tooltip /> <el-table-column prop="trackingNo" label="运单号" min-width="140" show-overflow-tooltip />
<el-table-column prop="transferNo" label="转单号" min-width="140" show-overflow-tooltip /> <el-table-column prop="transferNo" label="转单号" min-width="140" show-overflow-tooltip />
<el-table-column prop="customerName" label="客户" min-width="130" show-overflow-tooltip /> <el-table-column prop="customerName" label="客户" min-width="130" show-overflow-tooltip />
<el-table-column prop="bizDate" label="业务日期" width="105" :formatter="formatDateColumn" /> <el-table-column prop="bizDate" label="业务日期" width="170" :formatter="formatDateColumn" />
<el-table-column prop="productName" label="产品" min-width="140" show-overflow-tooltip /> <el-table-column prop="productName" label="产品" min-width="140" show-overflow-tooltip />
<el-table-column prop="countryName" label="国家/地区" min-width="110" show-overflow-tooltip /> <el-table-column prop="countryName" label="国家/地区" min-width="110" show-overflow-tooltip />
<el-table-column prop="actualWeight" label="实际重(kg)" width="105" align="right" :formatter="formatNumberColumn" /> <el-table-column prop="actualWeight" label="实际重(kg)" width="105" align="right" :formatter="formatNumberColumn" />
@@ -107,7 +107,7 @@
<el-table-column prop="trackingNo" label="运单号" min-width="180" show-overflow-tooltip /> <el-table-column prop="trackingNo" label="运单号" min-width="180" show-overflow-tooltip />
<el-table-column prop="transferNo" label="转单号" min-width="180" show-overflow-tooltip /> <el-table-column prop="transferNo" label="转单号" min-width="180" show-overflow-tooltip />
<el-table-column prop="customerName" label="客户" min-width="150" show-overflow-tooltip /> <el-table-column prop="customerName" label="客户" min-width="150" show-overflow-tooltip />
<el-table-column prop="bizDate" label="业务日期" width="120" :formatter="formatDateColumn" /> <el-table-column prop="bizDate" label="业务日期" width="170" :formatter="formatDateColumn" />
<el-table-column prop="incomeTotal" label="应收金额" width="130" align="right" :formatter="formatNumberColumn" /> <el-table-column prop="incomeTotal" label="应收金额" width="130" align="right" :formatter="formatNumberColumn" />
<el-table-column prop="currency" label="币种" width="80" /> <el-table-column prop="currency" label="币种" width="80" />
</el-table> </el-table>
@@ -533,7 +533,11 @@ function confirmGenerate() {
}) })
} }
function date(value) { return value ? String(value).slice(0, 10) : '-' } function date(value) {
if (!value) return '-'
const s = String(value).replace('T', ' ')
return s.length >= 19 ? s.slice(0, 19) : (s.length >= 10 ? s.slice(0, 10) : s)
}
function money(value) { const num = Number(value); return Number.isNaN(num) ? '-' : num.toFixed(2) } function money(value) { const num = Number(value); return Number.isNaN(num) ? '-' : num.toFixed(2) }
function formatDateColumn(_, __, value) { return date(value) } function formatDateColumn(_, __, value) { return date(value) }
function formatNumberColumn(_, __, value) { return Number(value || 0).toFixed(2) } function formatNumberColumn(_, __, value) { return Number(value || 0).toFixed(2) }
@@ -152,6 +152,7 @@ const columns = [
{ label: '计价来源', prop: 'matchSource', align: 'center', width: 130, slot: 'matchSource' }, { label: '计价来源', prop: 'matchSource', align: 'center', width: 130, slot: 'matchSource' },
{ label: '客户状态', prop: 'customerActiveStatus', align: 'center', width: 100, slot: 'customerActiveStatus' }, { label: '客户状态', prop: 'customerActiveStatus', align: 'center', width: 100, slot: 'customerActiveStatus' },
{ label: '额度欠费', prop: 'creditArrearsStatus', align: 'center', width: 100, slot: 'creditArrearsStatus' }, { label: '额度欠费', prop: 'creditArrearsStatus', align: 'center', width: 100, slot: 'creditArrearsStatus' },
{ label: '计费时间', prop: 'bizDate', align: 'center', width: 170, parseTime: true },
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true }, { label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true }, { label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true }, { label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
@@ -66,7 +66,7 @@
<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 ?? detail.weight) }}</el-descriptions-item> <el-descriptions-item label="计费重量(kg)">{{ formatWeight(detail.chargeWeight ?? detail.weight) }}</el-descriptions-item>
<el-descriptions-item label="重量段">{{ detail.weightLabel || '-' }}</el-descriptions-item> <el-descriptions-item label="重量段">{{ detail.weightLabel || '-' }}</el-descriptions-item>
<el-descriptions-item label="计费日期">{{ detail.bizDate || '-' }}</el-descriptions-item> <el-descriptions-item label="计费时间">{{ detail.bizDate || '-' }}</el-descriptions-item>
<el-descriptions-item label="计价来源"> <el-descriptions-item label="计价来源">
<el-tag size="small" :type="sourceTagType(detail.matchSource)">{{ sourceLabel(detail.matchSource) }}</el-tag> <el-tag size="small" :type="sourceTagType(detail.matchSource)">{{ sourceLabel(detail.matchSource) }}</el-tag>
</el-descriptions-item> </el-descriptions-item>