...
|
...
|
@@ -67,6 +67,7 @@ import com.yohoufo.product.response.IdentifyShareInfoResp; |
|
|
import com.yohoufo.product.response.IdentifyTrackResp;
|
|
|
import com.yohoufo.product.response.ProductIdentifyResp;
|
|
|
import com.yohoufo.product.service.ProductIdentifyService;
|
|
|
import com.yohoufo.product.service.SendMessageService;
|
|
|
|
|
|
|
|
|
@Service
|
...
|
...
|
@@ -116,6 +117,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
@Autowired
|
|
|
private TransferRecordsHistoryMapper transferRecordsHistoryMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private SendMessageService sendMessageService;
|
|
|
|
|
|
@Resource(name = "yhProducer")
|
|
|
private YhProducer yhProducer;
|
|
|
|
...
|
...
|
@@ -339,10 +343,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
throw new GatewayException(402, "已经是物权所有人");
|
|
|
}
|
|
|
|
|
|
TransferRecordsHistory history = transferRecordsHistoryMapper.selectByToUid(tagId, nfcUid, uid);
|
|
|
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, "当前不可再申请");
|
|
|
TransferRecordsHistory history = transferRecordsHistoryMapper.selectByToUid(tagId, nfcUid, null);
|
|
|
if(null != history && (history.getStatus().equals(OPERATE_TYPE_APPLYING))) {
|
|
|
throw new GatewayException(402, "当前不可申请");
|
|
|
}
|
|
|
|
|
|
//将申请记录插入数据库
|
...
|
...
|
@@ -355,6 +358,16 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
insertItem.setStatus(OPERATE_TYPE_APPLYING);
|
|
|
int result = transferRecordsHistoryMapper.insert(insertItem);
|
|
|
|
|
|
//根据鉴定记录 获取订单号
|
|
|
Long orderCode = identifyRecord.getOrderCode();
|
|
|
//获取订单详细信息
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
if(buyerOrder == null){
|
|
|
throw new GatewayException(403, "订单不存在");
|
|
|
}
|
|
|
//向物权所有人发短信“用户189******59向您发起商品xxxxxx的物权转移申请,您可以 打开有货APP站内信查看并确认”
|
|
|
sendSmsToOwner(insertItem.getFromUid(), String.valueOf(uid), orderCode);
|
|
|
|
|
|
//向物权所有人发送站内信
|
|
|
|
|
|
//发送定时mq
|
...
|
...
|
@@ -409,6 +422,23 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ |
|
|
return identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
|
|
|
}
|
|
|
|
|
|
private void sendSmsToOwner(String fromUid, String uid, Long orderCode) {
|
|
|
List<String> uidList = Lists.newArrayList(fromUid, uid);
|
|
|
Map<Integer, ProfileInfoRsp> profileMap = queryIcoAndMobile(uidList);
|
|
|
String fromMobile = profileMap.get(Integer.parseInt(fromUid)).getMobile();
|
|
|
String toMobileMask = MobileHelper.coverMobile2(profileMap.get(Integer.parseInt(uid)).getMobile());
|
|
|
|
|
|
//商品信息
|
|
|
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
|
|
|
Integer skup = buyerOrderGoods.getSkup();
|
|
|
//skup获取 productInfo
|
|
|
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
content.append("用户").append(toMobileMask).append("向您发起商品").append(sellerOrderGoods.getProductName());
|
|
|
content.append("的物权转移申请,您可以打开有货APP站内信查看并确认");
|
|
|
sendMessageService.smsSendByMobile(content.toString(), Lists.newArrayList(fromMobile));
|
|
|
}
|
|
|
|
|
|
private void rebuildResult(ProductIdentifyResp result, String tagId, String nfcUid, Integer uid) {
|
|
|
boolean isOwner = queryIsOwner(tagId, nfcUid, uid);
|
|
|
result.setIfOwner(isOwner);
|
...
|
...
|
|