|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.yoho.core.config.ConfigReader;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.constants.QNliveConstants;
|
|
|
import com.yohobuy.ufo.model.order.req.OrderTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderVideoResp;
|
|
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
|
|
import com.yohoufo.common.constant.OrderConfigConstant;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.common.utils.QiniuLiveUrlUtil;
|
...
|
...
|
@@ -47,6 +51,9 @@ public class QiniuLiveRecordService { |
|
|
@Autowired
|
|
|
private SellerOrderMapper sellerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private UfoServiceCaller serviceCaller;
|
|
|
|
|
|
public void updateStatusByPersistId(String persistId, Integer code) {
|
|
|
if (Integer.valueOf(0).equals(code)) {
|
|
|
qiniuLiveRecordMapper.updateStatusByPersistId(persistId, 1); // 更新直播记录状态为已转码成功
|
...
|
...
|
@@ -220,4 +227,71 @@ public class QiniuLiveRecordService { |
|
|
orderVideoResp.setInitFlag(Boolean.TRUE);
|
|
|
resps.add(orderVideoResp);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询鉴定服务对应的视频列表
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public List<OrderVideoResp> queryVideoList(Integer page, Integer limit) {
|
|
|
List<QiniuLiveRecord> qiNiuLiveRecords = qiniuLiveRecordMapper.selectByPage(OrderTypeEnum.ORDERTYPE_APPRAISEORDER.getCode(), (page - 1) * limit, limit);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(qiNiuLiveRecords)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
|
|
|
List<Integer> productIdList = qiNiuLiveRecords.stream().map(QiniuLiveRecord::getProductId).collect(Collectors.toList());
|
|
|
|
|
|
// 根据商品Id 查询商品名称和图片
|
|
|
Map<Integer, OrderVideoResp> productInfoMap = getProductInfo(productIdList);
|
|
|
|
|
|
LOG.info("queryVideoList method in productIdList is {}, productInfoMap.keySet is {}", productIdList, productInfoMap.keySet());
|
|
|
|
|
|
List<OrderVideoResp> result = Lists.newArrayList();
|
|
|
|
|
|
qiNiuLiveRecords.stream().forEach(item -> {
|
|
|
OrderVideoResp resp = new OrderVideoResp();
|
|
|
|
|
|
OrderVideoResp orderVideoResp = productInfoMap.get(item.getProductId());
|
|
|
resp.setVideoUrl(item.getVideoUrl());
|
|
|
resp.setProductName(null == orderVideoResp ? "" : orderVideoResp.getProductName());
|
|
|
resp.setProductId(item.getProductId());
|
|
|
resp.setProductPicUrl(null == orderVideoResp ? "" : orderVideoResp.getProductPicUrl());
|
|
|
result.add(resp);
|
|
|
});
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private Map<Integer,OrderVideoResp> getProductInfo(List<Integer> productIds) {
|
|
|
String product_id = StringUtils.join(productIds,",");
|
|
|
int type=7;
|
|
|
int limit = productIds == null ? 0 : productIds.size();
|
|
|
int page=1;
|
|
|
|
|
|
//调用商品接口返回商品list
|
|
|
com.yohoufo.common.ApiResponse productApiResponse = serviceCaller.call("ufo.product.search.list",
|
|
|
type,null, product_id,null
|
|
|
,null,null,null,null,null,null,null
|
|
|
,limit,page,"");
|
|
|
|
|
|
Map<Integer,OrderVideoResp> result = new HashMap<>();
|
|
|
|
|
|
if(productApiResponse != null && productApiResponse.getData() != null){
|
|
|
JSONObject jo=(JSONObject)productApiResponse.getData();
|
|
|
JSONArray product_list = jo.getJSONArray("product_list");
|
|
|
if (null != product_list) {
|
|
|
OrderVideoResp resp;
|
|
|
for (int i = 0; i < product_list.size(); i++) {
|
|
|
JSONObject product = (JSONObject)product_list.get(i);
|
|
|
resp = new OrderVideoResp();
|
|
|
resp.setProductName(product.getString("product_name"));
|
|
|
resp.setProductPicUrl(product.getString("default_images"));
|
|
|
result.put(product.getInteger("id"), resp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
} |
...
|
...
|
|