|
@@ -67,6 +67,7 @@ import com.yohoufo.product.response.IdentifyShareInfoResp; |
|
@@ -67,6 +67,7 @@ import com.yohoufo.product.response.IdentifyShareInfoResp; |
67
|
import com.yohoufo.product.response.IdentifyTrackResp;
|
67
|
import com.yohoufo.product.response.IdentifyTrackResp;
|
68
|
import com.yohoufo.product.response.ProductIdentifyResp;
|
68
|
import com.yohoufo.product.response.ProductIdentifyResp;
|
69
|
import com.yohoufo.product.service.ProductIdentifyService;
|
69
|
import com.yohoufo.product.service.ProductIdentifyService;
|
|
|
70
|
+import com.yohoufo.product.service.SendMessageService;
|
70
|
|
71
|
|
71
|
|
72
|
|
72
|
@Service
|
73
|
@Service
|
|
@@ -116,6 +117,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
@@ -116,6 +117,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
116
|
@Autowired
|
117
|
@Autowired
|
117
|
private TransferRecordsHistoryMapper transferRecordsHistoryMapper;
|
118
|
private TransferRecordsHistoryMapper transferRecordsHistoryMapper;
|
118
|
|
119
|
|
|
|
120
|
+ @Autowired
|
|
|
121
|
+ private SendMessageService sendMessageService;
|
|
|
122
|
+
|
119
|
@Resource(name = "yhProducer")
|
123
|
@Resource(name = "yhProducer")
|
120
|
private YhProducer yhProducer;
|
124
|
private YhProducer yhProducer;
|
121
|
|
125
|
|
|
@@ -339,10 +343,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
@@ -339,10 +343,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
339
|
throw new GatewayException(402, "已经是物权所有人");
|
343
|
throw new GatewayException(402, "已经是物权所有人");
|
340
|
}
|
344
|
}
|
341
|
|
345
|
|
342
|
- TransferRecordsHistory history = transferRecordsHistoryMapper.selectByToUid(tagId, nfcUid, uid);
|
|
|
343
|
- if(null != history && (history.getStatus().equals(OPERATE_TYPE_APPLYING)
|
|
|
344
|
- || history.getStatus().equals(OPERATE_TYPE_PASS) || history.getStatus().equals(OPERATE_TYPE_REJECT))) {
|
|
|
345
|
- throw new GatewayException(402, "当前不可再申请");
|
346
|
+ TransferRecordsHistory history = transferRecordsHistoryMapper.selectByToUid(tagId, nfcUid, null);
|
|
|
347
|
+ if(null != history && (history.getStatus().equals(OPERATE_TYPE_APPLYING))) {
|
|
|
348
|
+ throw new GatewayException(402, "当前不可申请");
|
346
|
}
|
349
|
}
|
347
|
|
350
|
|
348
|
//将申请记录插入数据库
|
351
|
//将申请记录插入数据库
|
|
@@ -355,6 +358,16 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
@@ -355,6 +358,16 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
355
|
insertItem.setStatus(OPERATE_TYPE_APPLYING);
|
358
|
insertItem.setStatus(OPERATE_TYPE_APPLYING);
|
356
|
int result = transferRecordsHistoryMapper.insert(insertItem);
|
359
|
int result = transferRecordsHistoryMapper.insert(insertItem);
|
357
|
|
360
|
|
|
|
361
|
+ //根据鉴定记录 获取订单号
|
|
|
362
|
+ Long orderCode = identifyRecord.getOrderCode();
|
|
|
363
|
+ //获取订单详细信息
|
|
|
364
|
+ BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
365
|
+ if(buyerOrder == null){
|
|
|
366
|
+ throw new GatewayException(403, "订单不存在");
|
|
|
367
|
+ }
|
|
|
368
|
+ //向物权所有人发短信“用户189******59向您发起商品xxxxxx的物权转移申请,您可以 打开有货APP站内信查看并确认”
|
|
|
369
|
+ sendSmsToOwner(insertItem.getFromUid(), String.valueOf(uid), orderCode);
|
|
|
370
|
+
|
358
|
//向物权所有人发送站内信
|
371
|
//向物权所有人发送站内信
|
359
|
|
372
|
|
360
|
//发送定时mq
|
373
|
//发送定时mq
|
|
@@ -409,6 +422,23 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
@@ -409,6 +422,23 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
409
|
return identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
|
422
|
return identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
|
410
|
}
|
423
|
}
|
411
|
|
424
|
|
|
|
425
|
+ private void sendSmsToOwner(String fromUid, String uid, Long orderCode) {
|
|
|
426
|
+ List<String> uidList = Lists.newArrayList(fromUid, uid);
|
|
|
427
|
+ Map<Integer, ProfileInfoRsp> profileMap = queryIcoAndMobile(uidList);
|
|
|
428
|
+ String fromMobile = profileMap.get(Integer.parseInt(fromUid)).getMobile();
|
|
|
429
|
+ String toMobileMask = MobileHelper.coverMobile2(profileMap.get(Integer.parseInt(uid)).getMobile());
|
|
|
430
|
+
|
|
|
431
|
+ //商品信息
|
|
|
432
|
+ BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
|
|
|
433
|
+ Integer skup = buyerOrderGoods.getSkup();
|
|
|
434
|
+ //skup获取 productInfo
|
|
|
435
|
+ SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
436
|
+ StringBuilder content = new StringBuilder();
|
|
|
437
|
+ content.append("用户").append(toMobileMask).append("向您发起商品").append(sellerOrderGoods.getProductName());
|
|
|
438
|
+ content.append("的物权转移申请,您可以打开有货APP站内信查看并确认");
|
|
|
439
|
+ sendMessageService.smsSendByMobile(content.toString(), Lists.newArrayList(fromMobile));
|
|
|
440
|
+ }
|
|
|
441
|
+
|
412
|
private void rebuildResult(ProductIdentifyResp result, String tagId, String nfcUid, Integer uid) {
|
442
|
private void rebuildResult(ProductIdentifyResp result, String tagId, String nfcUid, Integer uid) {
|
413
|
boolean isOwner = queryIsOwner(tagId, nfcUid, uid);
|
443
|
boolean isOwner = queryIsOwner(tagId, nfcUid, uid);
|
414
|
result.setIfOwner(isOwner);
|
444
|
result.setIfOwner(isOwner);
|