Authored by mali

鉴定视频生成的时候 通过查询订单来判断鉴定结果

... ... @@ -31,7 +31,7 @@ public class AppraiseOrder implements Serializable {
private BigDecimal shipFee;
private Byte status;
private Integer status;
private Integer createTime;
... ... @@ -149,11 +149,11 @@ public class AppraiseOrder implements Serializable {
this.attributes = attributes;
}
public Byte getStatus() {
public Integer getStatus() {
return status;
}
public void setStatus(Byte status) {
public void setStatus(Integer status) {
this.status = status;
}
... ...
... ... @@ -47,6 +47,16 @@ public class QiniuLiveRecord {
private Integer orderType; // 订单类型 0 买家订单, 1 鉴定服务
private Integer appraiseResult; // 鉴定结果 1 代表真 0 代表假 2 无法鉴定 3瑕疵 -1 还未有结果
public Integer getAppraiseResult() {
return appraiseResult;
}
public void setAppraiseResult(Integer appraiseResult) {
this.appraiseResult = appraiseResult;
}
public Integer getOrderType() {
return orderType;
}
... ...
package com.yoho.ufo.order.service.event;
import com.google.common.collect.Lists;
import com.yoho.order.dal.BuyerOrderGoodsMapper;
import com.yoho.order.dal.LiveRecordTimeMapper;
import com.yoho.order.dal.QiniuLiveRecordMapper;
import com.yoho.order.dal.SellerOrderGoodsMapper;
import com.yoho.order.dal.*;
import com.yoho.order.model.*;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.order.service.impl.AppraiseOrderGoodsService;
import com.yoho.ufo.order.service.impl.UfoLiveService;
import com.yoho.ufo.util.DateUtil;
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
import com.yohobuy.ufo.model.order.constants.AppraiseResultEnum;
import com.yohobuy.ufo.model.order.req.OrderTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -19,6 +18,7 @@ import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
/**
* Created by li.ma on 2018/12/18.
... ... @@ -48,6 +48,9 @@ public class LiveEventsListener implements ApplicationListener<QiniuLiveRecordEv
@Autowired
private AppraiseOrderGoodsService appraiseOrderGoodsService;
@Autowired
private AppraiseOrderMapper appraiseOrderMapper;
/**
* seller_order_code = #{sellerOrderCode,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=INTEGER},
... ... @@ -97,11 +100,15 @@ public class LiveEventsListener implements ApplicationListener<QiniuLiveRecordEv
SellerOrderGoods sellerOrderGoods = sellerOrderGoodses.get(0);
record.setStorageId(sellerOrderGoods.getStorageId());
record.setProductId(sellerOrderGoods.getProductId());
} else {
} else { // 鉴定订单
record.setStorageId(0);
AppraiseOrderGoods appraiseOrderGoods = appraiseOrderGoodsService.selectByOrderCode(record.getOrderCode());
record.setProductId(null == appraiseOrderGoods ? 0 : appraiseOrderGoods.getProductId());
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(String.valueOf(record.getOrderCode()));
record.setAppraiseResult(getAppraiseResult(appraiseOrder));
}
record.setSellerOrderCode(0L);
... ... @@ -111,6 +118,16 @@ public class LiveEventsListener implements ApplicationListener<QiniuLiveRecordEv
qiniuLiveRecordMapper.updateProductByOrderCode(record);
}
// 根据鉴定订单的状态判断 当前订单鉴定的是真还是假,还是无法鉴定
private Integer getAppraiseResult(AppraiseOrder appraiseOrder) {
return Optional.ofNullable(appraiseOrder)
.map(AppraiseOrder::getStatus)
.map(AppraiseOrderStatus::getByCode)
.map(AppraiseOrderStatus::getAppraiseResultEnum)
.map(AppraiseResultEnum::getCode)
.orElse(AppraiseResultEnum.RESULT_UNKNOWN.getCode());
}
private QiniuLiveRecord convertQiNiuLiveRecord(BuyerOrderReq record) {
QiniuLiveRecord result = new QiniuLiveRecord();
... ...