| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPPreInfoMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserLevelChangedMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Service
|
| | | public class UserVIPPreInfoServiceImpl implements UserVIPPreInfoService {
|
| | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | if (userInfoRegister != null && userInfoRegister.getCreateTime() != null) {
|
| | | registerTime = userInfoRegister.getCreateTime();
|
| | | }
|
| | | int daysBetween = DateUtil.daysBetween(registerTime, new Date());
|
| | | int daysBetween = TimeUtil.getDayDifferenceCount(registerTime, new Date());
|
| | | userAccountMsgNotificationService.vipPreUpgrade(uid, "快省达人", "普通会员", daysBetween, limit1, limit2, type);
|
| | |
|
| | | // 升级弹框提示
|
| | |
| | | userInviteSeparateService.updateInvalidByBossId(uid);
|
| | | // 提醒上级
|
| | | remindBoss(uid, "普通会员", item, upgradeTime, true);
|
| | | |
| | | if (!Constant.IS_TEST) {
|
| | | UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(uid, UserLevelEnum.daRen,UserLevelEnum.normalVIP, new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg);
|
| | | producer.send(message);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | // 升级消息
|
| | | UserLevelEnum fromLevel = UserLevelEnum.normalVIP;
|
| | | int daysBetween = 0;
|
| | | boolean divorced = false;
|
| | | String beforeName = "快省达人";
|
| | |
| | | if (userInfoRegister != null && userInfoRegister.getCreateTime() != null) {
|
| | | registerTime = userInfoRegister.getCreateTime();
|
| | | }
|
| | | daysBetween = DateUtil.daysBetween(registerTime, upgradeTime);
|
| | | daysBetween = TimeUtil.getDayDifferenceCount(registerTime, upgradeTime);
|
| | |
|
| | | // 金币奖励 (直接升级高级会员补齐一级奖励)
|
| | | goldcoinReward(uid);
|
| | | // 需要发送脱离信息
|
| | | divorced = true;
|
| | | fromLevel = UserLevelEnum.daRen;
|
| | | }
|
| | | userAccountMsgNotificationService.vipPreUpgrade(uid, beforeName, "高级会员", daysBetween, limit1, limit2, type);
|
| | |
|
| | | // 提醒上级
|
| | | remindBoss(uid, "高级会员", item, upgradeTime, divorced);
|
| | | |
| | | |
| | | if (!Constant.IS_TEST) {
|
| | | UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(uid, fromLevel,UserLevelEnum.highVIP, new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg);
|
| | | producer.send(message);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.error(e);
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 验证上级是否已是会员
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(bossId, UserVIPPreInfo.PROCESS_1);
|
| | | if (oldInfo == null) {
|
| | | UserVIPPreInfo latestInfo = getLatestProcessInfo(bossId);
|
| | | if (latestInfo == null) {
|
| | | // 添加脱离关系倒计时
|
| | | userInviteSeparateService.addPreSeparateRecord(uid, bossId);
|
| | |
|