Commit e2fd8b2e authored by xiaoguang.xu's avatar xiaoguang.xu

容错处理

parent e1d988c8
......@@ -4,6 +4,7 @@ import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.model.webchat.WechatEventMsg;
import cn.quantgroup.xyqb.repository.IUserRepository;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
......@@ -14,6 +15,7 @@ import java.util.Map;
/**
* 微信绑定关系变动。通知某系统
*/
@Slf4j
@Component
public class NotifyWechatBindEventListener implements ApplicationListener<WechatBindEvent> {
......@@ -25,7 +27,15 @@ public class NotifyWechatBindEventListener implements ApplicationListener<Wechat
@Override
public void onApplicationEvent(WechatBindEvent event) {
WechatEventMsg wechatEventMsg = event.getWechatEventMsg();
if (wechatEventMsg.getUserId() == null) {
log.info("微信绑定数据,没有用户 ID 信息,openId:{}", wechatEventMsg.getOpenId());
return;
}
User user = userRepository.findById(wechatEventMsg.getUserId());
if (user == null) {
log.info("微信绑定数据,没有用户信息,openId:{},userId:{}", wechatEventMsg.getOpenId(), wechatEventMsg.getUserId());
return;
}
String uuid = user.getUuid();
Map<String, Object> msg = Maps.newHashMapWithExpectedSize(3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment