Authored by caoyan

Merge branch 'dev_物权转移' into test6.8.6

package com.yohoufo.common.helper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -32,6 +34,19 @@ public class ImageUrlAssist {
*/
private static final String SEPRATOR_SIZE = "x";
// 当前域名列表
private static final Map<String, String[]> DOMAIN_LIST;
static {
DOMAIN_LIST = new HashMap<>();
DOMAIN_LIST.put("01", new String[] { "img10.static.yhbimg.com", "img11.static.yhbimg.com" });
DOMAIN_LIST.put("02", new String[] { "img12.static.yhbimg.com", "img13.static.yhbimg.com" });
DOMAIN_LIST.put("03", new String[] { "flv01.static.yhbimg.com", "flv01.static.yhbimg.com" });
DOMAIN_LIST.put("yhb-head", new String[] { "head.static.yhbimg.com", "head.static.yhbimg.com" });
DOMAIN_LIST.put("imserver", new String[] { "im.static.yhbimg.com" });
}
/**
* 获取图片的完整路径 包含参数
* @param imageUrl 相对路径
... ... @@ -155,6 +170,53 @@ public class ImageUrlAssist {
return url + "?imageView2/{mode}/w/{width}/h/{height}/q/60";
}
public static String getImageAbsoluteUrl(String fileName, String bucket) {
if (StringUtils.isEmpty(fileName)) {
logger.warn("fileName is empty, file:{}, bucket:{}.", fileName, bucket);
return "";
}
// 兼容旧版本绝对URL地址
if (fileName.trim().toLowerCase().startsWith("http://")) {
// 旧版本url中可能会带参数,直接去掉
if (-1 != fileName.indexOf('?')) {
// 去掉后面的参数后返回
return fileName.substring(0, fileName.indexOf('?'));
} else {
return fileName;
}
}
logger.info("getImageAbsoluteUrl by fileName[{}] bucket[{}].", fileName, bucket);
if (fileName.length() <= 17) { // 不合法的脏数据,直接返回空
return "";
}
String fileMode = "";
try {
if (bucket.equals("yhb-head")){// 用户头像
fileMode = "yhb-head";
}else if (bucket.equals("imserver")){// 在线客服
fileMode = "imserver";
} else {
fileMode = fileName.substring(15, 17);
if (DOMAIN_LIST.get(fileMode) == null) {
logger.warn("getImageAbsoluteUrl by fileName[{}] bucket[{}] fail.", fileName, bucket);
return "";
}
}
} catch (Exception e) {
logger.warn("getImageAbsoluteUrl exception:", e);
return fileName;
}
// 随机从两个域名中获取
String[] domains = DOMAIN_LIST.get(fileMode);
int domainMode = 1 ; //new Random().nextInt(2); UFO默认域名http(s)://img11.static.yhbimg.com
return "http://" + domains[domainMode] + "/" + bucket + fileName;
}
private static String getDomain(String imageUrl) {
if (imageUrl.length() < 17) {
... ...
package com.yohoufo.dal.user;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.user.model.InBoxAttr;
/**
* Created by shengguo.cai on 2018/9/11.
*/
public interface IInBoxAttrDao {
void insert(InBoxAttr inboxAttr);
List<InBoxAttr> selectInboxAttrList(@Param("uid") Integer uid, @Param("inboxIdList") List<Integer> inboxIdList);
}
... ...
package com.yohoufo.dal.user.model;
/**
* Created by caoyan.
*/
public class InBoxAttr {
private Integer id;
private Integer inboxId;
private Integer uid;
private String jsonContent;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getInboxId() {
return inboxId;
}
public void setInboxId(Integer inboxId) {
this.inboxId = inboxId;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getJsonContent() {
return jsonContent;
}
public void setJsonContent(String jsonContent) {
this.jsonContent = jsonContent;
}
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.user.IInBoxAttrDao">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.user.model.InBoxAttr">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="inbox_id" property="inboxId" jdbcType="INTEGER"/>
<result column="uid" property="uid" jdbcType="INTEGER"/>
<result column="json_content" property="jsonContent" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, inbox_id, uid, json_content
</sql>
<insert id="insert" parameterType="com.yohoufo.dal.user.model.InBoxAttr">
INSERT INTO inbox_attr (inbox_id, uid, json_content)
values
(#{inboxId},#{uid},#{jsonContent})
</insert>
<select id="selectInboxAttrList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM inbox_attr where uid = #{uid}
<if test="inboxIdList != null and inboxIdList.size()>0">
and inbox_id in
<foreach item="item" index="index" collection="inboxIdList"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -22,7 +22,7 @@
<sql id="Base_Column_List">
id, uid, title, type, is_read, create_time, read_time, is_del,content,business_type,action
</sql>
<insert id="insertInbox">
<insert id="insertInbox" useGeneratedKeys="true" keyProperty="inBox.id">
INSERT INTO ${tableName} (uid,title,content,type,is_read,create_time,is_del, business_type,action)
values
(#{inBox.uid},#{inBox.title},#{inBox.content},#{inBox.type},#{inBox.isRead},
... ...
... ... @@ -46,5 +46,13 @@
<groupId>com.yoho.service.model</groupId>
<artifactId>message-service-model</artifactId>
</dependency>
<dependency>
<groupId>com.yohoufo.fore</groupId>
<artifactId>yohoufo-fore-inboxclient</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>user-ufo-model</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
... ... @@ -9,8 +9,11 @@ import com.alibaba.fastjson.JSON;
import com.yoho.core.rabbitmq.YhConsumer;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.product.TransferRecordsHistoryMapper;
import com.yohoufo.dal.product.model.IdentifyRecord;
import com.yohoufo.dal.product.model.TransferRecordsHistory;
import com.yohoufo.product.mq.TopicConstants;
import com.yohoufo.product.service.MessageFacade;
import com.yohoufo.product.service.ProductIdentifyService;
/**
* 物权确认超时
... ... @@ -23,6 +26,12 @@ public class ProductOwnerConfirmDelayMsgConsumer implements YhConsumer {
@Autowired
private TransferRecordsHistoryMapper transferRecordsHistoryMapper;
@Autowired
private ProductIdentifyService productIdentifyService;
@Autowired
private MessageFacade messageFacade;
public static final Integer OPERATE_TYPE_APPLYING = 0;//申请中
public static final Integer OPERATE_TYPE_TIMEOUT = 3;//确认超时
... ... @@ -47,6 +56,13 @@ public class ProductOwnerConfirmDelayMsgConsumer implements YhConsumer {
insertItem.setStatus(OPERATE_TYPE_TIMEOUT);
transferRecordsHistoryMapper.insert(insertItem);
LOGGER.info("handle productOwnerConfirmTimeout update message success, message is {}.", message);
IdentifyRecord record = productIdentifyService.queryIdentifyRecord(obj.getTagId(), obj.getNfcUid());
if(null == record) {
return;
}
//短信通知申请⼈人“您发起商品xxxxxx的物权转移申请, 当前物权所有⼈人确认超时,您可以重新发起物权申请”
messageFacade.ownerConfirmTimeOut(obj.getToUid(), record.getOrderCode());
return;
}
... ...
package com.yohoufo.product.service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.yoho.service.model.response.ProfileInfoRsp;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.MobileHelper;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.user.IInBoxAttrDao;
import com.yohoufo.dal.user.model.InBoxAttr;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import com.yohoufo.inboxclient.sdk.InBoxSDK;
/**
* Created by caoyan.
*/
@Service
public class MessageFacade {
private final Logger logger = LoggerFactory.getLogger(getClass());
private ExecutorService executorService = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1000), new MessageThreadFactory());
@Autowired
private InBoxSDK inBoxSDK;
@Autowired
private IInBoxAttrDao inboxAttrDao;
@Autowired
private SendMessageService sendMessageService;
@Autowired
private UserInfoProxyService userInfoProxyService;
@Autowired
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
/**
* 申请物权转移后
*/
public void applyToBeOwner(String ownerUid, String applicantUid, String tagId, String nfcUid, Long orderCode){
executorService.execute(()-> {
try {
InboxBusinessTypeEnum ibtOfBuyer = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_OWNER_CONFIRM;
List<String> uidList = Lists.newArrayList(ownerUid, applicantUid);
Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList);
String ownerMobile = profileMap.get(Integer.parseInt(ownerUid)).getMobile();
String applicantMobileMask = MobileHelper.coverMobile2(profileMap.get(Integer.parseInt(applicantUid)).getMobile());
//商品信息
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
Integer skup = buyerOrderGoods.getSkup();
//skup获取 productInfo
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
String prdName = sellerOrderGoods.getProductName();
String params = buildParams(applicantMobileMask, prdName);
InboxReqVO req = buildInboxReqVO(Integer.parseInt(ownerUid), params, ibtOfBuyer);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record applyToBeOwner inbox msg, ownerUid {}, applicantMobileMask {}, prdName {} resp {}",
ownerUid, applicantMobileMask, prdName, resp);
//增加倒计时属性
if(null != resp.getData()) {
Integer inboxId = (Integer)resp.getData();
InBoxAttr attr = new InBoxAttr();
attr.setInboxId(inboxId);
attr.setUid(Integer.parseInt(ownerUid));
JSONObject jo = new JSONObject();
jo.put("finalTime", DateUtil.getCurrentTimeSecond() + 3*24*60*60);//3天后
jo.put("tagId", tagId);
jo.put("nfcUid", nfcUid);
jo.put("fromUid", ownerUid);
jo.put("toUid", applicantUid);
attr.setJsonContent(jo.toJSONString());
inboxAttrDao.insert(attr);
}
//sms
if (StringUtils.isBlank(ownerMobile)){
logger.warn("in applyToBeOwner sms fail, ownerUid {} applicantMobileMask {} prdName {} ", ownerUid, applicantMobileMask,prdName);
return;
}
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_OWNER_CONFIRM.getContent(), applicantMobileMask, prdName);
List<String> mobileList = Arrays.asList(ownerMobile);
sendMessageService.smsSendByMobile(content,mobileList);
logger.info("record applyToBeOwner inbox sms msg, ownerUid {} applicantMobileMask {} prdName {}", ownerUid, applicantMobileMask,prdName);
} catch (Exception ex) {
logger.warn("InBoxFacade applyToBeOwner error inbox msg, ownerUid {} applicantUid {} tagId {} nfcUid {}",
ownerUid, applicantUid ,tagId, nfcUid, ex);
}
});
}
/**
* 物权转移确认超时
* @param buyerUid
* @param orderCode
* @param prdName
*/
public void ownerConfirmTimeOut(String applicantUid, Long orderCode){
executorService.execute(()-> {
try {
List<String> uidList = Lists.newArrayList(applicantUid);
Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList);
String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile();
//商品信息
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
Integer skup = buyerOrderGoods.getSkup();
//skup获取 productInfo
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
String prdName = sellerOrderGoods.getProductName();
//sms
if (StringUtils.isBlank(applicantMobile)){
logger.warn("in ownerConfirmTimeOut sms fail, applicantUid {} prdName {} ", applicantUid, prdName);
return;
}
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_OWNER_CONFIRM_TIMEOUT.getContent(), prdName);
List<String> mobileList = Arrays.asList(applicantMobile);
sendMessageService.smsSendByMobile(content,mobileList);
logger.info("record ownerConfirmTimeOut inbox sms msg, applicantUid {},prdName {}", applicantUid, prdName);
} catch (Exception ex) {
logger.warn("MessageFacade ownerConfirmTimeOut error inbox msg, applicantUid {} orderCode {} ",
applicantUid, orderCode, ex);
}
});
}
/**
* 当前主人拒绝物权转移
*/
public void ownerReject(String applicantUid, Long orderCode){
executorService.execute(()-> {
try {
List<String> uidList = Lists.newArrayList(applicantUid);
Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList);
String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile();
//商品信息
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
Integer skup = buyerOrderGoods.getSkup();
//skup获取 productInfo
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
String prdName = sellerOrderGoods.getProductName();
//sms
if (StringUtils.isBlank(applicantMobile)){
logger.warn("in ownerConfirmTimeOut sms fail, applicantUid {} prdName {} ", applicantUid, prdName);
return;
}
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_OWNER_CONFIRM_REJECT.getContent(), prdName);
List<String> mobileList = Arrays.asList(applicantMobile);
sendMessageService.smsSendByMobile(content,mobileList);
logger.info("record ownerConfirmTimeOut inbox sms msg, applicantUid {},prdName {}", applicantUid, prdName);
} catch (Exception ex) {
logger.warn("MessageFacade ownerConfirmTimeOut error inbox msg, applicantUid {} orderCode {} ",
applicantUid, orderCode, ex);
}
});
}
public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
InboxReqVO req = new InboxReqVO();
req.setType(ibt.getType());
req.setBusinessType(ibt.getBusinessType());
//
req.setUid(uid);
req.setParams(params);
return req;
}
public static String buildParams(Object... objects) {
if (objects == null) {
return null;
}
if (objects.length == 1) {
return objects[0].toString();
}
String params = StringUtils.join(objects, ",");
return params;
}
private String getReplacedContent(String content ,Object... params) {
return MessageFormatter.arrayFormat(content, params).getMessage();
}
}
... ...
package com.yohoufo.product.service;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 自定义java api线程池内工作线程工厂
* 指定生成线程名称:pool-inboxFacade-processor-thread-[num]
*/
public class MessageThreadFactory implements ThreadFactory {
private static final AtomicInteger poolNumber = new AtomicInteger(1);
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String namePrefix;
private final ThreadGroup group;
public MessageThreadFactory() {
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
namePrefix = "pool-inboxFacade-processor-" +
poolNumber.getAndIncrement() +
"-thread-";
}
public MessageThreadFactory(String bizName) {
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
namePrefix = "pool-" + bizName + "-processor-" +
poolNumber.getAndIncrement() +
"-thread-";
}
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(group, r,
namePrefix + threadNumber.getAndIncrement(),
0);
if (t.isDaemon())
t.setDaemon(true);
if (t.getPriority() != Thread.NORM_PRIORITY)
t.setPriority(Thread.NORM_PRIORITY);
return t;
}
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.product.service;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.dal.product.model.IdentifyRecord;
import com.yohoufo.product.response.IdentifyShareInfoResp;
import com.yohoufo.product.response.ProductIdentifyResp;
... ... @@ -18,4 +19,6 @@ public interface ProductIdentifyService {
int confirmOwner(String tagId, String nfcUid, Integer fromUid, Integer toUid, Integer status) throws GatewayException;
IdentifyRecord queryIdentifyRecord(String tagId, String nfcUid);
}
... ...
package com.yohoufo.product.service;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.google.common.collect.Maps;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.service.model.response.ProfileInfoRsp;
@Service
public class UserInfoProxyService {
private static final Logger logger = LoggerFactory.getLogger(UserInfoProxyService.class);
@Value("${uic.url:http://uic.yohoops.org/uic}")
private String uicUrl;
@Autowired
private ServiceCaller serviceCaller;
public Map<Integer,ProfileInfoRsp> queryIcoAndMobile(List<String> uidList) {
Map<Integer,ProfileInfoRsp> profileMap = Maps.newHashMap();
ProfileInfoRsp[] profileInfoArray = getUserProfilesByUids(uidList);
if(ArrayUtils.isEmpty(profileInfoArray)) {
return profileMap;
}
for(int i=0; i< profileInfoArray.length; i++) {
ProfileInfoRsp item = profileInfoArray[i];
profileMap.put(item.getUid(), item);
}
return profileMap;
}
/**
* 批量查询用户基本信息--头像信息+手机号
* @return
*/
private ProfileInfoRsp[] getUserProfilesByUids(List<String> uidList) {
try{
String uids = String.join(",", uidList);
String url = uicUrl + "/profile/getUserProfilesByUids";
logger.info("getUserProfilesByUids start call uic.getUserProfilesByUids uidList={}, url={} ", uidList, url);
return serviceCaller.post("uic.getUserProfilesByUids", url, uids, ProfileInfoRsp[].class,null).get();
}catch(Exception e){
logger.warn("getUserProfilesByUids call uic.getUserProfilesByUids error! uidList={}, e {}", uidList, e);
return null;
}
}
}
... ...
... ... @@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
... ... @@ -12,7 +13,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
import org.slf4j.Logger;
... ... @@ -22,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.yoho.core.config.ConfigReader;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
... ... @@ -55,10 +55,12 @@ import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.product.IdentifyRecordsMapper;
import com.yohoufo.dal.product.IdentifyRelationMapper;
import com.yohoufo.dal.product.ProductChainMapper;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.TransferRecordsHistoryMapper;
import com.yohoufo.dal.product.TransferRecordsMapper;
import com.yohoufo.dal.product.model.IdentifyRecord;
import com.yohoufo.dal.product.model.IdentifyRelation;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.dal.product.model.ProductChain;
import com.yohoufo.dal.product.model.TransferRecords;
import com.yohoufo.dal.product.model.TransferRecordsHistory;
... ... @@ -66,8 +68,9 @@ import com.yohoufo.product.mq.TopicConstants;
import com.yohoufo.product.response.IdentifyShareInfoResp;
import com.yohoufo.product.response.IdentifyTrackResp;
import com.yohoufo.product.response.ProductIdentifyResp;
import com.yohoufo.product.service.MessageFacade;
import com.yohoufo.product.service.ProductIdentifyService;
import com.yohoufo.product.service.SendMessageService;
import com.yohoufo.product.service.UserInfoProxyService;
@Service
... ... @@ -118,16 +121,32 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
private TransferRecordsHistoryMapper transferRecordsHistoryMapper;
@Autowired
private SendMessageService sendMessageService;
private MessageFacade messageFacade;
@Autowired
private UserInfoProxyService userInfoProxyService;
@Autowired
private ProductMapper productMapper;
@Resource(name = "yhProducer")
private YhProducer yhProducer;
@Value("${uic.url:http://uic.yohoops.org/uic}")
private String uicUrl;
@Value("${ip.port.uic.server}")
private String uicServerIpAndPort;
@Value("${ufo.nfc.syncBlockChain.url}")
private String syncBlockChain_url;
private static final String UIC_PROFILE_URL = "/uic/profile/getProfile";
public static final String DEFAULT_HEAD_IMG = "http://img11.static.yhbimg.com/yhb-img01/2016/07/05/13/017ec560b82c132ab2fdb22f7cf6f42b83.png?imageView/{mode}/w/{width}/h/{height}";
private static final String DEFAULT_FROM = "YOHO!";
public static final Integer OPERATE_TYPE_APPLYING = 0;//申请中
public static final Integer OPERATE_TYPE_PASS = 1;//同意
... ... @@ -367,10 +386,8 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
if(buyerOrder == null){
throw new GatewayException(403, "订单不存在");
}
//向物权所有人发短信“用户189******59向您发起商品xxxxxx的物权转移申请,您可以 打开有货APP站内信查看并确认”
sendSmsToOwner(insertItem.getFromUid(), String.valueOf(uid), orderCode);
//向物权所有人发送站内信
//向物权所有人发短信、站内信
messageFacade.applyToBeOwner(insertItem.getFromUid(), String.valueOf(uid), tagId, nfcUid, orderCode);
//发送定时mq
yhProducer.send(TopicConstants.MQ_TOPIC_CONFIRM_OWNER_DELAY, insertItem, null, 3*24*60);//3天
... ... @@ -408,6 +425,8 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
int result = transferRecordsHistoryMapper.insert(histroy);
if(status.equals(OPERATE_TYPE_REJECT)) {
//“不同意”则拒绝物权占有,短信通知申请⼈人“您发起商品xxxxxx的物权转 移申请,当前物权所有⼈人拒绝转移申请,您可以重新发起物权申请”
messageFacade.ownerReject(String.valueOf(toUid), queryIdentifyRecord(tagId, nfcUid).getOrderCode());
return result;
}
... ... @@ -420,30 +439,71 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
transferRecords.setCreateTime(DateUtil.getCurrentTimeSecond());
transferRecordsMapper.insert(transferRecords);
//更新identify_record
result = identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
//区块链
syncBlockChain(tagId, nfcUid, toUid);
//清理缓存
clearIdentifyCache(tagId, nfcUid);
//更新identify_record
return identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
return result;
}
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);
private void syncBlockChain(String tagId, String nfcUid, Integer toUid){
IdentifyRecord record = queryIdentifyRecord(tagId, nfcUid);
//商品信息
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(record.getOrderCode());
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));
}
SellerOrderGoods goodsInfo = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
//去product表获取商品货号
Product productInfo = productMapper.selectByPrimaryKey(goodsInfo.getProductId());
if(productInfo == null){
logger.info("syncBlockChain get sellerGoods from sellerOrderGoodsMapper is null, productId is {}",goodsInfo.getProductId() );
return;
}
//商品图片,尺寸,颜色,来源,所有人等信息
String image = ImageUrlAssist.getImageAbsoluteUrl(goodsInfo.getImageUrl(), "goodsimg");
String size = goodsInfo.getSizeName();
String color = goodsInfo.getColorName();
String productCode = productInfo.getProductCode();
String ownerName = "";
//根据uid去uic获取用户手机号,并进行模糊处理。吃掉异常,防止超时影响正常逻辑
try{
Map<String,Integer> request = Collections.singletonMap("uid", toUid);
JSONObject jsonObject = serviceCaller.get("uic.getProfileAction", "http://" + uicServerIpAndPort + UIC_PROFILE_URL, request, JSONObject.class, null).get(1);
if(null != jsonObject.getJSONObject("data") && null != jsonObject.getJSONObject("data").getString("mobile_phone")) {
String mobile = jsonObject.getJSONObject("data").getString("mobile_phone");;
ownerName = MobileHelper.coverMobile2(mobile);
}
}catch (Exception e){
logger.info("syncBlockChain get mobile from uic error, e is {}", e);
}
//获取手机号失败的情况,owner 默认是uid模糊处理
if(StringUtils.isBlank(ownerName)){
ownerName = blurUid(toUid);
}
//组装信息 同步至区块链写代理
Map<String, Object> infoMap = new HashMap<>();
infoMap.put("tagid", tagId);
infoMap.put("product_url", image);
infoMap.put("color", color);
infoMap.put("size", size);
infoMap.put("goods_no", productCode);
infoMap.put("source", DEFAULT_FROM); //默认来源yoho
infoMap.put("transaction_time", DateUtil.getCurrentTimeSecond());
infoMap.put("owner", ownerName);
infoMap.put("auth_time", DateUtil.getCurrentTimeSecond());
logger.info("req url is {}, params is {}", syncBlockChain_url, infoMap);
String result = serviceCaller.post("", syncBlockChain_url, infoMap, String.class, null).get(5);
logger.info(" result is {}", result);
}
private void rebuildResult(ProductIdentifyResp result, String tagId, String nfcUid, Integer uid) {
boolean isOwner = queryIsOwner(tagId, nfcUid, uid);
result.setIfOwner(isOwner);
... ... @@ -462,12 +522,12 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
result.setApplyStatus(history.getStatus());
}
ProfileInfoRsp[] profileInfoArray = getUserProfilesByUids(Lists.newArrayList(String.valueOf(uid)));
if(ArrayUtils.isEmpty(profileInfoArray)) {
Map<Integer,ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(Lists.newArrayList(String.valueOf(uid)));
if(MapUtils.isEmpty(profileMap)) {
return;
}
ProfileInfoRsp profileInfo = profileInfoArray[0];
ProfileInfoRsp profileInfo = profileMap.get(uid);
IdentifyTrackResp track = new IdentifyTrackResp();
track.setUid(uid);
track.setType(MESSAGE_TYPE_APPLICANT);
... ... @@ -514,7 +574,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
allUidList.addAll(ownerUidList);
//查询头像和手机号
Map<Integer, ProfileInfoRsp> profileMap = queryIcoAndMobile(allUidList);
Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(allUidList);
List<IdentifyTrackResp> historyTrackList = buildTransferTrackList(profileMap, transferList);
trackRespList.addAll(historyTrackList);
... ... @@ -557,21 +617,6 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
return trackList;
}
private Map<Integer,ProfileInfoRsp> queryIcoAndMobile(List<String> uidList) {
Map<Integer,ProfileInfoRsp> profileMap = Maps.newHashMap();
ProfileInfoRsp[] profileInfoArray = getUserProfilesByUids(uidList);
if(ArrayUtils.isEmpty(profileInfoArray)) {
return profileMap;
}
for(int i=0; i< profileInfoArray.length; i++) {
ProfileInfoRsp item = profileInfoArray[i];
profileMap.put(item.getUid(), item);
}
return profileMap;
}
//获取订单详情
private ProductIdentifyResp getOrderDetail(BuyerOrder buyerOrder, IdentifyRecord identifyRecord, String tagId) {
ProductIdentifyResp result = new ProductIdentifyResp();
... ... @@ -686,7 +731,8 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
}
private IdentifyRecord queryIdentifyRecord(String tagId, String nfcUid) {
@Override
public IdentifyRecord queryIdentifyRecord(String tagId, String nfcUid) {
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyRecord:").
appendVar(tagId).appendVar(":").appendVar(nfcUid);
IdentifyRecord result = clientCache.get(kb, IdentifyRecord.class);
... ... @@ -729,22 +775,6 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
}
/**
* 批量查询用户基本信息--头像信息+手机号
* @return
*/
private ProfileInfoRsp[] getUserProfilesByUids(List<String> uidList) {
try{
String uids = String.join(",", uidList);
String url = uicUrl + "/profile/getUserProfilesByUids";
logger.info("getUserProfilesByUids start call uic.getUserProfilesByUids uidList={}, url={} ", uidList, url);
return serviceCaller.post("uic.getUserProfilesByUids", url, uids, ProfileInfoRsp[].class,null).get();
}catch(Exception e){
logger.warn("getUserProfilesByUids call uic.getUserProfilesByUids error! uidList={}, e {}", uidList, e);
return null;
}
}
/**
* 查询用户基本信息--头像信息(不要取此接口的手机号)
* @return
*/
... ... @@ -813,48 +843,23 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
}
// /**
// * 批量获取买家信息
// *
// * @return
// *//*
// private AsyncFuture<ProfileInfoRsp[]> getUserProfileInfo(List<Integer> uidsList) {
// //参数校验
// if(uidsList == null || uidsList.size() == 0){
// return null;
// }
// StringBuilder sb = new StringBuilder();
// for(Integer uid : uidsList ){
// if(uid != null && uid > 0){
// sb.append(uid).append(",");
// }
// }
// String s = sb.toString();
// if(s.length() == 0){
// return null;
// }
//
// String uids = s.substring(0, s.length() - 1);
// //调用多个的只有这个才行
// return serviceCaller.asyncCall("uic.getUserProfilesByUids", uids, ProfileInfoRsp[].class);
//
// }
// /**
// * 转换用户信息 为map
// * @return
// */
// private Map<Integer, ProfileInfoRsp> convertUserInfoToMap(ProfileInfoRsp[] infos) {
//
// Map<Integer, ProfileInfoRsp> result = new HashMap<>();
// if(infos == null || infos.length == 0){
// return result;
// }
// List<ProfileInfoRsp> resultList = Arrays.asList(infos);
//// List<ProfileInfoRsp> resultList = rsp.stream().map(profileInfoRsp -> JSONObject.parseObject(JSONObject.toJSONString(profileInfoRsp),ProfileInfoRsp.class)).collect(Collectors.toList());
// result = resultList.stream().collect(Collectors.toMap(ProfileInfoRsp :: getUid, (ProfileInfoRsp obj) -> obj));
// return result;
// }
private String blurUid( Integer uid ) {
if ( uid == null ) {
return null;
}
String tmp =String.valueOf(uid).trim();
if(tmp.length() <= 4){
int j = tmp.length();
for (int i=0; i< 11 - j; i++){
tmp = "*".concat(tmp);
}
}else {
tmp = tmp.substring(tmp.length()-4, tmp.length());
for (int i=0; i< 7; i++){
tmp = "*".concat(tmp);
}
}
return tmp;
}
}
... ...
package com.yohoufo.user.controller.inbox;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.dal.user.model.InBox;
import com.yohoufo.user.requestVO.ListInboxReqVO;
import com.yohoufo.user.requestVO.ListInboxTypeInfoReqVO;
import com.yohoufo.user.responseVO.InBoxVO;
import com.yohoufo.user.responseVO.PageResponseVO;
import com.yohoufo.user.service.IInBoxService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* Created by shengguo.cai on 2018/9/11.
... ... @@ -74,7 +74,7 @@ public class InBoxController {
@RequestMapping(params = "method=ufo.users.listInboxs")
public ApiResponse listInboxs(ListInboxReqVO reqVO){
logger.info("enter listInboxByTypes param is {}", reqVO);
PageResponseVO<InBox> pageList = inBoxService.listInboxByTypes(reqVO);
PageResponseVO<InBoxVO> pageList = inBoxService.listInboxByTypes(reqVO);
return new ApiResponse(200,"操作成功",pageList);
}
... ... @@ -88,7 +88,7 @@ public class InBoxController {
@RequestParam(name = "businessType") Integer businessType,
@RequestParam(name = "params",required = false) String params){
logger.info("addInbox with param :uid is {},type is {},businessType is {},params is {}", uid,type,businessType,params);
inBoxService.addInbox(uid,type,businessType,params);
return new ApiResponse(200,"保存成功",null);
Integer id = inBoxService.addInbox(uid,type,businessType,params);
return new ApiResponse(200,"保存成功",id);
}
}
... ...
package com.yohoufo.user.responseVO;
import com.yohoufo.dal.user.model.InBox;
public class InBoxVO extends InBox{
private Integer finalTime;
private Integer leftTime;
private String tagId;
private String nfcUid;
private Integer fromUid;
private Integer toUid;
public Integer getFinalTime() {
return finalTime;
}
public void setFinalTime(Integer finalTime) {
this.finalTime = finalTime;
}
public Integer getLeftTime() {
return leftTime;
}
public void setLeftTime(Integer leftTime) {
this.leftTime = leftTime;
}
public String getTagId() {
return tagId;
}
public void setTagId(String tagId) {
this.tagId = tagId;
}
public String getNfcUid() {
return nfcUid;
}
public void setNfcUid(String nfcUid) {
this.nfcUid = nfcUid;
}
public Integer getFromUid() {
return fromUid;
}
public void setFromUid(Integer fromUid) {
this.fromUid = fromUid;
}
public Integer getToUid() {
return toUid;
}
public void setToUid(Integer toUid) {
this.toUid = toUid;
}
}
... ...
... ... @@ -2,9 +2,9 @@ package com.yohoufo.user.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yohoufo.dal.user.model.InBox;
import com.yohoufo.user.requestVO.ListInboxReqVO;
import com.yohoufo.user.requestVO.ListInboxTypeInfoReqVO;
import com.yohoufo.user.responseVO.InBoxVO;
import com.yohoufo.user.responseVO.PageResponseVO;
/**
... ... @@ -18,9 +18,9 @@ public interface IInBoxService {
*/
JSONArray listInboxTypeInfo(ListInboxTypeInfoReqVO reqBO);
PageResponseVO<InBox> listInboxByTypes(ListInboxReqVO reqVO);
PageResponseVO<InBoxVO> listInboxByTypes(ListInboxReqVO reqVO);
void addInbox(int uid, Integer type, Integer businessType, String params);
Integer addInbox(int uid, Integer type, Integer businessType, String params);
JSONObject getTotalUnread(int uid);
}
... ...
package com.yohoufo.user.service.impl;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
... ... @@ -9,25 +25,18 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.enums.InboxTypeEnum;
import com.yohoufo.common.redis.NoSyncGracefulRedisTemplate;
import com.yohoufo.dal.user.IInBoxAttrDao;
import com.yohoufo.dal.user.IInBoxDao;
import com.yohoufo.dal.user.model.InBox;
import com.yohoufo.dal.user.model.InBoxAttr;
import com.yohoufo.dal.user.model.TypeCountInbox;
import com.yohoufo.user.cache.CacheKeyHelper;
import com.yohoufo.user.constants.CacheEnum;
import com.yohoufo.user.requestVO.ListInboxReqVO;
import com.yohoufo.user.requestVO.ListInboxTypeInfoReqVO;
import com.yohoufo.user.responseVO.InBoxVO;
import com.yohoufo.user.responseVO.PageResponseVO;
import com.yohoufo.user.service.IInBoxService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* Created by shengguo.cai on 2018/9/11.
... ... @@ -39,6 +48,9 @@ public class InBoxServiceImpl implements IInBoxService {
private IInBoxDao inBoxDao;
@Resource(name="NoSyncGracefulRedisTemplate")
private NoSyncGracefulRedisTemplate redisTemplate;
@Autowired
private IInBoxAttrDao inBoxAttrDao;
@Override
public JSONArray listInboxTypeInfo(ListInboxTypeInfoReqVO reqBO) {
... ... @@ -122,7 +134,7 @@ public class InBoxServiceImpl implements IInBoxService {
}
@Override
public PageResponseVO<InBox> listInboxByTypes(ListInboxReqVO reqVO) {
public PageResponseVO<InBoxVO> listInboxByTypes(ListInboxReqVO reqVO) {
log.info("entre listInboxByTypes with param is {}", reqVO);
//判断为空
if (reqVO.getUid() <= 0) {
... ... @@ -132,8 +144,10 @@ public class InBoxServiceImpl implements IInBoxService {
//如果根据类型查看,设置未读为已读
updateReaded(reqVO);
//优先从缓存查
PageResponseVO<InBox> response = listInboxByRedis(reqVO);
PageResponseVO<InBoxVO> response = listInboxByRedis(reqVO);
if(null != response){
//实时计算剩余秒数
calculateRealTimeData(response.getList());
return response;
}
//缓存没有则从数据库查
... ... @@ -149,7 +163,11 @@ public class InBoxServiceImpl implements IInBoxService {
}
List<InBox> inBoxes = inBoxDao.selectInboxs(getTableName(reqVO.getUid()),reqVO.getType(),
reqVO.getUid(),reqVO.getRowNo(),reqVO.getLimit());
response.setList(inBoxes);
//添加附加属性倒计时
List<InBoxVO> voList = rebuildInBox(inBoxes, reqVO.getUid());
response.setList(voList);
response.setPage(reqVO.getPage());
response.setSize(reqVO.getLimit());
response.setTotal(total);
... ... @@ -157,6 +175,50 @@ public class InBoxServiceImpl implements IInBoxService {
setInboxByRedis(reqVO,inBoxes,total);
return response;
}
private void calculateRealTimeData(List<InBoxVO> voList) {
for(InBoxVO vo : voList) {
if(null != vo.getFinalTime()) {
int realTimeLeftTime = vo.getFinalTime() - DateUtil.getCurrentTimeSecond();
vo.setLeftTime(realTimeLeftTime < 0 ? 0 : realTimeLeftTime);
}
}
}
private List<InBoxVO> rebuildInBox(List<InBox> inBoxList, Integer uid){
List<InBoxVO> voList = Lists.newArrayList();
List<Integer> identifyInboxIdList = Lists.newArrayList();
for(InBox item : inBoxList) {
InBoxVO vo = new InBoxVO();
BeanUtils.copyProperties(item, vo);
voList.add(vo);
if(item.getType().intValue() == 2 && item.getBusinessType().intValue() == 2016) {//物权转移站内信,需特殊处理
identifyInboxIdList.add(item.getId());
}
}
if(CollectionUtils.isEmpty(identifyInboxIdList)) {
return voList;
}
List<InBoxAttr> attrList = inBoxAttrDao.selectInboxAttrList(uid, identifyInboxIdList);
Map<Integer, String> attrMap = attrList.stream().collect(Collectors.toMap(InBoxAttr::getInboxId, InBoxAttr::getJsonContent));
for(InBoxVO vo : voList) {
if(vo.getType().intValue() == 2 && vo.getBusinessType().intValue() == 2016) {
JSONObject jo = JSON.parseObject(attrMap.get(vo.getId()));
int finalTime = jo.getIntValue("finalTime");
vo.setFinalTime(finalTime);
vo.setTagId(jo.getString("tagId"));
vo.setNfcUid(jo.getString("nfcUid"));
vo.setFromUid(jo.getInteger("fromUid"));
vo.setToUid(jo.getInteger("toUid"));
int leftTime = finalTime - DateUtil.getCurrentTimeSecond();
vo.setLeftTime(leftTime < 0 ? 0 : leftTime);
}
}
return voList;
}
private void setInboxByRedis(ListInboxReqVO reqVO, List<InBox> inBoxes, int total) {
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(reqVO.getUid());
... ... @@ -175,10 +237,10 @@ public class InBoxServiceImpl implements IInBoxService {
}
}
private PageResponseVO<InBox> listInboxByRedis(ListInboxReqVO reqVO) {
PageResponseVO<InBox> response = new PageResponseVO<>();
private PageResponseVO<InBoxVO> listInboxByRedis(ListInboxReqVO reqVO) {
PageResponseVO<InBoxVO> response = new PageResponseVO<>();
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(reqVO.getUid());
List<InBox> inboxes = redisTemplate.getList(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),InBox.class);
List<InBoxVO> inboxes = redisTemplate.getList(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),InBoxVO.class);
RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType());
Integer total = redisTemplate.get(inboxTotalKey,Integer.class);
if(inboxes == null || total == null){
... ... @@ -194,7 +256,7 @@ public class InBoxServiceImpl implements IInBoxService {
}
@Override
public void addInbox(int uid, Integer type, Integer businessType, String params) {
public Integer addInbox(int uid, Integer type, Integer businessType, String params) {
log.info("entre addInbox with param .uid is {},type is {},businessType is {},params is {}", uid,type,businessType,params);
InboxBusinessTypeEnum businessTypeEnum = InboxBusinessTypeEnum.getByTypeAndBusinessType(type,businessType);
if(businessTypeEnum == null){
... ... @@ -215,6 +277,7 @@ public class InBoxServiceImpl implements IInBoxService {
inBoxDao.insertInbox(getTableName(inBox.getUid()),inBox);
//清空redis缓存
deleteIboxsByRedis(uid,type);
return inBox.getId();
}
private void dealAddition(InBox inBox,String params) {
... ... @@ -233,7 +296,7 @@ public class InBoxServiceImpl implements IInBoxService {
vo.setUid(uid);
vo.setPage(1);
vo.setLimit(1);
PageResponseVO<InBox> inBoxVo = listInboxByTypes(vo);
PageResponseVO<InBoxVO> inBoxVo = listInboxByTypes(vo);
if(inBoxVo != null && !CollectionUtils.isEmpty(inBoxVo.getList())){
result.put("lastMessage",inBoxVo.getList().get(0).getContent());
result.put("createTime",inBoxVo.getList().get(0).getCreateTime());
... ...
... ... @@ -52,7 +52,7 @@ password.aes.key=yoho9646yoho9646
#用户uic服务地址
uic.service.url=http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
#消息盒子-baseurl
inbox.baseurl=http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/?debug=XYZ
inbox.baseurl=http://172.16.12.59:8080/ufo-gateway/?debug=XYZ
#signature encrypt key salt
gateway.signature.key.salt=mQyMTMwZjlmZTZmYjY4UjkNmYwZGM0OTk0Y
trace.enabled=false
... ... @@ -137,4 +137,8 @@ yoho.gateway.url=http://api-test3.dev.yohocorp.com
ufo.platform.url=http://java-ufo-platform.test3.ingress.dev.yohocorp.com/ufoPlatform
offline.store.seller=70,50000638
\ No newline at end of file
offline.store.seller=70,50000638
ip.port.uic.server = java-yoho-uic.test3.ingress.dev.yohocorp.com
ufo.nfc.syncBlockChain.url=http://192.168.102.49:3030/api/addItem
\ No newline at end of file
... ...
... ... @@ -111,4 +111,8 @@ mq.seller.deliverNotice.old.third=7200
yoho.gateway.url=${yoho.gateway.url}
offline.store.seller=${offline.store.seller}
\ No newline at end of file
offline.store.seller=${offline.store.seller}
ip.port.uic.server = ${ip.port.uic.server}
ufo.nfc.syncBlockChain.url=${ufo.nfc.syncBlockChain.url}
\ No newline at end of file
... ...