@be-link/ecommerce-plan-allocation-service-node-sdk 0.0.52 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -211,6 +211,7 @@ export declare namespace PreAllocationOrderTypes {
211
211
  operator: string;
212
212
  storeIds?: string[];
213
213
  productIds?: string[];
214
+ skuIds?: string[];
214
215
  skuCodes?: string[];
215
216
  deliveryModes?: number[];
216
217
  sourceTypes?: number[];
@@ -237,6 +238,7 @@ export declare namespace PreAllocationOrderTypes {
237
238
  batchNos?: string[];
238
239
  preAllocationOrderIds?: string[];
239
240
  productIds?: string[];
241
+ skuIds?: string[];
240
242
  skuCodes?: string[];
241
243
  pageIndex?: number;
242
244
  pageSize?: number;
@@ -259,6 +261,7 @@ export declare namespace PreAllocationOrderTypes {
259
261
  warehouseId: string;
260
262
  batchNos?: string[];
261
263
  preAllocationOrderIds?: string[];
264
+ skuIds?: string[];
262
265
  pickingRemark: string;
263
266
  operator: string;
264
267
  }
@@ -3,6 +3,9 @@ import BaseService from '../BaseService';
3
3
  declare class ProductStatisticsService extends BaseService implements ProductStatisticsTypes.ProductStatisticsController {
4
4
  protected prefixUrl: string;
5
5
  getStockInProductStats(request: ProductStatisticsTypes.Request.GetStockInProductStats): Promise<ProductStatisticsTypes.Response.GetStockInProductStats>;
6
+ searchStockInProductStats(request: ProductStatisticsTypes.Request.SearchStockInProductStats): Promise<ProductStatisticsTypes.Response.GetStockInProductStats>;
7
+ getProductTradeStats(request: ProductStatisticsTypes.Request.GetProductTradeStats): Promise<ProductStatisticsTypes.Response.GetProductTradeStats>;
8
+ getSkuTradeStatsByProduct(request: ProductStatisticsTypes.Request.GetSkuTradeStatsByProduct): Promise<ProductStatisticsTypes.Response.GetSkuTradeStatsByProduct>;
6
9
  }
7
10
  export declare const productStatisticsService: ProductStatisticsService;
8
11
  export default productStatisticsService;
@@ -24,11 +24,32 @@ let ProductStatisticsService = class ProductStatisticsService extends BaseServic
24
24
  getStockInProductStats(request) {
25
25
  return (0, http_1.callApi)(this.getApiUrl(this.getStockInProductStats), request);
26
26
  }
27
+ searchStockInProductStats(request) {
28
+ return (0, http_1.callApi)(this.getApiUrl(this.searchStockInProductStats), request);
29
+ }
30
+ getProductTradeStats(request) {
31
+ return (0, http_1.callApi)(this.getApiUrl(this.getProductTradeStats), request);
32
+ }
33
+ getSkuTradeStatsByProduct(request) {
34
+ return (0, http_1.callApi)(this.getApiUrl(this.getSkuTradeStatsByProduct), request);
35
+ }
27
36
  };
28
37
  __decorate([
29
38
  (0, tsoa_1.Post)('get-stock-in-product-stats'),
30
39
  __param(0, (0, tsoa_1.Body)())
31
40
  ], ProductStatisticsService.prototype, "getStockInProductStats", null);
41
+ __decorate([
42
+ (0, tsoa_1.Post)('search-stock-in-product-stats'),
43
+ __param(0, (0, tsoa_1.Body)())
44
+ ], ProductStatisticsService.prototype, "searchStockInProductStats", null);
45
+ __decorate([
46
+ (0, tsoa_1.Post)('get-product-trade-stats'),
47
+ __param(0, (0, tsoa_1.Body)())
48
+ ], ProductStatisticsService.prototype, "getProductTradeStats", null);
49
+ __decorate([
50
+ (0, tsoa_1.Post)('get-sku-trade-stats-by-product'),
51
+ __param(0, (0, tsoa_1.Body)())
52
+ ], ProductStatisticsService.prototype, "getSkuTradeStatsByProduct", null);
32
53
  ProductStatisticsService = __decorate([
33
54
  (0, tsoa_1.Route)('ProductStatistics'),
34
55
  (0, tsoa_1.Tags)('productStatistics')
@@ -1,6 +1,22 @@
1
1
  export declare namespace ProductStatisticsTypes {
2
2
  /** 实体定义 */
3
3
  namespace Entity {
4
+ /**
5
+ * 入库单商品下的 SKU 行:商品中心规格 + POS orderList(itemInfo) 销量 + 核销流水
6
+ */
7
+ interface StockInProductSkuStat {
8
+ skuId: string;
9
+ skuCode?: string;
10
+ attrs?: ProductAttr[];
11
+ /** orderList 返回的 itemInfo 聚合销量(每条商品行计 1 份) */
12
+ salesVolume: number;
13
+ /** getVerificationRecords 汇总已核销数量 */
14
+ verifiedCount: number;
15
+ /** max(0, salesVolume - verifiedCount) */
16
+ unverifiedCount: number;
17
+ /** 退货量 */
18
+ refundCount: number;
19
+ }
4
20
  /** 入库单商品统计项 */
5
21
  interface StockInProductStat {
6
22
  productId: string;
@@ -12,18 +28,104 @@ export declare namespace ProductStatisticsTypes {
12
28
  dispatchType: string;
13
29
  pickType: string;
14
30
  isCombo?: number;
31
+ /** 该商品下全部 SKU(商品中心),并映射本门店下单时间范围内的订单销量与核销 */
32
+ skus: StockInProductSkuStat[];
33
+ }
34
+ /** 商品属性(规格) */
35
+ interface ProductAttr {
36
+ attrName: string;
37
+ attrValue: string;
38
+ }
39
+ /**
40
+ * 商品 + 交易统计(字段与 Trade getProductStats 对齐,并附带商品中心展示信息)
41
+ */
42
+ interface ProductTradeStatItem {
43
+ productId: string;
44
+ productName: string;
45
+ price: number;
46
+ productImage: string;
47
+ classification: string;
48
+ storageMethod: string;
49
+ dispatchType: string;
50
+ pickType: string;
51
+ isCombo?: number;
52
+ productPrice: number;
53
+ gmv: number;
54
+ salesVolume: number;
55
+ buyerCount: number;
56
+ verifiedCount: number;
57
+ unverifiedCount: number;
58
+ refundCount: number;
59
+ refundAmount: number;
60
+ }
61
+ /**
62
+ * SKU + 交易统计(字段与 Trade getSkuStatsByProduct 对齐,并附带规格展示信息)
63
+ */
64
+ interface SkuTradeStatItem {
65
+ productId: string;
66
+ skuId: string;
67
+ salesVolume: number;
68
+ verifiedCount: number;
69
+ unverifiedCount: number;
70
+ refundCount: number;
71
+ gmv: number;
72
+ buyerCount: number;
73
+ refundAmount: number;
74
+ productName?: string;
75
+ productImage?: string;
76
+ skuCode?: string;
77
+ attrs?: ProductAttr[];
15
78
  }
16
79
  }
17
80
  /** 请求定义 */
18
81
  namespace Request {
19
- /** 查询入库单商品统计请求 */
82
+ /**
83
+ * 查询入库单商品统计请求
84
+ * orderTimeStart/orderTimeEnd:下单时间(订单创建时间,毫秒),用于拉 POS orderList 与核销流水;必填
85
+ */
20
86
  interface GetStockInProductStats {
21
87
  storeId: string;
22
88
  updatedAtStart?: number;
23
89
  updatedAtEnd?: number;
90
+ orderTimeStart: number;
91
+ orderTimeEnd: number;
24
92
  pageIndex: number;
25
93
  pageSize: number;
26
94
  }
95
+ /**
96
+ * 入库单商品统计搜索(按商品 ID 筛选后分页;出参与 GetStockInProductStats 一致)
97
+ */
98
+ interface SearchStockInProductStats {
99
+ storeId: string;
100
+ productIds: string[];
101
+ orderTimeStart: number;
102
+ orderTimeEnd: number;
103
+ pageIndex: number;
104
+ pageSize: number;
105
+ }
106
+ /**
107
+ * 分页查询商品交易统计。
108
+ * 未传 productIds:先 Trade getProductStats 分页,再按返回 id 查商品中心;total 与 Trade 一致。
109
+ * 传入 productIds:先商品中心 queryProductList 分页(可选 classifications),再 Trade;total 与商品中心一致。
110
+ * classification 与 Trade productCate 同义(商品服务 PRODUCT_ENUM.CLASSIFICATION 字符串,如 DEPARTMENT_STORE)。
111
+ */
112
+ interface GetProductTradeStats {
113
+ storeId: string;
114
+ startTime: number;
115
+ endTime: number;
116
+ pageIndex: number;
117
+ pageSize: number;
118
+ productIds?: string[];
119
+ classification?: string;
120
+ }
121
+ /** 按商品查 SKU 维度交易统计 */
122
+ interface GetSkuTradeStatsByProduct {
123
+ storeId: string;
124
+ productId: string;
125
+ startTime: number;
126
+ endTime: number;
127
+ skuIds?: string[];
128
+ }
27
129
  }
28
130
  /** 响应定义 */
29
131
  namespace Response {
@@ -31,10 +133,28 @@ export declare namespace ProductStatisticsTypes {
31
133
  interface GetStockInProductStats {
32
134
  products: Entity.StockInProductStat[];
33
135
  }
136
+ /**
137
+ * 分页查询商品交易统计响应。
138
+ * total:无 productIds 时为 Trade 总条数;有 productIds 时为商品中心分页总条数。
139
+ */
140
+ interface GetProductTradeStats {
141
+ total: number;
142
+ list: Entity.ProductTradeStatItem[];
143
+ }
144
+ /** SKU 维度交易统计响应 */
145
+ interface GetSkuTradeStatsByProduct {
146
+ list: Entity.SkuTradeStatItem[];
147
+ }
34
148
  }
35
149
  /** ProductStatistics Controller 接口定义 */
36
150
  interface ProductStatisticsController {
37
151
  /** 查询入库单商品统计 */
38
152
  getStockInProductStats(request: ProductStatisticsTypes.Request.GetStockInProductStats): Promise<ProductStatisticsTypes.Response.GetStockInProductStats>;
153
+ /** 入库单商品统计搜索(出参与 getStockInProductStats 相同) */
154
+ searchStockInProductStats(request: ProductStatisticsTypes.Request.SearchStockInProductStats): Promise<ProductStatisticsTypes.Response.GetStockInProductStats>;
155
+ /** 分页查询商品交易统计 */
156
+ getProductTradeStats(request: ProductStatisticsTypes.Request.GetProductTradeStats): Promise<ProductStatisticsTypes.Response.GetProductTradeStats>;
157
+ /** 查询指定商品下 SKU 交易统计 */
158
+ getSkuTradeStatsByProduct(request: ProductStatisticsTypes.Request.GetSkuTradeStatsByProduct): Promise<ProductStatisticsTypes.Response.GetSkuTradeStatsByProduct>;
39
159
  }
40
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/ecommerce-plan-allocation-service-node-sdk",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "EcommercePlanAllocationService Node.js SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  declare module '@fastify/request-context' {
2
2
  interface RequestContextData {
3
- requestId?: string;
3
+ requestId: string;
4
4
  traceMessageId?: string;
5
5
  pandoraUserId?: string;
6
6
  beLinkUserId?: string;
package/utils/http.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare module '@fastify/request-context' {
2
2
  interface RequestContextData {
3
- requestId?: string;
3
+ requestId: string;
4
4
  traceMessageId?: string;
5
5
  pandoraUserId?: string;
6
6
  beLinkUserId?: string;