From 52d4fbddfd46b0dd684d99e5c0849b022606c8e2 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 26 五月 2020 10:37:32 +0800
Subject: [PATCH] 邀请成功消息延迟
---
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java | 79 ++++++++++++++++++++++++++++++---------
1 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java b/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java
index 67f47ad..034ebec 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java
@@ -12,13 +12,20 @@
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
import com.yeshi.fanli.dto.mq.user.body.BeComeValidUserMQMsg;
import com.yeshi.fanli.dto.mq.user.body.TaoBaoBindSuccessMQMsg;
+import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg.UserInfoUpdateTypeEnum;
import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
+import com.yeshi.fanli.dto.mq.user.body.UserLevelChangedMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserMoneyChangeMQMsg;
+import com.yeshi.fanli.dto.mq.user.body.UserPhoneOpenMQMsg;
+import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
+import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
import net.sf.json.JSONObject;
@@ -34,8 +41,16 @@
@Resource
private TeamFansInfoService teamFansInfoService;
-
-
+
+ @Resource
+ private ThreeSaleDetailService threeSaleDetailService;
+
+ @Resource
+ private ThreeSaleSerivce threeSaleSerivce;
+
+ @Resource
+ private TeamUserLevelStatisticService teamUserLevelStatisticService;
+
@Override
public Action consume(Message message, ConsumeContext context) {
@@ -46,60 +61,88 @@
tag = "";
// 璁㈤槄绮変笣澧炲姞/绮変笣鎴愪负鏈夋晥鐢ㄦ埛 娑堟伅,娣樺疂鎺堟潈锛屽井淇″彿缁戝畾锛屾渶杩戠櫥褰曪紝鐢ㄦ埛璧勯噾澧炲姞
-
if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
if (tag.equalsIgnoreCase(UserTopicTagEnum.userActve.name())) {// 鐢ㄦ埛娲昏穬
JSONObject json = JSONObject.fromObject(new String(message.getBody()));
- UserActiveMQMsg userActiveMQMsg = new Gson().fromJson(json.toString(),UserActiveMQMsg.class);
+ UserActiveMQMsg userActiveMQMsg = new Gson().fromJson(json.toString(), UserActiveMQMsg.class);
if (userActiveMQMsg != null) {
// 鏇存敼鐢ㄦ埛娲昏穬鏃堕棿
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);
+ UserInfoUpdateMQMsg mqMsg = new Gson().fromJson(json.toString(), UserInfoUpdateMQMsg.class);
if (mqMsg != null) {
if (UserInfoUpdateTypeEnum.nickName == mqMsg.getType()) { // 鏇存敼鏄电О
teamFansInfoService.updateNickName(mqMsg.getUid(), mqMsg.getValue());
} else if (UserInfoUpdateTypeEnum.wxId == mqMsg.getType()) { // 寰俊鍙风粦瀹�
- teamFansInfoService.updateWeixinBind(mqMsg.getUid(), true);
+ teamFansInfoService.updateWeixinId(mqMsg.getUid(), mqMsg.getValue());
+ } else if (UserInfoUpdateTypeEnum.inviteCode == mqMsg.getType()) { // 閭�璇风爜鏇存敼
+ teamFansInfoService.updateInviteCode(mqMsg.getUid(), mqMsg.getValue());
}
}
} else if (tag.equalsIgnoreCase(UserTopicTagEnum.taobaoBindSuccess.name())) {// 娣樺疂缁戝畾鎴愬姛
- // 鏇存敼娣樺疂缁戝畾鐘舵�佷笌鍘熺敤鎴锋窐瀹濈粦瀹氱姸鎬�
+ // 鏇存敼娣樺疂缁戝畾鐘舵�佷笌鍘熺敤鎴锋窐瀹濈粦瀹氱姸鎬�
JSONObject json = JSONObject.fromObject(new String(message.getBody()));
- TaoBaoBindSuccessMQMsg mqMsg = new Gson().fromJson(json.toString(),TaoBaoBindSuccessMQMsg.class);
+ TaoBaoBindSuccessMQMsg mqMsg = new Gson().fromJson(json.toString(), TaoBaoBindSuccessMQMsg.class);
if (mqMsg != null) {
- // 鏇存柊娣樺疂缁戝畾
- teamFansInfoService.updateWeixinBind(mqMsg.getUid(), true);
+ teamFansInfoService.updateTaobaoBind(mqMsg.getUid(), true);
Long fromUid = mqMsg.getFromUid();
if (fromUid != null) { // 娣樺疂琚В缁�
- teamFansInfoService.updateWeixinBind(fromUid, false);
+ teamFansInfoService.updateTaobaoBind(fromUid, false);
}
}
} else if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {// 閭�璇锋垚鍔�
- // 鏇存柊绮変笣鏁伴噺
JSONObject json = JSONObject.fromObject(new String(message.getBody()));
- UserInviteMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInviteMQMsg.class);
+ UserInviteMQMsg mqMsg = new Gson().fromJson(json.toString(), UserInviteMQMsg.class);
if (mqMsg != null) {
+ // 鏇存柊涓婄骇鐨勭矇涓濇暟閲�
teamFansInfoService.updateFansNum(mqMsg.getBossId());
-
+
+ threeSaleDetailService.addByWorkerUid(mqMsg.getWorkerId());
+
+ // 鏇存柊闃熷憳缁熻淇℃伅
+ teamUserLevelStatisticService.initData(mqMsg.getBossId());
+ UserInfo boss = threeSaleSerivce.getBoss(mqMsg.getBossId());
+ if (boss != null) {
+ teamUserLevelStatisticService.initData(boss.getId());
+ }
+
}
} 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);
+ UserMoneyChangeMQMsg mqMsg = new Gson().fromJson(json.toString(), UserMoneyChangeMQMsg.class);
if (mqMsg != null) {
+ // 鏇存柊杩�60澶╁埌璐�
teamFansInfoService.updateIncome(mqMsg.getUid(), mqMsg.getChangeMoney());
}
} else if (tag.equalsIgnoreCase(UserTopicTagEnum.becomeValidUser.name())) {// 鎴愪负鏈夋晥鐢ㄦ埛
- // 鏈夋晥鐢ㄦ埛鏍囪瘑
JSONObject json = JSONObject.fromObject(new String(message.getBody()));
- BeComeValidUserMQMsg mqMsg = new Gson().fromJson(json.toString(),BeComeValidUserMQMsg.class);
+ BeComeValidUserMQMsg mqMsg = new Gson().fromJson(json.toString(), BeComeValidUserMQMsg.class);
if (mqMsg != null) {
// 鏇存柊鎴愪负鏈夋晥绮変笣
teamFansInfoService.updateStateValid(mqMsg.getUid(), true);
}
+ } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userAccountBinding.name())) {// 缁戝畾淇℃伅
+ JSONObject json = JSONObject.fromObject(new String(message.getBody()));
+ UserAccountBindingMQMsg mqMsg = new Gson().fromJson(json.toString(), UserAccountBindingMQMsg.class);
+ if (mqMsg != null) {
+ if (mqMsg.getType() == UserAccountBindingMQMsg.TYPE_PHONE) { // 缁戝畾鐢佃瘽鍙风爜
+ teamFansInfoService.updatePhone(mqMsg.getUid(), mqMsg.getValue());
+ }
+ }
+ } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userLevelChanged.name())) {// 绛夌骇鍙樺寲
+ JSONObject json = JSONObject.fromObject(new String(message.getBody()));
+ UserLevelChangedMQMsg mqMsg = new Gson().fromJson(json.toString(), UserLevelChangedMQMsg.class);
+ if (mqMsg != null) {
+ teamFansInfoService.updateLevel(mqMsg.getUid(), mqMsg.getToLevel());
+ }
+ } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userPhoneOpen.name())) {// 鐢佃瘽鍙风爜鍏紑
+ JSONObject json = JSONObject.fromObject(new String(message.getBody()));
+ UserPhoneOpenMQMsg mqMsg = new Gson().fromJson(json.toString(), UserPhoneOpenMQMsg.class);
+ if (mqMsg != null) {
+ teamFansInfoService.updatePhoneOpen(mqMsg.getUid(), mqMsg.isState());
+ }
}
}
return Action.CommitMessage;
--
Gitblit v1.8.0