| | |
| | | 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.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | |
| | | // 老用户同步绑定信息
|
| | | userInfoModifyRecordService.syncBeforeInfo(uid);
|
| | |
|
| | | // 同步老用户等级
|
| | | UserActiveLog log = userActiveLogService.getUserLatestActiveInfo(uid);
|
| | |
|
| | | // 低版本全部升级普通会员
|
| | | if (log != null && !VersionUtil.greaterThan_2_1(
|
| | | "appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android", log.getVersionCode())) {
|
| | | UserVIPPreInfo vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {
|
| | | vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {// 没有生成高级及以上会员
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode())) {
|
| | | // 老用户生成普通会员
|
| | | UserVIPPreInfo vip = new UserVIPPreInfo();
|
| | | vip.setCreateTime(new Date());
|
| | | vip.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | vip.setUid(uid);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(vip);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | List<ThreeSale> threeSaleList = threeSaleSerivce.getMyBossDeepList(uid, 2);
|
| | | List<Long> uidList = new ArrayList<>();
|
| | | uidList.add(uid);
|
| | |
|
| | | if (threeSaleList != null) {
|
| | | for (ThreeSale ts : threeSaleList) {
|
| | | uidList.add(ts.getBoss().getId());
|
| | | }
|
| | | }
|
| | | upgradeOldUser(uidList);
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | private void upgradeOldUser(List<Long> uidList) {
|
| | | for (Long uid : uidList) {
|
| | | // 同步老用户等级
|
| | | UserActiveLog log = userActiveLogService.getUserLatestActiveInfo(uid);
|
| | |
|
| | | // 低版本全部升级普通会员
|
| | | if (log != null
|
| | | && !VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android",
|
| | | log.getVersionCode())) {
|
| | | UserVIPPreInfo vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {
|
| | | vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {// 没有生成高级及以上会员
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode())) {
|
| | | // 老用户生成普通会员
|
| | | UserVIPPreInfo vip = new UserVIPPreInfo();
|
| | | vip.setCreateTime(new Date());
|
| | | vip.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | vip.setUid(uid);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(vip);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } else if (log != null && VersionUtil.greaterThan_2_1(
|
| | | "appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android", log.getVersionCode())) {// 2.1后升级其他等级
|
| | | // 线上老用户升级到2.1,自动计算等级
|
| | | List<Long> uids = new ArrayList<>();
|
| | | uids.add(uid);
|
| | | List<UserInfoRegister> list = userInfoRegisterService.listByMultipleUids(uids);
|
| | | if (list != null && list.size() > 0)// 有注册信息
|
| | | {
|
| | | if (list.get(0).getCreateTime().getTime() < Constant.NEW_ORDER_FANLI_RULE_TIME) {// 老用户
|
| | | // 同步用户等级
|
| | | UserVIPPreInfo vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {
|
| | | // 计算等级
|
| | | userVIPPreInfoService.upgradeVipByMyOrder(uid);
|
| | | userVIPPreInfoService.upgradeVipByTeamNum(uid);
|
| | | vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {// 没有生成高级及以上会员
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode())) {
|
| | | // 老用户生成普通会员
|
| | | UserVIPPreInfo vip = new UserVIPPreInfo();
|
| | | vip.setCreateTime(new Date());
|
| | | vip.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | vip.setUid(uid);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(vip);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | } else if (log != null && VersionUtil.greaterThan_2_1(
|
| | | "appstore".equalsIgnoreCase(log.getChannel()) ? "ios" : "android", log.getVersionCode())) {// 2.1后升级其他等级
|
| | | // 线上老用户升级到2.1,自动计算等级
|
| | | List<Long> uids = new ArrayList<>();
|
| | | uids.add(uid);
|
| | | List<UserInfoRegister> list = userInfoRegisterService.listByMultipleUids(uids);
|
| | | if (list != null && list.size() > 0)// 有注册信息
|
| | | {
|
| | | if (list.get(0).getCreateTime().getTime() < Constant.NEW_ORDER_FANLI_RULE_TIME) {// 老用户
|
| | | // 同步用户等级
|
| | | UserVIPPreInfo vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {
|
| | | // 计算等级
|
| | | userVIPPreInfoService.upgradeVipByMyOrder(uid);
|
| | | userVIPPreInfoService.upgradeVipByTeamNum(uid);
|
| | | vipInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (vipInfo == null) {// 没有生成高级及以上会员
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode())) {
|
| | | // 老用户生成普通会员
|
| | | UserVIPPreInfo vip = new UserVIPPreInfo();
|
| | | vip.setCreateTime(new Date());
|
| | | vip.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | vip.setUid(uid);
|
| | | try {
|
| | | userVIPPreInfoService.addUserVIPPreInfo(vip);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|