...
|
...
|
@@ -335,6 +335,47 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException {
|
|
|
logger.info("enter queryNewIdentifyInfo, tagId = {}, nfcUid={}", tagId, nfcUid);
|
|
|
//返回结果可能在缓存中
|
|
|
ProductIdentifyResp result = getNewIdentifyFromCache(tagId, nfcUid);
|
|
|
if(result != null ){
|
|
|
logger.info("queryIdentifyInfoForPlatform get result from cache success! tagId = {}, nfcUid={}, result={} ", tagId, nfcUid, result);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//1)鉴定 记录--先从缓存去取
|
|
|
IdentifyRecord identifyRecord = queryIdentifyRecord(tagId, nfcUid);
|
|
|
if(identifyRecord == null){
|
|
|
throw new GatewayException(402, "鉴定信息不存在");
|
|
|
}
|
|
|
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//2)订单号 获取订单详细信息
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if(buyerOrder == null){
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
|
|
|
//3)商品详细信息
|
|
|
result = getOrderDetail(buyerOrder, identifyRecord, tagId);
|
|
|
|
|
|
//4)物权转移轨迹
|
|
|
List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat());
|
|
|
result.setTrackList(trackList);
|
|
|
|
|
|
//5)设置当前物权所有人
|
|
|
result.setCurrentOwner(trackList.get(trackList.size()-1).getContent());
|
|
|
|
|
|
//设置缓存--可能会有延时,不影响的
|
|
|
setNewIdentifyCache(tagId, nfcUid, result);
|
|
|
|
|
|
logger.info("queryIdentifyInfoForPlatform success!, tagId = {}, nfcUid={}, result ={}", tagId, nfcUid, result );
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int applyToBeOwner(String tagId, String nfcUid, Integer uid) throws GatewayException {
|
|
|
IdentifyRecord identifyRecord = queryIdentifyRecord(tagId, nfcUid);
|
|
|
if(identifyRecord == null){
|
...
|
...
|
@@ -716,7 +757,6 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
}
|
|
|
|
|
|
private void setNewIdentifyCache(String tagId, String nfcUid, ProductIdentifyResp result) {
|
|
|
|
|
|
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:newIdentifyResultInfo:").
|
|
|
appendVar(tagId).appendVar(":").appendVar(nfcUid);
|
|
|
clientCache.setEx(kb, result,5 * 60 );
|
...
|
...
|
|