| | |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.email.MailSenderUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | throw new UserVIPInfoException(1, "请先升级为高级会员");
|
| | | }
|
| | |
|
| | | if (!verifyVip(uid))
|
| | | int verifyResult = verifyVip(uid);
|
| | | if (verifyResult <= 0)
|
| | | throw new UserVIPInfoException(1, "不满足升级条件");
|
| | |
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | |
| | | info.setState(UserVIPInfo.STATE_VERIFING);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | // 发送邮件通知
|
| | | try {
|
| | | Config config = configService.getConfig(ConfigKeyEnum.extractCodeEmailFrom.getKey());
|
| | | String[] sts = config.getValue().split(",");
|
| | | String account = sts[0];
|
| | | String pwd = sts[1];
|
| | |
|
| | | String msg = String.format("用户ID:%s 申请超级会员", uid + "");
|
| | | String email = userVipConfigService.getValueByKey("apply_vip_email");
|
| | | String[] emails = email.split(",");
|
| | | for (String e : emails) {
|
| | | MailSenderUtil.sendEmail(e, account, pwd, msg, msg);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | }
|
| | |
|
| | | if (!verifyVip(uid))
|
| | | int verifyVipResult = verifyVip(uid);
|
| | |
|
| | | if (verifyVipResult <= 0)
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | |
|
| | | Date upgradeTime = new Date();
|
| | |
| | | UserVIPPreInfo preInfo = new UserVIPPreInfo();
|
| | | preInfo.setCreateTime(new Date());
|
| | | preInfo.setProcess(UserLevelEnum.superVIP.getLevel());
|
| | | preInfo.setSourceType(verifyVipResult);
|
| | | preInfo.setUid(uid);
|
| | |
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * 验证是否符合VIP
|
| | | * @Title: verifyVip
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return
|
| | | * @return 0-不符合 1-订单 2-团队
|
| | | * int 返回类型
|
| | | * @throws
|
| | | */
|
| | | private boolean verifyVip(Long uid) {
|
| | | private int verifyVip(Long uid) {
|
| | | // 自购 + 分享订单
|
| | | long doneOrder = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY);
|
| | | // 有效粉丝
|
| | |
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | |
|
| | | if (doneOrder >= limitOrder || (doneFirst >= limitFirst && doneSecond >= limitSecond)) {
|
| | | return true;
|
| | | if (doneOrder >= limitOrder) {
|
| | | return UserVIPPreInfo.SOURCE_TYPE_ORDER;
|
| | | }
|
| | | return false;
|
| | |
|
| | | if ((doneFirst >= limitFirst && doneSecond >= limitSecond))
|
| | |
|
| | | return UserVIPPreInfo.SOURCE_TYPE_TEAM;
|
| | | return 0;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|