|
@@ -335,6 +335,47 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
@@ -335,6 +335,47 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
335
|
}
|
335
|
}
|
336
|
|
336
|
|
337
|
@Override
|
337
|
@Override
|
|
|
338
|
+ public ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException {
|
|
|
339
|
+ logger.info("enter queryNewIdentifyInfo, tagId = {}, nfcUid={}", tagId, nfcUid);
|
|
|
340
|
+ //返回结果可能在缓存中
|
|
|
341
|
+ ProductIdentifyResp result = getNewIdentifyFromCache(tagId, nfcUid);
|
|
|
342
|
+ if(result != null ){
|
|
|
343
|
+ logger.info("queryIdentifyInfoForPlatform get result from cache success! tagId = {}, nfcUid={}, result={} ", tagId, nfcUid, result);
|
|
|
344
|
+ return result;
|
|
|
345
|
+ }
|
|
|
346
|
+
|
|
|
347
|
+ //1)鉴定 记录--先从缓存去取
|
|
|
348
|
+ IdentifyRecord identifyRecord = queryIdentifyRecord(tagId, nfcUid);
|
|
|
349
|
+ if(identifyRecord == null){
|
|
|
350
|
+ throw new GatewayException(402, "鉴定信息不存在");
|
|
|
351
|
+ }
|
|
|
352
|
+
|
|
|
353
|
+ //根据鉴定记录 获取订单号
|
|
|
354
|
+ Long orderCode = identifyRecord.getOrderCode();
|
|
|
355
|
+ //2)订单号 获取订单详细信息
|
|
|
356
|
+ BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
357
|
+ if(buyerOrder == null){
|
|
|
358
|
+ throw new GatewayException(403, "订单不存在");
|
|
|
359
|
+ }
|
|
|
360
|
+
|
|
|
361
|
+ //3)商品详细信息
|
|
|
362
|
+ result = getOrderDetail(buyerOrder, identifyRecord, tagId);
|
|
|
363
|
+
|
|
|
364
|
+ //4)物权转移轨迹
|
|
|
365
|
+ List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat());
|
|
|
366
|
+ result.setTrackList(trackList);
|
|
|
367
|
+
|
|
|
368
|
+ //5)设置当前物权所有人
|
|
|
369
|
+ result.setCurrentOwner(trackList.get(trackList.size()-1).getContent());
|
|
|
370
|
+
|
|
|
371
|
+ //设置缓存--可能会有延时,不影响的
|
|
|
372
|
+ setNewIdentifyCache(tagId, nfcUid, result);
|
|
|
373
|
+
|
|
|
374
|
+ logger.info("queryIdentifyInfoForPlatform success!, tagId = {}, nfcUid={}, result ={}", tagId, nfcUid, result );
|
|
|
375
|
+ return result;
|
|
|
376
|
+ }
|
|
|
377
|
+
|
|
|
378
|
+ @Override
|
338
|
public int applyToBeOwner(String tagId, String nfcUid, Integer uid) throws GatewayException {
|
379
|
public int applyToBeOwner(String tagId, String nfcUid, Integer uid) throws GatewayException {
|
339
|
IdentifyRecord identifyRecord = queryIdentifyRecord(tagId, nfcUid);
|
380
|
IdentifyRecord identifyRecord = queryIdentifyRecord(tagId, nfcUid);
|
340
|
if(identifyRecord == null){
|
381
|
if(identifyRecord == null){
|
|
@@ -716,7 +757,6 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
@@ -716,7 +757,6 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
716
|
}
|
757
|
}
|
717
|
|
758
|
|
718
|
private void setNewIdentifyCache(String tagId, String nfcUid, ProductIdentifyResp result) {
|
759
|
private void setNewIdentifyCache(String tagId, String nfcUid, ProductIdentifyResp result) {
|
719
|
-
|
|
|
720
|
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:newIdentifyResultInfo:").
|
760
|
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:newIdentifyResultInfo:").
|
721
|
appendVar(tagId).appendVar(":").appendVar(nfcUid);
|
761
|
appendVar(tagId).appendVar(":").appendVar(nfcUid);
|
722
|
clientCache.setEx(kb, result,5 * 60 );
|
762
|
clientCache.setEx(kb, result,5 * 60 );
|