| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | |
|
| | |
|
| | |
|
| | |
| | | userVIPInfoMapper.insert(info);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | |
| | | // 下级的超级会员 不脱离
|
| | | userInviteSeparateService.updateInvalidByBossId(uid);
|
| | |
|
| | | // 赠送券
|
| | | try {
|
| | | BigDecimal percent = new BigDecimal(configService.get("exchange_rebate_percent"));
|
| | | for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), |
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | | |
| | | for (int i = 0; i < Constant.VIP_COUPON_GIVEFREE_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(), |
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | throw new UserVIPInfoException(1, "券赠送失败");
|
| | | }
|
| | | |
| | | // 消息
|
| | | MsgOtherVIPDTO msgOther = new MsgOtherVIPDTO();
|
| | | msgOther.setContent1("恭喜你,已成为超级会员");
|
| | | msgOther.setContent2("满足升级条件");
|
| | | msgOther.setContent3(TimeUtil.formatDateDot(new Date()));
|
| | | userOtherMsgNotificationService.passVIPApplyMsg(uid, "如有疑问请联系我的-人工客服", msgOther);
|
| | | userOtherMsgNotificationService.passVIPApplyMsg(uid, "返利奖励券和赠送免单券请到我的-福利中心中查看", msgOther);
|
| | |
|
| | | // 通知上级
|
| | | callBoss(uid);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 通知上级脱离关系
|
| | | * @param uid
|
| | | */
|
| | | @Transactional
|
| | | private void callBoss(Long uid) {
|
| | | // 是否存在上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null)
|
| | |
| | | inviteSeparate.setUpdateTime(new Date());
|
| | | userInviteSeparateService.insertSelective(inviteSeparate);
|
| | |
|
| | | |
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | // 消息
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | |
| | | msgboss.setContent3("今日起"+limitDays+"天内,你未能成为超级会员将会与其以及其直接粉丝脱离邀请关系 ");
|
| | | userOtherMsgNotificationService.teamVIPCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | |
|
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException {
|