正在显示
6 个修改的文件
包含
91 行增加
和
188 行删除
1 | -package com.aukey.example.constant; | ||
2 | - | ||
3 | -/** | ||
4 | - * @author: wgf | ||
5 | - * @create: 2020-05-21 10:36 | ||
6 | - * @description: 这里面配置的API一定要是授权过的,否则获取不了数据 | ||
7 | - **/ | ||
8 | -public interface DwApi { | ||
9 | - | ||
10 | - /** | ||
11 | - * 汇率API | ||
12 | - */ | ||
13 | - String CURRENCY_SET_API = "/base/currency_set"; | ||
14 | - | ||
15 | - /** | ||
16 | - * FBA-库存快照 | ||
17 | - */ | ||
18 | - String FULFILLMENT_CURRENT_INVENTORY = "/stock/fulfillment_current_inventory"; | ||
19 | -} |
1 | +package com.aukey.example.constant; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author: wgf | ||
5 | + * @create: 2020-05-21 10:36 | ||
6 | + * @description: 这里面配置的API一定要是授权过的,否则获取不了数据 | ||
7 | + **/ | ||
8 | +public enum ServiceCodeEnum { | ||
9 | + | ||
10 | + logistics_stock_id_mapping("11101000"); | ||
11 | + | ||
12 | + private String serviceCode; | ||
13 | + | ||
14 | + ServiceCodeEnum(String serviceCode) { | ||
15 | + this.serviceCode = serviceCode; | ||
16 | + } | ||
17 | + | ||
18 | + public String getServiceCode() { | ||
19 | + return serviceCode; | ||
20 | + } | ||
21 | +} |
1 | -package com.aukey.example.entity; | ||
2 | - | ||
3 | -import java.math.BigDecimal; | ||
4 | -import java.util.Date; | ||
5 | - | ||
6 | -/** | ||
7 | - * @author: wgf | ||
8 | - * @create: 2020-05-13 14:38 | ||
9 | - * @description: 汇率实体 | ||
10 | - **/ | ||
11 | -public class CurrencySet { | ||
12 | - private Integer currencyId; | ||
13 | - private String currencyCode; | ||
14 | - private String currencyName; | ||
15 | - private BigDecimal currencyRate; | ||
16 | - private String baseCurrency; | ||
17 | - private Integer createBy; | ||
18 | - private Date createTime; | ||
19 | - private String updateBy; | ||
20 | - private Date updateTime; | ||
21 | - private String dataStatus; | ||
22 | - private Integer auditBy; | ||
23 | - private String auditStatus; | ||
24 | - private Date auditTime; | ||
25 | - private String currencySymbol; | ||
26 | - | ||
27 | - public Integer getCurrencyId() { | ||
28 | - return currencyId; | ||
29 | - } | ||
30 | - | ||
31 | - public void setCurrencyId(Integer currencyId) { | ||
32 | - this.currencyId = currencyId; | ||
33 | - } | ||
34 | - | ||
35 | - public String getCurrencyCode() { | ||
36 | - return currencyCode; | ||
37 | - } | ||
38 | - | ||
39 | - public void setCurrencyCode(String currencyCode) { | ||
40 | - this.currencyCode = currencyCode; | ||
41 | - } | ||
42 | - | ||
43 | - public String getCurrencyName() { | ||
44 | - return currencyName; | ||
45 | - } | ||
46 | - | ||
47 | - public void setCurrencyName(String currencyName) { | ||
48 | - this.currencyName = currencyName; | ||
49 | - } | ||
50 | - | ||
51 | - public BigDecimal getCurrencyRate() { | ||
52 | - return currencyRate; | ||
53 | - } | ||
54 | - | ||
55 | - public void setCurrencyRate(BigDecimal currencyRate) { | ||
56 | - this.currencyRate = currencyRate; | ||
57 | - } | ||
58 | - | ||
59 | - public String getBaseCurrency() { | ||
60 | - return baseCurrency; | ||
61 | - } | ||
62 | - | ||
63 | - public void setBaseCurrency(String baseCurrency) { | ||
64 | - this.baseCurrency = baseCurrency; | ||
65 | - } | ||
66 | - | ||
67 | - public Integer getCreateBy() { | ||
68 | - return createBy; | ||
69 | - } | ||
70 | - | ||
71 | - public void setCreateBy(Integer createBy) { | ||
72 | - this.createBy = createBy; | ||
73 | - } | ||
74 | - | ||
75 | - public Date getCreateTime() { | ||
76 | - return createTime; | ||
77 | - } | ||
78 | - | ||
79 | - public void setCreateTime(Date createTime) { | ||
80 | - this.createTime = createTime; | ||
81 | - } | ||
82 | - | ||
83 | - public String getUpdateBy() { | ||
84 | - return updateBy; | ||
85 | - } | ||
86 | - | ||
87 | - public void setUpdateBy(String updateBy) { | ||
88 | - this.updateBy = updateBy; | ||
89 | - } | ||
90 | - | ||
91 | - public Date getUpdateTime() { | ||
92 | - return updateTime; | ||
93 | - } | ||
94 | - | ||
95 | - public void setUpdateTime(Date updateTime) { | ||
96 | - this.updateTime = updateTime; | ||
97 | - } | ||
98 | - | ||
99 | - public String getDataStatus() { | ||
100 | - return dataStatus; | ||
101 | - } | ||
102 | - | ||
103 | - public void setDataStatus(String dataStatus) { | ||
104 | - this.dataStatus = dataStatus; | ||
105 | - } | ||
106 | - | ||
107 | - public Integer getAuditBy() { | ||
108 | - return auditBy; | ||
109 | - } | ||
110 | - | ||
111 | - public void setAuditBy(Integer auditBy) { | ||
112 | - this.auditBy = auditBy; | ||
113 | - } | ||
114 | - | ||
115 | - public String getAuditStatus() { | ||
116 | - return auditStatus; | ||
117 | - } | ||
118 | - | ||
119 | - public void setAuditStatus(String auditStatus) { | ||
120 | - this.auditStatus = auditStatus; | ||
121 | - } | ||
122 | - | ||
123 | - public Date getAuditTime() { | ||
124 | - return auditTime; | ||
125 | - } | ||
126 | - | ||
127 | - public void setAuditTime(Date auditTime) { | ||
128 | - this.auditTime = auditTime; | ||
129 | - } | ||
130 | - | ||
131 | - public String getCurrencySymbol() { | ||
132 | - return currencySymbol; | ||
133 | - } | ||
134 | - | ||
135 | - public void setCurrencySymbol(String currencySymbol) { | ||
136 | - this.currencySymbol = currencySymbol; | ||
137 | - } | ||
138 | -} |
1 | +package com.aukey.example.entity; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author: wgf | ||
5 | + * @create: 2020-05-13 14:38 | ||
6 | + * @description: | ||
7 | + **/ | ||
8 | +public class LogisticsStockIdMapping { | ||
9 | + private Integer id; | ||
10 | + private Integer baiyiStockId; | ||
11 | + private Integer logisticsStockId; | ||
12 | + | ||
13 | + public Integer getId() { | ||
14 | + return id; | ||
15 | + } | ||
16 | + | ||
17 | + public void setId(Integer id) { | ||
18 | + this.id = id; | ||
19 | + } | ||
20 | + | ||
21 | + public Integer getBaiyiStockId() { | ||
22 | + return baiyiStockId; | ||
23 | + } | ||
24 | + | ||
25 | + public void setBaiyiStockId(Integer baiyiStockId) { | ||
26 | + this.baiyiStockId = baiyiStockId; | ||
27 | + } | ||
28 | + | ||
29 | + public Integer getLogisticsStockId() { | ||
30 | + return logisticsStockId; | ||
31 | + } | ||
32 | + | ||
33 | + public void setLogisticsStockId(Integer logisticsStockId) { | ||
34 | + this.logisticsStockId = logisticsStockId; | ||
35 | + } | ||
36 | +} |
@@ -3,6 +3,7 @@ package com.aukey.example.util; | @@ -3,6 +3,7 @@ package com.aukey.example.util; | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.alibaba.fastjson.JSONReader; | 4 | import com.alibaba.fastjson.JSONReader; |
5 | import com.alibaba.fastjson.TypeReference; | 5 | import com.alibaba.fastjson.TypeReference; |
6 | +import com.aukey.example.constant.ServiceCodeEnum; | ||
6 | import com.aukey.example.vo.DwParamVo; | 7 | import com.aukey.example.vo.DwParamVo; |
7 | import com.aukey.example.web.TokenController; | 8 | import com.aukey.example.web.TokenController; |
8 | import okhttp3.OkHttpClient; | 9 | import okhttp3.OkHttpClient; |
@@ -46,6 +47,7 @@ public class DwHelperUtil { | @@ -46,6 +47,7 @@ public class DwHelperUtil { | ||
46 | /** | 47 | /** |
47 | * http请求默认超时为7200秒 | 48 | * http请求默认超时为7200秒 |
48 | * 可根据同步数据大小自行设置超时时间 | 49 | * 可根据同步数据大小自行设置超时时间 |
50 | + * | ||
49 | * @return | 51 | * @return |
50 | */ | 52 | */ |
51 | public static OkHttpClient getClient() { | 53 | public static OkHttpClient getClient() { |
@@ -134,12 +136,12 @@ public class DwHelperUtil { | @@ -134,12 +136,12 @@ public class DwHelperUtil { | ||
134 | 136 | ||
135 | /** | 137 | /** |
136 | * @param dwDoMain 数据仓库域名 | 138 | * @param dwDoMain 数据仓库域名 |
137 | - * @param api 数据仓库申请的API | 139 | + * @param serviceCodeEnum 服务编码 |
138 | * @param params 参数 | 140 | * @param params 参数 |
139 | * @return | 141 | * @return |
140 | */ | 142 | */ |
141 | - public static String doGet(String dwDoMain, String api, Map<String, Object> params) { | ||
142 | - return doGet(dwDoMain + api, params); | 143 | + public static String doGet(String dwDoMain, ServiceCodeEnum serviceCodeEnum, Map<String, Object> params) { |
144 | + return doGet(String.format("%s/%s", dwDoMain, serviceCodeEnum.getServiceCode()), params); | ||
143 | } | 145 | } |
144 | 146 | ||
145 | 147 | ||
@@ -190,14 +192,14 @@ public class DwHelperUtil { | @@ -190,14 +192,14 @@ public class DwHelperUtil { | ||
190 | * | 192 | * |
191 | * @param callBack 回调方法,需要返回总页数 | 193 | * @param callBack 回调方法,需要返回总页数 |
192 | * @param dwDataApi dw获取数据接口 | 194 | * @param dwDataApi dw获取数据接口 |
193 | - * @param api 申请的api | 195 | + * @param serviceCodeEnum 服务编码 |
194 | * @param paramVo 请求参数 | 196 | * @param paramVo 请求参数 |
195 | * @param typeReference json字符串转实体引用类型 | 197 | * @param typeReference json字符串转实体引用类型 |
196 | * @param <T> | 198 | * @param <T> |
197 | */ | 199 | */ |
198 | public static <T> void pageReader(Function<T, Integer> callBack, | 200 | public static <T> void pageReader(Function<T, Integer> callBack, |
199 | String dwDataApi, | 201 | String dwDataApi, |
200 | - String api, | 202 | + ServiceCodeEnum serviceCodeEnum, |
201 | DwParamVo paramVo, | 203 | DwParamVo paramVo, |
202 | TypeReference<T> typeReference) { | 204 | TypeReference<T> typeReference) { |
203 | 205 | ||
@@ -213,9 +215,9 @@ public class DwHelperUtil { | @@ -213,9 +215,9 @@ public class DwHelperUtil { | ||
213 | paramVo.setToken(TokenController.getCurrentToken()); | 215 | paramVo.setToken(TokenController.getCurrentToken()); |
214 | paramVo.setPageNumber(currentPageNumber); | 216 | paramVo.setPageNumber(currentPageNumber); |
215 | 217 | ||
216 | - String jsonStr = DwHelperUtil.doGet(dwDataApi, api, paramVo.toMap()); | 218 | + String jsonStr = DwHelperUtil.doGet(dwDataApi, serviceCodeEnum, paramVo.toMap()); |
217 | if (StringUtils.isEmpty(jsonStr)) { | 219 | if (StringUtils.isEmpty(jsonStr)) { |
218 | - throw new RuntimeException(String.format("API %s 调用失败", dwDataApi + api)); | 220 | + throw new RuntimeException(String.format("API %s 调用失败", serviceCodeEnum.getServiceCode())); |
219 | } | 221 | } |
220 | 222 | ||
221 | // json解析为对象 | 223 | // json解析为对象 |
@@ -228,7 +230,7 @@ public class DwHelperUtil { | @@ -228,7 +230,7 @@ public class DwHelperUtil { | ||
228 | totalPageNum = calculatePage(total, paramVo.getPageSize()); | 230 | totalPageNum = calculatePage(total, paramVo.getPageSize()); |
229 | } | 231 | } |
230 | 232 | ||
231 | - log.info("========== 获取API:{} 第:{}页数据 ==========", dwDataApi + api, currentPageNumber); | 233 | + log.info("========== 获取API:{} 第:{}页数据 ==========", serviceCodeEnum.getServiceCode(), currentPageNumber); |
232 | } while (currentPageNumber < totalPageNum); | 234 | } while (currentPageNumber < totalPageNum); |
233 | } | 235 | } |
234 | 236 | ||
@@ -256,20 +258,21 @@ public class DwHelperUtil { | @@ -256,20 +258,21 @@ public class DwHelperUtil { | ||
256 | * 流式读取 | 258 | * 流式读取 |
257 | * | 259 | * |
258 | * @param dwDataApi dw数据请求接口 | 260 | * @param dwDataApi dw数据请求接口 |
259 | - * @param api 平台申请的api | 261 | + * @param serviceCodeEnum 服务编码 |
260 | * @param paramMap 参数 | 262 | * @param paramMap 参数 |
261 | * @param callback 业务回调 | 263 | * @param callback 业务回调 |
262 | * @param batchSize 业务回调数据量大小,参考值 [500,5000] | 264 | * @param batchSize 业务回调数据量大小,参考值 [500,5000] |
263 | * @param constructor 实体的构造函数 | 265 | * @param constructor 实体的构造函数 |
264 | * @throws Exception | 266 | * @throws Exception |
265 | */ | 267 | */ |
266 | - public static <T> void streamReader(String dwDataApi, String api, | 268 | + public static <T> void streamReader(String dwDataApi, |
269 | + ServiceCodeEnum serviceCodeEnum, | ||
267 | Map<String, Object> paramMap, | 270 | Map<String, Object> paramMap, |
268 | Consumer<List<T>> callback, | 271 | Consumer<List<T>> callback, |
269 | int batchSize, | 272 | int batchSize, |
270 | Supplier<T> constructor) throws Exception { | 273 | Supplier<T> constructor) throws Exception { |
271 | 274 | ||
272 | - dwDataApi = dwDataApi + api; | 275 | + dwDataApi = String.format("%s/%s", dwDataApi, serviceCodeEnum.getServiceCode()); |
273 | Response response = null; | 276 | Response response = null; |
274 | InputStream is = null; | 277 | InputStream is = null; |
275 | GZIPInputStream gzipInputStream = null; | 278 | GZIPInputStream gzipInputStream = null; |
@@ -2,9 +2,9 @@ package com.aukey.example.web; | @@ -2,9 +2,9 @@ package com.aukey.example.web; | ||
2 | 2 | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.alibaba.fastjson.TypeReference; | 4 | import com.alibaba.fastjson.TypeReference; |
5 | -import com.aukey.example.constant.DwApi; | ||
6 | -import com.aukey.example.entity.CurrencySet; | 5 | +import com.aukey.example.constant.ServiceCodeEnum; |
7 | import com.aukey.example.entity.FulfillmentCurrentInventory; | 6 | import com.aukey.example.entity.FulfillmentCurrentInventory; |
7 | +import com.aukey.example.entity.LogisticsStockIdMapping; | ||
8 | import com.aukey.example.util.DwHelperUtil; | 8 | import com.aukey.example.util.DwHelperUtil; |
9 | import com.aukey.example.vo.DwParamVo; | 9 | import com.aukey.example.vo.DwParamVo; |
10 | import com.aukey.example.vo.DwResultVo; | 10 | import com.aukey.example.vo.DwResultVo; |
@@ -60,19 +60,19 @@ public class TestApiController { | @@ -60,19 +60,19 @@ public class TestApiController { | ||
60 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); | 60 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); |
61 | 61 | ||
62 | // 添加查询条件 | 62 | // 添加查询条件 |
63 | - paramVo.setQueryCondition("WHERE currency_code = 'USD'"); | 63 | + paramVo.setQueryCondition("WHERE id = 1"); |
64 | // 每页数据条数 dw服务端有限制 取值[1, 3000] | 64 | // 每页数据条数 dw服务端有限制 取值[1, 3000] |
65 | paramVo.setPageSize(3000); | 65 | paramVo.setPageSize(3000); |
66 | paramVo.setDataStructure(DwParamVo.OBJ); | 66 | paramVo.setDataStructure(DwParamVo.OBJ); |
67 | 67 | ||
68 | // 调用API | 68 | // 调用API |
69 | - String result = DwHelperUtil.doGet(dwDataApi, DwApi.CURRENCY_SET_API, paramVo.toMap()); | 69 | + String result = DwHelperUtil.doGet(dwDataApi, ServiceCodeEnum.logistics_stock_id_mapping, paramVo.toMap()); |
70 | 70 | ||
71 | if (StringUtils.isEmpty(result)) { | 71 | if (StringUtils.isEmpty(result)) { |
72 | - throw new RuntimeException(String.format("API %s 调用失败", DwApi.CURRENCY_SET_API)); | 72 | + throw new RuntimeException(String.format("API %s 调用失败", ServiceCodeEnum.logistics_stock_id_mapping.getServiceCode())); |
73 | } | 73 | } |
74 | // json解析为对象 | 74 | // json解析为对象 |
75 | - DwResultVo<ObjVo<CurrencySet>> resultVo = JSON.parseObject(result, new TypeReference<DwResultVo<ObjVo<CurrencySet>>>() { | 75 | + DwResultVo<ObjVo<LogisticsStockIdMapping>> resultVo = JSON.parseObject(result, new TypeReference<DwResultVo<ObjVo<LogisticsStockIdMapping>>>() { |
76 | }); | 76 | }); |
77 | 77 | ||
78 | log.info(""); | 78 | log.info(""); |
@@ -91,16 +91,16 @@ public class TestApiController { | @@ -91,16 +91,16 @@ public class TestApiController { | ||
91 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); | 91 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); |
92 | 92 | ||
93 | // 添加查询条件 | 93 | // 添加查询条件 |
94 | - paramVo.setQueryCondition("WHERE currency_code = 'USD'"); | 94 | + paramVo.setQueryCondition("WHERE id < 1000"); |
95 | // 每页数据条数 dw服务端有限制 取值[1, 3000] | 95 | // 每页数据条数 dw服务端有限制 取值[1, 3000] |
96 | paramVo.setPageSize(3000); | 96 | paramVo.setPageSize(3000); |
97 | paramVo.setDataStructure(DwParamVo.SL); | 97 | paramVo.setDataStructure(DwParamVo.SL); |
98 | 98 | ||
99 | // 调用API | 99 | // 调用API |
100 | - String result = DwHelperUtil.doGet(dwDataApi, DwApi.CURRENCY_SET_API, paramVo.toMap()); | 100 | + String result = DwHelperUtil.doGet(dwDataApi, ServiceCodeEnum.logistics_stock_id_mapping, paramVo.toMap()); |
101 | 101 | ||
102 | if (StringUtils.isEmpty(result)) { | 102 | if (StringUtils.isEmpty(result)) { |
103 | - throw new RuntimeException(String.format("API %s 调用失败", DwApi.CURRENCY_SET_API)); | 103 | + throw new RuntimeException(String.format("API %s 调用失败", ServiceCodeEnum.logistics_stock_id_mapping.getServiceCode())); |
104 | } | 104 | } |
105 | 105 | ||
106 | // json解析为对象 | 106 | // json解析为对象 |
@@ -127,17 +127,17 @@ public class TestApiController { | @@ -127,17 +127,17 @@ public class TestApiController { | ||
127 | // 构造请求参数 | 127 | // 构造请求参数 |
128 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); | 128 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); |
129 | // 每页数据条数 dw服务端有限制 取值[1, 3000] | 129 | // 每页数据条数 dw服务端有限制 取值[1, 3000] |
130 | - paramVo.setPageSize(1000); | 130 | + paramVo.setPageSize(100); |
131 | paramVo.setDataStructure(DwParamVo.OBJ); | 131 | paramVo.setDataStructure(DwParamVo.OBJ); |
132 | // TODO 自定义查询条件 | 132 | // TODO 自定义查询条件 |
133 | 133 | ||
134 | // json字符串转实体引用类型 | 134 | // json字符串转实体引用类型 |
135 | - TypeReference typeReference = new TypeReference<DwResultVo<ObjVo<CurrencySet>>>() { | 135 | + TypeReference typeReference = new TypeReference<DwResultVo<ObjVo<LogisticsStockIdMapping>>>() { |
136 | }; | 136 | }; |
137 | 137 | ||
138 | // 回调函数 | 138 | // 回调函数 |
139 | - Function<DwResultVo<ObjVo<CurrencySet>>, Integer> callback = (DwResultVo<ObjVo<CurrencySet>> resultVo) -> { | ||
140 | - List<CurrencySet> dataList = resultVo.getData().getData(); | 139 | + Function<DwResultVo<ObjVo<LogisticsStockIdMapping>>, Integer> callback = (DwResultVo<ObjVo<LogisticsStockIdMapping>> resultVo) -> { |
140 | + List<LogisticsStockIdMapping> dataList = resultVo.getData().getData(); | ||
141 | System.out.println(dataList.size()); | 141 | System.out.println(dataList.size()); |
142 | // TODO 业务逻辑在这里实现 | 142 | // TODO 业务逻辑在这里实现 |
143 | // ... more | 143 | // ... more |
@@ -150,7 +150,7 @@ public class TestApiController { | @@ -150,7 +150,7 @@ public class TestApiController { | ||
150 | // 使用分页API | 150 | // 使用分页API |
151 | DwHelperUtil.pageReader(callback, | 151 | DwHelperUtil.pageReader(callback, |
152 | dwDataApi, | 152 | dwDataApi, |
153 | - DwApi.CURRENCY_SET_API, | 153 | + ServiceCodeEnum.logistics_stock_id_mapping, |
154 | paramVo, | 154 | paramVo, |
155 | typeReference); | 155 | typeReference); |
156 | } | 156 | } |
@@ -167,7 +167,7 @@ public class TestApiController { | @@ -167,7 +167,7 @@ public class TestApiController { | ||
167 | // 构造请求参数 | 167 | // 构造请求参数 |
168 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); | 168 | DwParamVo paramVo = new DwParamVo(this.appId, TokenController.getCurrentToken()); |
169 | // 每页数据条数 dw服务端有限制 取值[1, 3000] | 169 | // 每页数据条数 dw服务端有限制 取值[1, 3000] |
170 | - paramVo.setPageSize(1000); | 170 | + paramVo.setPageSize(100); |
171 | paramVo.setDataStructure(DwParamVo.SL); | 171 | paramVo.setDataStructure(DwParamVo.SL); |
172 | // TODO 自定义查询条件 | 172 | // TODO 自定义查询条件 |
173 | 173 | ||
@@ -190,7 +190,7 @@ public class TestApiController { | @@ -190,7 +190,7 @@ public class TestApiController { | ||
190 | // 使用分页API | 190 | // 使用分页API |
191 | DwHelperUtil.pageReader(callback, | 191 | DwHelperUtil.pageReader(callback, |
192 | dwDataApi, | 192 | dwDataApi, |
193 | - DwApi.CURRENCY_SET_API, | 193 | + ServiceCodeEnum.logistics_stock_id_mapping, |
194 | paramVo, | 194 | paramVo, |
195 | typeReference); | 195 | typeReference); |
196 | } | 196 | } |
@@ -231,10 +231,10 @@ public class TestApiController { | @@ -231,10 +231,10 @@ public class TestApiController { | ||
231 | // TODO 自定义查询条件 | 231 | // TODO 自定义查询条件 |
232 | 232 | ||
233 | // 定义实体构造函数 | 233 | // 定义实体构造函数 |
234 | - Supplier<FulfillmentCurrentInventory> constructor = FulfillmentCurrentInventory::new; | 234 | + Supplier<LogisticsStockIdMapping> constructor = LogisticsStockIdMapping::new; |
235 | 235 | ||
236 | // 流式读取回调函数 | 236 | // 流式读取回调函数 |
237 | - Consumer<List<FulfillmentCurrentInventory>> callBack = (List<FulfillmentCurrentInventory> list) -> { | 237 | + Consumer<List<LogisticsStockIdMapping>> callBack = (List<LogisticsStockIdMapping> list) -> { |
238 | System.out.println(list.size()); | 238 | System.out.println(list.size()); |
239 | // TODO 业务逻辑在这里实现 | 239 | // TODO 业务逻辑在这里实现 |
240 | // ... more | 240 | // ... more |
@@ -243,12 +243,12 @@ public class TestApiController { | @@ -243,12 +243,12 @@ public class TestApiController { | ||
243 | 243 | ||
244 | // 指定回调函数数据大小,取值[1000, 3000]. 建议1000最为稳定 | 244 | // 指定回调函数数据大小,取值[1000, 3000]. 建议1000最为稳定 |
245 | // 取值越大,数据读取占用的堆内存越高 | 245 | // 取值越大,数据读取占用的堆内存越高 |
246 | - int batchSize = 1000; | 246 | + int batchSize = 100; |
247 | 247 | ||
248 | // 使用 StreamAPI | 248 | // 使用 StreamAPI |
249 | DwHelperUtil.streamReader( | 249 | DwHelperUtil.streamReader( |
250 | dwDataApi, | 250 | dwDataApi, |
251 | - DwApi.FULFILLMENT_CURRENT_INVENTORY, | 251 | + ServiceCodeEnum.logistics_stock_id_mapping, |
252 | paramVo.toMap(), | 252 | paramVo.toMap(), |
253 | callBack, | 253 | callBack, |
254 | batchSize, | 254 | batchSize, |
-
请 注册 或 登录 后发表评论