10 Commits

Author SHA1 Message Date
wuweihua 4ceb0bc830 Merge branch 'test' of https://git.lionquexpress.com/wuweihua/BMS into test 2026-11-11 13:52:35 +08:00
wuweihua f7384c88f6 优化代码注释为简体中文 2026-11-11 13:52:28 +08:00
caojia beba9e9caa 🐛 校验账单价格后确认提成比例 2026-11-11 13:45:34 +08:00
wuweihua b7d0674fda 优化代码注释为简体中文 2026-11-11 13:35:53 +08:00
wuweihua 0545de88b4 新增订单计费失败原因的价格周期字段,并优化前端展示,支持查看价格周期详情。 2026-11-11 13:12:32 +08:00
wuweihua 2430e344a0 Merge branch 'test' of https://git.lionquexpress.com/wuweihua/BMS into test 2026-11-11 11:30:22 +08:00
wuweihua 5db27e00ba 修改计费失败原因 2026-11-11 11:30:17 +08:00
caojia a06962d1dd ⚡ 优化应收账单毛利查询 2026-11-11 11:27:54 +08:00
wuweihua 5f679b5a6e 修改订单列表重新计费 2026-11-11 10:49:45 +08:00
wuweihua 02763f092e 修改打单套餐功能 2026-11-11 10:12:11 +08:00
167 changed files with 2874 additions and 1864 deletions
@@ -59,9 +59,9 @@ public class TmsPriceController extends BaseController
private IBillSearchStore billSearchStore; private IBillSearchStore billSearchStore;
/** /**
* Quote by customer + product + country + weight (+ destPostcode when country has zones). * 按客户 + 产品 + 国家 + 重量试算(国家配置了分区时需传 destPostcode)。
* Zone resolve: destPostcode -> prc_zone_detail/prc_zone -> product_country.zone_code. * 分区解析:destPostcode -> prc_zone_detail/prc_zone -> product_country.zone_code。
* Match: customer package FIXED > DISCOUNT > product default. * 匹配顺序:客户套餐 FIXED > DISCOUNT > 产品默认价。
*/ */
@PostMapping("/quote") @PostMapping("/quote")
public AjaxResult quote( public AjaxResult quote(
@@ -83,9 +83,9 @@ public class TmsPriceController extends BaseController
} }
/** /**
* Sync order and persist prc_order_bill / prc_income_bill_fee. * 同步订单并落库 prc_order_bill / prc_income_bill_fee。
* Same price match as quote (bound set + active version by bizDate, else default). * 价格匹配与试算一致(绑定套餐 + 按 bizDate 取生效版本,否则取默认价)。
* Same orderNo upserts. * 相同 orderNo 执行 upsert。
*/ */
@PostMapping("/bill") @PostMapping("/bill")
public AjaxResult bill( public AjaxResult bill(
@@ -106,8 +106,8 @@ public class TmsPriceController extends BaseController
} }
/** /**
* Warehouse inbound: create billing task (PENDING/REBILL/REFUND) and publish MQ. * 仓库入库:创建计费任务(PENDING/REBILL/REFUND)并发送 MQ。
* Consumer queries Oracle by transferNo/orderNo then inserts prc_order_bill. * 消费端按 transferNo/orderNo 查询 Oracle,然后插入 prc_order_bill。
* POST /api/tms/price/billing-task * POST /api/tms/price/billing-task
*/ */
@PostMapping("/billing-task") @PostMapping("/billing-task")
@@ -121,7 +121,7 @@ public class TmsPriceController extends BaseController
} }
/** /**
* Query billing task writeback status. * 查询计费任务回写状态。
* GET /api/tms/price/billing-task/{taskId} * GET /api/tms/price/billing-task/{taskId}
*/ */
@GetMapping("/billing-task/{taskId}") @GetMapping("/billing-task/{taskId}")
@@ -135,7 +135,7 @@ public class TmsPriceController extends BaseController
} }
/** /**
* Query order bill by orderNo after sync. * 同步完成后按 orderNo 查询订单账单。
*/ */
@GetMapping("/bill/by-order/{orderNo}") @GetMapping("/bill/by-order/{orderNo}")
public AjaxResult getBillByOrder( public AjaxResult getBillByOrder(
@@ -188,7 +188,7 @@ public class CommonController
} }
/** /**
* Common resource download: local profile path or oss://bucket/key (AR bill style). * 通用资源下载:本地 profile 路径或 oss://bucket/key(AR 账单风格)。
*/ */
@GetMapping("/download/resource") @GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
@@ -207,7 +207,7 @@ public class CommonController
} }
if (ossFile) if (ossFile)
{ {
// Extension check still applies to the object key suffix. // 扩展名校验仍适用于对象 key 后缀。
if (!FileUtils.checkAllowDownload(resource)) if (!FileUtils.checkAllowDownload(resource))
{ {
throw new Exception(StringUtils.format("resource ({}) not allowed", resource)); throw new Exception(StringUtils.format("resource ({}) not allowed", resource));
@@ -33,7 +33,7 @@ public class BillingTaskMonitorController extends BaseController
@Autowired @Autowired
private IPrcBillingTaskService billingTaskService; private IPrcBillingTaskService billingTaskService;
/** Default list = FAILED abnormal tasks. */ /** 默认列表 = FAILED 异常任务。 */
@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)
@@ -58,7 +58,7 @@ public class BillingTaskMonitorController extends BaseController
return success(billingTaskService.getById(taskId)); return success(billingTaskService.getById(taskId));
} }
/** Manual resync one task (reset WAITING then process). */ /** 手工重同步单个任务(先重置为 WAITING 再处理)。 */
@PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')") @PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')")
@Log(title = "billing task retry", businessType = BusinessType.UPDATE) @Log(title = "billing task retry", businessType = BusinessType.UPDATE)
@PostMapping("/retry/{taskId}") @PostMapping("/retry/{taskId}")
@@ -67,7 +67,7 @@ public class BillingTaskMonitorController extends BaseController
return success(billingTaskService.retryTask(taskId)); return success(billingTaskService.retryTask(taskId));
} }
/** Manual resync selected tasks. */ /** 手工重同步选中的任务。 */
@PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')") @PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')")
@Log(title = "billing task batch retry", businessType = BusinessType.UPDATE) @Log(title = "billing task batch retry", businessType = BusinessType.UPDATE)
@PostMapping("/retry") @PostMapping("/retry")
@@ -116,8 +116,8 @@ public class BillingTaskMonitorController extends BaseController
} }
/** /**
* Async resync by customer + bill_time (batched ID pages to avoid OOM). * 按客户 + 计费时间异步重同步(ID 分页批处理,避免 OOM)。
* Returns asyncTaskId; poll {@code GET /retryTask/{asyncTaskId}}. * 返回 asyncTaskId,通过 {@code GET /retryTask/{asyncTaskId}} 轮询进度。
*/ */
@PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')") @PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')")
@Log(title = "billing task filter retry", businessType = BusinessType.UPDATE) @Log(title = "billing task filter retry", businessType = BusinessType.UPDATE)
@@ -53,7 +53,7 @@ public class PriceLogController extends BaseController
return rsp; return rsp;
} }
/** Group by productCode + write time for package-version drill-down. */ /** 按 productCode + 写入时间分组,用于套餐版本下钻。 */
@PreAuthorize("@ss.hasPermi('monitor:priceLog:list')") @PreAuthorize("@ss.hasPermi('monitor:priceLog:list')")
@GetMapping("/groups") @GetMapping("/groups")
public TableDataInfo groups( public TableDataInfo groups(
@@ -119,7 +119,7 @@ public class TabOrderMonitorController extends BaseController
rsp.setTotal(0L); rsp.setTotal(0L);
return rsp; return rsp;
} }
// clear time so shared resolvers cannot accidentally reuse month window // 清空时间,避免共用解析器误复用按月时间窗口
query.setBeginTime(null); query.setBeginTime(null);
query.setEndTime(null); query.setEndTime(null);
customerKeywordResolver.resolve(query); customerKeywordResolver.resolve(query);
@@ -224,7 +224,7 @@ public class TabOrderMonitorController extends BaseController
@PostMapping("/syncByFilter") @PostMapping("/syncByFilter")
public AjaxResult syncByFilter(@RequestBody TabOrderMonitorQuery query) public AjaxResult syncByFilter(@RequestBody TabOrderMonitorQuery query)
{ {
// Upstream field overwrite only (no billing). Same filters as list query. // 仅覆盖上游字段(不触发计费)。筛选条件与列表查询一致。
if (!hasListFilters(query)) if (!hasListFilters(query))
{ {
return error("orderIdentifiers or (customer and pickup time) required"); return error("orderIdentifiers or (customer and pickup time) required");
@@ -257,7 +257,7 @@ public class TabOrderMonitorController extends BaseController
return success(task); return success(task);
} }
/** Selected rows: overwrite local bill fields from Oracle; does not quote/rebill. */ /** 选中行:用 Oracle 数据覆盖本地账单字段;不做报价/重算。 */
@PreAuthorize("@ss.hasPermi('monitor:orderSource:sync') or @ss.hasPermi('price:orderBill:rebill')") @PreAuthorize("@ss.hasPermi('monitor:orderSource:sync') or @ss.hasPermi('price:orderBill:rebill')")
@Log(title = "order source sync selected", businessType = BusinessType.UPDATE) @Log(title = "order source sync selected", businessType = BusinessType.UPDATE)
@PostMapping("/sync") @PostMapping("/sync")
@@ -318,7 +318,7 @@ public class TabOrderMonitorController extends BaseController
{ {
continue; continue;
} }
// Prefer transferNo as bizId (same as BILL / upstream sync ES). // 优先使用转单号作为 bizId(与 BILL / 上游同步 ES 一致)。
if (StringUtils.isNotEmpty(row.getTransferOrderId())) if (StringUtils.isNotEmpty(row.getTransferOrderId()))
{ {
return prefix + "_" + row.getTransferOrderId().trim(); return prefix + "_" + row.getTransferOrderId().trim();
@@ -96,7 +96,7 @@ public class BillingController extends BaseController
private IBillSearchStore billSearchStore; private IBillSearchStore billSearchStore;
/** /**
* Historical quote list. * 历史报价列表。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:quote')") @PreAuthorize("@ss.hasPermi('price:billing:quote')")
@GetMapping("/quote/list") @GetMapping("/quote/list")
@@ -108,7 +108,7 @@ public class BillingController extends BaseController
} }
/** /**
* Products of the customer's bound effective package version (trial product dropdown). * 客户已绑定生效套餐版本下的产品(试算产品下拉)。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:quote')") @PreAuthorize("@ss.hasPermi('price:billing:quote')")
@GetMapping("/quote/products") @GetMapping("/quote/products")
@@ -124,7 +124,7 @@ public class BillingController extends BaseController
} }
/** /**
* Historical quote detail with fee lines. * 历史报价详情,含费用明细行。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:quote')") @PreAuthorize("@ss.hasPermi('price:billing:quote')")
@GetMapping("/quote/{quoteId}") @GetMapping("/quote/{quoteId}")
@@ -134,7 +134,7 @@ public class BillingController extends BaseController
} }
/** /**
* Same matching logic as TMS open API, for BMS console trial. * 与 TMS 开放接口使用相同匹配逻辑,供 BMS 后台试算使用。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:quote')") @PreAuthorize("@ss.hasPermi('price:billing:quote')")
@PostMapping("/quote") @PostMapping("/quote")
@@ -152,8 +152,8 @@ public class BillingController extends BaseController
{ {
query = new PrcOrderBill(); query = new PrcOrderBill();
} }
// Billing list only shows success and the three soft misses. // 计费列表只展示计费成功的订单。
query.setBillingFailStatuses(limitBillingListFailStatus(query.getBillingFailStatuses())); query.setBillingFailStatuses(limitBillingListFailStatus());
query.setBillingFailStatus(null); query.setBillingFailStatus(null);
startPage(); startPage();
List<PrcOrderBill> list = prcOrderBillService.selectBillList(query); List<PrcOrderBill> list = prcOrderBillService.selectBillList(query);
@@ -161,8 +161,8 @@ public class BillingController extends BaseController
} }
/** /**
* Async export billing list by current filters (status limited to 0-3). * 按当前筛选条件异步导出计费列表(状态限定为成功 success=0)。
* Requires at least one meaningful filter. Poll task then download. * 需至少一个有效筛选条件。轮询任务完成后再下载。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:export')") @PreAuthorize("@ss.hasPermi('price:billing:export')")
@Log(title = "计费列表", businessType = BusinessType.EXPORT) @Log(title = "计费列表", businessType = BusinessType.EXPORT)
@@ -173,12 +173,12 @@ public class BillingController extends BaseController
{ {
query = new PrcOrderBill(); query = new PrcOrderBill();
} }
// Filter gate uses the request as-is; defaults applied only for query scope. // 筛选条件校验使用原始请求;默认值仅用于查询范围。
if (!OrderBillExportSupport.hasExportFilter(query)) if (!OrderBillExportSupport.hasExportFilter(query))
{ {
return error(MessageUtils.message("price.bill.export.filterRequired")); return error(MessageUtils.message("price.bill.export.filterRequired"));
} }
query.setBillingFailStatuses(limitBillingListFailStatus(query.getBillingFailStatuses())); query.setBillingFailStatuses(limitBillingListFailStatus());
query.setBillingFailStatus(null); query.setBillingFailStatus(null);
return successTask(prcOrderBillService.submitOrderBillExport( return successTask(prcOrderBillService.submitOrderBillExport(
PrcOrderBillExportTask.TYPE_BILLING, query)); PrcOrderBillExportTask.TYPE_BILLING, query));
@@ -204,32 +204,13 @@ public class BillingController extends BaseController
prcOrderBillService.downloadOrderBillExport(taskId, response); prcOrderBillService.downloadOrderBillExport(taskId, response);
} }
private static List<Integer> limitBillingListFailStatus(List<Integer> requested) private static List<Integer> limitBillingListFailStatus()
{ {
// Soft-fail list: success + sales 1/2/3 + product-catalog 23/24/25 // 计费列表仅包含成功数据(billing_fail_status = 0)。
List<Integer> allowed = Arrays.asList( return new ArrayList<Integer>(Arrays.asList(Integer.valueOf(0)));
Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3),
Integer.valueOf(23), Integer.valueOf(24), Integer.valueOf(25));
if (requested == null || requested.isEmpty())
{
return new ArrayList<Integer>(allowed);
}
List<Integer> kept = new ArrayList<Integer>();
for (Integer status : requested)
{
if (status != null && allowed.contains(status) && !kept.contains(status))
{
kept.add(status);
}
}
if (kept.isEmpty())
{
kept.add(Integer.valueOf(-1));
}
return kept;
} }
/** All prc_order_bill rows. Billing list stays limited to status 0-3. */ /** 全部 prc_order_bill 记录。计费列表仍限定为状态 0。 */
@PreAuthorize("@ss.hasPermi('price:orderBill:list')") @PreAuthorize("@ss.hasPermi('price:orderBill:list')")
@GetMapping("/orderBill/list") @GetMapping("/orderBill/list")
public TableDataInfo orderBillList(PrcOrderBill query) public TableDataInfo orderBillList(PrcOrderBill query)
@@ -239,9 +220,18 @@ public class BillingController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** 订单列表弹窗:按 billId 查询计费失败原因(受数据权限控制)。 */
@PreAuthorize("@ss.hasPermi('price:orderBill:list')")
@GetMapping("/orderBill/{billId}/failReason")
public AjaxResult orderBillFailReason(@PathVariable("billId") String billId)
{
return success(prcOrderBillService.getBillingFailReason(billId));
}
/** /**
* Async export order list by current filters. * 按当前筛选条件异步导出订单列表。
* Requires at least one meaningful filter (default orderStatuses alone is not enough). * 需至少一个有效筛选条件(仅默认 orderStatuses 不够)。
*/ */
@PreAuthorize("@ss.hasPermi('price:orderBill:export')") @PreAuthorize("@ss.hasPermi('price:orderBill:export')")
@Log(title = "订单列表", businessType = BusinessType.EXPORT) @Log(title = "订单列表", businessType = BusinessType.EXPORT)
@@ -273,8 +263,8 @@ public class BillingController extends BaseController
} }
/** /**
* Compare local order-bill products vs customer bound package SALES products * 对比本地订单账单产品与客户绑定套餐的 SALES 产品
* (includes product_code_mapping). * (包含 product_code_mapping)。
*/ */
@PreAuthorize("@ss.hasPermi('price:orderBill:list')") @PreAuthorize("@ss.hasPermi('price:orderBill:list')")
@PostMapping("/orderBill/checkProducts") @PostMapping("/orderBill/checkProducts")
@@ -284,7 +274,7 @@ public class BillingController extends BaseController
return success(data); return success(data);
} }
/** Drill-down order bills for one product under the same check filters. */ /** 在同一校验筛选条件下,下钻查看单个产品的订单账单。 */
@PreAuthorize("@ss.hasPermi('price:orderBill:list')") @PreAuthorize("@ss.hasPermi('price:orderBill:list')")
@PostMapping("/orderBill/checkProducts/orders") @PostMapping("/orderBill/checkProducts/orders")
public AjaxResult listOrderBillsByProduct(@RequestBody PrcOrderBill query) public AjaxResult listOrderBillsByProduct(@RequestBody PrcOrderBill query)
@@ -293,8 +283,8 @@ public class BillingController extends BaseController
} }
/** /**
* Order-list rebill from local prc_order_bill only (no Oracle TAB_ORDER). * 订单列表重算,仅基于本地 prc_order_bill(不查询 Oracle TAB_ORDER)。
* Poll {@code GET /orderBill/rebill/task/{taskId}}. * 轮询 {@code GET /orderBill/rebill/task/{taskId}}。
*/ */
@PreAuthorize("@ss.hasPermi('price:orderBill:rebill')") @PreAuthorize("@ss.hasPermi('price:orderBill:rebill')")
@Log(title = "Order bill local rebill", businessType = BusinessType.UPDATE) @Log(title = "Order bill local rebill", businessType = BusinessType.UPDATE)
@@ -325,7 +315,7 @@ public class BillingController extends BaseController
} }
/** /**
* Order no options for remote-search dropdown (bill list multi search). * 远程搜索下拉的订单号选项(计费列表多选搜索)。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:bill') or @ss.hasPermi('price:orderBill:list')") @PreAuthorize("@ss.hasPermi('price:billing:bill') or @ss.hasPermi('price:orderBill:list')")
@GetMapping("/bill/orderNos") @GetMapping("/bill/orderNos")
@@ -367,8 +357,8 @@ public class BillingController extends BaseController
} }
/** /**
* ES BILL logs for this order (billing / upstream sync / fail snapshots). * 该订单的 ES BILL 日志(计费 / 上游同步 / 失败快照)。
* bizId prefers transferNo then orderNo (same as write path). * bizId 优先取 transferNo,其次取 orderNo(与写入路径一致)。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:bill') or @ss.hasPermi('price:orderBill:list')") @PreAuthorize("@ss.hasPermi('price:billing:bill') or @ss.hasPermi('price:orderBill:list')")
@GetMapping("/bill/{billId}/history") @GetMapping("/bill/{billId}/history")
@@ -393,7 +383,7 @@ public class BillingController extends BaseController
int pageSize = pageDomain.getPageSize() == null ? 10 : pageDomain.getPageSize().intValue(); int pageSize = pageDomain.getPageSize() == null ? 10 : pageDomain.getPageSize().intValue();
String primary = EsBizLogSupport.billBizId(bill.getTransferNo(), bill.getOrderNo()); String primary = EsBizLogSupport.billBizId(bill.getTransferNo(), bill.getOrderNo());
BillSearchPage page = billSearchStore.search(EsLogType.BILL, primary, null, pageNum, pageSize); BillSearchPage page = billSearchStore.search(EsLogType.BILL, primary, null, pageNum, pageSize);
// Also pull by orderNo when transferNo was used as bizId, so older orderNo-keyed rows appear. // 当 bizId 使用 transferNo 时,再按 orderNo 拉取一次,以便出现更早的以 orderNo 为 key 的记录。
if (StringUtils.isNotEmpty(bill.getTransferNo()) && StringUtils.isNotEmpty(bill.getOrderNo()) if (StringUtils.isNotEmpty(bill.getTransferNo()) && StringUtils.isNotEmpty(bill.getOrderNo())
&& !bill.getTransferNo().trim().equalsIgnoreCase(bill.getOrderNo().trim()) && !bill.getTransferNo().trim().equalsIgnoreCase(bill.getOrderNo().trim())
&& pageNum == 1) && pageNum == 1)
@@ -458,7 +448,7 @@ public class BillingController extends BaseController
} }
/** /**
* Refund one receivable bill via billing task billType=REFUND. * 通过计费任务 billType=REFUND 退费单笔应收账单。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:refund')") @PreAuthorize("@ss.hasPermi('price:billing:refund')")
@Log(title = "Billing refund", businessType = BusinessType.UPDATE) @Log(title = "Billing refund", businessType = BusinessType.UPDATE)
@@ -495,7 +485,7 @@ public class BillingController extends BaseController
} }
/** /**
* Batch update order credit arrears status (ARREARS -> NORMAL) with available-credit check. * 批量更新订单信用欠款状态(ARREARS -> NORMAL),并校验可用额度。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:arrearsUpdate')") @PreAuthorize("@ss.hasPermi('price:billing:arrearsUpdate')")
@Log(title = "Billing credit arrears", businessType = BusinessType.UPDATE) @Log(title = "Billing credit arrears", businessType = BusinessType.UPDATE)
@@ -555,7 +545,7 @@ public class BillingController extends BaseController
return success(prcOrderBillService.addIncomeFee(request)); return success(prcOrderBillService.addIncomeFee(request));
} }
/** Preview matched bills for batch add fee (filter: customer / transferNo / country). */ /** 批量加费前预览匹配的账单(筛选:客户 / transferNo / 国家)。 */
@PreAuthorize("@ss.hasPermi('price:billing:feeAdd')") @PreAuthorize("@ss.hasPermi('price:billing:feeAdd')")
@PostMapping("/bill/fee/batch/preview") @PostMapping("/bill/fee/batch/preview")
public AjaxResult previewBatchAddIncomeFee(@RequestBody BatchAddIncomeBillFeeRequest request) public AjaxResult previewBatchAddIncomeFee(@RequestBody BatchAddIncomeBillFeeRequest request)
@@ -563,7 +553,7 @@ public class BillingController extends BaseController
return success(prcOrderBillService.previewBatchAddIncomeFee(request)); return success(prcOrderBillService.previewBatchAddIncomeFee(request));
} }
/** Submit async batch add fee; poll /bill/fee/batch/task/{taskId}. */ /** 提交异步批量加费;轮询 /bill/fee/batch/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:billing:feeAdd')") @PreAuthorize("@ss.hasPermi('price:billing:feeAdd')")
@Log(title = "Billing batch income fee", businessType = BusinessType.INSERT) @Log(title = "Billing batch income fee", businessType = BusinessType.INSERT)
@PostMapping("/bill/fee/batch") @PostMapping("/bill/fee/batch")
@@ -587,7 +577,7 @@ public class BillingController extends BaseController
return success(task); return success(task);
} }
/** Async recalc product_amount only. Poll /bill/recalcPrice/task/{taskId}. */ /** 仅异步重算 product_amount。轮询 /bill/recalcPrice/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:billing:recalc')") @PreAuthorize("@ss.hasPermi('price:billing:recalc')")
@Log(title = "Billing recalc product amount", businessType = BusinessType.UPDATE) @Log(title = "Billing recalc product amount", businessType = BusinessType.UPDATE)
@PostMapping("/bill/recalcProduct") @PostMapping("/bill/recalcProduct")
@@ -601,7 +591,7 @@ public class BillingController extends BaseController
return successTask(prcOrderBillService.submitRecalcBillPrice(request)); return successTask(prcOrderBillService.submitRecalcBillPrice(request));
} }
/** Async recalc redline_amount only. Poll /bill/recalcPrice/task/{taskId}. */ /** 仅异步重算 redline_amount。轮询 /bill/recalcPrice/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:billing:recalc')") @PreAuthorize("@ss.hasPermi('price:billing:recalc')")
@Log(title = "Billing recalc redline amount", businessType = BusinessType.UPDATE) @Log(title = "Billing recalc redline amount", businessType = BusinessType.UPDATE)
@PostMapping("/bill/recalcRedline") @PostMapping("/bill/recalcRedline")
@@ -658,7 +648,7 @@ public class BillingController extends BaseController
return success(result); return success(result);
} }
/** Update charge_weight (keep weight), then rebill. */ /** 更新 charge_weight(保留 weight),随后重新计费。 */
@PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')") @PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')")
@Log(title = "Billing charge weight", businessType = BusinessType.UPDATE) @Log(title = "Billing charge weight", businessType = BusinessType.UPDATE)
@PutMapping("/bill/chargeWeight") @PutMapping("/bill/chargeWeight")
@@ -668,7 +658,7 @@ public class BillingController extends BaseController
} }
/** /**
* Download import template. fillByFilter=true fills orderNo/customer from list filters. * 下载导入模板。fillByFilter=true 时按列表筛选条件填充 orderNo/customer。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')") @PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')")
@PostMapping("/bill/chargeWeight/importTemplate") @PostMapping("/bill/chargeWeight/importTemplate")
@@ -690,8 +680,8 @@ public class BillingController extends BaseController
} }
/** /**
* Async import charge_weight updates and rebill. * 异步导入 charge_weight 更新并重新计费。
* Returns taskId; poll /bill/chargeWeight/import/task/{taskId}. * 返回 taskId;轮询 /bill/chargeWeight/import/task/{taskId}。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')") @PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')")
@Log(title = "Billing charge weight import", businessType = BusinessType.IMPORT) @Log(title = "Billing charge weight import", businessType = BusinessType.IMPORT)
@@ -722,7 +712,7 @@ public class BillingController extends BaseController
} }
catch (Exception e) catch (Exception e)
{ {
// Import task already queued; attachment failure should not block rebill // 导入任务已入队;附件保存失败不应阻塞后续重新计费
Map<String, Object> payload = new HashMap<String, Object>(); Map<String, Object> payload = new HashMap<String, Object>();
payload.put("taskId", taskId); payload.put("taskId", taskId);
payload.put("attachmentWarn", e.getMessage()); payload.put("attachmentWarn", e.getMessage());
@@ -743,7 +733,7 @@ public class BillingController extends BaseController
} }
/** /**
* List charge-weight import Excel attachment records. * 查询收费重导入的 Excel 附件记录。
*/ */
@PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')") @PreAuthorize("@ss.hasPermi('price:billing:chargeWeightEdit')")
@GetMapping("/bill/chargeWeight/import/attachments") @GetMapping("/bill/chargeWeight/import/attachments")
@@ -37,7 +37,7 @@ import com.bms.price.service.IPrcPriceExcelFileService;
import com.bms.price.service.IPrcPriceSetService; import com.bms.price.service.IPrcPriceSetService;
/** /**
* Exclusive quote (shares prc_price_set with PACKAGE) * 独家报价(与 PACKAGE 共用 prc_price_set 表)
* *
* @author bms * @author bms
*/ */
@@ -82,7 +82,7 @@ public class ExclusiveQuoteController extends BaseController
set.setCreateBy(getUsername()); set.setCreateBy(getUsername());
set.setUpdateBy(getUsername()); set.setUpdateBy(getUsername());
String taskId = priceSetService.submitSaveAsync(set); String taskId = priceSetService.submitSaveAsync(set);
// Do not pass bare String to success(): overload puts it into msg, not data. // 不要向 success() 直接传字符串:该重载会把字符串放进 msg 而不是 data。
Map<String, Object> payload = new HashMap<String, Object>(); Map<String, Object> payload = new HashMap<String, Object>();
payload.put("taskId", taskId); payload.put("taskId", taskId);
return success(payload); return success(payload);
@@ -111,7 +111,7 @@ public class ExclusiveQuoteController extends BaseController
return toAjax(priceSetService.updatePrcPriceSet(set)); return toAjax(priceSetService.updatePrcPriceSet(set));
} }
/** Update package name and note only. */ /** 仅更新套餐名称与备注。 */
@PreAuthorize("@ss.hasPermi('price:exclusive:edit')") @PreAuthorize("@ss.hasPermi('price:exclusive:edit')")
@Log(title = "Exclusive quote basic", businessType = BusinessType.UPDATE) @Log(title = "Exclusive quote basic", businessType = BusinessType.UPDATE)
@PutMapping("/basic") @PutMapping("/basic")
@@ -200,7 +200,7 @@ public class ExclusiveQuoteController extends BaseController
return toAjax(priceSetService.deleteVersion(psvId, getUsername())); return toAjax(priceSetService.deleteVersion(psvId, getUsername()));
} }
/** Import excel attachments for a version (prc_price_excel_file.psv_id). */ /** 版本的 Excel 附件导入(prc_price_excel_file.psv_id)。 */
@PreAuthorize("@ss.hasPermi('price:exclusive:list')") @PreAuthorize("@ss.hasPermi('price:exclusive:list')")
@GetMapping("/version/{psvId}/excelFiles") @GetMapping("/version/{psvId}/excelFiles")
public AjaxResult versionExcelFiles(@PathVariable Long psvId) public AjaxResult versionExcelFiles(@PathVariable Long psvId)
@@ -253,7 +253,7 @@ public class ExclusiveQuoteController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** All detail rows for one product (no page); used by edit-price drawer. */ /** 单个产品的全部明细行(不分页),供改价抽屉使用。 */
@PreAuthorize("@ss.hasPermi('price:exclusive:list')") @PreAuthorize("@ss.hasPermi('price:exclusive:list')")
@GetMapping("/detail/byProduct") @GetMapping("/detail/byProduct")
public AjaxResult detailByProduct(@RequestParam("psvId") Long psvId, public AjaxResult detailByProduct(@RequestParam("psvId") Long psvId,
@@ -262,7 +262,7 @@ public class ExclusiveQuoteController extends BaseController
return success(priceSetService.selectDetailListByProduct(psvId, productCode)); return success(priceSetService.selectDetailListByProduct(psvId, productCode));
} }
/** All detail rows for a version (no page); batch prefetch instead of N byProduct calls. */ /** 某个版本的全部明细行(不分页);用批量预取替代 N 次 byProduct 调用。 */
@PreAuthorize("@ss.hasPermi('price:exclusive:list')") @PreAuthorize("@ss.hasPermi('price:exclusive:list')")
@GetMapping("/detail/byVersion") @GetMapping("/detail/byVersion")
public AjaxResult detailByVersion(@RequestParam("psvId") Long psvId) public AjaxResult detailByVersion(@RequestParam("psvId") Long psvId)
@@ -318,7 +318,7 @@ public class ExclusiveQuoteController extends BaseController
} }
/** /**
* Preview pull product library (no DB write). For create wizard before finish. * 预览拉取产品库(不写库),用于新建向导提交前的预览。
*/ */
@PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit') or @ss.hasPermi('price:exclusive:add')") @PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit') or @ss.hasPermi('price:exclusive:add')")
@PostMapping("/detail/previewPullFromLibrary") @PostMapping("/detail/previewPullFromLibrary")
@@ -328,8 +328,8 @@ public class ExclusiveQuoteController extends BaseController
} }
/** /**
* Preview Excel import (no DB write). Optional detailsJson for updateOnly / build-price merge. * 预览 Excel 导入(不写库)。可选 detailsJson,用于 updateOnly / 构建价格合并。
* Optional countryCode = single-country dedicated-line Excel (same as product country import). * 可选 countryCode = 单国家专线 Excel(与按产品国家导入一致)。
*/ */
@PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit') or @ss.hasPermi('price:exclusive:add')") @PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit') or @ss.hasPermi('price:exclusive:add')")
@PostMapping("/detail/previewImportPrices") @PostMapping("/detail/previewImportPrices")
@@ -359,7 +359,7 @@ public class ExclusiveQuoteController extends BaseController
} }
/** /**
* Async pull product library into version details. Returns taskId; poll /save/task/{taskId}. * 异步拉取产品库到版本明细。返回 taskId,通过 /save/task/{taskId} 轮询进度。
*/ */
@PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit')") @PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit')")
@Log(title = "Exclusive quote拉取产品", businessType = BusinessType.IMPORT) @Log(title = "Exclusive quote拉取产品", businessType = BusinessType.IMPORT)
@@ -376,7 +376,7 @@ public class ExclusiveQuoteController extends BaseController
} }
/** /**
* Async batch write of detail surcharge snapshots. Returns taskId; poll /save/task/{taskId}. * 异步批量写入明细附加费快照。返回 taskId,通过 /save/task/{taskId} 轮询进度。
*/ */
@PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit')") @PreAuthorize("@ss.hasPermi('price:exclusive:edit') or @ss.hasPermi('price:exclusive:forceEdit')")
@Log(title = "Exclusive quote附加费", businessType = BusinessType.UPDATE) @Log(title = "Exclusive quote附加费", businessType = BusinessType.UPDATE)
@@ -217,54 +217,6 @@ public class LabelPackageController extends BaseController
return toAjax(payProductService.removeLabelProducts(priceSetId, productIds)); return toAjax(payProductService.removeLabelProducts(priceSetId, productIds));
} }
@PreAuthorize("@ss.hasPermi('price:label:query')")
@GetMapping("/{priceSetId}/channels")
public AjaxResult listChannels(@PathVariable Long priceSetId)
{
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
return success(payProductService.listLabelChannels(priceSetId));
}
@PreAuthorize("@ss.hasPermi('price:label:edit')")
@Log(title = "打单套餐绑定渠道", businessType = BusinessType.UPDATE)
@PutMapping("/{priceSetId}/channels")
public AjaxResult bindChannels(@PathVariable Long priceSetId, @RequestBody Map<String, Object> body)
{
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
List<String> channelIds = new ArrayList<String>();
Object rawIds = body == null ? null : body.get("channelIds");
if (rawIds instanceof List<?>)
{
for (Object item : (List<?>) rawIds)
{
if (item != null && !String.valueOf(item).trim().isEmpty())
{
channelIds.add(String.valueOf(item).trim());
}
}
}
Long productId = null;
Object rawProductId = body == null ? null : body.get("productId");
if (rawProductId instanceof Number)
{
productId = ((Number) rawProductId).longValue();
}
else if (rawProductId != null && !String.valueOf(rawProductId).trim().isEmpty()
&& !"null".equalsIgnoreCase(String.valueOf(rawProductId).trim()))
{
productId = Long.valueOf(String.valueOf(rawProductId).trim());
}
return success(payProductService.bindLabelChannels(priceSetId, channelIds, productId));
}
@PreAuthorize("@ss.hasPermi('price:label:edit')")
@Log(title = "打单套餐解绑渠道", businessType = BusinessType.DELETE)
@DeleteMapping("/{priceSetId}/channels/{channelId}")
public AjaxResult unbindChannel(@PathVariable Long priceSetId, @PathVariable String channelId)
{
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
return toAjax(payProductService.unbindLabelChannel(priceSetId, channelId));
}
@PreAuthorize("@ss.hasPermi('price:label:list')") @PreAuthorize("@ss.hasPermi('price:label:list')")
@GetMapping("/customer/list") @GetMapping("/customer/list")
@@ -55,7 +55,7 @@ public class PriceSetController extends BaseController
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(PrcPriceSet set) public TableDataInfo list(PrcPriceSet set)
{ {
// Ordinary package module: never mix exclusive quotes into this list. // 普通套餐模块:该列表不混入专属报价。
set.setSetCategory(PrcPriceSet.CATEGORY_PACKAGE); set.setSetCategory(PrcPriceSet.CATEGORY_PACKAGE);
startPage(); startPage();
List<PrcPriceSet> list = priceSetService.selectPrcPriceSetList(set); List<PrcPriceSet> list = priceSetService.selectPrcPriceSetList(set);
@@ -83,7 +83,7 @@ public class PriceSetController extends BaseController
set.setCreateBy(getUsername()); set.setCreateBy(getUsername());
set.setUpdateBy(getUsername()); set.setUpdateBy(getUsername());
String taskId = priceSetService.submitSaveAsync(set); String taskId = priceSetService.submitSaveAsync(set);
// Do not pass bare String to success(): overload puts it into msg, not data. // 不要向 success() 直接传裸 String:重载会把它放入 msg 而不是 data。
Map<String, Object> payload = new HashMap<String, Object>(); Map<String, Object> payload = new HashMap<String, Object>();
payload.put("taskId", taskId); payload.put("taskId", taskId);
return success(payload); return success(payload);
@@ -112,7 +112,7 @@ public class PriceSetController extends BaseController
return toAjax(priceSetService.updatePrcPriceSet(set)); return toAjax(priceSetService.updatePrcPriceSet(set));
} }
/** Update package name and note only. */ /** 仅更新套餐名称和备注。 */
@PreAuthorize("@ss.hasPermi('price:set:edit')") @PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "价格套餐基本信息", businessType = BusinessType.UPDATE) @Log(title = "价格套餐基本信息", businessType = BusinessType.UPDATE)
@PutMapping("/basic") @PutMapping("/basic")
@@ -190,7 +190,7 @@ public class PriceSetController extends BaseController
return toAjax(priceSetService.deleteVersion(psvId, getUsername())); return toAjax(priceSetService.deleteVersion(psvId, getUsername()));
} }
/** Import excel attachments for a version (prc_price_excel_file.psv_id). */ /** 某个版本的导入 Excel 附件(prc_price_excel_file.psv_id)。 */
@PreAuthorize("@ss.hasPermi('price:set:list')") @PreAuthorize("@ss.hasPermi('price:set:list')")
@GetMapping("/version/{psvId}/excelFiles") @GetMapping("/version/{psvId}/excelFiles")
public AjaxResult versionExcelFiles(@PathVariable Long psvId) public AjaxResult versionExcelFiles(@PathVariable Long psvId)
@@ -240,7 +240,7 @@ public class PriceSetController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** All detail rows for one product (no page); used by edit-price drawer. */ /** 某个产品的全部明细行(不分页);供改价抽屉使用。 */
@PreAuthorize("@ss.hasPermi('price:set:list')") @PreAuthorize("@ss.hasPermi('price:set:list')")
@GetMapping("/detail/byProduct") @GetMapping("/detail/byProduct")
public AjaxResult detailByProduct(@RequestParam("psvId") Long psvId, public AjaxResult detailByProduct(@RequestParam("psvId") Long psvId,
@@ -249,7 +249,7 @@ public class PriceSetController extends BaseController
return success(priceSetService.selectDetailListByProduct(psvId, productCode)); return success(priceSetService.selectDetailListByProduct(psvId, productCode));
} }
/** All detail rows for a version (no page); batch prefetch instead of N byProduct calls. */ /** 某个版本的全部明细行(不分页);批量预取,避免 N 次 byProduct 调用。 */
@PreAuthorize("@ss.hasPermi('price:set:list')") @PreAuthorize("@ss.hasPermi('price:set:list')")
@GetMapping("/detail/byVersion") @GetMapping("/detail/byVersion")
public AjaxResult detailByVersion(@RequestParam("psvId") Long psvId) public AjaxResult detailByVersion(@RequestParam("psvId") Long psvId)
@@ -304,7 +304,7 @@ public class PriceSetController extends BaseController
} }
/** /**
* Preview pull product library (no DB write). For create wizard before finish. * 预览从产品库拉取(不写库)。用于新建向导完成前的预览。
*/ */
@PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit') or @ss.hasPermi('price:set:add')") @PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit') or @ss.hasPermi('price:set:add')")
@PostMapping("/detail/previewPullFromLibrary") @PostMapping("/detail/previewPullFromLibrary")
@@ -314,8 +314,8 @@ public class PriceSetController extends BaseController
} }
/** /**
* Preview Excel import (no DB write). Optional detailsJson for updateOnly / build-price merge. * 预览 Excel 导入(不写库)。可选 detailsJson 用于 updateOnly / 构建价格时的合并。
* Optional countryCode = single-country dedicated-line Excel (same as product country import). * 可选 countryCode = 单国家专线 Excel(与产品国家导入一致)。
*/ */
@PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit') or @ss.hasPermi('price:set:add')") @PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit') or @ss.hasPermi('price:set:add')")
@PostMapping("/detail/previewImportPrices") @PostMapping("/detail/previewImportPrices")
@@ -345,7 +345,7 @@ public class PriceSetController extends BaseController
} }
/** /**
* Async pull product library into version details. Returns taskId; poll /save/task/{taskId}. * 异步从产品库拉取到版本明细。返回 taskId;轮询 /save/task/{taskId}。
*/ */
@PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit')") @PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit')")
@Log(title = "套餐拉取产品", businessType = BusinessType.IMPORT) @Log(title = "套餐拉取产品", businessType = BusinessType.IMPORT)
@@ -361,7 +361,7 @@ public class PriceSetController extends BaseController
} }
/** /**
* Async batch write of detail surcharge snapshots. Returns taskId; poll /save/task/{taskId}. * 异步批量写入明细附加费快照。返回 taskId;轮询 /save/task/{taskId}。
*/ */
@PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit')") @PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit')")
@Log(title = "套餐附加费", businessType = BusinessType.UPDATE) @Log(title = "套餐附加费", businessType = BusinessType.UPDATE)
@@ -63,8 +63,8 @@ public class ProductController extends BaseController
} }
/** /**
* Product dropdown (non-paged). Slim query, no list-page status refresh. * 产品下拉(非分页)。精简查询,不做列表页状态刷新。
* Used by price-set / billing / customer bind; login required, no extra perm. * 供价格套餐 / 计费 / 客户绑定使用;需登录,无额外权限要求。
*/ */
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect(BmsProduct product) public AjaxResult optionselect(BmsProduct product)
@@ -139,7 +139,7 @@ public class ProductController extends BaseController
return success(); return success();
} }
/** Persist create-page preview details into draft/pending/effect version. */ /** 将新建页预览明细保存到草稿/待生效/生效版本。 */
@PreAuthorize("@ss.hasPermi('price:product:add') or @ss.hasPermi('price:product:edit')") @PreAuthorize("@ss.hasPermi('price:product:add') or @ss.hasPermi('price:product:edit')")
@Log(title = "product preview apply", businessType = BusinessType.UPDATE) @Log(title = "product preview apply", businessType = BusinessType.UPDATE)
@PostMapping("/version/applyPreview") @PostMapping("/version/applyPreview")
@@ -148,7 +148,7 @@ public class ProductController extends BaseController
return success(productService.applyCatalogPreview(body)); return success(productService.applyCatalogPreview(body));
} }
/** Async parallel save of create-page preview. Returns taskId; poll /import/task/{taskId}. */ /** 异步并行保存新建页预览。返回 taskId;轮询 /import/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:product:add') or @ss.hasPermi('price:product:edit')") @PreAuthorize("@ss.hasPermi('price:product:add') or @ss.hasPermi('price:product:edit')")
@Log(title = "product preview apply", businessType = BusinessType.UPDATE) @Log(title = "product preview apply", businessType = BusinessType.UPDATE)
@PostMapping("/version/applyPreviewAsync") @PostMapping("/version/applyPreviewAsync")
@@ -160,7 +160,7 @@ public class ProductController extends BaseController
return success(payload); return success(payload);
} }
/** Save import Excel attachment onto a draft/pending/effect version (prc_price_excel_file). */ /** 将导入 Excel 附件保存到草稿/待生效/生效版本(prc_price_excel_file)。 */
@PreAuthorize("@ss.hasPermi('price:product:import')") @PreAuthorize("@ss.hasPermi('price:product:import')")
@Log(title = "product version excel", businessType = BusinessType.IMPORT) @Log(title = "product version excel", businessType = BusinessType.IMPORT)
@PostMapping("/version/{psvId}/excel") @PostMapping("/version/{psvId}/excel")
@@ -176,7 +176,7 @@ public class ProductController extends BaseController
return success(row); return success(row);
} }
/** List Excel attachments of a version. */ /** 查询某个版本的 Excel 附件列表。 */
@PreAuthorize("@ss.hasPermi('price:product:query')") @PreAuthorize("@ss.hasPermi('price:product:query')")
@GetMapping("/version/{psvId}/excelFiles") @GetMapping("/version/{psvId}/excelFiles")
public AjaxResult listVersionExcelFiles(@PathVariable Long psvId) public AjaxResult listVersionExcelFiles(@PathVariable Long psvId)
@@ -201,8 +201,8 @@ public class ProductController extends BaseController
} }
/** /**
* Async import Weishi B2C workbook. Returns taskId; poll /import/task/{taskId}. * 异步导入 Weishi B2C 工作簿。返回 taskId;轮询 /import/task/{taskId}。
* effectiveDate is required: written to product / product_country; previous open rows expire at this date. * effectiveDate 必填:写入 product / product_country;原有未失效记录在该日期失效。
*/ */
@Log(title = "产品列表", businessType = BusinessType.IMPORT) @Log(title = "产品列表", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('price:product:import')") @PreAuthorize("@ss.hasPermi('price:product:import')")
@@ -217,8 +217,8 @@ public class ProductController extends BaseController
} }
/** /**
* Async single-country cost-sheet import. Returns taskId; poll /import/task/{taskId}. * 异步导入单国家成本表。返回 taskId;轮询 /import/task/{taskId}。
* effectiveDate is required: written to product / product_country; previous open rows expire at this date. * effectiveDate 必填:写入 product / product_country;原有未失效记录在该日期失效。
*/ */
@Log(title = "产品列表", businessType = BusinessType.IMPORT) @Log(title = "产品列表", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('price:product:import')") @PreAuthorize("@ss.hasPermi('price:product:import')")
@@ -233,7 +233,7 @@ public class ProductController extends BaseController
return success(payload); return success(payload);
} }
/** Async parse-only preview; returns taskId, poll /import/task/{taskId} for result. */ /** 仅解析的异步预览;返回 taskId,轮询 /import/task/{taskId} 获取结果。 */
@PreAuthorize("@ss.hasPermi('price:product:import')") @PreAuthorize("@ss.hasPermi('price:product:import')")
@PostMapping("/previewImport") @PostMapping("/previewImport")
public AjaxResult previewImport( public AjaxResult previewImport(
@@ -246,7 +246,7 @@ public class ProductController extends BaseController
return success(payload); return success(payload);
} }
/** Async single-country parse-only preview; returns taskId, poll /import/task/{taskId}. */ /** 单国家仅解析的异步预览;返回 taskId,轮询 /import/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:product:import')") @PreAuthorize("@ss.hasPermi('price:product:import')")
@PostMapping("/previewImportCountry") @PostMapping("/previewImportCountry")
public AjaxResult previewImportCountry( public AjaxResult previewImportCountry(
@@ -139,7 +139,7 @@ public class RedlineProductController extends BaseController
return success(); return success();
} }
/** Persist create-page preview details into draft/pending/effect version. */ /** 将新建页预览明细保存到草稿/待生效/生效版本。 */
@PreAuthorize("@ss.hasPermi('price:redline:add') or @ss.hasPermi('price:redline:edit')") @PreAuthorize("@ss.hasPermi('price:redline:add') or @ss.hasPermi('price:redline:edit')")
@Log(title = "redline preview apply", businessType = BusinessType.UPDATE) @Log(title = "redline preview apply", businessType = BusinessType.UPDATE)
@PostMapping("/version/applyPreview") @PostMapping("/version/applyPreview")
@@ -148,7 +148,7 @@ public class RedlineProductController extends BaseController
return success(productService.applyCatalogPreview(body)); return success(productService.applyCatalogPreview(body));
} }
/** Async parallel save of create-page preview. Returns taskId; poll /import/task/{taskId}. */ /** 异步并行保存新建页预览。返回 taskId;轮询 /import/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:redline:add') or @ss.hasPermi('price:redline:edit')") @PreAuthorize("@ss.hasPermi('price:redline:add') or @ss.hasPermi('price:redline:edit')")
@Log(title = "redline preview apply", businessType = BusinessType.UPDATE) @Log(title = "redline preview apply", businessType = BusinessType.UPDATE)
@PostMapping("/version/applyPreviewAsync") @PostMapping("/version/applyPreviewAsync")
@@ -160,7 +160,7 @@ public class RedlineProductController extends BaseController
return success(payload); return success(payload);
} }
/** Save import Excel attachment onto a draft/pending/effect version (prc_price_excel_file). */ /** 将导入 Excel 附件保存到草稿/待生效/生效版本(prc_price_excel_file)。 */
@PreAuthorize("@ss.hasPermi('price:redline:import')") @PreAuthorize("@ss.hasPermi('price:redline:import')")
@Log(title = "redline version excel", businessType = BusinessType.IMPORT) @Log(title = "redline version excel", businessType = BusinessType.IMPORT)
@PostMapping("/version/{psvId}/excel") @PostMapping("/version/{psvId}/excel")
@@ -176,7 +176,7 @@ public class RedlineProductController extends BaseController
return success(row); return success(row);
} }
/** List Excel attachments of a version. */ /** 查询某个版本的 Excel 附件列表。 */
@PreAuthorize("@ss.hasPermi('price:redline:query')") @PreAuthorize("@ss.hasPermi('price:redline:query')")
@GetMapping("/version/{psvId}/excelFiles") @GetMapping("/version/{psvId}/excelFiles")
public AjaxResult listVersionExcelFiles(@PathVariable Long psvId) public AjaxResult listVersionExcelFiles(@PathVariable Long psvId)
@@ -201,8 +201,8 @@ public class RedlineProductController extends BaseController
} }
/** /**
* Async import Weishi B2C workbook. Returns taskId; poll /import/task/{taskId}. * 异步导入 Weishi B2C 工作簿。返回 taskId;轮询 /import/task/{taskId}。
* effectiveDate is required: written to product / product_country; previous open rows expire at this date. * effectiveDate 必填:写入 product / product_country;原有未失效记录在该日期失效。
*/ */
@Log(title = "产品列表", businessType = BusinessType.IMPORT) @Log(title = "产品列表", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('price:redline:import')") @PreAuthorize("@ss.hasPermi('price:redline:import')")
@@ -217,8 +217,8 @@ public class RedlineProductController extends BaseController
} }
/** /**
* Async single-country cost-sheet import. Returns taskId; poll /import/task/{taskId}. * 异步导入单国家成本表。返回 taskId;轮询 /import/task/{taskId}。
* effectiveDate is required: written to product / product_country; previous open rows expire at this date. * effectiveDate 必填:写入 product / product_country;原有未失效记录在该日期失效。
*/ */
@Log(title = "产品列表", businessType = BusinessType.IMPORT) @Log(title = "产品列表", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('price:redline:import')") @PreAuthorize("@ss.hasPermi('price:redline:import')")
@@ -233,7 +233,7 @@ public class RedlineProductController extends BaseController
return success(payload); return success(payload);
} }
/** Async parse-only preview; returns taskId, poll /import/task/{taskId} for result. */ /** 仅解析的异步预览;返回 taskId,轮询 /import/task/{taskId} 获取结果。 */
@PreAuthorize("@ss.hasPermi('price:redline:import')") @PreAuthorize("@ss.hasPermi('price:redline:import')")
@PostMapping("/previewImport") @PostMapping("/previewImport")
public AjaxResult previewImport( public AjaxResult previewImport(
@@ -246,7 +246,7 @@ public class RedlineProductController extends BaseController
return success(payload); return success(payload);
} }
/** Async single-country parse-only preview; returns taskId, poll /import/task/{taskId}. */ /** 单国家仅解析的异步预览;返回 taskId,轮询 /import/task/{taskId}。 */
@PreAuthorize("@ss.hasPermi('price:redline:import')") @PreAuthorize("@ss.hasPermi('price:redline:import')")
@PostMapping("/previewImportCountry") @PostMapping("/previewImportCountry")
public AjaxResult previewImportCountry( public AjaxResult previewImportCountry(
@@ -47,7 +47,7 @@ public class SysFileTemplateController extends BaseController
return success(fileTemplateService.selectSysFileTemplateById(templateId)); return success(fileTemplateService.selectSysFileTemplateById(templateId));
} }
/** Meta by file code (authenticated; used by import dialogs). */ /** 按文件编码获取元信息(需登录,供导入弹窗使用)。 */
@GetMapping("/code/{fileCode}") @GetMapping("/code/{fileCode}")
public AjaxResult getByCode(@PathVariable String fileCode) public AjaxResult getByCode(@PathVariable String fileCode)
{ {
@@ -91,7 +91,7 @@ public class SysFileTemplateController extends BaseController
} }
/** /**
* Download by file_code. Login required; no admin perm so import pages can use it. * 按 file_code 下载。需要登录,但不校验管理员权限,便于导入页面调用。
*/ */
@GetMapping("/download/{fileCode}") @GetMapping("/download/{fileCode}")
public void download(@PathVariable String fileCode, HttpServletResponse response) throws Exception public void download(@PathVariable String fileCode, HttpServletResponse response) throws Exception
@@ -1,9 +1,11 @@
package com.bms.report; package com.bms.report;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -11,18 +13,93 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import com.bms.common.core.domain.entity.SysUser;
import com.bms.common.core.domain.model.LoginUser;
import com.bms.receivable.domain.ArBalanceWriteoff; import com.bms.receivable.domain.ArBalanceWriteoff;
import com.bms.receivable.domain.ArBill; import com.bms.receivable.domain.ArBill;
import com.bms.receivable.mapper.ArBillMapper;
import com.bms.receivable.mapper.ArCommissionMapper; import com.bms.receivable.mapper.ArCommissionMapper;
import com.bms.receivable.profit.ArCommissionRate; import com.bms.receivable.profit.ArCommissionRate;
import com.bms.receivable.profit.ArCommissionResult; import com.bms.receivable.profit.ArCommissionResult;
import com.bms.receivable.profit.ArCommissionService; import com.bms.receivable.profit.ArCommissionService;
import com.bms.receivable.profit.ArProfitScope; import com.bms.receivable.profit.ArProfitScope;
import com.bms.receivable.profit.ArProfitScopeResolver; import com.bms.receivable.profit.ArProfitScopeResolver;
import com.bms.receivable.profit.ArWriteoffRate;
import com.bms.common.exception.ServiceException; import com.bms.common.exception.ServiceException;
class ArCommissionServiceTest class ArCommissionServiceTest
{ {
@Test
void rateConfirmationRequiresCompleteProfitDataBeforeAnyWrite()
{
List<String> calls = new ArrayList<>();
AtomicReference<Integer> complete = new AtomicReference<>(0);
ArCommissionMapper mapper = (ArCommissionMapper) Proxy.newProxyInstance(getClass().getClassLoader(),
new Class<?>[] { ArCommissionMapper.class }, (proxy, method, args) -> {
calls.add(method.getName());
return switch (method.getName()) {
case "selectBillIdByWriteoffId" -> 25L;
case "isBillProfitDataComplete" -> complete.get();
case "confirmMissingRate", "reverseResults" -> 1;
case "countMissingRates" -> 0;
case "selectSettlementInputs" -> List.of();
default -> throw new AssertionError(method.getName());
};
});
ArBill bill = new ArBill();
bill.setProfitSalesUserId(7L);
bill.setGenerationStatus("READY");
ArBillMapper billMapper = (ArBillMapper) Proxy.newProxyInstance(getClass().getClassLoader(),
new Class<?>[] { ArBillMapper.class }, (proxy, method, args) -> {
if ("selectArBillByIdForUpdate".equals(method.getName())) return bill;
throw new AssertionError(method.getName());
});
ArProfitScopeResolver resolver = new ArProfitScopeResolver() {
@Override public ArProfitScope resolve() { return new ArProfitScope(true, false, false, 1L, 1L); }
};
ArCommissionService service = new ArCommissionService(mapper, resolver, null, billMapper);
ArWriteoffRate input = new ArWriteoffRate();
input.setWriteoffId(18L);
input.setRate(new BigDecimal("5"));
input.setRemark("已核对");
for (String status : List.of("CONFIRMED", "PARTIAL_WRITTEN_OFF", "WRITTEN_OFF"))
{
bill.setStatus(status);
calls.clear();
ServiceException error = assertThrows(ServiceException.class, () -> service.confirmMissingRate(input));
assertTrue(error.getMessage().contains("请先处理后再确认比例"));
assertFalse(calls.contains("confirmMissingRate"));
assertFalse(calls.contains("reverseResults"));
}
complete.set(null);
assertThrows(ServiceException.class, () -> service.confirmMissingRate(input));
complete.set(1);
SysUser user = new SysUser();
user.setUserName("finance");
SecurityContextHolder.getContext().setAuthentication(
new UsernamePasswordAuthenticationToken(new LoginUser(user, java.util.Set.of()), null));
try
{
bill.setStatus("PARTIAL_WRITTEN_OFF");
calls.clear();
service.confirmMissingRate(input);
assertTrue(calls.contains("confirmMissingRate"));
assertFalse(calls.contains("reverseResults"));
bill.setStatus("WRITTEN_OFF");
calls.clear();
service.confirmMissingRate(input);
assertTrue(calls.indexOf("isBillProfitDataComplete") < calls.indexOf("confirmMissingRate"));
assertTrue(calls.contains("reverseResults"));
assertTrue(calls.contains("selectSettlementInputs"));
}
finally
{
SecurityContextHolder.clearContext();
}
}
@Test @Test
void commissionReadsUseServerResolvedScopeAndManagementRemainsRestricted() void commissionReadsUseServerResolvedScopeAndManagementRemainsRestricted()
{ {
@@ -14,6 +14,31 @@ import com.bms.receivable.profit.ArCommissionResult;
class ArProfitMapperSqlTest class ArProfitMapperSqlTest
{ {
@Test
void snapshotCalculationIsScopedToTheGeneratingBill() throws Exception
{
Configuration configuration = new Configuration();
configuration.getTypeAliasRegistry().registerAlias("ArBill", com.bms.receivable.domain.ArBill.class);
for (String resource : new String[] {"mapper/receivable/ArBillScopeMapper.xml", "mapper/receivable/ArBillMapper.xml"})
{
try (InputStream input = getClass().getClassLoader().getResourceAsStream(resource))
{
new XMLMapperBuilder(input, configuration, resource, configuration.getSqlFragments()).parse();
}
}
var bound = configuration.getMappedStatement("com.bms.receivable.mapper.ArBillMapper.updateProfitSnapshot")
.getBoundSql(Map.of("arBillId", 42L, "shenzhenArea", "C", "guangzhouArea", "GZ"));
String sql = bound.getSql();
assertTrue(sql.contains("fd.ar_bill_id = ?"));
assertTrue(sql.contains("d.ar_bill_id = ?"));
assertTrue(sql.contains("b.ar_bill_id = ? and b.generation_status = 'GENERATING'"));
assertTrue(sql.contains("f.sales_amount = d.total_amount"));
assertTrue(sql.contains("a.detail_total != b.total_amount"));
assertTrue(sql.contains("'MISSING_PRICE'"));
assertTrue(sql.contains("'CURRENCY_MISMATCH'"));
assertTrue(sql.contains("'PRICE_OVERFLOW'"));
}
@Test @Test
void commissionInReportSummaryUsesBillFiltersAndDataScope() throws Exception void commissionInReportSummaryUsesBillFiltersAndDataScope() throws Exception
{ {
@@ -23,7 +48,7 @@ class ArProfitMapperSqlTest
{ {
new XMLMapperBuilder(input, configuration, resource, configuration.getSqlFragments()).parse(); new XMLMapperBuilder(input, configuration, resource, configuration.getSqlFragments()).parse();
} }
var statement = configuration.getMappedStatement("com.bms.ar.mapper.ArProfitMapper.selectSummary"); var statement = configuration.getMappedStatement("com.bms.receivable.mapper.ArProfitMapper.selectSummary");
ArProfitQuery query = new ArProfitQuery(); ArProfitQuery query = new ArProfitQuery();
query.setCustomerId(5L); query.setCustomerId(5L);
query.setBillNo("AR123"); query.setBillNo("AR123");
@@ -74,7 +99,7 @@ class ArProfitMapperSqlTest
} }
for (String id : new String[] { "selectBills", "selectSummary", "selectBillDetails", "selectFees" }) for (String id : new String[] { "selectBills", "selectSummary", "selectBillDetails", "selectFees" })
{ {
String name = "com.bms.ar.mapper.ArProfitMapper." + id; String name = "com.bms.receivable.mapper.ArProfitMapper." + id;
String self = configuration.getMappedStatement(name).getBoundSql(Map.of( String self = configuration.getMappedStatement(name).getBoundSql(Map.of(
"query", new ArProfitQuery(), "scope", new ArProfitScope(false, true, false, 8L, 10L))).getSql(); "query", new ArProfitQuery(), "scope", new ArProfitScope(false, true, false, 8L, 10L))).getSql();
String manager = configuration.getMappedStatement(name).getBoundSql(Map.of( String manager = configuration.getMappedStatement(name).getBoundSql(Map.of(
@@ -84,18 +109,26 @@ class ArProfitMapperSqlTest
assertTrue(manager.contains("find_in_set")); assertTrue(manager.contains("find_in_set"));
assertTrue(manager.contains("b.status in")); assertTrue(manager.contains("b.status in"));
} }
String bills = configuration.getMappedStatement("com.bms.ar.mapper.ArProfitMapper.selectBills") String bills = configuration.getMappedStatement("com.bms.receivable.mapper.ArProfitMapper.selectBills")
.getBoundSql(Map.of("query", new ArProfitQuery(), "scope", new ArProfitScope(true, false, false, 8L, 10L))).getSql(); .getBoundSql(Map.of("query", new ArProfitQuery(), "scope", new ArProfitScope(true, false, false, 8L, 10L))).getSql();
assertTrue(bills.contains("from ar_bill b")); assertTrue(bills.contains("from ar_bill b"));
assertTrue(bills.contains("b.bill_name")); assertTrue(bills.contains("b.bill_name"));
assertTrue(bills.contains("b.profit_calc_status = 'READY'"));
assertTrue(bills.contains("b.product_amount"));
assertTrue(bills.contains("b.redline_amount"));
assertFalse(bills.contains("ar_bill_detail"));
assertFalse(bills.contains("order_no")); assertFalse(bills.contains("order_no"));
String billCommission = configuration.getMappedStatement("com.bms.ar.mapper.ArCommissionMapper.selectCommissionSummary") String summary = configuration.getMappedStatement("com.bms.receivable.mapper.ArProfitMapper.selectSummary")
.getBoundSql(Map.of("query", new ArProfitQuery(), "scope", new ArProfitScope(true, false, false, 8L, 10L))).getSql();
assertFalse(summary.contains("ar_bill_detail"));
assertTrue(summary.contains("ar_profit_commission_result"));
String billCommission = configuration.getMappedStatement("com.bms.receivable.mapper.ArCommissionMapper.selectCommissionSummary")
.getBoundSql(Map.of("billId", 9L, "scope", new ArProfitScope(true, false, false, 8L, 10L))).getSql(); .getBoundSql(Map.of("billId", 9L, "scope", new ArProfitScope(true, false, false, 8L, 10L))).getSql();
assertTrue(billCommission.contains("r.ar_bill_id = ?")); assertTrue(billCommission.contains("r.ar_bill_id = ?"));
assertTrue(billCommission.contains("then null")); assertTrue(billCommission.contains("then null"));
for (String id : new String[] { "selectResults", "selectCommissionSummary" }) for (String id : new String[] { "selectResults", "selectCommissionSummary" })
{ {
var statement = configuration.getMappedStatement("com.bms.ar.mapper.ArCommissionMapper." + id); var statement = configuration.getMappedStatement("com.bms.receivable.mapper.ArCommissionMapper." + id);
String self = statement.getBoundSql(Map.of("billId", 9L, "includeReversed", true, String self = statement.getBoundSql(Map.of("billId", 9L, "includeReversed", true,
"scope", new ArProfitScope(false, true, false, 8L, 10L))).getSql(); "scope", new ArProfitScope(false, true, false, 8L, 10L))).getSql();
String department = statement.getBoundSql(Map.of("includeReversed", false, String department = statement.getBoundSql(Map.of("includeReversed", false,
@@ -113,7 +146,7 @@ class ArProfitMapperSqlTest
assertFalse(all.contains("b.profit_sales_user_id = ?")); assertFalse(all.contains("b.profit_sales_user_id = ?"));
assertFalse(all.contains("find_in_set")); assertFalse(all.contains("find_in_set"));
} }
var salesSql = configuration.getMappedStatement("com.bms.ar.mapper.ArProfitMapper.selectSalesOptions") var salesSql = configuration.getMappedStatement("com.bms.receivable.mapper.ArProfitMapper.selectSalesOptions")
.getBoundSql(Map.of("keyword", "sales")); .getBoundSql(Map.of("keyword", "sales"));
assertTrue(salesSql.getSql().contains("from sys_user u")); assertTrue(salesSql.getSql().contains("from sys_user u"));
assertTrue(salesSql.getSql().contains("u.nick_name like")); assertTrue(salesSql.getSql().contains("u.nick_name like"));
@@ -121,11 +154,22 @@ class ArProfitMapperSqlTest
assertFalse(salesSql.getSql().contains("ar_bill")); assertFalse(salesSql.getSql().contains("ar_bill"));
assertFalse(salesSql.getSql().contains("sys_role")); assertFalse(salesSql.getSql().contains("sys_role"));
assertTrue(salesSql.getSql().contains("limit 50")); assertTrue(salesSql.getSql().contains("limit 50"));
String settlement = configuration.getMappedStatement("com.bms.ar.mapper.ArCommissionMapper.selectSettlementInputs") String settlement = configuration.getMappedStatement("com.bms.receivable.mapper.ArCommissionMapper.selectSettlementInputs")
.getBoundSql(Map.of("billId", 1L)).getSql(); .getBoundSql(Map.of("billId", 1L)).getSql();
assertTrue(settlement.contains("w.status = 'EFFECTIVE'")); assertTrue(settlement.contains("w.status = 'EFFECTIVE'"));
assertTrue(settlement.contains("b.status = 'WRITTEN_OFF'")); assertTrue(settlement.contains("b.status = 'WRITTEN_OFF'"));
var insert = configuration.getMappedStatement("com.bms.ar.mapper.ArCommissionMapper.insertResults") String validation = configuration.getMappedStatement("com.bms.receivable.mapper.ArCommissionMapper.isBillProfitDataComplete")
.getBoundSql(Map.of("billId", 1L)).getSql();
assertTrue(validation.contains("detail.ar_bill_id = ?"));
assertTrue(validation.contains("d.ar_bill_id = ?"));
assertTrue(validation.contains("a.detail_total = b.total_amount"));
assertTrue(validation.contains("f.sales_amount = d.total_amount"));
assertTrue(validation.contains("f.fee_currency = d.currency"));
assertTrue(validation.contains("f.product_complete = 1"));
assertTrue(validation.contains("f.redline_complete = 1"));
assertFalse(validation.contains("b.status = 'WRITTEN_OFF'"));
assertFalse(validation.contains("profit_calc_status"));
var insert = configuration.getMappedStatement("com.bms.receivable.mapper.ArCommissionMapper.insertResults")
.getBoundSql(Map.of("items", java.util.List.of(new ArCommissionResult(), new ArCommissionResult()), "operator", "test")); .getBoundSql(Map.of("items", java.util.List.of(new ArCommissionResult(), new ArCommissionResult()), "operator", "test"));
assertTrue(insert.getSql().contains("ar_profit_commission_result")); assertTrue(insert.getSql().contains("ar_profit_commission_result"));
assertTrue(insert.getParameterMappings().size() == 16); assertTrue(insert.getParameterMappings().size() == 16);
@@ -169,9 +169,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
} }
/** /**
* Normalize destination postcode for zone match / persist. * 规范化目的地邮编,用于分区匹配/持久化。
* Removes all Unicode whitespace (incl. NBSP / U+2005) and ASCII spaces; * 移除所有 Unicode 空白字符(包括 NBSP / U+2005)和 ASCII 空格;
* strips Excel-style trailing ".0" on pure digits. * 去除纯数字末尾 Excel 风格的 ".0"。
*/ */
public static String normalizePostcode(String postcode) public static String normalizePostcode(String postcode)
{ {
@@ -681,12 +681,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
} }
/** /**
* Compares given {@code string} to a CharSequences vararg of {@code searchStrings}, * 将给定的 {@code string} 与 {@code searchStrings} 可变参数中的字符序列进行比较,
* returning {@code true} if the {@code string} is equal to any of the {@code searchStrings}, ignoring case. * 如果 {@code string} 与其中任意一个 {@code searchStrings} 相等(忽略大小写),则返回 {@code true}。
* *
* @param string to compare, may be {@code null}. * @param string 要比较的字符串,可能为 {@code null}。
* @param searchStrings a vararg of strings, may be {@code null}. * @param searchStrings 字符串可变参数,可能为 {@code null}。
* @return {@code true} if the string is equal (case-insensitive) to any other element of {@code searchStrings}; * @return 如果字符串与 {@code searchStrings} 中的任意其他元素相等(不区分大小写),则返回 {@code true};
*/ */
public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence... searchStrings) public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence... searchStrings)
{ {
@@ -29,13 +29,13 @@ public class MimeTypeUtils
public static final String[] DEFAULT_ALLOWED_EXTENSION = { public static final String[] DEFAULT_ALLOWED_EXTENSION = {
// 图片 // 图片
"bmp", "gif", "jpg", "jpeg", "png", "bmp", "gif", "jpg", "jpeg", "png",
// word excel powerpoint // Word、Excel、PowerPoint 文档
"doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt",
// 压缩文件 // 压缩文件
"rar", "zip", "gz", "bz2", "rar", "zip", "gz", "bz2",
// 视频格式 // 视频格式
"mp4", "avi", "rmvb", "mp4", "avi", "rmvb",
// pdf // pdf 文档
"pdf" }; "pdf" };
public static String getExtension(String prefix) public static String getExtension(String prefix)
@@ -20,7 +20,7 @@ public class EscapeUtil
TEXT[i] = new char[] { (char) i }; TEXT[i] = new char[] { (char) i };
} }
// special HTML characters // 特殊的 HTML 字符
TEXT['\''] = "&#039;".toCharArray(); // 单引号 TEXT['\''] = "&#039;".toCharArray(); // 单引号
TEXT['"'] = "&#34;".toCharArray(); // 双引号 TEXT['"'] = "&#34;".toCharArray(); // 双引号
TEXT['&'] = "&#38;".toCharArray(); // &符 TEXT['&'] = "&#38;".toCharArray(); // &符
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
public final class HTMLFilter public final class HTMLFilter
{ {
/** /**
* regex flag union representing /si modifiers in php * 表示 php 中 /si 修饰符的正则表达式标志组合
**/ **/
private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL;
private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL); private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL);
@@ -45,60 +45,60 @@ public final class HTMLFilter
private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); private static final Pattern P_RIGHT_ARROW = Pattern.compile(">");
private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>");
// @xxx could grow large... maybe use sesat's ReferenceMap // @xxx 可能会变得很大……也许可以使用 sesat 的 ReferenceMap
private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>();
private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>();
/** /**
* set of allowed html elements, along with allowed attributes for each element * 允许的 html 元素集合,以及每个元素允许的属性
**/ **/
private final Map<String, List<String>> vAllowed; private final Map<String, List<String>> vAllowed;
/** /**
* counts of open tags for each (allowable) html element * 每个(允许的)html 元素当前打开的标签计数
**/ **/
private final Map<String, Integer> vTagCounts = new HashMap<>(); private final Map<String, Integer> vTagCounts = new HashMap<>();
/** /**
* html elements which must always be self-closing (e.g. "<img />") * 必须始终自闭合的 html 元素(例如 "<img />")
**/ **/
private final String[] vSelfClosingTags; private final String[] vSelfClosingTags;
/** /**
* html elements which must always have separate opening and closing tags (e.g. "<b></b>") * 必须始终具有独立开始和结束标签的 html 元素(例如 "<b></b>")
**/ **/
private final String[] vNeedClosingTags; private final String[] vNeedClosingTags;
/** /**
* set of disallowed html elements * 不允许的 html 元素集合
**/ **/
private final String[] vDisallowed; private final String[] vDisallowed;
/** /**
* attributes which should be checked for valid protocols * 需要校验协议是否有效的属性
**/ **/
private final String[] vProtocolAtts; private final String[] vProtocolAtts;
/** /**
* allowed protocols * 允许的协议
**/ **/
private final String[] vAllowedProtocols; private final String[] vAllowedProtocols;
/** /**
* tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />") * 内容为空时应移除的标签(例如 "<b></b>" 或 "<b />")
**/ **/
private final String[] vRemoveBlanks; private final String[] vRemoveBlanks;
/** /**
* entities allowed within html markup * html 标记中允许的实体
**/ **/
private final String[] vAllowedEntities; private final String[] vAllowedEntities;
/** /**
* flag determining whether comments are allowed in input String. * 用于标识输入字符串中是否允许注释的标志。
*/ */
private final boolean stripComment; private final boolean stripComment;
private final boolean encodeQuotes; private final boolean encodeQuotes;
/** /**
* flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "<b text </b>" * 用于标识在遇到“不配对”的尖括号时是否尝试构造标签的标志(例如 "<b text </b>"
* becomes "<b> text </b>"). If set to false, unbalanced angle brackets will be html escaped. * 会变成 "<b> text </b>")。如果设置为 false,不配对的尖括号将被 html 转义。
*/ */
private final boolean alwaysMakeTags; private final boolean alwaysMakeTags;
/** /**
* Default constructor. * 默认构造方法。
*/ */
public HTMLFilter() public HTMLFilter()
{ {
@@ -125,7 +125,7 @@ public final class HTMLFilter
vSelfClosingTags = new String[] { "img" }; vSelfClosingTags = new String[] { "img" };
vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" };
vDisallowed = new String[] {}; vDisallowed = new String[] {};
vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. vAllowedProtocols = new String[] { "http", "mailto", "https" }; // 不支持 ftp。
vProtocolAtts = new String[] { "src", "href" }; vProtocolAtts = new String[] { "src", "href" };
vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" };
vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" };
@@ -135,9 +135,9 @@ public final class HTMLFilter
} }
/** /**
* Map-parameter configurable constructor. * 可通过 Map 参数配置的构造方法。
* *
* @param conf map containing configuration. keys match field names. * @param conf 包含配置的 map。键与字段名一致。
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public HTMLFilter(final Map<String, Object> conf) public HTMLFilter(final Map<String, Object> conf)
@@ -171,7 +171,7 @@ public final class HTMLFilter
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------
// my versions of some PHP library functions // 我实现的某些 PHP 库函数版本
public static String chr(final int decimal) public static String chr(final int decimal)
{ {
return String.valueOf((char) decimal); return String.valueOf((char) decimal);
@@ -190,10 +190,10 @@ public final class HTMLFilter
// --------------------------------------------------------------- // ---------------------------------------------------------------
/** /**
* given a user submitted input String, filter out any invalid or restricted html. * 对用户提交的输入字符串,过滤掉任何无效或受限的 html。
* *
* @param input text (i.e. submitted by a user) than may contain html * @param input 可能包含 html 的文本(即用户提交的内容)
* @return "clean" version of input, with only valid, whitelisted html elements allowed * @return 输入的“干净”版本,仅允许有效且在 html 白名单中的元素
*/ */
public String filter(final String input) public String filter(final String input)
{ {
@@ -242,7 +242,7 @@ public final class HTMLFilter
if (alwaysMakeTags) if (alwaysMakeTags)
{ {
// //
// try and form html // 尝试构造 html
// //
s = regexReplace(P_END_ARROW, "", s); s = regexReplace(P_END_ARROW, "", s);
// 不追加结束标签 // 不追加结束标签
@@ -253,15 +253,15 @@ public final class HTMLFilter
else else
{ {
// //
// escape stray brackets // 转义多余的括号
// //
s = regexReplace(P_STRAY_LEFT_ARROW, "&lt;$1", s); s = regexReplace(P_STRAY_LEFT_ARROW, "&lt;$1", s);
s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2&gt;<", s); s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2&gt;<", s);
// //
// the last regexp causes '<>' entities to appear // 上一个正则表达式会导致出现 "<>" 实体
// (we need to do a lookahead assertion so that the last bracket can // (我们需要使用先行断言,以便最后一个括号
// be used in the next pass of the regexp) // 可以在正则表达式的下一次匹配中使用)
// //
s = regexReplace(P_BOTH_ARROWS, "", s); s = regexReplace(P_BOTH_ARROWS, "", s);
} }
@@ -282,8 +282,8 @@ public final class HTMLFilter
} }
m.appendTail(buf); m.appendTail(buf);
// these get tallied in processTag // 这些计数在 processTag 中进行累加
// (remember to reset before subsequent calls to filter method) // (记住在后续调用 filter 方法之前重置计数)
final StringBuilder sBuilder = new StringBuilder(buf.toString()); final StringBuilder sBuilder = new StringBuilder(buf.toString());
for (String key : vTagCounts.keySet()) for (String key : vTagCounts.keySet())
{ {
@@ -325,7 +325,7 @@ public final class HTMLFilter
private String processTag(final String s) private String processTag(final String s)
{ {
// ending tags // 结束标签
Matcher m = P_END_TAG.matcher(s); Matcher m = P_END_TAG.matcher(s);
if (m.find()) if (m.find())
{ {
@@ -343,7 +343,7 @@ public final class HTMLFilter
} }
} }
// starting tags // 开始标签
m = P_START_TAG.matcher(s); m = P_START_TAG.matcher(s);
if (m.find()) if (m.find())
{ {
@@ -424,7 +424,7 @@ public final class HTMLFilter
} }
} }
// comments // 注释
m = P_COMMENT.matcher(s); m = P_COMMENT.matcher(s);
if (!stripComment && m.find()) if (!stripComment && m.find())
{ {
@@ -443,7 +443,7 @@ public final class HTMLFilter
final String protocol = m.group(1); final String protocol = m.group(1);
if (!inArray(protocol, vAllowedProtocols)) if (!inArray(protocol, vAllowedProtocols))
{ {
// bad protocol, turn into local anchor link instead // 协议不合法,改为本地锚点链接
s = "#" + s.substring(protocol.length() + 1); s = "#" + s.substring(protocol.length() + 1);
if (s.startsWith("#//")) if (s.startsWith("#//"))
{ {
@@ -499,7 +499,7 @@ public final class HTMLFilter
{ {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
// validate entities throughout the string // 校验整个字符串中的实体
Matcher m = P_VALID_ENTITIES.matcher(s); Matcher m = P_VALID_ENTITIES.matcher(s);
while (m.find()) while (m.find())
{ {
@@ -569,12 +569,12 @@ public class ExcelUtil<T>
} }
/** /**
* Common one-liner export for controllers. * 供控制器使用的通用一行式导出方法。
* *
* @param response HTTP response * @param response HTTP 响应
* @param list export rows * @param list 导出的数据行
* @param clazz row class with @Excel fields * @param clazz 带有 @Excel 注解字段的数据行类
* @param sheetName sheet / file title * @param sheetName sheet / 文件标题
*/ */
public static <E> void export(HttpServletResponse response, List<E> list, Class<E> clazz, String sheetName) public static <E> void export(HttpServletResponse response, List<E> list, Class<E> clazz, String sheetName)
{ {
@@ -75,10 +75,10 @@ public final class Base64
} }
/** /**
* Encodes hex octects into Base64 * 将十六进制字节编码为 Base64
* *
* @param binaryData Array containing binaryData * @param binaryData 包含二进制数据的数组
* @return Encoded Base64 array * @return 编码后的 Base64 数组
*/ */
public static String encode(byte[] binaryData) public static String encode(byte[] binaryData)
{ {
@@ -124,7 +124,7 @@ public final class Base64
encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
} }
// form integral number of 6-bit groups // 组成完整的 6 位组
if (fewerThan24bits == EIGHTBIT) if (fewerThan24bits == EIGHTBIT)
{ {
b1 = binaryData[dataIndex]; b1 = binaryData[dataIndex];
@@ -154,10 +154,10 @@ public final class Base64
} }
/** /**
* Decodes Base64 data into octects * 将 Base64 数据解码为字节
* *
* @param encoded string containing Base64 data * @param encoded 包含 Base64 数据的字符串
* @return Array containind decoded data. * @return 包含解码后数据的数组。
*/ */
public static byte[] decode(String encoded) public static byte[] decode(String encoded)
{ {
@@ -167,12 +167,12 @@ public final class Base64
} }
char[] base64Data = encoded.toCharArray(); char[] base64Data = encoded.toCharArray();
// remove white spaces // 去除空白字符
int len = removeWhiteSpace(base64Data); int len = removeWhiteSpace(base64Data);
if (len % FOURBYTE != 0) if (len % FOURBYTE != 0)
{ {
return null;// should be divisible by four return null;// 应为 4 的倍数
} }
int numberQuadruple = (len / FOURBYTE); int numberQuadruple = (len / FOURBYTE);
@@ -198,7 +198,7 @@ public final class Base64
|| !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++])))
{ {
return null; return null;
} // if found "no data" just return null } // 如果未找到数据,直接返回 null
b1 = base64Alphabet[d1]; b1 = base64Alphabet[d1];
b2 = base64Alphabet[d2]; b2 = base64Alphabet[d2];
@@ -212,7 +212,7 @@ public final class Base64
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])))
{ {
return null;// if found "no data" just return null return null;// 如果未找到数据,直接返回 null
} }
b1 = base64Alphabet[d1]; b1 = base64Alphabet[d1];
@@ -221,10 +221,10 @@ public final class Base64
d3 = base64Data[dataIndex++]; d3 = base64Data[dataIndex++];
d4 = base64Data[dataIndex++]; d4 = base64Data[dataIndex++];
if (!isData((d3)) || !isData((d4))) if (!isData((d3)) || !isData((d4)))
{// Check if they are PAD characters {// 检查它们是否为 PAD 字符
if (isPad(d3) && isPad(d4)) if (isPad(d3) && isPad(d4))
{ {
if ((b2 & 0xf) != 0)// last 4 bits should be zero if ((b2 & 0xf) != 0)// 最后 4 位应为零
{ {
return null; return null;
} }
@@ -236,7 +236,7 @@ public final class Base64
else if (!isPad(d3) && isPad(d4)) else if (!isPad(d3) && isPad(d4))
{ {
b3 = base64Alphabet[d3]; b3 = base64Alphabet[d3];
if ((b3 & 0x3) != 0)// last 2 bits should be zero if ((b3 & 0x3) != 0)// 最后 2 位应为零
{ {
return null; return null;
} }
@@ -252,7 +252,7 @@ public final class Base64
} }
} }
else else
{ // No PAD e.g 3cQl { // 没有 PAD,例如 3cQl
b3 = base64Alphabet[d3]; b3 = base64Alphabet[d3];
b4 = base64Alphabet[d4]; b4 = base64Alphabet[d4];
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
@@ -264,10 +264,10 @@ public final class Base64
} }
/** /**
* remove WhiteSpace from MIME containing encoded Base64 data. * 从包含已编码 Base64 数据的 MIME 中移除空白字符。
* *
* @param data the byte array of base64 data (with WS) * @param data Base64 数据的字节数组(含空白字符)
* @return the new length * @return 新的长度
*/ */
private static int removeWhiteSpace(char[] data) private static int removeWhiteSpace(char[] data)
{ {
@@ -276,7 +276,7 @@ public final class Base64
return 0; return 0;
} }
// count characters that's not whitespace // 统计非空白字符的数量
int newSize = 0; int newSize = 0;
int len = data.length; int len = data.length;
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
@@ -97,10 +97,10 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
byte[] randomBytes = new byte[16]; byte[] randomBytes = new byte[16];
ng.nextBytes(randomBytes); ng.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */ randomBytes[6] &= 0x0f; /* 清除版本位 */
randomBytes[6] |= 0x40; /* set to version 4 */ randomBytes[6] |= 0x40; /* 设置为版本 4 */
randomBytes[8] &= 0x3f; /* clear variant */ randomBytes[8] &= 0x3f; /* 清除变体位 */
randomBytes[8] |= 0x80; /* set to IETF variant */ randomBytes[8] |= 0x80; /* 设置为 IETF 变体 */
return new UUID(randomBytes); return new UUID(randomBytes);
} }
@@ -123,10 +123,10 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
throw new InternalError("MD5 not supported"); throw new InternalError("MD5 not supported");
} }
byte[] md5Bytes = md.digest(name); byte[] md5Bytes = md.digest(name);
md5Bytes[6] &= 0x0f; /* clear version */ md5Bytes[6] &= 0x0f; /* 清除版本位 */
md5Bytes[6] |= 0x30; /* set to version 3 */ md5Bytes[6] |= 0x30; /* 设置为版本 3 */
md5Bytes[8] &= 0x3f; /* clear variant */ md5Bytes[8] &= 0x3f; /* 清除变体位 */
md5Bytes[8] |= 0x80; /* set to IETF variant */ md5Bytes[8] |= 0x80; /* 设置为 IETF 变体 */
return new UUID(md5Bytes); return new UUID(md5Bytes);
} }
@@ -198,7 +198,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
*/ */
public int version() public int version()
{ {
// Version is bits masked by 0x000000000000F000 in MS long // 版本号是最高有效长整型中被 0x000000000000F000 掩码的位
return (int) ((mostSigBits >> 12) & 0x0f); return (int) ((mostSigBits >> 12) & 0x0f);
} }
@@ -217,11 +217,11 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
*/ */
public int variant() public int variant()
{ {
// This field is composed of a varying number of bits. // 该字段由数量可变的位组成。
// 0 - - Reserved for NCS backward compatibility // 0 - - 为 NCS 向后兼容保留
// 1 0 - The IETF aka Leach-Salz variant (used by this class) // 1 0 - IETF 即 Leach-Salz 变体(本类使用)
// 1 1 0 Reserved, Microsoft backward compatibility // 1 1 0 保留,微软向后兼容
// 1 1 1 Reserved for future definition. // 1 1 1 保留供以后定义使用。
return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63)); return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63));
} }
@@ -403,7 +403,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits);
} }
// Comparison Operations // 比较操作
/** /**
* 将此 UUID 与指定的 UUID 比较。 * 将此 UUID 与指定的 UUID 比较。
@@ -419,8 +419,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
@Override @Override
public int compareTo(UUID val) public int compareTo(UUID val)
{ {
// The ordering is intentionally set up so that the UUIDs // 此处有意这样设置比较顺序,使得 UUID
// can simply be numerically compared as two numbers // 可以简单地作为两个数字进行数值比较
return (this.mostSigBits < val.mostSigBits ? -1 : // return (this.mostSigBits < val.mostSigBits ? -1 : //
(this.mostSigBits > val.mostSigBits ? 1 : // (this.mostSigBits > val.mostSigBits ? 1 : //
(this.leastSigBits < val.leastSigBits ? -1 : // (this.leastSigBits < val.leastSigBits ? -1 : //
@@ -429,7 +429,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
} }
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
// Private method start // 私有方法开始
/** /**
* 返回指定数字对应的hex值 * 返回指定数字对应的hex值
* *
@@ -106,7 +106,7 @@ public class MyBatisConfig
} }
catch (IOException e) catch (IOException e)
{ {
// ignore // 忽略
} }
} }
} }
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
public class TmsApiProperties public class TmsApiProperties
{ {
/** /**
* Agreed API identification code (header X-Api-Code or body apiCode). * 约定的 API 标识码(请求头 X-Api-Code 或请求体 apiCode)。
*/ */
private String apiCode = "BMS.TMS.ZYaOvlQzpcfau8TUaCFfO3Hp8ieHIqGw"; private String apiCode = "BMS.TMS.ZYaOvlQzpcfau8TUaCFfO3Hp8ieHIqGw";
@@ -59,7 +59,7 @@ public class BmsCustomerPriceSet extends BaseEntity
/** 计价类型 FIXED=固定价 DISCOUNT=折扣 */ /** 计价类型 FIXED=固定价 DISCOUNT=折扣 */
private String setType; private String setType;
/** Package status D=pending-enable A=audit E=effective R=reject S=stopped */ /** 套餐状态 D=待启用 A=审核 E=生效 R=拒绝 S=停用 */
private String priceSetStatus; private String priceSetStatus;
/** 套餐生效日期 */ /** 套餐生效日期 */
@@ -26,7 +26,7 @@ public class BmsPriceSetOption
/** 计价类型 FIXED=固定价 DISCOUNT=折扣 */ /** 计价类型 FIXED=固定价 DISCOUNT=折扣 */
private String setType; private String setType;
/** Package status D=pending-enable A=audit E=effective R=reject S=stopped */ /** 套餐状态 D=待启用 A=审核 E=生效 R=拒绝 S=停用 */
private String status; private String status;
/** 生效日期 */ /** 生效日期 */
@@ -94,7 +94,7 @@ public class BmsCustomerPriceSetServiceImpl implements IBmsCustomerPriceSetServi
if (existing != null) if (existing != null)
{ {
bind.setCustomerPricesetId(existing.getCustomerPricesetId()); bind.setCustomerPricesetId(existing.getCustomerPricesetId());
// UI no longer collects bind dates: keep existing when not passed. // UI 不再收集绑定日期:未传时保留原值。
if (bind.getPrBegindate() == null) if (bind.getPrBegindate() == null)
{ {
bind.setPrBegindate(existing.getPrBegindate()); bind.setPrBegindate(existing.getPrBegindate());
@@ -107,7 +107,7 @@ public class BmsCustomerPriceSetServiceImpl implements IBmsCustomerPriceSetServi
} }
else else
{ {
// pr_begindate NOT NULL; UI omits it — default to now (same as price-set bind). // pr_begindate NOT NULL,UI 未传时默认取当前时间(与价格套餐绑定一致)。
if (bind.getPrBegindate() == null) if (bind.getPrBegindate() == null)
{ {
bind.setPrBegindate(DateUtils.getNowDate()); bind.setPrBegindate(DateUtils.getNowDate());
@@ -525,7 +525,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
} }
catch (RuntimeException e) catch (RuntimeException e)
{ {
// Concurrent first-create: peer may have inserted; re-lock existing row. // 并发首次创建:其他节点可能已插入;重新锁定已存在的行。
if (isAccountInitRace(e)) if (isAccountInitRace(e))
{ {
account = customerMoneyMapper.selectAccountForUpdate(customerId, BASE_CURRENCY); account = customerMoneyMapper.selectAccountForUpdate(customerId, BASE_CURRENCY);
@@ -539,7 +539,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
} }
} }
/** Deadlock / duplicate key while inserting ctr_customer_account. */ /** 插入 ctr_customer_account 时出现死锁 / 唯一键冲突。 */
private static boolean isAccountInitRace(Throwable e) private static boolean isAccountInitRace(Throwable e)
{ {
Throwable t = e; Throwable t = e;
@@ -607,7 +607,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
flow.setEffectiveDate(effectiveDate); flow.setEffectiveDate(effectiveDate);
flow.setExpireDate(expireDate); flow.setExpireDate(expireDate);
flow.setReason("账户初始化"); flow.setReason("账户初始化");
// No login (open API / MQ / job): operatorId null, same as occupyCredit // 无登录态(开放 API / MQ / 定时任务):operatorId 为 null,与 occupyCredit 一致
flow.setOperatorId(currentUserId()); flow.setOperatorId(currentUserId());
flow.setCreateBy(username); flow.setCreateBy(username);
flow.setRemark(remark); flow.setRemark(remark);
@@ -10,22 +10,22 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "bms.billing") @ConfigurationProperties(prefix = "bms.billing")
public class BillingProperties public class BillingProperties
{ {
/** local = Spring event; redis = Redis list queue */ /** local = Spring 事件;redis = Redis 列表队列 */
private String mqMode = "redis"; private String mqMode = "redis";
private String mqQueueKey = "bms:billing:task"; private String mqQueueKey = "bms:billing:task";
private boolean consumerEnabled = true; private boolean consumerEnabled = true;
/** Messages popped per scheduled tick (redis mode) */ /** 每个调度周期取出的消息数量(redis 模式) */
private int consumerBatchSize = 32; private int consumerBatchSize = 32;
/** Concurrent processTask threads (redis mode) */ /** 并发执行 processTask 的线程数(redis 模式) */
private int consumerThreads = 8; private int consumerThreads = 8;
/** Concurrent threads for monitor order-source sync */ /** 监控订单数源同步的并发线程数 */
private int orderSourceSyncThreads = 8; private int orderSourceSyncThreads = 8;
/** /**
* Concurrent threads for order-list local rebill (2~24). * 订单列表本地重计费的并发线程数(2~24)。
* Keep below Druid maxActive with headroom for other traffic. * 需低于 Druid maxActive,并给其他流量留出余量。
*/ */
private int localRebillThreads = 16; private int localRebillThreads = 16;
/** Hourly auto-retry of prc_billing_task (all statuses) */ /** 每小时自动重试 prc_billing_task(所有状态) */
private NightRetry nightRetry = new NightRetry(); private NightRetry nightRetry = new NightRetry();
private Oracle oracle = new Oracle(); private Oracle oracle = new Oracle();
@@ -120,18 +120,18 @@ public class BillingProperties
} }
/** /**
* Auto rebill window: pull prc_billing_task (all success_status) and retryTask. * 自动重计费时间窗:拉取 prc_billing_task(所有 success_status)并执行 retryTask。
* Default hours [0, 24) local time (all day); empty result skips billing. * 默认本地时间 [0, 24) 点(全天);结果为空则跳过计费。
*/ */
public static class NightRetry public static class NightRetry
{ {
/** Master switch */ /** 总开关 */
private boolean enabled = true; private boolean enabled = true;
/** Inclusive start hour (0 = 00:00) */ /** 起始小时,含(0 = 00:00) */
private int startHour = 0; private int startHour = 0;
/** Exclusive end hour (24 = all day) */ /** 结束小时,不含(24 = 全天) */
private int endHour = 24; private int endHour = 24;
/** Page size: bill this many then pull next page (default 500) */ /** 分页大小:计费这么多条后再拉下一页(默认 500) */
private int batchSize = 500; private int batchSize = 500;
public boolean isEnabled() public boolean isEnabled()
@@ -177,9 +177,9 @@ public class BillingProperties
public static class Oracle public static class Oracle
{ {
/** Upstream main-order table name on SLAVE/Oracle DS */ /** SLAVE/Oracle 数据源上的上游主订单表名 */
private String orderTable = "WEISHI_USER.TAB_ORDER"; private String orderTable = "WEISHI_USER.TAB_ORDER";
/** Optional default product when Oracle row has no PRODUCT_CODE */ /** Oracle 行中没有 PRODUCT_CODE 时使用的可选默认产品 */
private String defaultProductCode = ""; private String defaultProductCode = "";
public String getOrderTable() public String getOrderTable()
@@ -14,7 +14,7 @@ public class BmsProduct extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** maps to prc_price_set_product.psp_id */ /** 对应 prc_price_set_product.psp_id */
private Long productId; private Long productId;
private Long psvId; private Long psvId;
private String priceType; private String priceType;
@@ -30,7 +30,7 @@ public class BmsProduct extends BaseEntity
private Date effectiveDate; private Date effectiveDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireDate; private Date expireDate;
/** 0 pending, 1 active, 2 expired */ /** 0 待生效,1 生效,2 已失效 */
public static final String STATUS_PENDING = "0"; public static final String STATUS_PENDING = "0";
public static final String STATUS_ACTIVE = "1"; public static final String STATUS_ACTIVE = "1";
public static final String STATUS_EXPIRED = "2"; public static final String STATUS_EXPIRED = "2";
@@ -45,8 +45,8 @@ public class BmsProduct extends BaseEntity
private Integer countryCount; private Integer countryCount;
private Integer surchargeCount; private Integer surchargeCount;
private List<BmsProductCountry> countries; private List<BmsProductCountry> countries;
/** query alias of status (0/1/2) */ /** status 的查询别名(0/1/2) */
private String effectStatus; private String effectStatus;
/** query: active = status in (0,1); expired = status 2 */ /** 查询:active = status in (0,1);expired = status 2 */
private String statusGroup; private String statusGroup;
} }
@@ -12,23 +12,23 @@ public class BmsProductCountry implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** maps to prc_price_set_detail.psd_id */ /** 对应 prc_price_set_detail.psd_id */
private Long detailId; private Long detailId;
private Long psvId; private Long psvId;
private Long pspId; private Long pspId;
private String priceType; private String priceType;
/** FK to product.product_id */ /** 外键,指向 product.product_id */
private Long productId; private Long productId;
private String productCode; private String productCode;
/** Parse/import helper only (not a DB column). */ /** 仅用于解析/导入辅助(非数据库字段)。 */
private String productName; private String productName;
private String countryName; private String countryName;
private String countryCode; private String countryCode;
/** prc_zone.zone_id; null when product country has no zone */ /** prc_zone.zone_id;产品国家无分区时为 null */
private Long zoneId; private Long zoneId;
/** e.g. Z1; null when no zone */ /** 例如 Z1;无分区时为 null */
private String zoneCode; private String zoneCode;
/** e.g. Australia(Z1); null when no zone */ /** 例如 Australia(Z1);无分区时为 null */
private String zoneName; private String zoneName;
private BigDecimal weightMin; private BigDecimal weightMin;
private BigDecimal weightMax; private BigDecimal weightMax;
@@ -39,10 +39,10 @@ public class BmsProductCountry implements Serializable
private String leadTime; private String leadTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveDate; private Date effectiveDate;
/** null=open; closed to next import effective_date */ /** null=未关闭;关闭到下次导入的 effective_date */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireDate; private Date expireDate;
/** 0 pending, 1 active, 2 expired */ /** 0 待生效,1 生效,2 已失效 */
private String status; private String status;
/** 0未删除 1已删除 */ /** 0未删除 1已删除 */
public static final String IS_DEL_NO = "0"; public static final String IS_DEL_NO = "0";
@@ -52,8 +52,8 @@ public class BmsProductCountry implements Serializable
private Date createTime; private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** query only: true = expire_date is null */ /** 仅查询用:true = expire_date 为 null */
private Boolean openOnly; private Boolean openOnly;
/** query alias of status (0/1/2) */ /** status 的查询别名(0/1/2) */
private String effectStatus; private String effectStatus;
} }
@@ -19,7 +19,7 @@ public class BmsProductImportTask implements Serializable
private int percent; private int percent;
private String message; private String message;
private String error; private String error;
/** Preview parse payload (products / details); not persisted to DB. */ /** 预览解析结果(products / details);不落库。 */
private Object result; private Object result;
public String getTaskId() public String getTaskId()
@@ -29,7 +29,7 @@ public class BmsRedlineProduct extends BaseEntity
private Date effectiveDate; private Date effectiveDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireDate; private Date expireDate;
/** 0 pending, 1 active, 2 expired */ /** 0 待生效,1 生效,2 已失效 */
public static final String STATUS_PENDING = "0"; public static final String STATUS_PENDING = "0";
public static final String STATUS_ACTIVE = "1"; public static final String STATUS_ACTIVE = "1";
public static final String STATUS_EXPIRED = "2"; public static final String STATUS_EXPIRED = "2";
@@ -44,8 +44,8 @@ public class BmsRedlineProduct extends BaseEntity
private Integer countryCount; private Integer countryCount;
private Integer surchargeCount; private Integer surchargeCount;
private List<BmsRedlineProductCountry> countries; private List<BmsRedlineProductCountry> countries;
/** query alias of status (0/1/2) */ /** status 的查询别名(0/1/2) */
private String effectStatus; private String effectStatus;
/** query: active = status in (0,1); expired = status 2 */ /** 查询:active = status in (0,1);expired = status 2 */
private String statusGroup; private String statusGroup;
} }
@@ -12,23 +12,23 @@ public class BmsRedlineProductCountry implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** maps to prc_price_set_detail.psd_id */ /** 对应 prc_price_set_detail.psd_id */
private Long detailId; private Long detailId;
private Long psvId; private Long psvId;
private Long pspId; private Long pspId;
private String priceType; private String priceType;
/** FK to product.product_id / psp_id */ /** 外键,指向 product.product_id / psp_id */
private Long productId; private Long productId;
private String productCode; private String productCode;
/** Parse/import helper only (not a DB column). */ /** 仅用于解析/导入辅助(非数据库字段)。 */
private String productName; private String productName;
private String countryName; private String countryName;
private String countryCode; private String countryCode;
/** prc_zone.zone_id; null when product country has no zone */ /** prc_zone.zone_id;产品国家无分区时为 null */
private Long zoneId; private Long zoneId;
/** e.g. Z1; null when no zone */ /** 例如 Z1;无分区时为 null */
private String zoneCode; private String zoneCode;
/** e.g. Australia(Z1); null when no zone */ /** 例如 Australia(Z1);无分区时为 null */
private String zoneName; private String zoneName;
private BigDecimal weightMin; private BigDecimal weightMin;
private BigDecimal weightMax; private BigDecimal weightMax;
@@ -39,10 +39,10 @@ public class BmsRedlineProductCountry implements Serializable
private String leadTime; private String leadTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveDate; private Date effectiveDate;
/** null=open; closed to next import effective_date */ /** null=未关闭;关闭到下次导入的 effective_date */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireDate; private Date expireDate;
/** 0 pending, 1 active, 2 expired */ /** 0 待生效,1 生效,2 已失效 */
private String status; private String status;
/** 0未删除 1已删除 */ /** 0未删除 1已删除 */
public static final String IS_DEL_NO = "0"; public static final String IS_DEL_NO = "0";
@@ -52,8 +52,8 @@ public class BmsRedlineProductCountry implements Serializable
private Date createTime; private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** query only: true = expire_date is null */ /** 仅查询用:true = expire_date 为 null */
private Boolean openOnly; private Boolean openOnly;
/** query alias of status (0/1/2) */ /** status 的查询别名(0/1/2) */
private String effectStatus; private String effectStatus;
} }
@@ -19,7 +19,7 @@ public class BmsRedlineProductImportTask implements Serializable
private int percent; private int percent;
private String message; private String message;
private String error; private String error;
/** Preview parse payload (products / details); not persisted to DB. */ /** 预览解析结果(products / details);不落库。 */
private Object result; private Object result;
public String getTaskId() public String getTaskId()
@@ -13,7 +13,7 @@ public class CatalogPreviewApplyRequest implements Serializable
private Long psvId; private Long psvId;
private List<BmsProduct> products; private List<BmsProduct> products;
/** key = upper-case productCode */ /** key = 大写后的 productCode */
private Map<String, List<BmsProductCountry>> detailsByProductCode; private Map<String, List<BmsProductCountry>> detailsByProductCode;
public Long getPsvId() public Long getPsvId()
@@ -20,9 +20,6 @@ public class ChannelProductMap
private Long productId; private Long productId;
/** 打单套餐 ID,对应 prc_price_set.price_set_id(应收可填) */
private Long priceSetId;
/** 渠道名称(列表回显) */ /** 渠道名称(列表回显) */
private String channelName; private String channelName;
@@ -17,17 +17,17 @@ public class PrcBillingTask extends BaseEntity
private String transferNo; private String transferNo;
private String trackingNo; private String trackingNo;
private String orderNo; private String orderNo;
/** Customer code snapshot for filter / rebill */ /** 客户编码快照,用于筛选 / 重计费 */
private String customerCode; private String customerCode;
/** PENDING / REBILL / REFUND */ /** PENDING / REBILL / REFUND */
private String billType; private String billType;
/** WAITING / SUCCESS / FAILED */ /** WAITING / SUCCESS / FAILED */
private String successStatus; private String successStatus;
/** Billing time from mobile (not Oracle order time; not overwritten on writeback) */ /** 移动端传入的计费时间(非 Oracle 订单时间;回写时不会被覆盖) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date billTime; private Date billTime;
private String billId; private String billId;
/** Stable fail code for search, e.g. NO_CUSTOMER_PACKAGE */ /** 用于查询的稳定失败码,例如 NO_CUSTOMER_PACKAGE */
private String failCode; private String failCode;
private String errorMessage; private String errorMessage;
} }
@@ -8,7 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
/** /**
* Price-set detail batch bind customers. * 价格套餐明细批量绑定客户。
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@@ -23,8 +23,8 @@ public class PrcCustomerPriceSetBatch extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date prEnddate; private Date prEnddate;
private String priceSetNote; private String priceSetNote;
/** Customers to bind (need customerCode; id/name optional). */ /** 要绑定的客户(需要 customerCode;id/name 可选)。 */
private List<PrcCustomerPriceSet> customers; private List<PrcCustomerPriceSet> customers;
/** true = move already-bound customers onto this set; false = skip them. */ /** true = 把已绑定的客户迁移到本套餐;false = 跳过这些客户。 */
private Boolean overwriteExisting; private Boolean overwriteExisting;
} }
@@ -25,7 +25,7 @@ public class PrcOrderBill extends BaseEntity
private String trackingNo; private String trackingNo;
/** 批量查询:多个运单号精确匹配(仅查询用,非表字段) */ /** 批量查询:多个运单号精确匹配(仅查询用,非表字段) */
private List<String> trackingNos; private List<String> trackingNos;
/** transfer order no */ /** 转单号 */
private String transferNo; private String transferNo;
/** 批量查询:多个转单号精确匹配(仅查询用,非表字段) */ /** 批量查询:多个转单号精确匹配(仅查询用,非表字段) */
private List<String> transferNos; private List<String> transferNos;
@@ -50,7 +50,7 @@ public class PrcOrderBill extends BaseEntity
private List<String> customerCodes; private List<String> customerCodes;
private Integer pieces; private Integer pieces;
private BigDecimal actualWeight; private BigDecimal actualWeight;
/** Receive weight from upstream TAB_ORDER.WEIGHT */ /** 收货重量,来自上游 TAB_ORDER.WEIGHT */
private BigDecimal receiveWeight; private BigDecimal receiveWeight;
private BigDecimal volume; private BigDecimal volume;
private BigDecimal volumeWeight; private BigDecimal volumeWeight;
@@ -109,9 +109,9 @@ public class PrcOrderBill extends BaseEntity
private BigDecimal registrationFee; private BigDecimal registrationFee;
private BigDecimal freightAmount; private BigDecimal freightAmount;
private BigDecimal surchargeAmount; private BigDecimal surchargeAmount;
/** receivable total */ /** 应收合计 */
private BigDecimal incomeTotal; private BigDecimal incomeTotal;
/** payable total */ /** 应付合计 */
private BigDecimal payTotal; private BigDecimal payTotal;
private String currency; private String currency;
/** 应收账单状态:UNBILLED未出账/PARTIAL部分出账/BILLED已出账。 */ /** 应收账单状态:UNBILLED未出账/PARTIAL部分出账/BILLED已出账。 */
@@ -122,7 +122,7 @@ public class PrcOrderBill extends BaseEntity
private String creditArrearsStatus; private String creditArrearsStatus;
/** NONE / REFUNDED */ /** NONE / REFUNDED */
private String refundStatus; private String refundStatus;
/** Billing fail: 0 ok writes income bill+fee; non-0 amount=0, no income bill/fee */ /** 计费失败:0 正常,写入应收账单+费用;非 0 金额为 0,不写入应收账单/费用 */
private Integer billingFailStatus; private Integer billingFailStatus;
/** 失败原因 */ /** 失败原因 */
private String errorMessage; private String errorMessage;
@@ -133,6 +133,6 @@ public class PrcOrderBill extends BaseEntity
private List<PrcIncomeBillFee> incomeFees; private List<PrcIncomeBillFee> incomeFees;
private List<PrcPayBillFee> payFees; private List<PrcPayBillFee> payFees;
/** Excel export fields (Java props; export only). */ /** Excel 导出字段(Java 属性名;仅导出用)。 */
private List<String> exportFields; private List<String> exportFields;
} }
@@ -22,7 +22,7 @@ public class PrcOrderBillExportTask implements Serializable
private String error; private String error;
private String exportType; private String exportType;
private String fileName; private String fileName;
/** Relative path under download root, or empty until success. */ /** 下载根目录下的相对路径,成功前为空。 */
private String storageKey; private String storageKey;
private int rowCount; private int rowCount;
@@ -22,7 +22,7 @@ public class PrcPriceExcelFile extends BaseEntity
private Long pefId; private Long pefId;
/** PRODUCT / REDLINE / SALES */ /** PRODUCT / REDLINE / SALES */
private String excelType; private String excelType;
/** FK prc_price_set_version.psv_id */ /** 外键 prc_price_set_version.psv_id */
private Long psvId; private Long psvId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveTime; private Date effectiveTime;
@@ -32,6 +32,6 @@ public class PrcPriceExcelFile extends BaseEntity
private String contentType; private String contentType;
private String fileExtension; private String fileExtension;
private String ossId; private String ossId;
/** Comma-separated sheet names (optional) */ /** 逗号分隔的 Sheet 名称(可选) */
private String sheetNames; private String sheetNames;
} }
@@ -15,9 +15,9 @@ public class PrcPriceSet extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** Ordinary package (default). */ /** 普通套餐(默认)。 */
public static final String CATEGORY_PACKAGE = "PACKAGE"; public static final String CATEGORY_PACKAGE = "PACKAGE";
/** Boss exclusive quote. */ /** 老板专属报价。 */
public static final String CATEGORY_EXCLUSIVE = "EXCLUSIVE"; public static final String CATEGORY_EXCLUSIVE = "EXCLUSIVE";
/** Label / 打单套餐(应收价卡套餐). */ /** Label / 打单套餐(应收价卡套餐). */
public static final String CATEGORY_LABEL = "LABEL"; public static final String CATEGORY_LABEL = "LABEL";
@@ -28,7 +28,7 @@ public class PrcPriceSet extends BaseEntity
private String priceSetNote; private String priceSetNote;
/** FIXED / DISCOUNT */ /** FIXED / DISCOUNT */
private String setType; private String setType;
/** PACKAGE=ordinary set / EXCLUSIVE=boss exclusive quote / LABEL=打单套餐 */ /** PACKAGE=普通套餐 / EXCLUSIVE=老板专属报价 / LABEL=打单套餐 */
private String setCategory; private String setCategory;
private BigDecimal defaultDiscount; private BigDecimal defaultDiscount;
private String defaultType; private String defaultType;
@@ -43,27 +43,27 @@ public class PrcPriceSet extends BaseEntity
private Integer productCount; private Integer productCount;
private Integer customerCount; private Integer customerCount;
/** List display: bound customer code/name summary (not a DB column). */ /** 列表展示:已绑定客户编码/名称摘要(非数据库字段)。 */
private String boundCustomers; private String boundCustomers;
private Boolean expired; private Boolean expired;
private String keyword; private String keyword;
/** Query only: filter packages by bound customer id. */ /** 仅查询用:按绑定客户ID筛选套餐。 */
private Long customerId; private Long customerId;
private String submitFlag; private String submitFlag;
/** current version on create/edit save */ /** 新建/编辑保存时的当前版本 */
private PrcPriceSetVersion version; private PrcPriceSetVersion version;
private List<PrcPriceSetDetail> details; private List<PrcPriceSetDetail> details;
private List<PrcPriceSetVersion> versions; private List<PrcPriceSetVersion> versions;
private List<PrcCustomerPriceSet> customers; private List<PrcCustomerPriceSet> customers;
/** async save task id (not persisted) */ /** 异步保存任务ID(不落库) */
private String saveTaskId; private String saveTaskId;
/** Y: ignored on save; library pull only via /detail/pullFromLibrary */ /** Y:保存时忽略;只能通过 /detail/pullFromLibrary 从库拉取 */
private String pullFromLibrary; private String pullFromLibrary;
/** Y: even if version already has details, delete+re-pull from library */ /** Y:即使版本已有明细,也删除后重新从库拉取 */
private String forcePullLibrary; private String forcePullLibrary;
/** /**
* Request-only: bind this Excel attachment (pef_id) to the saved version.psv_id * 仅请求用:把这个 Excel 附件(pef_id)绑定到保存的版本 psv_id
* (not a column on prc_price_set). * (不是 prc_price_set 的字段)。
*/ */
private Long pefId; private Long pefId;
/** 请求专用:多个 Excel 附件 pef_id,保存时绑到版本(非表字段) */ /** 请求专用:多个 Excel 附件 pef_id,保存时绑到版本(非表字段) */
@@ -30,14 +30,14 @@ public class PrcPriceSetDetail implements Serializable
private String weightLabel; private String weightLabel;
private BigDecimal weightMin; private BigDecimal weightMin;
private BigDecimal weightMax; private BigDecimal weightMax;
/** legacy migrate source id */ /** 历史迁移来源ID */
private Long productCountryId; private Long productCountryId;
private BigDecimal fvValue; private BigDecimal fvValue;
private BigDecimal fvRegistrationFee; private BigDecimal fvRegistrationFee;
private String sizeLimit; private String sizeLimit;
private String lastMile; private String lastMile;
private String leadTime; private String leadTime;
/** display-only base from PRODUCT type when comparing discounts */ /** 比较折扣时仅用于展示的 PRODUCT 类型基价 */
private BigDecimal baseFreightPrice; private BigDecimal baseFreightPrice;
private BigDecimal baseRegistrationFee; private BigDecimal baseRegistrationFee;
private BigDecimal discountValue; private BigDecimal discountValue;
@@ -47,7 +47,7 @@ public class PrcPriceSetDetail implements Serializable
private Date effectiveDate; private Date effectiveDate;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date expireDate; private Date expireDate;
/** 0 not deleted / 1 deleted */ /** 0 未删除 / 1 已删除 */
public static final String IS_DEL_NO = "0"; public static final String IS_DEL_NO = "0";
public static final String IS_DEL_YES = "1"; public static final String IS_DEL_YES = "1";
private String isDel; private String isDel;
@@ -29,12 +29,12 @@ public class PrcPriceSetProduct implements Serializable
private Date effectiveTime; private Date effectiveTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireTime; private Date expireTime;
/** 0 draft / 3 pending / 1 effect / 2 expired */ /** 0 草稿 / 3 待生效 / 1 生效 / 2 已失效 */
private String status; private String status;
/** legacy migrate source id */ /** 历史迁移来源ID */
private Long sourceProductId; private Long sourceProductId;
private String sourceSheet; private String sourceSheet;
/** 0 not deleted / 1 deleted */ /** 0 未删除 / 1 已删除 */
public static final String IS_DEL_NO = "0"; public static final String IS_DEL_NO = "0";
public static final String IS_DEL_YES = "1"; public static final String IS_DEL_YES = "1";
private String isDel; private String isDel;
@@ -23,27 +23,27 @@ public class PrcPriceSetVersion extends BaseEntity
private Integer versionSeq; private Integer versionSeq;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveTime; private Date effectiveTime;
/** null = open; set to next version effective_time when that version starts */ /** null = 未关闭;当下一版本开始时设置为该版本的 effective_time */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireTime; private Date expireTime;
/** 0 draft / 3 pending / 1 active / 2 expired */ /** 0 草稿 / 3 待生效 / 1 生效 / 2 已失效 */
private String status; private String status;
/** /**
* Create-price mode for this version (column: price_build_mode). * 该版本的建价模式(字段:price_build_mode)。
* SALES: PULL = product library; IMPORT = Excel + prior version; IMPORT_FRESH = Excel blank. * SALES:PULL = 产品库;IMPORT = Excel + 上一个版本;IMPORT_FRESH = Excel 空白。
* PRODUCT/REDLINE: IMPORT = copy from effect version; IMPORT_FRESH = rebuild (Excel). * PRODUCT/REDLINE:IMPORT = 从生效版本复制;IMPORT_FRESH = 重建(Excel)。
* Legacy catalog: COPY → IMPORT, old IMPORT → IMPORT_FRESH (see migrate SQL). * 历史目录:COPY → IMPORT,旧的 IMPORT → IMPORT_FRESH(见迁移 SQL)。
*/ */
private String priceBuildMode; private String priceBuildMode;
/** 0 normal / 1 soft-deleted */ /** 0 正常 / 1 软删除 */
private String isDel; private String isDel;
private List<PrcPriceSetDetail> details; private List<PrcPriceSetDetail> details;
private List<PrcPriceSetProduct> products; private List<PrcPriceSetProduct> products;
/** query display: active product rows */ /** 查询展示:生效的产品行数 */
private Integer productCount; private Integer productCount;
/** query display: active detail rows */ /** 查询展示:生效的明细行数 */
private Integer detailCount; private Integer detailCount;
/** query only: pending / expired / effect */ /** 仅查询用:待生效 / 已失效 / 生效 */
private String statusGroup; private String statusGroup;
} }
@@ -17,7 +17,7 @@ public class PrcQuoteFee implements Serializable
/** bms_fee_type: BASIC_FREIGHT / REGISTRATION_FEE / SURCHARGE */ /** bms_fee_type: BASIC_FREIGHT / REGISTRATION_FEE / SURCHARGE */
private String feeType; private String feeType;
private String feeName; private String feeName;
/** prc_surcharge.sc_id, 0 for freight/registration */ /** prc_surcharge.sc_id,运费/挂号费为 0 */
private Long scId; private Long scId;
private BigDecimal amount; private BigDecimal amount;
private String currency; private String currency;
@@ -22,7 +22,7 @@ public class PrcSurcharge extends BaseEntity
private String currency; private String currency;
/** 字典 bms_round_mode:UP / DOWN / HALF_UP */ /** 字典 bms_round_mode:UP / DOWN / HALF_UP */
private String roundMode; private String roundMode;
/** on / of */ /** 开 / 关 */
private String ssCode; private String ssCode;
/** 0未删除 1已删除 */ /** 0未删除 1已删除 */
public static final String IS_DEL_NO = "0"; public static final String IS_DEL_NO = "0";
@@ -28,10 +28,10 @@ public class PrcSurchargeRel extends BaseEntity
private Long relId; private Long relId;
private Long scId; private Long scId;
/** psp_id for PRODUCT/REDLINE/SALES */ /** PRODUCT/REDLINE/SALES 时为 psp_id */
private Long productId; private Long productId;
private String productCode; private String productCode;
/** psd_id for PRODUCT/REDLINE/SALES (null=all) */ /** PRODUCT/REDLINE/SALES 时为 psd_id(null=全部) */
private Long detailId; private Long detailId;
/** PRODUCT / SALES / REDLINE */ /** PRODUCT / SALES / REDLINE */
private String priceType; private String priceType;
@@ -13,7 +13,7 @@ public class PrcWeightSectionTemplate extends BaseEntity
private Long wstId; private Long wstId;
private String wstName; private String wstName;
/** on / off */ /** 开 / 关 */
private String ssCode; private String ssCode;
private String pgCode; private String pgCode;
private Long snId; private Long snId;
@@ -13,7 +13,7 @@ public class PrcZone implements Serializable
private Long zoneId; private Long zoneId;
private Long regionId; private Long regionId;
/** ISO2 country code stored on prc_zone */ /** 存储在 prc_zone 上的 ISO2 国家代码 */
private String countryCode; private String countryCode;
private String zoneCode; private String zoneCode;
private String zoneName; private String zoneName;
@@ -23,8 +23,8 @@ public class PrcZone implements Serializable
private Date createTime; private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** list display, not a table column */ /** 列表展示,非表字段 */
private Integer detailCount; private Integer detailCount;
/** list display from region */ /** 列表展示,来源于 region */
private String countryNameCn; private String countryNameCn;
} }
@@ -13,7 +13,7 @@ public class RedlineCatalogPreviewApplyRequest implements Serializable
private Long psvId; private Long psvId;
private List<BmsRedlineProduct> products; private List<BmsRedlineProduct> products;
/** key = upper-case productCode */ /** key = 大写后的 productCode */
private Map<String, List<BmsRedlineProductCountry>> detailsByProductCode; private Map<String, List<BmsRedlineProductCountry>> detailsByProductCode;
public Long getPsvId() public Long getPsvId()
@@ -15,17 +15,17 @@ public class AddIncomeBillFeeRequest implements Serializable
@NotBlank(message = "billId required") @NotBlank(message = "billId required")
private String billId; private String billId;
/** Surcharge config id (prc_surcharge.sc_id). */ /** 附加费配置ID(prc_surcharge.sc_id)。 */
@NotNull(message = "scId required") @NotNull(message = "scId required")
private Long scId; private Long scId;
/** Dict bms_fee_type; empty = use surcharge.feeType. */ /** 字典 bms_fee_type;为空则使用 surcharge.feeType。 */
private String feeType; private String feeType;
/** Empty = calculate from surcharge chargeType. */ /** 为空则按附加费的 chargeType 计算。 */
private BigDecimal amount; private BigDecimal amount;
/** Default CNY. */ /** 默认 CNY。 */
private String currency; private String currency;
private String remark; private String remark;
@@ -11,7 +11,7 @@ public class BatchAddIncomeBillFeePreview implements Serializable
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int matchCount; private int matchCount;
/** First N rows for UI preview. */ /** 供界面预览的前 N 行。 */
private List<PrcOrderBill> samples = new ArrayList<PrcOrderBill>(); private List<PrcOrderBill> samples = new ArrayList<PrcOrderBill>();
public int getMatchCount() public int getMatchCount()
@@ -15,13 +15,13 @@ public class BatchAddIncomeBillFeeRequest implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ALL = list filters; SELECTED = billIds only. */ /** ALL = 列表筛选条件;SELECTED = 仅 billIds。 */
private String scopeMode; private String scopeMode;
/** Selected bill ids when scopeMode=SELECTED. */ /** scopeMode=SELECTED 时选中的账单ID。 */
private List<String> billIds; private List<String> billIds;
/** Same filters as billing list search. */ /** 与计费列表搜索相同的筛选条件。 */
private List<String> orderNos; private List<String> orderNos;
private List<String> trackingNos; private List<String> trackingNos;
private List<String> transferNos; private List<String> transferNos;
@@ -31,33 +31,33 @@ public class BatchAddIncomeBillFeeRequest implements Serializable
private List<String> productCodes; private List<String> productCodes;
private String countryCode; private String countryCode;
private String creditArrearsStatus; private String creditArrearsStatus;
/** Same as list filter order_status IN (...). */ /** 与列表筛选 order_status IN (...) 相同。 */
private List<Integer> orderStatuses; private List<Integer> orderStatuses;
/** Same as list filter billing_fail_status IN (...). */ /** 与列表筛选 billing_fail_status IN (...) 相同。 */
private List<Integer> billingFailStatuses; private List<Integer> billingFailStatuses;
/** Billing time range (biz_date), inclusive; format yyyy-MM-dd. */ /** 计费时间范围(biz_date),含边界;格式 yyyy-MM-dd。 */
private String beginBizDate; private String beginBizDate;
private String endBizDate; private String endBizDate;
/** Receive/pickup time range (pickup_date), inclusive. */ /** 收货/提货时间范围(pickup_date),含边界。 */
private String beginPickupDate; private String beginPickupDate;
private String endPickupDate; private String endPickupDate;
/** Surcharge config id (prc_surcharge.sc_id). */ /** 附加费配置ID(prc_surcharge.sc_id)。 */
@NotNull(message = "scId required") @NotNull(message = "scId required")
private Long scId; private Long scId;
/** Dict bms_fee_type; empty = use surcharge.feeType. */ /** 字典 bms_fee_type;为空则使用 surcharge.feeType。 */
private String feeType; private String feeType;
/** /**
* Fixed amount for every matched bill. * 每个匹配账单的固定金额。
* Empty = calculate per bill from surcharge chargeType / weight / freight. * 为空则按附加费的 chargeType / 重量 / 运费逐票计算。
*/ */
private BigDecimal amount; private BigDecimal amount;
/** Default CNY. */ /** 默认 CNY。 */
private String currency; private String currency;
private String remark; private String remark;
@@ -12,14 +12,14 @@ public class BillingTaskRetryByFilterRequest implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** Customer code (exact match) */ /** 客户编码(精确匹配) */
private String customerCode; private String customerCode;
/** Bill time start yyyy-MM-dd */ /** 计费时间起 yyyy-MM-dd */
private String beginTime; private String beginTime;
/** Bill time end yyyy-MM-dd */ /** 计费时间止 yyyy-MM-dd */
private String endTime; private String endTime;
/** Optional: FAILED / WAITING / SUCCESS / ALL; default ALL */ /** 可选:FAILED / WAITING / SUCCESS / ALL;默认 ALL */
private String successStatus; private String successStatus;
/** Optional batch size; server clamps to 20~200, default 50 */ /** 可选批大小;服务端限制在 20~200,默认 50 */
private Integer batchSize; private Integer batchSize;
} }
@@ -18,13 +18,13 @@ public class BillingTaskSubmitRequest implements Serializable
private String transferNo; private String transferNo;
private String trackingNo; private String trackingNo;
private String orderNo; private String orderNo;
/** Optional customer code; also filled from Oracle when task runs */ /** 可选客户编码;任务执行时也会从 Oracle 补全 */
private String customerCode; private String customerCode;
/** Billing time from mobile; persisted to prc_billing_task.bill_time */ /** 移动端传入的计费时间;写入 prc_billing_task.bill_time */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date billTime; private Date billTime;
/** Optional: PENDING / REBILL / REFUND. Empty = auto PENDING or REBILL. */ /** 可选:PENDING / REBILL / REFUND。为空则自动取 PENDING 或 REBILL。 */
private String billType; private String billType;
/** Optional body apiCode when header X-Api-Code missing */ /** 可选请求体 apiCode,请求头缺少 X-Api-Code 时使用 */
private String apiCode; private String apiCode;
} }
@@ -10,7 +10,7 @@ public class ChargeWeightTemplateRequest implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** true = fill orderNo/customer from current list filters */ /** true = 按当前列表筛选条件填充 orderNo/customer */
private boolean fillByFilter; private boolean fillByFilter;
private List<String> orderNos; private List<String> orderNos;
@@ -21,11 +21,11 @@ public class ChargeWeightTemplateRequest implements Serializable
private List<String> customerCodes; private List<String> customerCodes;
private List<String> productCodes; private List<String> productCodes;
private String creditArrearsStatus; private String creditArrearsStatus;
/** Same as list filter order_status IN (...). */ /** 与列表筛选 order_status IN (...) 相同。 */
private List<Integer> orderStatuses; private List<Integer> orderStatuses;
private String beginBizDate; private String beginBizDate;
private String endBizDate; private String endBizDate;
/** Receive/pickup time range (pickup_date), inclusive. */ /** 收货/提货时间范围(pickup_date),含边界。 */
private String beginPickupDate; private String beginPickupDate;
private String endPickupDate; private String endPickupDate;
} }
@@ -0,0 +1,67 @@
package com.bms.price.domain.vo;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
* 订单列表计费失败原因弹窗数据。
*/
@Data
public class OrderBillFailReasonVo implements Serializable
{
private static final long serialVersionUID = 1L;
private String billId;
private String orderNo;
private String transferNo;
private String trackingNo;
private String customerCode;
private String customerName;
private String productCode;
private String productName;
private String countryCode;
private String countryName;
private String zoneCode;
private String zoneName;
private String destPostcode;
private Long priceSetId;
private String priceSetCode;
private String priceSetName;
private String setType;
private Long psvId;
private String versionNo;
/** 价卡周期的版本生效时间。 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date effectiveTime;
/** 价卡周期的版本失效时间;null = 未关闭。 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date expireTime;
private Long psdId;
private BigDecimal weight;
private BigDecimal chargeWeight;
private BigDecimal weightMin;
private BigDecimal weightMax;
private String weightLabel;
private BigDecimal freightRate;
private BigDecimal freightAmount;
private BigDecimal incomeTotal;
private String currency;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bizDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pickupDate;
private Integer billingFailStatus;
private String billingFailStatusLabel;
/** 原始落库的失败文本。 */
private String errorMessage;
/** 模板化后的可读失败原因。 */
private String failReasonDetail;
}
@@ -13,7 +13,7 @@ public class RecalcBillPriceRequest implements Serializable
/** PRODUCT | REDLINE */ /** PRODUCT | REDLINE */
private String mode; private String mode;
/** ALL = filters; SELECTED = billIds. */ /** ALL = 筛选条件;SELECTED = billIds。 */
private String scopeMode; private String scopeMode;
private List<String> billIds; private List<String> billIds;
private List<String> orderNos; private List<String> orderNos;
@@ -25,13 +25,13 @@ public class RecalcBillPriceRequest implements Serializable
private List<String> productCodes; private List<String> productCodes;
private String countryCode; private String countryCode;
private String creditArrearsStatus; private String creditArrearsStatus;
/** Same as list filter order_status IN (...). */ /** 与列表筛选 order_status IN (...) 相同。 */
private List<Integer> orderStatuses; private List<Integer> orderStatuses;
/** Same as list filter billing_fail_status IN (...). */ /** 与列表筛选 billing_fail_status IN (...) 相同。 */
private List<Integer> billingFailStatuses; private List<Integer> billingFailStatuses;
private String beginBizDate; private String beginBizDate;
private String endBizDate; private String endBizDate;
/** Receive/pickup time range (pickup_date), inclusive. */ /** 收货/提货时间范围(pickup_date),含边界。 */
private String beginPickupDate; private String beginPickupDate;
private String endPickupDate; private String endPickupDate;
} }
@@ -39,7 +39,7 @@ public class TabOrderCompareTask implements Serializable
* 每项:transferNo / upstreamStatus / localStatus * 每项:transferNo / upstreamStatus / localStatus
*/ */
private List<Map<String, Object>> statusMismatchSamples = new ArrayList<Map<String, Object>>(); private List<Map<String, Object>> statusMismatchSamples = new ArrayList<Map<String, Object>>();
/** status-mismatch transfer_no sample (flat, for UI fill) */ /** 状态不一致的 transfer_no 样本(扁平结构,便于界面回填) */
private List<String> statusMismatchTransferNos = new ArrayList<String>(); private List<String> statusMismatchTransferNos = new ArrayList<String>();
public String getTaskId() { return taskId; } public String getTaskId() { return taskId; }
@@ -18,7 +18,7 @@ public class TabOrderExportTask implements Serializable
private String message; private String message;
private String error; private String error;
private String fileName; private String fileName;
/** Relative path under download root. */ /** 下载根目录下的相对路径。 */
private String storageKey; private String storageKey;
private int rowCount; private int rowCount;
@@ -50,6 +50,6 @@ public class TabOrderMonitorQuery implements Serializable
private Integer blPickup; private Integer blPickup;
/** 分批同步计费每批条数 */ /** 分批同步计费每批条数 */
private Integer batchSize; private Integer batchSize;
/** Excel export field names (Java props; export only). */ /** Excel 导出字段名(Java 属性名;仅导出用)。 */
private List<String> exportFields; private List<String> exportFields;
} }
@@ -21,7 +21,7 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
private String orderNo; private String orderNo;
private String trackingNo; private String trackingNo;
/** transfer order no */ /** 转单号 */
private String transferNo; private String transferNo;
/** 所属销售员 */ /** 所属销售员 */
private String belongSaler; private String belongSaler;
@@ -36,11 +36,11 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
/** 客服员编码 */ /** 客服员编码 */
private String serviceManCode; private String serviceManCode;
private String customerName; private String customerName;
/** From upstream LINE_NAME (fallback PRODUCT_NAME). */ /** 来自上游 LINE_NAME(无则取 PRODUCT_NAME)。 */
private String productName; private String productName;
private Integer pieces; private Integer pieces;
private BigDecimal actualWeight; private BigDecimal actualWeight;
/** Upstream TAB_ORDER.WEIGHT (receive weight) */ /** 上游 TAB_ORDER.WEIGHT(收货重量) */
private BigDecimal receiveWeight; private BigDecimal receiveWeight;
private BigDecimal volume; private BigDecimal volume;
private BigDecimal volumeWeight; private BigDecimal volumeWeight;
@@ -52,11 +52,11 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
private String warehouseCode; private String warehouseCode;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime; private Date orderTime;
/** Upstream TAB_ORDER.ORDER_STATUS */ /** 上游 TAB_ORDER.ORDER_STATUS */
private Integer orderStatus; private Integer orderStatus;
/** Upstream TAB_ORDER.BL_PICKUP 0/1 */ /** 上游 TAB_ORDER.BL_PICKUP 0/1 */
private Integer blPickup; private Integer blPickup;
/** Upstream TAB_ORDER.PICKUP_DATE */ /** 上游 TAB_ORDER.PICKUP_DATE */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pickupDate; private Date pickupDate;
private String orderRemark; private String orderRemark;
@@ -13,7 +13,7 @@ public class TmsPriceQuoteFeeLine implements Serializable
private String feeId; private String feeId;
private String feeType; private String feeType;
private String feeName; private String feeName;
/** surcharge config id, 0 for freight/registration */ /** 附加费配置ID,运费/挂号费为 0 */
private Long scId; private Long scId;
private BigDecimal amount; private BigDecimal amount;
/** 产品价(目录价分摊) */ /** 产品价(目录价分摊) */
@@ -25,6 +25,6 @@ public class TmsPriceQuoteFeeLine implements Serializable
private String remark; private String remark;
/** UNBILLED / BILLED */ /** UNBILLED / BILLED */
private String arBillStatus; private String arBillStatus;
/** 0=system 1=manual */ /** 0=系统 1=人工 */
private String manualFlag; private String manualFlag;
} }
@@ -14,7 +14,7 @@ public class TmsPriceQuoteRequest implements Serializable
private Long customerId; private Long customerId;
/** Required. Maps to ctr_customer.customer_code; used in quote unique key. */ /** 必填。对应 ctr_customer.customer_code;参与报价唯一键。 */
@NotBlank(message = "customerCode is required") @NotBlank(message = "customerCode is required")
private String customerCode; private String customerCode;
@@ -26,20 +26,20 @@ public class TmsPriceQuoteRequest implements Serializable
*/ */
private String channelId; private String channelId;
/** ISO2; countryName alternative */ /** ISO2;作为 countryName 的替代 */
private String countryCode; private String countryCode;
/** country display name; countryCode alternative */ /** 国家显示名称;作为 countryCode 的替代 */
private String countryName; private String countryName;
/** Dest postcode; required when product-country has zones */ /** 目的邮编;产品国家配置了分区时必填 */
private String destPostcode; private String destPostcode;
@NotNull(message = "weight is required") @NotNull(message = "weight is required")
private BigDecimal weight; private BigDecimal weight;
/** yyyy-MM-dd or yyyy-MM-dd HH:mm:ss; quote defaults today; bill required */ /** yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss;试算默认当天;计费必填 */
private String bizDate; private String bizDate;
private Integer tmsId; private Integer tmsId;
/** Header X-Api-Code first; body as fallback */ /** 优先取请求头 X-Api-Code;否则取请求体 */
private String apiCode; private String apiCode;
} }
@@ -25,11 +25,11 @@ public class TmsPriceQuoteResult implements Serializable
private String setType; private String setType;
private Integer bindPriority; private Integer bindPriority;
private Long customerPricesetId; private Long customerPricesetId;
/** Hit package version id (prc_price_set_version.psv_id) */ /** 命中的套餐版本ID(prc_price_set_version.psv_id) */
private Long psvId; private Long psvId;
/** Hit package version no (e.g. V1) */ /** 命中的套餐版本号(例如 V1) */
private String versionNo; private String versionNo;
/** Hit package detail id when package version detail matched */ /** 套餐版本明细命中时,命中的套餐明细ID */
private Long psdId; private Long psdId;
private String productCode; private String productCode;
@@ -56,19 +56,19 @@ public class TmsPriceQuoteResult implements Serializable
private BigDecimal freightAmount; private BigDecimal freightAmount;
/** 附加费合计(按产品关联命中后汇总) */ /** 附加费合计(按产品关联命中后汇总) */
private BigDecimal surchargeAmount; private BigDecimal surchargeAmount;
/** product catalog total: base freight*weight + base registration (no package surcharge) */ /** 产品价合计:基础运费*重量 + 基础挂号费(不含套餐附加费) */
private BigDecimal productAmount; private BigDecimal productAmount;
/** redline total from redline_product_country (+ REDLINE surcharges) */ /** 红线价合计,来自 redline_product_country(含 REDLINE 附加费) */
private BigDecimal redlineAmount; private BigDecimal redlineAmount;
/** matched redline_product_country.detail_id for REDLINE surcharge scope */ /** 命中的 redline_product_country.detail_id,用于 REDLINE 附加费范围 */
private Long redlineCountryId; private Long redlineCountryId;
/** cost total (currently = product catalog amount) */ /** 成本合计(当前 = 产品价合计) */
private BigDecimal costAmount; private BigDecimal costAmount;
/** receivable total (order bill) */ /** 应收合计(订单账单) */
private BigDecimal incomeTotal; private BigDecimal incomeTotal;
/** payable total (order bill); also quote payable */ /** 应付合计(订单账单);也是报价应付 */
private BigDecimal payTotal; private BigDecimal payTotal;
/** quote / legacy field; same as incomeTotal for bill sync */ /** 报价 / 历史字段;账单同步时与 incomeTotal 相同 */
private BigDecimal payableTotal; private BigDecimal payableTotal;
private String currency = "CNY"; private String currency = "CNY";
/** UP / DOWN / HALF_UP */ /** UP / DOWN / HALF_UP */
@@ -81,7 +81,7 @@ public class TmsPriceQuoteResult implements Serializable
private String billId; private String billId;
private String orderNo; private String orderNo;
private String trackingNo; private String trackingNo;
/** transfer order no */ /** 转单号 */
private String transferNo; private String transferNo;
/** 所属销售员 */ /** 所属销售员 */
private String belongSaler; private String belongSaler;
@@ -103,11 +103,11 @@ public class TmsPriceQuoteResult implements Serializable
private String creditArrearsStatus; private String creditArrearsStatus;
/** NONE / REFUNDED */ /** NONE / REFUNDED */
private String refundStatus; private String refundStatus;
/** Billing fail: 0 ok (income bill+fee); 1/2/3 sales; 23/24/25 catalog */ /** 计费失败:0 正常(写入应收账单+费用);1/2/3 销售价;23/24/25 产品价 */
private Integer billingFailStatus; private Integer billingFailStatus;
private Integer pieces; private Integer pieces;
private BigDecimal actualWeight; private BigDecimal actualWeight;
/** Receive weight from upstream TAB_ORDER.WEIGHT */ /** 收货重量,来自上游 TAB_ORDER.WEIGHT */
private BigDecimal receiveWeight; private BigDecimal receiveWeight;
private BigDecimal volume; private BigDecimal volume;
private BigDecimal volumeWeight; private BigDecimal volumeWeight;
@@ -120,10 +120,10 @@ public class TmsPriceQuoteResult implements Serializable
private String warehouseCode; private String warehouseCode;
private Date orderTime; private Date orderTime;
private String orderRemark; private String orderRemark;
/** true=hit stored quote */ /** true=命中已存报价 */
private Boolean fromCache; private Boolean fromCache;
/** 计费请求 JSON(当次响应/日志用,不落库) */ /** 计费请求 JSON(当次响应/日志用,不落库) */
private String requestJson; private String requestJson;
/** original billing response JSON from Elasticsearch */ /** 来自 Elasticsearch 的原始计费响应 JSON */
private String responseJson; private String responseJson;
} }
@@ -14,10 +14,10 @@ public class UpdateIncomeBillFeeRequest implements Serializable
@NotBlank(message = "feeId required") @NotBlank(message = "feeId required")
private String feeId; private String feeId;
/** Optional: change surcharge config. */ /** 可选:更换附加费配置。 */
private Long scId; private Long scId;
/** Dict bms_fee_type. */ /** 字典 bms_fee_type。 */
private String feeType; private String feeType;
private BigDecimal amount; private BigDecimal amount;
@@ -1,13 +1,13 @@
package com.bms.price.enums; package com.bms.price.enums;
/** /**
* prc_order_bill.billing_fail_status numeric codes. * prc_order_bill.billing_fail_status 数字编码。
* 0 success; * 0 成功;
* 1/2/3 sales-price (package) miss: product / country / weight; * 1/2/3 销售价(套餐)未命中:产品 / 国家 / 重量段;
* 23/24/25 product-catalog price miss: product / country / weight; * 23/24/25 产品价(目录)未命中:产品 / 国家 / 重量段;
* 4+ map to prc_billing_task.fail_code. * 4 及以上对应 prc_billing_task.fail_code。
* 26 not billed yet (order-source sync only). * 26 尚未计费(仅订单数源同步使用)。
* Income bill + fee rows: only status 0. * 应收账单 + 费用行:仅状态 0 才写入。
*/ */
public enum BillBillingFailStatus public enum BillBillingFailStatus
{ {
@@ -34,13 +34,13 @@ public enum BillBillingFailStatus
CUSTOMER_DISABLED(20), CUSTOMER_DISABLED(20),
FREIGHT_MISSING(21), FREIGHT_MISSING(21),
UNKNOWN(22), UNKNOWN(22),
/** Product catalog (产品价) miss: no product rows. */ /** 产品价(目录)未命中:没有产品行。 */
CATALOG_PRODUCT(23), CATALOG_PRODUCT(23),
/** Product catalog miss: product hit but country/zone miss. */ /** 产品价未命中:产品命中但国家/分区未命中。 */
CATALOG_COUNTRY(24), CATALOG_COUNTRY(24),
/** Product catalog miss: product+country hit but weight band miss. */ /** 产品价未命中:产品+国家命中但重量段未命中。 */
CATALOG_WEIGHT(25), CATALOG_WEIGHT(25),
/** Order landed from upstream but not billed yet. */ /** 订单已从上游落地但尚未计费。 */
NOT_BILLED(26); NOT_BILLED(26);
private final int code; private final int code;
@@ -86,7 +86,7 @@ public enum BillBillingFailStatus
return code != null && code.intValue() == NOT_BILLED.code; return code != null && code.intValue() == NOT_BILLED.code;
} }
/** Only success (0) persists prc_income_bill. */ /** 仅成功(0)才写入 prc_income_bill。 */
public static boolean storesIncomeBill(Integer code) public static boolean storesIncomeBill(Integer code)
{ {
return code == null || code.intValue() == SUCCESS.code; return code == null || code.intValue() == SUCCESS.code;
@@ -7,9 +7,9 @@ package com.bms.price.enums;
*/ */
public enum BillOrderStatus public enum BillOrderStatus
{ {
/** Upstream: returned package; also set after billing-list fee refund. */ /** 上游:包裹退回;账单列表费用退款后也会置为此状态。 */
REFUNDED(9), REFUNDED(9),
/** Upstream: cancelled / deleted. */ /** 上游:已取消 / 已删除。 */
CANCELLED(10); CANCELLED(10);
private final int code; private final int code;
@@ -34,7 +34,7 @@ public enum BillOrderStatus
return status != null && status.intValue() == code; return status != null && status.intValue() == code;
} }
/** Upstream ORDER_STATUS 9/10 -> fee refund path. */ /** 上游 ORDER_STATUS 9/10 -> 走费用退款流程。 */
public static boolean requiresFeeRefund(Integer status) public static boolean requiresFeeRefund(Integer status)
{ {
return REFUNDED.matches(status) || CANCELLED.matches(status); return REFUNDED.matches(status) || CANCELLED.matches(status);
@@ -12,17 +12,17 @@ public enum BillTaskFailCode
NO_ACTIVE_PACKAGE_VERSION("NO_ACTIVE_PACKAGE_VERSION"), NO_ACTIVE_PACKAGE_VERSION("NO_ACTIVE_PACKAGE_VERSION"),
ALREADY_IN_AR_BILL("ALREADY_IN_AR_BILL"), ALREADY_IN_AR_BILL("ALREADY_IN_AR_BILL"),
PRODUCT_ARCHIVE_MISSING("PRODUCT_ARCHIVE_MISSING"), PRODUCT_ARCHIVE_MISSING("PRODUCT_ARCHIVE_MISSING"),
/** Soft-fail: sales price (package) product miss. */ /** 软失败:销售价(套餐)产品未命中。 */
PRODUCT_NOT_HIT("PRODUCT_NOT_HIT"), PRODUCT_NOT_HIT("PRODUCT_NOT_HIT"),
/** Soft-fail: sales price country/zone miss. */ /** 软失败:销售价国家/分区未命中。 */
COUNTRY_NOT_HIT("COUNTRY_NOT_HIT"), COUNTRY_NOT_HIT("COUNTRY_NOT_HIT"),
/** Soft-fail: sales price weight band miss. */ /** 软失败:销售价重量段未命中。 */
WEIGHT_NOT_HIT("WEIGHT_NOT_HIT"), WEIGHT_NOT_HIT("WEIGHT_NOT_HIT"),
/** Soft-fail: product catalog (产品价) product miss. */ /** 软失败:产品价(目录)产品未命中。 */
CATALOG_PRODUCT_NOT_HIT("CATALOG_PRODUCT_NOT_HIT"), CATALOG_PRODUCT_NOT_HIT("CATALOG_PRODUCT_NOT_HIT"),
/** Soft-fail: product catalog country/zone miss. */ /** 软失败:产品价国家/分区未命中。 */
CATALOG_COUNTRY_NOT_HIT("CATALOG_COUNTRY_NOT_HIT"), CATALOG_COUNTRY_NOT_HIT("CATALOG_COUNTRY_NOT_HIT"),
/** Soft-fail: product catalog weight band miss. */ /** 软失败:产品价重量段未命中。 */
CATALOG_WEIGHT_NOT_HIT("CATALOG_WEIGHT_NOT_HIT"), CATALOG_WEIGHT_NOT_HIT("CATALOG_WEIGHT_NOT_HIT"),
PRICE_NOT_HIT("PRICE_NOT_HIT"), PRICE_NOT_HIT("PRICE_NOT_HIT"),
ZONE_PRICE_NOT_HIT("ZONE_PRICE_NOT_HIT"), ZONE_PRICE_NOT_HIT("ZONE_PRICE_NOT_HIT"),
@@ -53,7 +53,7 @@ public enum BillTaskFailCode
} }
/** /**
* Map free-text error message to a stable fail code for search. * 把自由文本错误信息映射为可用于查询的稳定失败码。
*/ */
public static String resolveCode(String errorMessage) public static String resolveCode(String errorMessage)
{ {
@@ -78,7 +78,7 @@ public enum BillTaskFailCode
{ {
return PRODUCT_ARCHIVE_MISSING.code; return PRODUCT_ARCHIVE_MISSING.code;
} }
// Soft-fail: product catalog before sales (more specific Chinese prefix) // 软失败:产品价先于销售价判断(中文前缀更具体)
if (containsAny(msg, "产品价未匹配重量段", "CATALOG_WEIGHT_NOT_HIT", "billingFail.catalogWeight")) if (containsAny(msg, "产品价未匹配重量段", "CATALOG_WEIGHT_NOT_HIT", "billingFail.catalogWeight"))
{ {
return CATALOG_WEIGHT_NOT_HIT.code; return CATALOG_WEIGHT_NOT_HIT.code;
@@ -91,7 +91,7 @@ public enum BillTaskFailCode
{ {
return CATALOG_PRODUCT_NOT_HIT.code; return CATALOG_PRODUCT_NOT_HIT.code;
} }
// Soft-fail sales price (order matters: weight/country before generic product) // 软失败:销售价(顺序重要:重量段/国家先于笼统的产品)
if (containsAny(msg, "销售价未匹配重量段", "未匹配重量段", "WEIGHT_NOT_HIT", "billingFail.weight")) if (containsAny(msg, "销售价未匹配重量段", "未匹配重量段", "WEIGHT_NOT_HIT", "billingFail.weight"))
{ {
return WEIGHT_NOT_HIT.code; return WEIGHT_NOT_HIT.code;
@@ -3,11 +3,11 @@ package com.bms.price.enums;
/** 计费任务类型,对应 prc_billing_task.bill_type */ /** 计费任务类型,对应 prc_billing_task.bill_type */
public enum BillTaskType public enum BillTaskType
{ {
/** first-time billing */ /** 首次计费 */
PENDING("PENDING"), PENDING("PENDING"),
/** same transfer/order already billed */ /** 同一转单/订单已计费过 */
REBILL("REBILL"), REBILL("REBILL"),
/** refund */ /** 退款 */
REFUND("REFUND"); REFUND("REFUND");
private final String code; private final String code;
@@ -22,36 +22,36 @@ public interface BmsProductCountryMapper
/** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */ /** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */
public int updateBmsProductCountry(BmsProductCountry country); public int updateBmsProductCountry(BmsProductCountry country);
/** Import overlay: update price/zone/attrs on matched country row */ /** 导入覆盖:更新命中国家行的价格/分区/属性 */
public int updateBmsProductCountryImport(BmsProductCountry country); public int updateBmsProductCountryImport(BmsProductCountry country);
/** Soft delete by product_id */ /** 按 product_id 逻辑删除 */
public int deleteByProductId(Long productId); public int deleteByProductId(Long productId);
/** Soft delete by product_code */ /** 按 product_code 逻辑删除 */
public int deleteByProductCode(String productCode); public int deleteByProductCode(String productCode);
/** Soft delete by product_code + effective_date */ /** 按 product_code + effective_date 逻辑删除 */
public int deleteByProductCodeAndEffectiveDate( public int deleteByProductCodeAndEffectiveDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Max open (expire_date is null) effective_date for product */ /** 该产品最大的未结束(expire_date 为空)生效日期 */
public Date selectMaxOpenEffectiveDate(@Param("productCode") String productCode); public Date selectMaxOpenEffectiveDate(@Param("productCode") String productCode);
/** Close open versions: set expire_date = newEffectiveDate where effective_date &lt; newEffectiveDate */ /** 结束未关闭版本:把 effective_date &lt; newEffectiveDate 的行 expire_date 置为 newEffectiveDate */
public int expireOpenByProductCode( public int expireOpenByProductCode(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("newEffectiveDate") Date newEffectiveDate); @Param("newEffectiveDate") Date newEffectiveDate);
/** After deleting a pending version: reopen country rows closed at that effective date */ /** 删除待生效版本后:恢复在该生效日期被关闭的国家行 */
public int reopenExpiredByProductCodeAndExpireDate( public int reopenExpiredByProductCodeAndExpireDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("expireDate") Date expireDate); @Param("expireDate") Date expireDate);
/** /**
* Close open rows for one product + country where effective_date &lt; newEffectiveDate. * 关闭某产品 + 国家下 effective_date &lt; newEffectiveDate 的未关闭行。
* Match by country_code when present, otherwise country_name. * 有 country_code 时按它匹配,否则按 country_name 匹配。
*/ */
public int expireOpenByProductCodeAndCountry( public int expireOpenByProductCodeAndCountry(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -59,26 +59,26 @@ public interface BmsProductCountryMapper
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("newEffectiveDate") Date newEffectiveDate); @Param("newEffectiveDate") Date newEffectiveDate);
/** Recompute status from effective_date / expire_date vs today */ /** 按 effective_date / expire_date 与今天重新计算状态 */
public int refreshStatusByDates(); public int refreshStatusByDates();
/** Replace same-day version only */ /** 仅替换同一生效日期的版本 */
public int deleteOpenByProductCodeAndEffectiveDate( public int deleteOpenByProductCodeAndEffectiveDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Hard-delete all detail rows of one product (psp_id). */ /** 物理删除某产品的全部明细行(psp_id)。 */
public int physicalDeleteByPspId(@Param("productId") Long productId); public int physicalDeleteByPspId(@Param("productId") Long productId);
/** Hard-delete detail rows of one product + country (psp_id scope). */ /** 物理删除某产品 + 国家的明细行(psp_id 范围)。 */
public int physicalDeleteByPspIdAndCountry( public int physicalDeleteByPspIdAndCountry(
@Param("productId") Long productId, @Param("productId") Long productId,
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@Param("countryName") String countryName); @Param("countryName") String countryName);
/** /**
* Hard-delete draft/pending detail rows for one product + country (same-version replace). * 物理删除某产品 + 国家的草稿/待生效明细行(同版本替换)。
* Only versions with status draft(0) or pending(3) are affected. * 只影响状态为草稿(0)或待生效(3)的版本。
*/ */
public int deleteOpenByProductCodeAndCountryOnDate( public int deleteOpenByProductCodeAndCountryOnDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -86,17 +86,17 @@ public interface BmsProductCountryMapper
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Hard-delete surcharge_rel rows linked to draft/pending details for product+country. */ /** 物理删除产品+国家草稿/待生效明细关联的 surcharge_rel 行。 */
public int deleteSurchargeRelByProductCodeAndCountryOnDate( public int deleteSurchargeRelByProductCodeAndCountryOnDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Open country rows (expire_date is null) for product */ /** 该产品未结束(expire_date 为空)的国家行 */
public List<BmsProductCountry> selectOpenByProductCode(@Param("productCode") String productCode); public List<BmsProductCountry> selectOpenByProductCode(@Param("productCode") String productCode);
/** Copy previously open rows into a new effective_date (caller must expire first) */ /** 把之前未结束的行复制到新的生效日期(调用方需先结束旧版本) */
public int copyOpenCountries( public int copyOpenCountries(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("productId") Long productId, @Param("productId") Long productId,
@@ -104,9 +104,9 @@ public interface BmsProductCountryMapper
@Param("status") String status); @Param("status") String status);
/** /**
* Match by product + country + weight + bizDate (+ optional zoneCode). * 按产品 + 国家 + 重量 + 业务日期(+ 可选 zoneCode)匹配。
* When zoneCode is empty, prefer rows without zone. * zoneCode 为空时优先取无分区的行。
* When zoneCode is set, require matching zone_code. * zoneCode 有值时要求 zone_code 一致。
*/ */
public BmsProductCountry selectMatchByProductCountryWeight( public BmsProductCountry selectMatchByProductCountryWeight(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -117,8 +117,8 @@ public interface BmsProductCountryMapper
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
/** /**
* Lowest PRODUCT catalog weight band for product/country/zone (ignore weight). * 产品/国家/分区下最低的 PRODUCT 目录重量段(忽略重量)。
* Used when charge weight is below the minimum band. * 用于计费重量低于最小重量段时。
*/ */
public BmsProductCountry selectMinBandByProductCountry( public BmsProductCountry selectMinBandByProductCountry(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -127,21 +127,21 @@ public interface BmsProductCountryMapper
@Param("zoneCode") String zoneCode, @Param("zoneCode") String zoneCode,
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
/** Count product-country rows that have a zone for this product+country+bizDate */ /** 统计该产品+国家+业务日期下带分区的产品国家行数 */
public int countZonedByProductCountry( public int countZonedByProductCountry(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
/** Count catalog rows by product (+ bizDate window), ignore country/zone/weight. */ /** 按产品(+ 业务日期区间)统计目录行数,忽略国家/分区/重量。 */
public int countByProduct( public int countByProduct(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
/** /**
* Count catalog rows by product + country + zone (+ bizDate), ignore weight. * 按产品 + 国家 + 分区(+ 业务日期)统计目录行数,忽略重量。
* Used to diagnose country miss vs weight miss. * 用于区分是国家未命中还是重量未命中。
*/ */
public int countByProductCountryZone( public int countByProductCountryZone(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -14,43 +14,43 @@ public interface BmsProductMapper
{ {
public BmsProduct selectBmsProductById(Long productId); public BmsProduct selectBmsProductById(Long productId);
/** Latest row by product_code (effective_date desc) */ /** 按 product_code 取最新行(effective_date 倒序) */
public BmsProduct selectBmsProductByCode(String productCode); public BmsProduct selectBmsProductByCode(String productCode);
/** Unique business key: product_code + effective_date */ /** 唯一业务键:product_code + effective_date */
public BmsProduct selectBmsProductByCodeAndDate(@Param("productCode") String productCode, public BmsProduct selectBmsProductByCodeAndDate(@Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Product row in a specific version */ /** 指定版本中的产品行 */
public BmsProduct selectByCodeAndPsvId(@Param("productCode") String productCode, @Param("psvId") Long psvId); public BmsProduct selectByCodeAndPsvId(@Param("productCode") String productCode, @Param("psvId") Long psvId);
/** Product version effective on bizDate */ /** 业务日期生效的产品版本 */
public BmsProduct selectEffectiveBmsProductByCode(@Param("productCode") String productCode, public BmsProduct selectEffectiveBmsProductByCode(@Param("productCode") String productCode,
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
public List<BmsProduct> selectBmsProductList(BmsProduct product); public List<BmsProduct> selectBmsProductList(BmsProduct product);
/** Dropdown options: slim columns, no country/surcharge count subqueries */ /** 下拉选项:仅精简列,不含国家/附加费计数子查询 */
public List<BmsProduct> selectBmsProductOptions(BmsProduct product); public List<BmsProduct> selectBmsProductOptions(BmsProduct product);
public int insertBmsProduct(BmsProduct product); public int insertBmsProduct(BmsProduct product);
public int updateBmsProduct(BmsProduct product); public int updateBmsProduct(BmsProduct product);
/** Soft delete: set del_flag = 2 */ /** 逻辑删除:del_flag 置为 2 */
public int deleteBmsProductByIds(Long[] productIds); public int deleteBmsProductByIds(Long[] productIds);
/** Close previous open versions: expire_date = newEffectiveDate */ /** 结束之前的未关闭版本:expire_date 置为 newEffectiveDate */
public int expireOpenByProductCode( public int expireOpenByProductCode(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("newEffectiveDate") Date newEffectiveDate, @Param("newEffectiveDate") Date newEffectiveDate,
@Param("excludeId") Long excludeId); @Param("excludeId") Long excludeId);
/** After deleting a pending version: reopen rows closed at that effective date */ /** 删除待生效版本后:恢复在该生效日期被关闭的行 */
public int reopenExpiredByProductCodeAndExpireDate( public int reopenExpiredByProductCodeAndExpireDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("expireDate") Date expireDate); @Param("expireDate") Date expireDate);
/** Recompute status from effective_date / expire_date vs today */ /** 按 effective_date / expire_date 与今天重新计算状态 */
public int refreshStatusByDates(); public int refreshStatusByDates();
} }
@@ -22,7 +22,7 @@ public interface BmsRedlineProductCountryMapper
/** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */ /** 按明细行主键更新可编辑字段(重量段/运费/挂号费/尺寸/尾程/时效/生效失效日期) */
public int updateBmsRedlineProductCountry(BmsRedlineProductCountry country); public int updateBmsRedlineProductCountry(BmsRedlineProductCountry country);
/** Import overlay: update price/zone/attrs on matched country row */ /** 导入覆盖:更新命中国家行的价格/分区/属性 */
public int updateBmsRedlineProductCountryImport(BmsRedlineProductCountry country); public int updateBmsRedlineProductCountryImport(BmsRedlineProductCountry country);
public int deleteByProductId(Long productId); public int deleteByProductId(Long productId);
@@ -33,22 +33,22 @@ public interface BmsRedlineProductCountryMapper
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Max open (expire_date is null) effective_date for product */ /** 该产品最大的未结束(expire_date 为空)生效日期 */
public Date selectMaxOpenEffectiveDate(@Param("productCode") String productCode); public Date selectMaxOpenEffectiveDate(@Param("productCode") String productCode);
/** Close open versions: set expire_date = newEffectiveDate where effective_date &lt; newEffectiveDate */ /** 结束未关闭版本:把 effective_date &lt; newEffectiveDate 的行 expire_date 置为 newEffectiveDate */
public int expireOpenByProductCode( public int expireOpenByProductCode(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("newEffectiveDate") Date newEffectiveDate); @Param("newEffectiveDate") Date newEffectiveDate);
/** After deleting a pending version: reopen rows closed at that effective date */ /** 删除待生效版本后:恢复在该生效日期被关闭的行 */
public int reopenExpiredByProductCodeAndExpireDate( public int reopenExpiredByProductCodeAndExpireDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("expireDate") Date expireDate); @Param("expireDate") Date expireDate);
/** /**
* Close open rows for one product + country where effective_date &lt; newEffectiveDate. * 关闭某产品 + 国家下 effective_date &lt; newEffectiveDate 的未关闭行。
* Match by country_code when present, otherwise country_name. * 有 country_code 时按它匹配,否则按 country_name 匹配。
*/ */
public int expireOpenByProductCodeAndCountry( public int expireOpenByProductCodeAndCountry(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -56,26 +56,26 @@ public interface BmsRedlineProductCountryMapper
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("newEffectiveDate") Date newEffectiveDate); @Param("newEffectiveDate") Date newEffectiveDate);
/** Recompute status from effective_date / expire_date vs today */ /** 按 effective_date / expire_date 与今天重新计算状态 */
public int refreshStatusByDates(); public int refreshStatusByDates();
/** Replace same-day version only */ /** 仅替换同一生效日期的版本 */
public int deleteOpenByProductCodeAndEffectiveDate( public int deleteOpenByProductCodeAndEffectiveDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Hard-delete all detail rows of one product (psp_id). */ /** 物理删除某产品的全部明细行(psp_id)。 */
public int physicalDeleteByPspId(@Param("productId") Long productId); public int physicalDeleteByPspId(@Param("productId") Long productId);
/** Hard-delete detail rows of one product + country (psp_id scope). */ /** 物理删除某产品 + 国家的明细行(psp_id 范围)。 */
public int physicalDeleteByPspIdAndCountry( public int physicalDeleteByPspIdAndCountry(
@Param("productId") Long productId, @Param("productId") Long productId,
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@Param("countryName") String countryName); @Param("countryName") String countryName);
/** /**
* Hard-delete draft/pending detail rows for one product + country (same-version replace). * 物理删除某产品 + 国家的草稿/待生效明细行(同版本替换)。
* Only versions with status draft(0) or pending(3) are affected. * 只影响状态为草稿(0)或待生效(3)的版本。
*/ */
public int deleteOpenByProductCodeAndCountryOnDate( public int deleteOpenByProductCodeAndCountryOnDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -83,17 +83,17 @@ public interface BmsRedlineProductCountryMapper
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Hard-delete surcharge_rel rows linked to draft/pending details for product+country. */ /** 物理删除产品+国家草稿/待生效明细关联的 surcharge_rel 行。 */
public int deleteSurchargeRelByProductCodeAndCountryOnDate( public int deleteSurchargeRelByProductCodeAndCountryOnDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@Param("countryName") String countryName, @Param("countryName") String countryName,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Open country rows (expire_date is null) for product */ /** 该产品未结束(expire_date 为空)的国家行 */
public List<BmsRedlineProductCountry> selectOpenByProductCode(@Param("productCode") String productCode); public List<BmsRedlineProductCountry> selectOpenByProductCode(@Param("productCode") String productCode);
/** Copy previously open rows into a new effective_date (caller must expire first) */ /** 把之前未结束的行复制到新的生效日期(调用方需先结束旧版本) */
public int copyOpenCountries( public int copyOpenCountries(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("productId") Long productId, @Param("productId") Long productId,
@@ -101,9 +101,9 @@ public interface BmsRedlineProductCountryMapper
@Param("status") String status); @Param("status") String status);
/** /**
* Match by product + country + weight + bizDate (+ optional zoneCode). * 按产品 + 国家 + 重量 + 业务日期(+ 可选 zoneCode)匹配。
* When zoneCode is empty, prefer rows without zone. * zoneCode 为空时优先取无分区的行。
* When zoneCode is set, require matching zone_code. * zoneCode 有值时要求 zone_code 一致。
*/ */
public BmsRedlineProductCountry selectMatchByProductCountryWeight( public BmsRedlineProductCountry selectMatchByProductCountryWeight(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@@ -113,7 +113,7 @@ public interface BmsRedlineProductCountryMapper
@Param("weight") BigDecimal weight, @Param("weight") BigDecimal weight,
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
/** Count product-country rows that have a zone for this product+country+bizDate */ /** 统计该产品+国家+业务日期下带分区的产品国家行数 */
public int countZonedByProductCountry( public int countZonedByProductCountry(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@@ -14,17 +14,17 @@ public interface BmsRedlineProductMapper
{ {
public BmsRedlineProduct selectBmsRedlineProductById(Long productId); public BmsRedlineProduct selectBmsRedlineProductById(Long productId);
/** Latest row by product_code (effective_date desc) */ /** 按 product_code 取最新行(effective_date 倒序) */
public BmsRedlineProduct selectBmsRedlineProductByCode(String productCode); public BmsRedlineProduct selectBmsRedlineProductByCode(String productCode);
/** Unique business key: product_code + effective_date */ /** 唯一业务键:product_code + effective_date */
public BmsRedlineProduct selectBmsRedlineProductByCodeAndDate(@Param("productCode") String productCode, public BmsRedlineProduct selectBmsRedlineProductByCodeAndDate(@Param("productCode") String productCode,
@Param("effectiveDate") Date effectiveDate); @Param("effectiveDate") Date effectiveDate);
/** Product row in a specific version */ /** 指定版本中的产品行 */
public BmsRedlineProduct selectByCodeAndPsvId(@Param("productCode") String productCode, @Param("psvId") Long psvId); public BmsRedlineProduct selectByCodeAndPsvId(@Param("productCode") String productCode, @Param("psvId") Long psvId);
/** Product version effective on bizDate */ /** 业务日期生效的产品版本 */
public BmsRedlineProduct selectEffectiveBmsRedlineProductByCode(@Param("productCode") String productCode, public BmsRedlineProduct selectEffectiveBmsRedlineProductByCode(@Param("productCode") String productCode,
@Param("bizDate") Date bizDate); @Param("bizDate") Date bizDate);
@@ -36,17 +36,17 @@ public interface BmsRedlineProductMapper
public int deleteBmsRedlineProductByIds(Long[] productIds); public int deleteBmsRedlineProductByIds(Long[] productIds);
/** Close previous open versions: expire_date = newEffectiveDate */ /** 结束之前的未关闭版本:expire_date 置为 newEffectiveDate */
public int expireOpenByProductCode( public int expireOpenByProductCode(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("newEffectiveDate") Date newEffectiveDate, @Param("newEffectiveDate") Date newEffectiveDate,
@Param("excludeId") Long excludeId); @Param("excludeId") Long excludeId);
/** After deleting a pending version: reopen rows closed at that effective date */ /** 删除待生效版本后:恢复在该生效日期被关闭的行 */
public int reopenExpiredByProductCodeAndExpireDate( public int reopenExpiredByProductCodeAndExpireDate(
@Param("productCode") String productCode, @Param("productCode") String productCode,
@Param("expireDate") Date expireDate); @Param("expireDate") Date expireDate);
/** Recompute status from effective_date / expire_date vs today */ /** 按 effective_date / expire_date 与今天重新计算状态 */
public int refreshStatusByDates(); public int refreshStatusByDates();
} }
@@ -1,24 +1,19 @@
package com.bms.price.mapper; package com.bms.price.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.bms.price.domain.ChannelProductMap; import com.bms.price.domain.ChannelProductMap;
/** /**
* 渠道产品关系映射 * 渠道-产品付款方式映射。
*/ */
public interface ChannelProductMapMapper public interface ChannelProductMapMapper
{ {
ChannelProductMap selectByChannelAndType(@Param("channelId") String channelId, @Param("payType") String payType); ChannelProductMap selectByChannelAndType(@Param("channelId") String channelId, @Param("payType") String payType);
List<ChannelProductMap> selectByPriceSetId(@Param("priceSetId") Long priceSetId);
int upsert(ChannelProductMap row); int upsert(ChannelProductMap row);
int deleteByChannelAndType(@Param("channelId") String channelId, @Param("payType") String payType); int deleteByChannelAndType(@Param("channelId") String channelId, @Param("payType") String payType);
int deleteByChannelTypeAndPriceSet(@Param("channelId") String channelId, @Param("payType") String payType,
@Param("priceSetId") Long priceSetId);
int deleteByProductId(@Param("productId") Long productId); int deleteByProductId(@Param("productId") Long productId);
} }
@@ -22,7 +22,7 @@ public interface OracleUpstreamOrderMapper
long countTabOrderMonitor(@Param("orderTable") String orderTable, @Param("query") TabOrderMonitorQuery query); long countTabOrderMonitor(@Param("orderTable") String orderTable, @Param("query") TabOrderMonitorQuery query);
/** Key-first page for customer+time queries (sort narrow columns only). */ /** 客户+时间查询的主键优先分页(仅对窄列排序)。 */
List<Map<String, Object>> selectTabOrderMonitorKeyPage( List<Map<String, Object>> selectTabOrderMonitorKeyPage(
@Param("orderTable") String orderTable, @Param("orderTable") String orderTable,
@Param("query") TabOrderMonitorQuery query, @Param("query") TabOrderMonitorQuery query,
@@ -38,17 +38,17 @@ public interface OracleUpstreamOrderMapper
@Param("startRow") long startRow, @Param("startRow") long startRow,
@Param("endRow") long endRow); @Param("endRow") long endRow);
/** List detail by ids: display columns only. */ /** 按 ID 查明细:仅返回展示列。 */
List<Map<String, Object>> selectTabOrderMonitorListByIds( List<Map<String, Object>> selectTabOrderMonitorListByIds(
@Param("orderTable") String orderTable, @Param("orderTable") String orderTable,
@Param("ids") List<String> ids); @Param("ids") List<String> ids);
/** Distinct product codes for product-vs-package check (grouped, no pagination). */ /** 产品与套餐比对用的去重产品编码(分组,不分页)。 */
List<Map<String, Object>> selectTabOrderProductCodes( List<Map<String, Object>> selectTabOrderProductCodes(
@Param("orderTable") String orderTable, @Param("orderTable") String orderTable,
@Param("query") TabOrderMonitorQuery query); @Param("query") TabOrderMonitorQuery query);
/** Order ids for one product code under the same filters (no pagination). */ /** 相同筛选条件下某个产品编码的订单 ID(不分页)。 */
List<Map<String, Object>> selectTabOrderIdsByProduct( List<Map<String, Object>> selectTabOrderIdsByProduct(
@Param("orderTable") String orderTable, @Param("orderTable") String orderTable,
@Param("query") TabOrderMonitorQuery query); @Param("query") TabOrderMonitorQuery query);
@@ -17,8 +17,6 @@ public interface PayProductTermMapper
PayProductTerm selectByProductId(Long productId); PayProductTerm selectByProductId(Long productId);
/** 打单产品所属套餐 ID */
Long selectLabelPriceSetIdByProduct(@Param("productId") Long productId);
List<PayProductTerm> selectByPriceSetId(@Param("priceSetId") Long priceSetId); List<PayProductTerm> selectByPriceSetId(@Param("priceSetId") Long priceSetId);
@@ -14,18 +14,18 @@ public interface PrcBillingTaskMapper
int updatePrcBillingTask(PrcBillingTask task); int updatePrcBillingTask(PrcBillingTask task);
/** CAS: WAITING -> processing claim not needed; writeback SUCCESS/FAILED */ /** CAS:WAITING -> processing 无需抢占;回写 SUCCESS/FAILED */
int updateBillingResult(PrcBillingTask task); int updateBillingResult(PrcBillingTask task);
/** Delete the queue row once prc_order_bill is saved. transfer_no is the unique key. */ /** prc_order_bill 保存后删除队列行。transfer_no 为唯一键。 */
int deleteByTransferNo(@Param("transferNo") String transferNo); int deleteByTransferNo(@Param("transferNo") String transferNo);
/** Count tasks for filter retry (customer + bill_time window). */ /** 统计筛选重试的任务数(客户 + 账单时间窗口)。 */
int countTaskIdsByFilter(PrcBillingTask query); int countTaskIdsByFilter(PrcBillingTask query);
/** /**
* Keyset page of task ids only (asc) to avoid loading full rows into memory. * 仅按任务 ID 做键集分页(升序),避免把完整行加载到内存。
* lastTaskId exclusive lower bound; pass 0 for first page. * lastTaskId 为排他下界;首页传 0。
*/ */
List<Long> selectTaskIdsByFilter( List<Long> selectTaskIdsByFilter(
@Param("query") PrcBillingTask query, @Param("query") PrcBillingTask query,
@@ -25,7 +25,7 @@ public interface PrcCustomerPriceSetMapper
public int countByPriceSetId(Long priceSetId); public int countByPriceSetId(Long priceSetId);
/** Count binds of this customer; optional exclude current bind or current set */ /** 统计该客户的绑定数;可选排除当前绑定或当前套餐 */
public int countByCustomerId(@Param("customerId") Long customerId, public int countByCustomerId(@Param("customerId") Long customerId,
@Param("excludeId") Long excludeId, @Param("excludeId") Long excludeId,
@Param("excludePriceSetId") Long excludePriceSetId); @Param("excludePriceSetId") Long excludePriceSetId);
@@ -40,7 +40,7 @@ public interface PrcCustomerPriceSetMapper
@Param("endDate") java.util.Date endDate); @Param("endDate") java.util.Date endDate);
/** /**
* Customer package binds (package not stopped). Temporal match uses version effective_time in quote/bill. * 客户套餐绑定(套餐未停用)。时效匹配在报价/账单中使用版本的 effective_time。
*/ */
public java.util.List<PrcCustomerPriceSet> selectEffectiveByCustomer( public java.util.List<PrcCustomerPriceSet> selectEffectiveByCustomer(
@Param("customerId") Long customerId); @Param("customerId") Long customerId);
@@ -17,11 +17,11 @@ public interface PrcIncomeBillFeeMapper
public PrcIncomeBillFee selectByFeeId(String feeId); public PrcIncomeBillFee selectByFeeId(String feeId);
/** Lookup by unique key uk_bill_fee_item (bill_id, fee_type, sc_id). */ /** 按唯一键 uk_bill_fee_item(bill_id、fee_type、sc_id)查询。 */
public PrcIncomeBillFee selectByBillIdAndFeeTypeAndScId(@Param("billId") String billId, public PrcIncomeBillFee selectByBillIdAndFeeTypeAndScId(@Param("billId") String billId,
@Param("feeType") String feeType, @Param("scId") Long scId); @Param("feeType") String feeType, @Param("scId") Long scId);
/** Count fees of a bill under given ar_bill_status and fee_type (e.g. BILLED + BASIC_FREIGHT). */ /** 统计某账单在指定 ar_bill_status 和 fee_type 下的费用数(例如 BILLED + BASIC_FREIGHT)。 */
public int countByBillIdAndArBillStatusAndFeeType(@Param("billId") String billId, public int countByBillIdAndArBillStatusAndFeeType(@Param("billId") String billId,
@Param("arBillStatus") String arBillStatus, @Param("feeType") String feeType); @Param("arBillStatus") String arBillStatus, @Param("feeType") String feeType);
@@ -48,6 +48,6 @@ public interface PrcIncomeBillFeeMapper
public int deleteByBillId(String billId); public int deleteByBillId(String billId);
/** Rebill: delete auto fees only; keep manual_flag=1 rows. */ /** 重新出账:只删除自动费用;保留 manual_flag=1 的行。 */
public int deleteAutoFeesByBillId(String billId); public int deleteAutoFeesByBillId(String billId);
} }
@@ -21,16 +21,16 @@ public interface PrcOrderBillMapper
public List<PrcOrderBill> selectPrcOrderBillList(PrcOrderBill bill); public List<PrcOrderBill> selectPrcOrderBillList(PrcOrderBill bill);
/** bill_id only (same filters / data-scope as list), for large local rebill. */ /** 只取 bill_id(筛选条件/数据权限与列表一致),用于本地大批量重新出账。 */
List<String> selectPrcOrderBillIds(PrcOrderBill bill); List<String> selectPrcOrderBillIds(PrcOrderBill bill);
/** Count matching bills (same filters / data-scope as list). */ /** 统计匹配的账单数(筛选条件/数据权限与列表一致)。 */
int countPrcOrderBillIds(PrcOrderBill bill); int countPrcOrderBillIds(PrcOrderBill bill);
/** Distinct customer+product groups for product-check (order counts in filter window). */ /** 产品校验用的去重客户+产品分组(统计筛选窗口内的订单数)。 */
List<Map<String, Object>> selectDistinctProductGroups(PrcOrderBill bill); List<Map<String, Object>> selectDistinctProductGroups(PrcOrderBill bill);
/** Drill-down orders for one product under product-check filters. */ /** 产品校验筛选条件下钻某个产品的订单。 */
List<PrcOrderBill> selectOrderBillsByProductForCheck(@Param("query") PrcOrderBill query, @Param("limit") int limit); List<PrcOrderBill> selectOrderBillsByProductForCheck(@Param("query") PrcOrderBill query, @Param("limit") int limit);
/** /**
@@ -138,6 +138,6 @@ public interface PrcOrderBillMapper
/** 只更新应付合计,不改应收。 */ /** 只更新应付合计,不改应收。 */
int updatePayTotal(@Param("billId") String billId, @Param("payTotal") BigDecimal payTotal); int updatePayTotal(@Param("billId") String billId, @Param("payTotal") BigDecimal payTotal);
/** Count order bills that reference this sales package version. */ /** 统计引用该销售套餐版本的订单账单数。 */
int countByPsvId(@Param("psvId") Long psvId); int countByPsvId(@Param("psvId") Long psvId);
} }
@@ -13,10 +13,10 @@ public interface PrcPriceExcelFileMapper
public List<PrcPriceExcelFile> selectPrcPriceExcelFileList(PrcPriceExcelFile query); public List<PrcPriceExcelFile> selectPrcPriceExcelFileList(PrcPriceExcelFile query);
/** Excel files bound to a version via psv_id */ /** 通过 psv_id 绑定到某版本的 Excel 文件 */
public List<PrcPriceExcelFile> selectByPsvId(@Param("psvId") Long psvId); public List<PrcPriceExcelFile> selectByPsvId(@Param("psvId") Long psvId);
/** Hard delete attachments of a version. */ /** 物理删除某版本的附件。 */
public int physicalDeleteByPsvId(@Param("psvId") Long psvId); public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
public int insertPrcPriceExcelFile(PrcPriceExcelFile row); public int insertPrcPriceExcelFile(PrcPriceExcelFile row);
@@ -25,15 +25,15 @@ public interface PrcPriceSetDetailMapper
public int deletePrcPriceSetDetailByIds(Long[] psdIds); public int deletePrcPriceSetDetailByIds(Long[] psdIds);
/** Delete SALES details for all versions of a price set */ /** 删除某价格套餐所有版本的 SALES 明细 */
public int deletePrcPriceSetDetailByPriceSetId(Long priceSetId); public int deletePrcPriceSetDetailByPriceSetId(Long priceSetId);
public int deletePrcPriceSetDetailByPsvId(Long psvId); public int deletePrcPriceSetDetailByPsvId(Long psvId);
/** Hard delete detail rows by ids (draft / pending). */ /** 按 ID 物理删除明细行(草稿 / 待生效)。 */
public int physicalDeleteByIds(Long[] psdIds); public int physicalDeleteByIds(Long[] psdIds);
/** Hard delete all detail rows under a version. */ /** 物理删除某版本下的全部明细行。 */
public int physicalDeleteByPsvId(@Param("psvId") Long psvId); public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
public int deleteOrphanDetailsByPriceSetId(Long priceSetId); public int deleteOrphanDetailsByPriceSetId(Long priceSetId);
@@ -44,15 +44,15 @@ public interface PrcPriceSetDetailMapper
public int countByPsvId(Long psvId); public int countByPsvId(Long psvId);
/** Count detail rows including soft-deleted (for deleted-version tab). */ /** 统计明细行数,包含已逻辑删除的数据(供已删除版本页签使用)。 */
public int countByPsvIdAll(Long psvId); public int countByPsvIdAll(Long psvId);
public int copyDetailsFromVersion(@Param("srcPsvId") Long srcPsvId, @Param("newPsvId") Long newPsvId); public int copyDetailsFromVersion(@Param("srcPsvId") Long srcPsvId, @Param("newPsvId") Long newPsvId);
/** Copy version effective time, expire time and status onto catalog detail rows. */ /** 把版本生效时间、失效时间和状态复制到目录明细行。 */
public int syncEffectByPriceType(@Param("priceType") String priceType); public int syncEffectByPriceType(@Param("priceType") String priceType);
/** Copy SALES version effect fields onto package detail rows. */ /** 把 SALES 版本的生效字段复制到套餐明细行。 */
public int syncEffectByPriceSetId(@Param("priceSetId") Long priceSetId); public int syncEffectByPriceSetId(@Param("priceSetId") Long priceSetId);
public int insertFixedDetailsFromLibrary( public int insertFixedDetailsFromLibrary(
@@ -75,8 +75,8 @@ public interface PrcPriceSetDetailMapper
@Param("weight") BigDecimal weight); @Param("weight") BigDecimal weight);
/** /**
* Lowest FIXED weight band for product/country/zone (ignore weight). * 产品/国家/分区下最低的 FIXED 重量段(忽略重量)。
* Used when charge weight is below the minimum band. * 用于计费重量低于最小重量段时。
*/ */
public PrcPriceSetDetail selectFixedMinBand( public PrcPriceSetDetail selectFixedMinBand(
@Param("psvId") Long psvId, @Param("psvId") Long psvId,
@@ -86,8 +86,8 @@ public interface PrcPriceSetDetailMapper
@Param("zoneCode") String zoneCode); @Param("zoneCode") String zoneCode);
/** /**
* Next FIXED weight band whose weight_min is strictly above {@code weight} * 下一个 weight_min 严格大于 {@code weight} 的 FIXED 重量段
* (ceil into the gap between bands, e.g. 1.001 -> 1.01~2). * (重量落在段间空隙时向上取整,例如 1.001 -> 1.01~2)。
*/ */
public PrcPriceSetDetail selectFixedNextBandUp( public PrcPriceSetDetail selectFixedNextBandUp(
@Param("psvId") Long psvId, @Param("psvId") Long psvId,
@@ -126,7 +126,7 @@ public interface PrcPriceSetDetailMapper
public int updatePriceTypeByPsvId(@Param("psvId") Long psvId, @Param("priceType") String priceType); public int updatePriceTypeByPsvId(@Param("psvId") Long psvId, @Param("priceType") String priceType);
/** /**
* Match PRODUCT/REDLINE detail by catalog type + bizDate window on version. * 按目录类型 + 版本上的业务日期区间匹配 PRODUCT/REDLINE 明细。
*/ */
public PrcPriceSetDetail selectCatalogMatch( public PrcPriceSetDetail selectCatalogMatch(
@Param("priceType") String priceType, @Param("priceType") String priceType,
@@ -12,7 +12,7 @@ public interface PrcPriceSetMapper
{ {
public PrcPriceSet selectPrcPriceSetById(Long priceSetId); public PrcPriceSet selectPrcPriceSetById(Long priceSetId);
/** Header only (no product/customer count subqueries). */ /** 仅表头(不含产品/客户计数子查询)。 */
public PrcPriceSet selectPrcPriceSetHeaderById(Long priceSetId); public PrcPriceSet selectPrcPriceSetHeaderById(Long priceSetId);
public List<PrcPriceSet> selectPrcPriceSetList(PrcPriceSet set); public List<PrcPriceSet> selectPrcPriceSetList(PrcPriceSet set);
@@ -21,7 +21,7 @@ public interface PrcPriceSetMapper
public int updatePrcPriceSet(PrcPriceSet set); public int updatePrcPriceSet(PrcPriceSet set);
/** Update name / note only (does not touch set_type / discount / status). */ /** 仅更新名称 / 备注(不修改 set_type / discount / status)。 */
public int updateBasicInfo(PrcPriceSet set); public int updateBasicInfo(PrcPriceSet set);
public int updatePrcPriceSetStatus(PrcPriceSet set); public int updatePrcPriceSetStatus(PrcPriceSet set);
@@ -23,16 +23,16 @@ public interface PrcPriceSetProductMapper
public int deleteByPsvIdAndCode(@Param("psvId") Long psvId, @Param("productCode") String productCode); public int deleteByPsvIdAndCode(@Param("psvId") Long psvId, @Param("productCode") String productCode);
/** Hard delete one product under a version (draft / pending). */ /** 物理删除某版本下的一个产品(草稿 / 待生效)。 */
public int physicalDeleteByPsvIdAndCode(@Param("psvId") Long psvId, @Param("productCode") String productCode); public int physicalDeleteByPsvIdAndCode(@Param("psvId") Long psvId, @Param("productCode") String productCode);
/** Hard delete all product rows under a version. */ /** 物理删除某版本下的全部产品行。 */
public int physicalDeleteByPsvId(@Param("psvId") Long psvId); public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
/** Copy active PRODUCT catalog into this SALES version. */ /** 把生效的 PRODUCT 目录复制到该 SALES 版本。 */
public int insertFromLibrary(@Param("psvId") Long psvId); public int insertFromLibrary(@Param("psvId") Long psvId);
/** Preview: active PRODUCT catalog products. */ /** 预览:生效的 PRODUCT 目录产品。 */
public List<PrcPriceSetProduct> selectFromLibrary(); public List<PrcPriceSetProduct> selectFromLibrary();
public int copyFromVersion(@Param("srcPsvId") Long srcPsvId, @Param("newPsvId") Long newPsvId); public int copyFromVersion(@Param("srcPsvId") Long srcPsvId, @Param("newPsvId") Long newPsvId);
@@ -41,9 +41,9 @@ public interface PrcPriceSetProductMapper
public int updatePriceTypeByPsvId(@Param("psvId") Long psvId, @Param("priceType") String priceType); public int updatePriceTypeByPsvId(@Param("psvId") Long psvId, @Param("priceType") String priceType);
/** Copy version effective_time and status onto catalog product rows. */ /** 把版本 effective_time 和状态复制到目录产品行。 */
public int syncEffectByPriceType(@Param("priceType") String priceType); public int syncEffectByPriceType(@Param("priceType") String priceType);
/** Copy SALES version effect fields onto package product rows. */ /** 把 SALES 版本的生效字段复制到套餐产品行。 */
public int syncEffectByPriceSetId(@Param("priceSetId") Long priceSetId); public int syncEffectByPriceSetId(@Param("priceSetId") Long priceSetId);
} }
@@ -14,13 +14,13 @@ public interface PrcPriceSetVersionMapper
public List<PrcPriceSetVersion> selectPrcPriceSetVersionList(PrcPriceSetVersion version); public List<PrcPriceSetVersion> selectPrcPriceSetVersionList(PrcPriceSetVersion version);
/** Catalog versions (price_set_id null) with product/detail counts. */ /** 目录版本(price_set_id 为空)及产品/明细计数。 */
public List<PrcPriceSetVersion> selectCatalogVersionList(PrcPriceSetVersion version); public List<PrcPriceSetVersion> selectCatalogVersionList(PrcPriceSetVersion version);
/** Max seq for SALES by price_set_id */ /** 按 price_set_id 取 SALES 最大序号 */
public Integer selectMaxVersionSeq(@Param("priceSetId") Long priceSetId); public Integer selectMaxVersionSeq(@Param("priceSetId") Long priceSetId);
/** Max seq for catalog type (price_set_id null) or SALES when priceSetId set */ /** 目录类型(price_set_id 为空)或传了 priceSetId 时的 SALES 最大序号 */
public Integer selectMaxVersionSeqByType(@Param("priceType") String priceType, public Integer selectMaxVersionSeqByType(@Param("priceType") String priceType,
@Param("priceSetId") Long priceSetId); @Param("priceSetId") Long priceSetId);
@@ -30,7 +30,7 @@ public interface PrcPriceSetVersionMapper
public int deletePrcPriceSetVersionByIds(Long[] psvIds); public int deletePrcPriceSetVersionByIds(Long[] psvIds);
/** Soft-delete catalog/sales version row (is_del=1). */ /** 逻辑删除目录/销售版本行(is_del=1)。 */
public int softDeleteById(@Param("psvId") Long psvId, @Param("updateBy") String updateBy); public int softDeleteById(@Param("psvId") Long psvId, @Param("updateBy") String updateBy);
public int deletePrcPriceSetVersionByPriceSetId(Long priceSetId); public int deletePrcPriceSetVersionByPriceSetId(Long priceSetId);
@@ -38,14 +38,14 @@ public interface PrcPriceSetVersionMapper
public List<Long> selectPriceSetIds(); public List<Long> selectPriceSetIds();
/** /**
* SALES version effective at asOf for a price set. * 某价格套餐在 asOf 生效的 SALES 版本。
*/ */
public PrcPriceSetVersion selectActiveByPriceSetAt( public PrcPriceSetVersion selectActiveByPriceSetAt(
@Param("priceSetId") Long priceSetId, @Param("priceSetId") Long priceSetId,
@Param("asOf") Date asOf); @Param("asOf") Date asOf);
/** /**
* Catalog (PRODUCT/REDLINE) version effective at asOf. * 在 asOf 生效的目录(PRODUCT/REDLINE)版本。
*/ */
public PrcPriceSetVersion selectActiveByTypeAt( public PrcPriceSetVersion selectActiveByTypeAt(
@Param("priceType") String priceType, @Param("priceType") String priceType,
@@ -35,20 +35,20 @@ public interface PrcSurchargeRelMapper
@Param("productIds") List<Long> productIds, @Param("productIds") List<Long> productIds,
@Param("priceType") String priceType); @Param("priceType") String priceType);
/** Hard delete surcharge rows by detail ids (draft / pending). */ /** 按明细 ID 物理删除附加费行(草稿 / 待生效)。 */
public int physicalDeleteByDetailIdsAndPriceType( public int physicalDeleteByDetailIdsAndPriceType(
@Param("detailIds") List<Long> detailIds, @Param("detailIds") List<Long> detailIds,
@Param("priceType") String priceType); @Param("priceType") String priceType);
/** Hard delete surcharge rows by set-product ids (draft / pending). */ /** 按套餐产品 ID 物理删除附加费行(草稿 / 待生效)。 */
public int physicalDeleteByProductIdsAndPriceType( public int physicalDeleteByProductIdsAndPriceType(
@Param("productIds") List<Long> productIds, @Param("productIds") List<Long> productIds,
@Param("priceType") String priceType); @Param("priceType") String priceType);
/** Hard delete surcharge rows linked to products/details under a version. */ /** 物理删除某版本下产品/明细关联的附加费行。 */
public int physicalDeleteByPsvId(@Param("psvId") Long psvId); public int physicalDeleteByPsvId(@Param("psvId") Long psvId);
/** Soft-delete surcharge rows linked to products/details under a version. */ /** 逻辑删除某版本下产品/明细关联的附加费行。 */
public int softDeleteByPsvId(@Param("psvId") Long psvId); public int softDeleteByPsvId(@Param("psvId") Long psvId);
/** 附加费版本化编辑后,把产品关联从旧记录重指向新记录 */ /** 附加费版本化编辑后,把产品关联从旧记录重指向新记录 */
@@ -28,7 +28,7 @@ public interface PrcZoneDetailMapper
public int deletePrcZoneDetailByRegionId(Long regionId); public int deletePrcZoneDetailByRegionId(Long regionId);
/** /**
* Resolve zone by country ISO2 + postcode (exact first, then longest prefix). * 按国家 ISO2 + 邮编解析分区(先精确匹配,再取最长前缀)。
*/ */
public PrcZone selectZoneByCountryPostcode( public PrcZone selectZoneByCountryPostcode(
@Param("countryCode") String countryCode, @Param("countryCode") String countryCode,
@@ -41,7 +41,7 @@ public class BillingTaskMqConsumer
@Autowired(required = false) @Autowired(required = false)
private StringRedisTemplate stringRedisTemplate; private StringRedisTemplate stringRedisTemplate;
/** Local MQ mode: async event listener. */ /** 本地 MQ 模式:异步事件监听。 */
@Async @Async
@EventListener @EventListener
public void onLocalEvent(BillingTaskMqEvent event) public void onLocalEvent(BillingTaskMqEvent event)
@@ -58,8 +58,8 @@ public class BillingTaskMqConsumer
} }
/** /**
* Redis MQ mode: pop a batch each tick and process concurrently. * Redis MQ 模式:每次调度弹出一批消息并发处理。
* Previously only 1 message / schedule cycle — queue backlog grew while inserts were fast. * 原先每个调度周期只处理 1 条消息 —— 写入较快时队列会积压。
*/ */
@Scheduled(fixedDelayString = "${bms.billing.consumer-delay-ms:200}") @Scheduled(fixedDelayString = "${bms.billing.consumer-delay-ms:200}")
public void pollRedisQueue() public void pollRedisQueue()
@@ -61,7 +61,7 @@ public class CustomerKeywordResolver
} }
} }
} }
// Pass-through raw keywords (covers codes not yet in ctr_customer) // 原样保留原始关键字(覆盖尚未录入 ctr_customer 的代码)
for (String kw : keywords) for (String kw : keywords)
{ {
if (StringUtils.isNotEmpty(kw)) if (StringUtils.isNotEmpty(kw))
@@ -35,8 +35,8 @@ public class OracleOrderBillMapper
req.setUpstreamRow(row); req.setUpstreamRow(row);
req.setCustomerCode(firstStr(row, "CUSTOMER_CODE")); req.setCustomerCode(firstStr(row, "CUSTOMER_CODE"));
req.setCustomerName(firstStr(row, "CUSTOMER_NAME")); req.setCustomerName(firstStr(row, "CUSTOMER_NAME"));
// Upstream product identity: LINE_CODE / LINE_NAME (fallback PRODUCT_*). // 上游产品标识:LINE_CODE / LINE_NAME(回退取 PRODUCT_*)。
// (BMS product_code_mapping applied later in quote / persist). // (BMS 的 product_code_mapping 在后续报价 / 落库时应用)。
String product = firstStr(row, "LINE_CODE", "PRODUCT_CODE"); String product = firstStr(row, "LINE_CODE", "PRODUCT_CODE");
if (StringUtils.isEmpty(product)) if (StringUtils.isEmpty(product))
{ {
@@ -48,10 +48,10 @@ 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")));
// Prefer CONFIRM_WEIGHT (customer confirmed); fallback DIMENSIONAL_WEIGHT_FACTOR (charge weight). // 优先取 CONFIRM_WEIGHT(客户确认重量);回退取 DIMENSIONAL_WEIGHT_FACTOR(计费重量)。
BigDecimal weight = firstPositiveDecimal(row, "CONFIRM_WEIGHT", "DIMENSIONAL_WEIGHT_FACTOR"); BigDecimal weight = firstPositiveDecimal(row, "CONFIRM_WEIGHT", "DIMENSIONAL_WEIGHT_FACTOR");
req.setWeight(weight); req.setWeight(weight);
// TAB_ORDER.WEIGHT = receive 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"));
req.setPieces(firstInt(row, "ORDER_PIECE", "PACKAGE_NUM", "PRODUCT_SUM")); req.setPieces(firstInt(row, "ORDER_PIECE", "PACKAGE_NUM", "PRODUCT_SUM"));
@@ -64,7 +64,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 datetime) comes from task.bill_time. // CREATE_DATE 仅为下单时间;业务日期(计费时间)取自 task.bill_time。
Date createDate = firstDate(row, "CREATE_DATE"); Date createDate = firstDate(row, "CREATE_DATE");
if (createDate != null) if (createDate != null)
{ {
@@ -112,7 +112,7 @@ public class OracleOrderBillMapper
} }
} }
/** First decimal that is strictly &gt; 0 among keys (skip Oracle zero placeholders). */ /** 返回各 key 中第一个严格 &gt; 0 的数值(跳过 Oracle 的 0 占位值)。 */
private static BigDecimal firstPositiveDecimal(Map<String, Object> row, String... keys) private static BigDecimal firstPositiveDecimal(Map<String, Object> row, String... keys)
{ {
if (row == null || keys == null) if (row == null || keys == null)
@@ -51,10 +51,10 @@ public class OracleUpstreamOrderService
String track = emptyToNull(trackingNo); String track = emptyToNull(trackingNo);
try try
{ {
// Avoid PageHelper wrapping this Oracle query (can slow / break SQL). // 避免 PageHelper 包装该 Oracle 查询(可能导致变慢或 SQL 出错)。
PageHelper.clearPage(); PageHelper.clearPage();
// 1) Prefer exact match by transfer no (TRANSFER_ORDER_ID) // 1) 优先按转单号(TRANSFER_ORDER_ID)精确匹配
if (tf != null) if (tf != null)
{ {
Map<String, Object> byTransfer = query("TRANSFER_ORDER_ID", Map<String, Object> byTransfer = query("TRANSFER_ORDER_ID",
@@ -65,7 +65,7 @@ public class OracleUpstreamOrderService
} }
} }
// 2) Fallback: order no // 2) 回退:按订单号
Map<String, Object> row = null; Map<String, Object> row = null;
if (ono != null) if (ono != null)
{ {
@@ -76,7 +76,7 @@ public class OracleUpstreamOrderService
row = query("ORG_ORDER_ID", () -> oracleUpstreamOrderMapper.selectByOrgOrderId(table, ono)); row = query("ORG_ORDER_ID", () -> oracleUpstreamOrderMapper.selectByOrgOrderId(table, ono));
} }
// 3) Fallback: tracking no // 3) 回退:按运单号
if (isEmpty(row) && track != null) if (isEmpty(row) && track != null)
{ {
row = query("TRACK_ID", () -> oracleUpstreamOrderMapper.selectByTrackId(table, track)); row = query("TRACK_ID", () -> oracleUpstreamOrderMapper.selectByTrackId(table, track));
@@ -72,7 +72,7 @@ public class TabOrderMonitorService
/** 单批 Oracle 查询最长等待(从库 socketTimeout 为 120s,留同样余量)。 */ /** 单批 Oracle 查询最长等待(从库 socketTimeout 为 120s,留同样余量)。 */
private static final long COLLECT_BATCH_TIMEOUT_SECONDS = 120L; private static final long COLLECT_BATCH_TIMEOUT_SECONDS = 120L;
/** Same default as historical hardcoded ORDER_STATUS IN (...). */ /** 与历史硬编码的 ORDER_STATUS IN (...) 默认值相同。 */
private static final List<Integer> DEFAULT_ORDER_STATUSES = private static final List<Integer> DEFAULT_ORDER_STATUSES =
Collections.unmodifiableList(Arrays.asList( Collections.unmodifiableList(Arrays.asList(
Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6), Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6),
@@ -416,7 +416,7 @@ public class TabOrderMonitorService
Long.valueOf(System.currentTimeMillis() - t0)); Long.valueOf(System.currentTimeMillis() - t0));
return new TabOrderPageResult(keys.size(), rows); return new TabOrderPageResult(keys.size(), rows);
} }
// Customer+time: exact COUNT(1) + current-page keys. // 客户+时间:精确 COUNT(1) 统计总数 + 当前页主键。
return doSelectFilterListPage(table, query, pn, ps); return doSelectFilterListPage(table, query, pn, ps);
} }
@@ -442,7 +442,7 @@ public class TabOrderMonitorService
throw new ServiceException("单号数量超过服务端上限 " + IDENTIFIER_HARD_LIMIT throw new ServiceException("单号数量超过服务端上限 " + IDENTIFIER_HARD_LIMIT
+ ",请分批查询,避免内存溢出"); + ",请分批查询,避免内存溢出");
} }
// optional customer filter only; never use pickup time on this path // 仅可选的客户过滤条件;此路径绝不使用提货时间
List<String> codes = query.getCustomerCodes(); List<String> codes = query.getCustomerCodes();
List<String> cleanedCodes = new ArrayList<String>(); List<String> cleanedCodes = new ArrayList<String>();
if (codes != null) if (codes != null)
@@ -544,8 +544,8 @@ public class TabOrderMonitorService
} }
/** /**
* Customer+time list: exact COUNT(1) for total + key-page for current rows. * 客户+时间列表:用精确的 COUNT(1) 统计总数 + 主键分页取当前页数据。
* Total uses countTabOrderMonitor (same filters as Oct-13 style COUNT). * 总数使用 countTabOrderMonitor(与 10-13 风格的 COUNT 过滤条件相同)。
*/ */
private TabOrderPageResult doSelectFilterListPage(String table, TabOrderMonitorQuery query, int pn, int ps) private TabOrderPageResult doSelectFilterListPage(String table, TabOrderMonitorQuery query, int pn, int ps)
{ {
@@ -571,7 +571,7 @@ public class TabOrderMonitorService
return new TabOrderPageResult(total, list); return new TabOrderPageResult(total, list);
} }
/** Exact total for customer+time list; short TTL cache to avoid recount on every page flip. */ /** 客户+时间列表的精确总数;短期 TTL 缓存,避免每次翻页都重新统计。 */
private long countFilterTotal(String table, TabOrderMonitorQuery query) private long countFilterTotal(String table, TabOrderMonitorQuery query)
{ {
String fingerprint = "count|" + collectFingerprint(table, query); String fingerprint = "count|" + collectFingerprint(table, query);
@@ -604,7 +604,7 @@ public class TabOrderMonitorService
} }
} }
/** Collect (and cache) filter-path primary keys, newest first; hard-capped at FILTER_LIST_KEY_LIMIT. */ /** 收集(并缓存)筛选路径的主键,最新在前;硬性上限为 FILTER_LIST_KEY_LIMIT。 */
private List<String> doCollectFilterKeyIds(String table, TabOrderMonitorQuery query) private List<String> doCollectFilterKeyIds(String table, TabOrderMonitorQuery query)
{ {
String fingerprint = "filter|" + collectFingerprint(table, query); String fingerprint = "filter|" + collectFingerprint(table, query);
@@ -614,7 +614,7 @@ public class TabOrderMonitorService
{ {
return new ArrayList<String>(cached.ids); return new ArrayList<String>(cached.ids);
} }
// One Oracle key-page (ROWNUM <= limit+1). Avoid deep multi-page ROWNUM which hangs month windows. // 一次 Oracle 主键分页查询(ROWNUM <= limit+1)。避免深层多页 ROWNUM 导致月窗口查询卡死。
List<String> ids = selectKeyIds(table, query, 0L, FILTER_LIST_KEY_LIMIT + 1L); List<String> ids = selectKeyIds(table, query, 0L, FILTER_LIST_KEY_LIMIT + 1L);
if (ids.size() > FILTER_LIST_KEY_LIMIT) if (ids.size() > FILTER_LIST_KEY_LIMIT)
{ {
@@ -1214,7 +1214,7 @@ public class TabOrderMonitorService
normalizeBlPickup(query); normalizeBlPickup(query);
} }
/** Empty/missing -> default 3,4,5,6,7,8,11 so SQL always has a status IN list. */ /** 为空/未传时默认为 3,4,5,6,7,8,11,保证 SQL 始终有状态 IN 列表。 */
private static void normalizeOrderStatuses(TabOrderMonitorQuery query) private static void normalizeOrderStatuses(TabOrderMonitorQuery query)
{ {
List<Integer> statuses = query.getOrderStatuses(); List<Integer> statuses = query.getOrderStatuses();
@@ -1232,7 +1232,7 @@ public class TabOrderMonitorService
query.setOrderStatuses(cleaned.isEmpty() ? new ArrayList<Integer>(DEFAULT_ORDER_STATUSES) : cleaned); query.setOrderStatuses(cleaned.isEmpty() ? new ArrayList<Integer>(DEFAULT_ORDER_STATUSES) : cleaned);
} }
/** Always force BL_PICKUP=1; UI no longer exposes this filter. */ /** 始终强制 BL_PICKUP=1;界面已不再提供该过滤条件。 */
private static void normalizeBlPickup(TabOrderMonitorQuery query) private static void normalizeBlPickup(TabOrderMonitorQuery query)
{ {
query.setBlPickup(Integer.valueOf(1)); query.setBlPickup(Integer.valueOf(1));
@@ -1320,7 +1320,7 @@ public class TabOrderMonitorService
vo.setTrackId(str(row, "TRACK_ID")); vo.setTrackId(str(row, "TRACK_ID"));
vo.setCustomerCode(str(row, "CUSTOMER_CODE")); vo.setCustomerCode(str(row, "CUSTOMER_CODE"));
vo.setCustomerName(str(row, "CUSTOMER_NAME")); vo.setCustomerName(str(row, "CUSTOMER_NAME"));
// Prefer LINE_CODE / LINE_NAME (billing product); list SQL aliases them as PRODUCT_*. // 优先使用 LINE_CODE / LINE_NAME(计费产品);列表 SQL 将其别名输出为 PRODUCT_*。
vo.setProductCode(firstStr(row, "LINE_CODE", "PRODUCT_CODE")); vo.setProductCode(firstStr(row, "LINE_CODE", "PRODUCT_CODE"));
vo.setProductName(firstStr(row, "LINE_NAME", "PRODUCT_NAME")); vo.setProductName(firstStr(row, "LINE_NAME", "PRODUCT_NAME"));
vo.setProductFloorCode(str(row, "PRODUCT_FLOOR_CODE")); vo.setProductFloorCode(str(row, "PRODUCT_FLOOR_CODE"));
@@ -8,17 +8,17 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "bms.elasticsearch") @ConfigurationProperties(prefix = "bms.elasticsearch")
public class ElasticsearchProperties public class ElasticsearchProperties
{ {
/** false = skip ES write/read */ /** false = 跳过 ES 读写 */
private boolean enabled = true; private boolean enabled = true;
/** e.g. http://127.0.0.1:9200 */ /** 例如 http://127.0.0.1:9200 */
private String uris = "http://127.0.0.1:9200"; private String uris = "http://127.0.0.1:9200";
private String username; private String username;
private String password; private String password;
/** index name */ /** 索引名称 */
private String index = "bms_biz_log"; private String index = "bms_biz_log";
public boolean isEnabled() public boolean isEnabled()
@@ -69,7 +69,7 @@ public class EsBillSearchStore implements IBillSearchStore
doc.put("bizId", bizId.trim()); doc.put("bizId", bizId.trim());
doc.put("status", StringUtils.isEmpty(status) ? EsBizLogSupport.STATUS_SUCCESS : status.trim()); doc.put("status", StringUtils.isEmpty(status) ? EsBizLogSupport.STATUS_SUCCESS : status.trim());
doc.put("error", StringUtils.isEmpty(errorMessage) ? null : errorMessage); doc.put("error", StringUtils.isEmpty(errorMessage) ? null : errorMessage);
// Index dynamic mapping is strict on a few fields; coerce before PUT. // 索引动态映射对部分字段类型要求严格,PUT 前先做类型转换。
doc.put("request", normalizeRequestForEs(parseOrRaw(requestJson))); doc.put("request", normalizeRequestForEs(parseOrRaw(requestJson)));
doc.put("response", normalizeResponseForEs(parseOrRaw(responseJson))); doc.put("response", normalizeResponseForEs(parseOrRaw(responseJson)));
String ts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now); String ts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now);
@@ -87,8 +87,8 @@ public class EsBillSearchStore implements IBillSearchStore
} }
/** /**
* request.bizDate is mapped as date (ISO / epoch only); bill writes "yyyy-MM-dd HH:mm:ss". * request.bizDate 映射为 date(仅支持 ISO / epoch);计费写入的是 "yyyy-MM-dd HH:mm:ss"。
* request.taskId is mapped as long; UUID strings must not stay under taskId. * request.taskId 映射为 long;UUID 字符串不能留在 taskId 下。
*/ */
private Object normalizeRequestForEs(Object request) private Object normalizeRequestForEs(Object request)
{ {
@@ -103,8 +103,8 @@ public class EsBillSearchStore implements IBillSearchStore
} }
/** /**
* response.ok mapped as long; response.success as boolean; response.taskId as long. * response.ok 映射为 long;response.success 映射为 boolean;response.taskId 映射为 long。
* Local rebill DONE used UUID taskId + numeric success and was rejected by ES. * 本地重算完成消息曾使用 UUID taskId + 数字型 success,被 ES 拒绝。
*/ */
private Object normalizeResponseForEs(Object response) private Object normalizeResponseForEs(Object response)
{ {
@@ -135,7 +135,7 @@ public class EsBillSearchStore implements IBillSearchStore
return; return;
} }
String bizDate = ((String) raw).trim(); String bizDate = ((String) raw).trim();
// "yyyy-MM-dd HH:mm:ss" -> ISO-local so ES date mapper accepts it. // 将 "yyyy-MM-dd HH:mm:ss" 转为 ISO 本地时间,便于 ES 日期映射解析。
if (bizDate.length() >= 19 && bizDate.charAt(10) == ' ') if (bizDate.length() >= 19 && bizDate.charAt(10) == ' ')
{ {
obj.put("bizDate", bizDate.substring(0, 10) + "T" + bizDate.substring(11)); obj.put("bizDate", bizDate.substring(0, 10) + "T" + bizDate.substring(11));
@@ -504,7 +504,7 @@ public class EsBillSearchStore implements IBillSearchStore
filters.add(boolWrap); filters.add(boolWrap);
} }
/** Match country code / name (exact or contains). */ /** 匹配国家编码 / 名称(精确或包含)。 */
private void addCountryKeywordFilter(JSONArray filters, String countryKeyword) private void addCountryKeywordFilter(JSONArray filters, String countryKeyword)
{ {
if (StringUtils.isEmpty(countryKeyword)) if (StringUtils.isEmpty(countryKeyword))
@@ -603,7 +603,7 @@ public class EsBillSearchStore implements IBillSearchStore
filters.add(wrap); filters.add(wrap);
} }
/** Match write-time by minute prefix, e.g. 2026-11-05 13:27. */ /** 按分钟前缀匹配写入时间,例如 2026-11-05 13:27。 */
private void addUpdateTimePrefixFilter(JSONArray filters, String updateTimePrefix) private void addUpdateTimePrefixFilter(JSONArray filters, String updateTimePrefix)
{ {
if (StringUtils.isEmpty(updateTimePrefix)) if (StringUtils.isEmpty(updateTimePrefix))
@@ -631,7 +631,7 @@ public class EsBillSearchStore implements IBillSearchStore
filters.add(wrap); filters.add(wrap);
} }
/** Prefer numeric term; also accept keyword/string mapping of bizKeys.psvId. */ /** 优先使用数值 term,同时兼容 bizKeys.psvId 的 keyword/字符串映射。 */
private void addPsvIdFilter(JSONArray filters, Long psvId) private void addPsvIdFilter(JSONArray filters, Long psvId)
{ {
if (psvId == null) if (psvId == null)
@@ -18,7 +18,7 @@ public final class EsBizLogSupport
public static final String STATUS_SUCCESS = "SUCCESS"; public static final String STATUS_SUCCESS = "SUCCESS";
public static final String STATUS_FAIL = "FAIL"; public static final String STATUS_FAIL = "FAIL";
/** Request attribute: fail already written to ES in this request. */ /** 请求属性:本次请求中的失败日志已写入 ES。 */
public static final String ATTR_FAIL_LOGGED = "bms.es.fail.logged"; public static final String ATTR_FAIL_LOGGED = "bms.es.fail.logged";
private static final int ERROR_MAX = 2000; private static final int ERROR_MAX = 2000;
@@ -95,7 +95,7 @@ public final class EsBizLogSupport
} }
/** /**
* Billing ES bizId: prefer transferNo, then orderNo. * 计费 ES bizId:优先取 transferNo,其次取 orderNo。
*/ */
public static String billBizId(TmsPriceBillRequest request) public static String billBizId(TmsPriceBillRequest request)
{ {
@@ -138,8 +138,8 @@ public final class EsBizLogSupport
} }
/** /**
* Common entry for quote/bill API failures (validation / JSON parse / business / unexpected). * 报价 / 计费 API 失败的公共入口(校验 / JSON 解析 / 业务 / 未预期异常)。
* Dedups with {@link #ATTR_FAIL_LOGGED} so controller/service/advice can all call safely. * 通过 {@link #ATTR_FAIL_LOGGED} 去重,使 controller/service/advice 均可安全调用。
*/ */
public static void saveApiFail(IBillSearchStore store, HttpServletRequest httpRequest, Object boundTarget, public static void saveApiFail(IBillSearchStore store, HttpServletRequest httpRequest, Object boundTarget,
Throwable e) Throwable e)
@@ -162,7 +162,7 @@ public final class EsBizLogSupport
} }
Object payload = boundTarget != null ? boundTarget : rawBody; Object payload = boundTarget != null ? boundTarget : rawBody;
String bizId = resolveFailBizId(logType, boundTarget, rawBody); String bizId = resolveFailBizId(logType, boundTarget, rawBody);
// saveFail also marks ATTR_FAIL_LOGGED // saveFail 内部也会标记 ATTR_FAIL_LOGGED
saveFail(store, logType, bizId, payload, errorMessage); saveFail(store, logType, bizId, payload, errorMessage);
if (!isFailLogged(httpRequest)) if (!isFailLogged(httpRequest))
{ {
@@ -8,20 +8,20 @@ public final class EsLogType
{ {
public static final String BILL = "BILL"; public static final String BILL = "BILL";
public static final String QUOTE = "QUOTE"; public static final String QUOTE = "QUOTE";
/** Order credit occupy/release */ /** 订单额度占用/释放 */
public static final String CREDIT = "CREDIT"; public static final String CREDIT = "CREDIT";
/** Clear order credit arrears after balance in */ /** 充值到账后清除订单额度欠款 */
public static final String ARREARS = "ARREARS"; public static final String ARREARS = "ARREARS";
/** Monitor: sync billing from TAB_ORDER */ /** 监控:从 TAB_ORDER 同步计费 */
public static final String ORDER_SOURCE_SYNC = "ORDER_SOURCE_SYNC"; public static final String ORDER_SOURCE_SYNC = "ORDER_SOURCE_SYNC";
/** Monitor: sales / product / redline price before-after changes */ /** 监控:销售价 / 产品价 / 红线价的变更前后记录 */
public static final String PRICE_CHANGE = "PRICE_CHANGE"; public static final String PRICE_CHANGE = "PRICE_CHANGE";
private EsLogType() private EsLogType()
{ {
} }
/** One document per bizId + write time. */ /** 每个 bizId + 写入时间对应一条文档。 */
public static String docId(String logType, String bizId) public static String docId(String logType, String bizId)
{ {
return docId(logType, bizId, new Date()); return docId(logType, bizId, new Date());
@@ -19,7 +19,7 @@ public interface IBillSearchStore
BillSearchPage search(String logType, String bizId, String status, int pageNum, int pageSize); BillSearchPage search(String logType, String bizId, String status, int pageNum, int pageSize);
/** /**
* Search with optional sales-version / priceKind filters (request.bizKeys.psvId, request.priceKind). * 支持可选的销售版本 / 价格类型过滤查询(request.bizKeys.psvId、request.priceKind)。
*/ */
default BillSearchPage search(String logType, String bizId, String status, Long psvId, String priceKind, default BillSearchPage search(String logType, String bizId, String status, Long psvId, String priceKind,
int pageNum, int pageSize) int pageNum, int pageSize)
@@ -28,7 +28,7 @@ public interface IBillSearchStore
} }
/** /**
* Search with optional productCode + updateTime (exact) / updateTimePrefix (e.g. yyyy-MM-dd HH:mm) filters. * 支持可选的 productCode + updateTime(精确)/ updateTimePrefix(例如 yyyy-MM-dd HH:mm)过滤查询。
*/ */
default BillSearchPage search(String logType, String bizId, String status, Long psvId, String priceKind, default BillSearchPage search(String logType, String bizId, String status, Long psvId, String priceKind,
String productCode, String updateTime, int pageNum, int pageSize) String productCode, String updateTime, int pageNum, int pageSize)
@@ -44,7 +44,7 @@ public interface IBillSearchStore
} }
/** /**
* Search with optional countryKeyword (matches bizKeys.countryCode / countryName). * 支持可选的 countryKeyword 过滤查询(匹配 bizKeys.countryCode / countryName)。
*/ */
default BillSearchPage search(String logType, String bizId, String status, Long psvId, String priceKind, default BillSearchPage search(String logType, String bizId, String status, Long psvId, String priceKind,
String productCode, String updateTime, String updateTimePrefix, String countryKeyword, String productCode, String updateTime, String updateTimePrefix, String countryKeyword,
@@ -54,7 +54,7 @@ public interface IBillSearchStore
} }
/** /**
* Group PRICE_CHANGE logs by productCode + updateTime for one package version. * 按产品编码 + 更新时间对某一套餐版本下的 PRICE_CHANGE 日志分组。
*/ */
default PriceChangeGroupPage searchPriceChangeGroups(Long psvId, String priceKind, String status, default PriceChangeGroupPage searchPriceChangeGroups(Long psvId, String priceKind, String status,
int pageNum, int pageSize) int pageNum, int pageSize)
@@ -25,7 +25,7 @@ public final class PriceChangeEsLog
public static final String ACTION_DELETE = "DELETE"; public static final String ACTION_DELETE = "DELETE";
public static final String ACTION_IMPORT = "IMPORT"; public static final String ACTION_IMPORT = "IMPORT";
/** Async import workers have no SecurityContext; pass operName via this override. */ /** 异步导入线程没有 SecurityContext,通过该覆盖值传入操作人名称。 */
private static final ThreadLocal<String> OPERATOR_OVERRIDE = new ThreadLocal<String>(); private static final ThreadLocal<String> OPERATOR_OVERRIDE = new ThreadLocal<String>();
private PriceChangeEsLog() private PriceChangeEsLog()
@@ -106,7 +106,7 @@ public final class PriceChangeEsLog
changes.add(change(field, fieldLabel, oldValue, newValue)); changes.add(change(field, fieldLabel, oldValue, newValue));
} }
/** Sales detail price fields (freight / registration / discount). */ /** 销售明细价格字段(运费 / 挂号费 / 折扣)。 */
public static List<Map<String, String>> diffSalesDetail(PrcPriceSetDetail oldRow, PrcPriceSetDetail newRow) public static List<Map<String, String>> diffSalesDetail(PrcPriceSetDetail oldRow, PrcPriceSetDetail newRow)
{ {
List<Map<String, String>> changes = new ArrayList<Map<String, String>>(); List<Map<String, String>> changes = new ArrayList<Map<String, String>>();
@@ -159,7 +159,7 @@ public final class PriceChangeEsLog
return keys; return keys;
} }
/** Display weight band for sales detail logs (e.g. 0&lt;W≤0.5). */ /** 销售明细日志展示用的重量段(例如 0&lt;W≤0.5)。 */
public static String weightBandOf(PrcPriceSetDetail d) public static String weightBandOf(PrcPriceSetDetail d)
{ {
if (d == null) if (d == null)

Some files were not shown because too many files have changed in this diff Show More