|
|
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();
|
|
|
|
...
|
...
|
|