快遞運費配置:渠道與匹配規(guī)則
本文檔依據(jù) sanlin-bp-api 中 AdminDeliveryFeeController 各 jisuan* 方法的實際代碼,說明 delivery_fee 的匹配條件與計費所用字段。
說明
-
channel:delivery_fee.channel,表示快遞產(chǎn)品線(京東、菜鳥、信豐等),與表里fee_type(按重量/按件)不是同一維度。 -
計費(代碼實際):以代碼為準(zhǔn);表中
fee_type僅為業(yè)務(wù)標(biāo)注,計算邏輯未統(tǒng)一讀取fee_type,可能與庫不一致。 - 始發(fā)/目的在庫中為
district編碼:from_pcode/from_ccode/to_pcode/to_ccode/to_tcode等;訂單側(cè)由toProvince、toCity、toTown等經(jīng)queryP/queryC/queryT解析(各渠道用到的字段不同)。
各渠道一覽
| channel | 渠道(字典名) | 計費(代碼實際) | delivery_fee 匹配條件 | 訂單/匯總側(cè)主要字段 | 配置行參與計算的字段 |
|---|---|---|---|---|---|
| 0 | 京東快遞 | 按重量 |
channel=0 + from_pcode + from_ccode + to_pcode + to_ccode;可再限定 to_tcode,無則回退為不加區(qū) |
storageId→始發(fā);toProvince/toCity/toTown→目的;同運單 totalWeight
|
firstWeight、firstPrice、continueWeight、continuePrice、discount
|
| 1 | 菜鳥快遞 | 按重量 |
channel=1 + from_pcode + to_pcode(無 goods_id) |
storageId、toProvince;totalWeight
|
首續(xù)重 + 多段:continueWeight2/3、continuePrice2/3、discount
|
| 2 | 信豐 | 按件 |
channel=2 + from_pcode + from_ccode + to_pcode + to_ccode + goods_id
|
storageId、toProvince、toCity;goodsId、totalAmountsSale
|
price |
| 3 | 佳美運 | 按件 |
channel=3 + from_pcode + from_ccode + to_pcode + goods_id(匹配時無目的市) |
同上 | price |
| 4 | 安明快遞 | 按件 |
channel=4 + from_pcode + to_pcode + goods_id
|
toProvince;goodsId、totalAmountsSale
|
price |
| 5 | 泡面申通 | 按件(SKU 拆分) |
channel=5 + from_pcode + to_pcode + 代碼寫死的若干 goods_id
|
明細 goodsId、amountsSale 拆段后計件 | price |
| 6 | 川百匯順豐 | 按件 |
channel=6 + from_pcode + to_pcode + goods_id
|
goodsId、totalAmountsSale | price |
| 7 | 川百匯中通 | 按件 |
channel=7,同上 |
同上 | price |
| 8 | 川百匯京東 | 按重量 |
channel=8 + from_pcode + from_ccode + to_pcode + to_ccode(無 goods_id) |
始發(fā)/目的到市;totalWeight |
firstWeight、firstPrice、continueWeight、continuePrice、discount
|
| 9 | 廈門中通 | 按件 |
channel=9 + from_pcode + to_pcode + goods_id
|
goodsId、totalAmountsSale | price |
| 10 | 川百匯 EMS | 按件 |
channel=10 + from_pcode + to_pcode + goods_id
|
同上 | price |
公共說明
按重量
-
totalWeight:同一運單(post_code分組)下,各明細queryGoodsWeight(goodsId, 數(shù)量)之和(重量向上取整規(guī)則見代碼)。 - 依賴每條明細的 goodsId、amountsSale 及
goods_info.weight。 - 京東、菜鳥、川百匯京東等多條
delivery_fee命中時,代碼側(cè)取檔邏輯與排序?qū)崿F(xiàn)需結(jié)合源碼核對(存在未使用排序結(jié)果的寫法時,以列表順序為準(zhǔn))。
按件
- 一般為
feeList[0].price × totalAmountsSale(或泡面申通按拆段件數(shù) × 單價)。 -
goods_id參與匹配的渠道,配置行需與訂單商品 id 一致。
初始化任務(wù)是否重算
-
initShopOrder*DeliveryFee僅處理real_money為空或 0 且created >= begDate的明細;已算出非 0 的金額不會被該任務(wù)覆蓋。
參考代碼位置
-
com.sanlinst.api.delivery.controller.AdminDeliveryFeeController:jisuanJd、jisuanCn、jisuanXf、jisuanJmy、jisuanAm、jisuanPmst、jisuanCbhZtSf、jisuanCbhJd、jisuanXmzt -
com.sanlinst.api.delivery.domain.DeliveryFeeDO:表字段注釋