admin
2020-05-12 522315ae42936583042fc08aabda7e3c9e7a7b5d
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java
@@ -18,8 +18,7 @@
import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserMoneyChangeMQMsg;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleFocusInfoService;
import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
import net.sf.json.JSONObject;
@@ -34,10 +33,8 @@
public class UserTeamMessageListener implements MessageListener {
   @Resource
   private ThreeSaleFocusInfoService threeSaleFocusInfoService;
   private TeamFansInfoService teamFansInfoService;
   
   @Resource
   private TeamLevelDailyRecordService teamLevelDailyRecordService;
   
   @Override
   public Action consume(Message message, ConsumeContext context) {
@@ -56,16 +53,16 @@
            UserActiveMQMsg userActiveMQMsg = new Gson().fromJson(json.toString(),UserActiveMQMsg.class);
            if (userActiveMQMsg != null) {
               // 更改用户活跃时间
               threeSaleFocusInfoService.updateActiveTime(userActiveMQMsg.getUid(), userActiveMQMsg.getCreateTime());
               teamFansInfoService.updateActiveTime(userActiveMQMsg.getUid(), userActiveMQMsg.getCreateTime());
            }
         } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userInfoUpdate.name())) {// 用户信息更新
            JSONObject json = JSONObject.fromObject(new String(message.getBody()));
            UserInfoUpdateMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInfoUpdateMQMsg.class);
            if (mqMsg != null) {
               if (UserInfoUpdateTypeEnum.nickName == mqMsg.getType()) { // 更改昵称
                  threeSaleFocusInfoService.updateNickName(mqMsg.getUid(), mqMsg.getValue());
                  teamFansInfoService.updateNickName(mqMsg.getUid(), mqMsg.getValue());
               } else if (UserInfoUpdateTypeEnum.wxId == mqMsg.getType()) { // 微信号绑定
                  threeSaleFocusInfoService.updateWeixinBind(mqMsg.getUid(), true);
                  teamFansInfoService.updateWeixinBind(mqMsg.getUid(), true);
               }
            }
         } else if (tag.equalsIgnoreCase(UserTopicTagEnum.taobaoBindSuccess.name())) {// 淘宝绑定成功
@@ -74,10 +71,10 @@
            TaoBaoBindSuccessMQMsg mqMsg = new Gson().fromJson(json.toString(),TaoBaoBindSuccessMQMsg.class);
            if (mqMsg != null) {
               // 更新淘宝绑定
               threeSaleFocusInfoService.updateWeixinBind(mqMsg.getUid(), true);
               teamFansInfoService.updateWeixinBind(mqMsg.getUid(), true);
               Long fromUid = mqMsg.getFromUid();
               if (fromUid != null) { // 淘宝被解绑
                  threeSaleFocusInfoService.updateWeixinBind(fromUid, false);
                  teamFansInfoService.updateWeixinBind(fromUid, false);
               }
            }
         } else if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {// 邀请成功
@@ -85,17 +82,15 @@
            JSONObject json = JSONObject.fromObject(new String(message.getBody()));
            UserInviteMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInviteMQMsg.class);
            if (mqMsg != null) {
               threeSaleFocusInfoService.updateFansNum(mqMsg.getBossId());
               teamFansInfoService.updateFansNum(mqMsg.getBossId());
               
               // 重新统计粉丝等级数量
               teamLevelDailyRecordService.addStatisticByUid(mqMsg.getBossId());
            }
         } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userMoneyAdd.name())) {// 资金到账
            // 更新近60天到账
            JSONObject json = JSONObject.fromObject(new String(message.getBody()));
            UserMoneyChangeMQMsg mqMsg = new Gson().fromJson(json.toString(),UserMoneyChangeMQMsg.class);
            if (mqMsg != null) {
               threeSaleFocusInfoService.updateIncome(mqMsg.getUid(), mqMsg.getChangeMoney());
               teamFansInfoService.updateIncome(mqMsg.getUid(), mqMsg.getChangeMoney());
            }
         } else if (tag.equalsIgnoreCase(UserTopicTagEnum.becomeValidUser.name())) {// 成为有效用户
            // 有效用户标识
@@ -103,7 +98,7 @@
            BeComeValidUserMQMsg mqMsg = new Gson().fromJson(json.toString(),BeComeValidUserMQMsg.class);
            if (mqMsg != null) {
               // 更新成为有效粉丝
               threeSaleFocusInfoService.updateStateValid(mqMsg.getUid(), true);
               teamFansInfoService.updateStateValid(mqMsg.getUid(), true);
            }
         }
      }