1
|
package com.yohoufo.order.service.impl;
|
1
|
package com.yohoufo.order.service.impl;
|
2
|
|
2
|
|
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
|
|
4
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
5
|
+import com.alibaba.fastjson.JSONObject;
|
4
|
import com.google.common.collect.Lists;
|
6
|
import com.google.common.collect.Lists;
|
5
|
import com.google.common.collect.Maps;
|
7
|
import com.google.common.collect.Maps;
|
6
|
import com.yoho.core.config.ConfigReader;
|
8
|
import com.yoho.core.config.ConfigReader;
|
7
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
9
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
8
|
import com.yohobuy.ufo.model.order.constants.QNliveConstants;
|
10
|
import com.yohobuy.ufo.model.order.constants.QNliveConstants;
|
|
|
11
|
+import com.yohobuy.ufo.model.order.req.OrderTypeEnum;
|
9
|
import com.yohobuy.ufo.model.order.resp.OrderVideoResp;
|
12
|
import com.yohobuy.ufo.model.order.resp.OrderVideoResp;
|
|
|
13
|
+import com.yohoufo.common.caller.UfoServiceCaller;
|
10
|
import com.yohoufo.common.constant.OrderConfigConstant;
|
14
|
import com.yohoufo.common.constant.OrderConfigConstant;
|
11
|
import com.yohoufo.common.utils.DateUtil;
|
15
|
import com.yohoufo.common.utils.DateUtil;
|
12
|
import com.yohoufo.common.utils.QiniuLiveUrlUtil;
|
16
|
import com.yohoufo.common.utils.QiniuLiveUrlUtil;
|
|
@@ -47,6 +51,9 @@ public class QiniuLiveRecordService { |
|
@@ -47,6 +51,9 @@ public class QiniuLiveRecordService { |
47
|
@Autowired
|
51
|
@Autowired
|
48
|
private SellerOrderMapper sellerOrderMapper;
|
52
|
private SellerOrderMapper sellerOrderMapper;
|
49
|
|
53
|
|
|
|
54
|
+ @Autowired
|
|
|
55
|
+ private UfoServiceCaller serviceCaller;
|
|
|
56
|
+
|
50
|
public void updateStatusByPersistId(String persistId, Integer code) {
|
57
|
public void updateStatusByPersistId(String persistId, Integer code) {
|
51
|
if (Integer.valueOf(0).equals(code)) {
|
58
|
if (Integer.valueOf(0).equals(code)) {
|
52
|
qiniuLiveRecordMapper.updateStatusByPersistId(persistId, 1); // 更新直播记录状态为已转码成功
|
59
|
qiniuLiveRecordMapper.updateStatusByPersistId(persistId, 1); // 更新直播记录状态为已转码成功
|
|
@@ -220,4 +227,71 @@ public class QiniuLiveRecordService { |
|
@@ -220,4 +227,71 @@ public class QiniuLiveRecordService { |
220
|
orderVideoResp.setInitFlag(Boolean.TRUE);
|
227
|
orderVideoResp.setInitFlag(Boolean.TRUE);
|
221
|
resps.add(orderVideoResp);
|
228
|
resps.add(orderVideoResp);
|
222
|
}
|
229
|
}
|
|
|
230
|
+
|
|
|
231
|
+ /**
|
|
|
232
|
+ * 查询鉴定服务对应的视频列表
|
|
|
233
|
+ *
|
|
|
234
|
+ * @return
|
|
|
235
|
+ */
|
|
|
236
|
+ public List<OrderVideoResp> queryVideoList(Integer page, Integer limit) {
|
|
|
237
|
+ List<QiniuLiveRecord> qiNiuLiveRecords = qiniuLiveRecordMapper.selectByPage(OrderTypeEnum.ORDERTYPE_APPRAISEORDER.getCode(), (page - 1) * limit, limit);
|
|
|
238
|
+
|
|
|
239
|
+ if (CollectionUtils.isEmpty(qiNiuLiveRecords)) {
|
|
|
240
|
+ return Lists.newArrayList();
|
|
|
241
|
+ }
|
|
|
242
|
+
|
|
|
243
|
+ List<Integer> productIdList = qiNiuLiveRecords.stream().map(QiniuLiveRecord::getProductId).collect(Collectors.toList());
|
|
|
244
|
+
|
|
|
245
|
+ // 根据商品Id 查询商品名称和图片
|
|
|
246
|
+ Map<Integer, OrderVideoResp> productInfoMap = getProductInfo(productIdList);
|
|
|
247
|
+
|
|
|
248
|
+ LOG.info("queryVideoList method in productIdList is {}, productInfoMap.keySet is {}", productIdList, productInfoMap.keySet());
|
|
|
249
|
+
|
|
|
250
|
+ List<OrderVideoResp> result = Lists.newArrayList();
|
|
|
251
|
+
|
|
|
252
|
+ qiNiuLiveRecords.stream().forEach(item -> {
|
|
|
253
|
+ OrderVideoResp resp = new OrderVideoResp();
|
|
|
254
|
+
|
|
|
255
|
+ OrderVideoResp orderVideoResp = productInfoMap.get(item.getProductId());
|
|
|
256
|
+ resp.setVideoUrl(item.getVideoUrl());
|
|
|
257
|
+ resp.setProductName(null == orderVideoResp ? "" : orderVideoResp.getProductName());
|
|
|
258
|
+ resp.setProductId(item.getProductId());
|
|
|
259
|
+ resp.setProductPicUrl(null == orderVideoResp ? "" : orderVideoResp.getProductPicUrl());
|
|
|
260
|
+ result.add(resp);
|
|
|
261
|
+ });
|
|
|
262
|
+
|
|
|
263
|
+ return result;
|
|
|
264
|
+ }
|
|
|
265
|
+
|
|
|
266
|
+ private Map<Integer,OrderVideoResp> getProductInfo(List<Integer> productIds) {
|
|
|
267
|
+ String product_id = StringUtils.join(productIds,",");
|
|
|
268
|
+ int type=7;
|
|
|
269
|
+ int limit = productIds == null ? 0 : productIds.size();
|
|
|
270
|
+ int page=1;
|
|
|
271
|
+
|
|
|
272
|
+ //调用商品接口返回商品list
|
|
|
273
|
+ com.yohoufo.common.ApiResponse productApiResponse = serviceCaller.call("ufo.product.search.list",
|
|
|
274
|
+ type,null, product_id,null
|
|
|
275
|
+ ,null,null,null,null,null,null,null
|
|
|
276
|
+ ,limit,page,"");
|
|
|
277
|
+
|
|
|
278
|
+ Map<Integer,OrderVideoResp> result = new HashMap<>();
|
|
|
279
|
+
|
|
|
280
|
+ if(productApiResponse != null && productApiResponse.getData() != null){
|
|
|
281
|
+ JSONObject jo=(JSONObject)productApiResponse.getData();
|
|
|
282
|
+ JSONArray product_list = jo.getJSONArray("product_list");
|
|
|
283
|
+ if (null != product_list) {
|
|
|
284
|
+ OrderVideoResp resp;
|
|
|
285
|
+ for (int i = 0; i < product_list.size(); i++) {
|
|
|
286
|
+ JSONObject product = (JSONObject)product_list.get(i);
|
|
|
287
|
+ resp = new OrderVideoResp();
|
|
|
288
|
+ resp.setProductName(product.getString("product_name"));
|
|
|
289
|
+ resp.setProductPicUrl(product.getString("default_images"));
|
|
|
290
|
+ result.put(product.getInteger("id"), resp);
|
|
|
291
|
+ }
|
|
|
292
|
+ }
|
|
|
293
|
+ }
|
|
|
294
|
+
|
|
|
295
|
+ return result;
|
|
|
296
|
+ }
|
223
|
} |
297
|
} |