| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
|
| | | import com.yeshi.fanli.exception.user.TokenRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinGiveRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | | |
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | | |
| | |
|
| | | @Override
|
| | | public void insertSelective(TokenRecord record) {
|
| | |
| | | || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
|
| | | throw new TokenRecordException(1, "该券不存在或非赠送");
|
| | |
|
| | | |
| | | |
| | | try {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE);
|
| | | UserSystemCoupon.SOURCE_GIVE, null);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new TokenRecordException(1, "领取失败");
|
| | |
| | | updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
|
| | | userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
|
| | |
|
| | | integralGetService.addGiveFreeCoupon(giveUid);
|
| | | |
| | | msg = "领取成功[免单券]成功,请到[我的-福利中心]中查看";
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|
| | |
| | | || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
|
| | | throw new TokenRecordException(1, "该券不存在或非赠送");
|
| | |
|
| | | SystemCoupon systemCoupon = userCoupon.getSystemCoupon();
|
| | | if (systemCoupon == null)
|
| | | throw new TokenRecordException(1, "该券不存在");
|
| | | |
| | | systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (systemCoupon == null)
|
| | | throw new TokenRecordException(1, "该券不存在");
|
| | | |
| | | try {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE);
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE, systemCoupon.getPercent());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new TokenRecordException(1, "领取失败");
|
| | |
| | | updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
|
| | | userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
|
| | |
|
| | | integralGetService.addGiveRebateCoupon(giveUid);
|
| | | |
| | | msg = "领取成功[返利奖励券]成功,请到[我的-福利中心]中查看";
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|
| | |
| | | updateRecord.setState(UserTaoLiJinGiveRecord.STATE_RECEIVE);
|
| | | userTaoLiJinGiveRecordService.updateByPrimaryKeySelective(updateRecord);
|
| | |
|
| | | integralGetService.addGiveTaoLiJin(giveUid);
|
| | | |
| | | msg = "领取成功[推广红包]成功,请到[我的-推广红包]中查看";
|
| | |
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|