...
|
...
|
@@ -292,6 +292,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
if(identifyRecord == null){
|
|
|
throw new GatewayException(402, "鉴定信息不存在");
|
|
|
}
|
|
|
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//2)订单号 获取订单详细信息
|
...
|
...
|
@@ -307,6 +308,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat());
|
|
|
result.setTrackList(trackList);
|
|
|
|
|
|
//5)设置当前物权所有人
|
|
|
result.setCurrentOwner(trackList.get(trackList.size()-1).getContent());
|
|
|
|
|
|
//设置缓存--可能会有延时,不影响的
|
|
|
setIdentifyCache(tagId, nfcUid, result);
|
|
|
|
...
|
...
|
@@ -328,8 +332,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
}
|
|
|
|
|
|
TransferRecordsHistory history = transferRecordsHistoryMapper.selectByToUid(tagId, nfcUid, uid);
|
|
|
if(null != history) {
|
|
|
throw new GatewayException(402, "已经在申请中");
|
|
|
if(null != history && (history.getStatus().equals(OPERATE_TYPE_APPLYING)
|
|
|
|| history.getStatus().equals(OPERATE_TYPE_PASS) || history.getStatus().equals(OPERATE_TYPE_REJECT))) {
|
|
|
throw new GatewayException(402, "当前不可再申请");
|
|
|
}
|
|
|
|
|
|
//将申请记录插入数据库
|
...
|
...
|
@@ -345,7 +350,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
//向物权所有人发送站内信
|
|
|
|
|
|
//发送定时mq
|
|
|
yhProducer.send(TopicConstants.MQ_TOPIC_CONFIRM_OWNER_DELAY, insertItem, null, 5);//5分钟
|
|
|
yhProducer.send(TopicConstants.MQ_TOPIC_CONFIRM_OWNER_DELAY, insertItem, null, 3*24*60);//3天
|
|
|
|
|
|
return result;
|
|
|
}
|
...
|
...
|
@@ -365,31 +370,40 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
}
|
|
|
|
|
|
TransferRecordsHistory history = transferRecordsHistoryMapper.selectByToUid(tagId, nfcUid, toUid);
|
|
|
if(null != history && !history.getStatus().equals(OPERATE_TYPE_APPLYING)) {
|
|
|
if(null == history || !history.getStatus().equals(OPERATE_TYPE_APPLYING)) {
|
|
|
throw new GatewayException(402, "不是申请中状态");
|
|
|
}
|
|
|
|
|
|
//将记录插入历史表transfer_recors_history
|
|
|
TransferRecordsHistory insertItem = new TransferRecordsHistory();
|
|
|
insertItem.setTagId(tagId);
|
|
|
insertItem.setNfcUid(nfcUid);
|
|
|
insertItem.setFromUid(String.valueOf(identifyRecord.getOwner()));
|
|
|
insertItem.setToUid(String.valueOf(toUid));
|
|
|
insertItem.setOperateTime(DateUtil.getCurrentTimeSecond());
|
|
|
insertItem.setStatus(status);
|
|
|
int result = transferRecordsHistoryMapper.insert(insertItem);
|
|
|
TransferRecordsHistory histroy = new TransferRecordsHistory();
|
|
|
histroy.setTagId(tagId);
|
|
|
histroy.setNfcUid(nfcUid);
|
|
|
histroy.setFromUid(String.valueOf(identifyRecord.getOwner()));
|
|
|
histroy.setToUid(String.valueOf(toUid));
|
|
|
histroy.setOperateTime(DateUtil.getCurrentTimeSecond());
|
|
|
histroy.setStatus(status);
|
|
|
int result = transferRecordsHistoryMapper.insert(histroy);
|
|
|
|
|
|
if(status.equals(OPERATE_TYPE_REJECT)) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//增加记录到transfer_records
|
|
|
TransferRecords transferRecords = new TransferRecords();
|
|
|
transferRecords.setTagId(tagId);
|
|
|
transferRecords.setNfcUid(nfcUid);
|
|
|
transferRecords.setFromUid(histroy.getFromUid());
|
|
|
transferRecords.setToUid(history.getToUid());
|
|
|
transferRecords.setCreateTime(DateUtil.getCurrentTimeSecond());
|
|
|
transferRecordsMapper.insert(transferRecords);
|
|
|
|
|
|
//更新identify_record
|
|
|
return identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
|
|
|
}
|
|
|
|
|
|
private void rebuildResult(ProductIdentifyResp result, String tagId, String nfcUid, Integer uid) {
|
|
|
boolean isOwner = queryIsOwner(tagId, nfcUid, uid);
|
|
|
result.setOwner(isOwner);
|
|
|
result.setIfOwner(isOwner);
|
|
|
if(isOwner) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
|