...
|
...
|
@@ -7,8 +7,15 @@ import java.util.stream.Collectors; |
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.sun.org.apache.xpath.internal.operations.Bool;
|
|
|
import com.yoho.tools.common.beans.ApiResponse;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderCodeType;
|
|
|
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
|
|
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
|
|
import com.yohoufo.common.constant.OrderConfigConstant;
|
|
|
import com.yohoufo.common.utils.QiniuLiveUrlUtil;
|
|
|
import com.yohoufo.dal.order.*;
|
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
...
|
...
|
@@ -41,18 +48,6 @@ import com.yohoufo.common.helper.ImageUrlAssist; |
|
|
import com.yohoufo.common.redis.NoSyncGracefulRedisTemplate;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.common.utils.MobileHelper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.OrderOperateRecordMapper;
|
|
|
import com.yohoufo.dal.order.OrdersPayMapper;
|
|
|
import com.yohoufo.dal.order.QiniuLiveRecordMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.OrderOperateRecord;
|
|
|
import com.yohoufo.dal.order.model.OrdersPay;
|
|
|
import com.yohoufo.dal.order.model.QiniuLiveRecord;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.dal.product.IdentifyRecordsMapper;
|
|
|
import com.yohoufo.dal.product.IdentifyRelationMapper;
|
|
|
import com.yohoufo.dal.product.ProductChainMapper;
|
...
|
...
|
@@ -128,6 +123,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
|
|
|
@Autowired
|
|
|
private UserInfoProxyService userInfoProxyService;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderMapper appraiseOrderMapper;
|
|
|
@Autowired
|
|
|
private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
|
|
|
@Autowired
|
|
|
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ProductMapper productMapper;
|
...
|
...
|
@@ -151,6 +153,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
private String syncBlockChain_url;
|
|
|
|
|
|
@Autowired
|
|
|
UfoServiceCaller ufoServiceCaller;
|
|
|
|
|
|
@Autowired
|
|
|
OrderConfigConstant orderConfigConstant;
|
|
|
|
|
|
private static final String UIC_PROFILE_URL = "/profile/getProfile";
|
...
|
...
|
@@ -207,14 +212,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
}
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//2)订单号 获取订单详细信息
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if(buyerOrder == null){
|
|
|
Map<String, Object> infoMap = getProductInfo(orderCode);
|
|
|
Integer orderStatus = (Integer) (infoMap.get("status"));//5--订单已经完成
|
|
|
if(orderStatus == null){
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
Integer buyerUid = buyerOrder.getUid();//买家
|
|
|
Integer buyerUid = (Integer) (infoMap.get("uid"));
|
|
|
// Integer sellerUid = buyerOrder.getSellerUid();//卖家
|
|
|
Integer orderStatus = buyerOrder.getStatus();//5--订单已经完成
|
|
|
|
|
|
//去获取用户的基本信息(头像等 不要去取此接口的手机号!))--异步
|
|
|
AsyncFuture<UserInfoRspBO> userInfoRspBOAsyncFuture = getUserBaseInfo(buyerUid);
|
...
|
...
|
@@ -222,15 +226,11 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
AsyncFuture<UicResponse> uicResponseAsyncFuture = getProfileInfo(buyerUid);
|
|
|
|
|
|
//3)订单号获取 skup
|
|
|
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
|
|
|
Integer skup = buyerOrderGoods.getSkup();
|
|
|
//3)skup获取 productInfo
|
|
|
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
result.setProductImageUrl(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
|
|
|
result.setProductImageUrl((String) infoMap.get("image"));
|
|
|
result.setNfcUid(identifyRecord.getNfcUid());
|
|
|
result.setProductId(sellerOrderGoods.getProductId());
|
|
|
result.setProductName(sellerOrderGoods.getProductName());
|
|
|
result.setProductSize(sellerOrderGoods.getSizeName());
|
|
|
result.setProductId((Integer) infoMap.get("productId"));
|
|
|
result.setProductName((String) infoMap.get("productName"));
|
|
|
result.setProductSize((String) infoMap.get("size"));
|
|
|
|
|
|
//4)vedioFileUrl视频链接
|
|
|
String vedioFileUrl = getLiveVideoUrlByOrderCode(orderCode);
|
...
|
...
|
@@ -280,8 +280,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
//2)订单完成
|
|
|
if(orderStatus != null && orderStatus.intValue() == 5){//订单已完成
|
|
|
IdentifyTrackResp updateOrderTrack = new IdentifyTrackResp();
|
|
|
timeStr = formatDate(buyerOrder.getUpdateTime(), "yyyy.MM.dd HH:mm:ss");
|
|
|
updateOrderTrack.setTime(buyerOrder.getUpdateTime());
|
|
|
Integer updateTime = (Integer) infoMap.get("updateTime");
|
|
|
timeStr = formatDate(updateTime, "yyyy.MM.dd HH:mm:ss");
|
|
|
updateOrderTrack.setTime(updateTime);
|
|
|
updateOrderTrack.setTimeStr(timeStr);
|
|
|
updateOrderTrack.setContent("用户" + mobileMask + "成为商品物权所有人");
|
|
|
updateOrderTrack.setHeadIcon(headIcon);
|
...
|
...
|
@@ -344,14 +345,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//2)订单号 获取订单详细信息
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if(buyerOrder == null){
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
|
|
|
//3)商品详细信息
|
|
|
result = getOrderDetail(buyerOrder, identifyRecord, tagId);
|
|
|
result = getOrderDetail(orderCode, identifyRecord, tagId);
|
|
|
|
|
|
//4)物权转移轨迹
|
|
|
List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat());
|
...
|
...
|
@@ -391,14 +387,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//2)订单号 获取订单详细信息
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if(buyerOrder == null){
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
|
|
|
//3)商品详细信息
|
|
|
ProductIdentifyResp result = getOrderDetail(buyerOrder, identifyRecord, tagId);
|
|
|
ProductIdentifyResp result = getOrderDetail(orderCode, identifyRecord, tagId);
|
|
|
|
|
|
//4)物权转移轨迹
|
|
|
List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat());
|
...
|
...
|
@@ -441,11 +432,17 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//获取订单详细信息
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if(buyerOrder == null){
|
|
|
Object buyerOrder;
|
|
|
if (isServiceOrder(orderCode)) {
|
|
|
//获取订单详细信息
|
|
|
buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
} else {
|
|
|
buyerOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
}
|
|
|
if (buyerOrder == null) {
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
|
|
|
//向物权所有人发短信、站内信
|
|
|
messageFacade.applyToBeOwner(insertItem.getFromUid(), String.valueOf(uid), tagId, nfcUid, orderCode);
|
|
|
|
...
|
...
|
@@ -728,22 +725,24 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
}
|
|
|
|
|
|
//获取订单详情
|
|
|
private ProductIdentifyResp getOrderDetail(BuyerOrder buyerOrder, IdentifyRecord identifyRecord, String tagId) {
|
|
|
private ProductIdentifyResp getOrderDetail(Long orderCode, IdentifyRecord identifyRecord, String tagId) throws GatewayException {
|
|
|
ProductIdentifyResp result = new ProductIdentifyResp();
|
|
|
|
|
|
//3)订单号获取 skup
|
|
|
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(buyerOrder.getOrderCode());
|
|
|
Integer skup = buyerOrderGoods.getSkup();
|
|
|
//3)skup获取 productInfo
|
|
|
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
result.setProductImageUrl(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
|
|
|
Map<String, Object> infoMap = getProductInfo(orderCode);
|
|
|
Integer orderStatus = (Integer) (infoMap.get("status"));//5--订单已经完成
|
|
|
if(orderStatus == null){
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
Integer buyerUid = (Integer) (infoMap.get("uid"));
|
|
|
|
|
|
result.setProductImageUrl((String) infoMap.get("image"));
|
|
|
result.setNfcUid(identifyRecord.getNfcUid());
|
|
|
result.setProductId(sellerOrderGoods.getProductId());
|
|
|
result.setProductName(sellerOrderGoods.getProductName());
|
|
|
result.setProductSize(sellerOrderGoods.getSizeName());
|
|
|
result.setProductId((Integer) infoMap.get("productId"));
|
|
|
result.setProductName((String) infoMap.get("productName"));
|
|
|
result.setProductSize((String) infoMap.get("size"));
|
|
|
|
|
|
//4)vedioFileUrl视频链接
|
|
|
String vedioFileUrl = getLiveVideoUrlByOrderCode(buyerOrder.getOrderCode());
|
|
|
String vedioFileUrl = getLiveVideoUrlByOrderCode(orderCode);
|
|
|
result.setVedioFileUrl(vedioFileUrl);
|
|
|
|
|
|
//查询区块链id
|
...
|
...
|
@@ -758,7 +757,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
// result.setIdentifyTime(timeStr);
|
|
|
|
|
|
//查询鉴定师名字
|
|
|
OrderOperateRecord orderOperateRecord = orderOperateRecordMapper.selectByTypeAndOrderCode(OperateTypeEnum.OPERATE_TYPE_JUDGE_PASS.getCode(), buyerOrder.getOrderCode());
|
|
|
OrderOperateRecord orderOperateRecord = orderOperateRecordMapper.selectByTypeAndOrderCode(OperateTypeEnum.OPERATE_TYPE_JUDGE_PASS.getCode(), orderCode);
|
|
|
result.setIdentifyUserName(null == orderOperateRecord ? "" : orderOperateRecord.getUserName());
|
|
|
|
|
|
return result;
|
...
|
...
|
@@ -819,6 +818,55 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getProductInfo(Long orderCode) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
if (isServiceOrder(orderCode)) {
|
|
|
AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode);
|
|
|
AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCode(orderCode);
|
|
|
resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
|
|
|
resultMap.put("productId", goods == null ? "" : goods.getProductId());
|
|
|
resultMap.put("productName", goods == null ? "" : goods.getProductName());
|
|
|
resultMap.put("productCode", goods == null ? "" : goods.getProductCode());
|
|
|
resultMap.put("size", storage == null ? "" : storage.getSizeName());
|
|
|
resultMap.put("color", storage == null ? "" : storage.getColorName());
|
|
|
resultMap.put("uid", order == null ? "" : order.getUid());
|
|
|
} else {
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if (buyerOrder != null) {
|
|
|
resultMap.put("status", buyerOrder.getStatus());
|
|
|
resultMap.put("updateTime", buyerOrder.getUpdateTime());
|
|
|
}
|
|
|
//订单号获取 skup
|
|
|
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
|
|
|
Integer skup = buyerOrderGoods.getSkup();
|
|
|
//skup获取 productInfo
|
|
|
SellerOrderGoods goods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
|
|
|
resultMap.put("productId", goods == null ? "" : goods.getProductId());
|
|
|
resultMap.put("productName", goods == null ? "" : goods.getProductName());
|
|
|
resultMap.put("size", goods == null ? "" : goods.getSizeName());
|
|
|
resultMap.put("color", goods == null ? "" : goods.getColorName());
|
|
|
resultMap.put("uid", buyerOrderGoods == null ? "" : buyerOrderGoods.getUid());
|
|
|
if (goods != null) {
|
|
|
Product productInfo = productMapper.selectByPrimaryKey(goods.getProductId());
|
|
|
resultMap.put("productCode", goods == null ? "" : productInfo.getProductCode());
|
|
|
}
|
|
|
if (!resultMap.containsKey("productCode")) {
|
|
|
resultMap.put("productCode", "");
|
|
|
}
|
|
|
}
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
private boolean isServiceOrder(long orderCode) {
|
|
|
ApiResponse<Boolean> resp = ufoServiceCaller.call("ufo.order.isServiceOrder", ApiResponse.class, orderCode);
|
|
|
if (resp != null) {
|
|
|
return (Boolean) resp.getData();
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取鉴定者 所在的鉴定中心名
|
...
|
...
|
|