New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.user;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 同步消息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class SyncBeforeInfoMessageListener implements MessageListener {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserInfoModifyRecordService userInfoModifyRecordService;
|
| | | |
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | | |
| | | |
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | | LogHelper.mqInfo("consumer-SyncBeforeInfoMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | | if (tag == null)
|
| | | tag = "";
|
| | |
|
| | | // 邀请相关
|
| | | if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 用户活跃
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.userActve.name())) {
|
| | | UserActiveMQMsg msg = new Gson().fromJson(new String(message.getBody()), UserActiveMQMsg.class);
|
| | | Long uid = msg.getUid();
|
| | |
|
| | | // 老用户同步绑定信息
|
| | | userInfoModifyRecordService.syncBeforeInfo(uid);
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|