Commit 1e1d4dc8 by 吕明尚

抽奖增加时长,金额

parent 4af45b18
...@@ -5,7 +5,11 @@ public enum PrizeTypeEnum { ...@@ -5,7 +5,11 @@ public enum PrizeTypeEnum {
COUPON(1, "优惠券"), COUPON(1, "优惠券"),
GOODS(2, "商品"), GOODS(2, "商品"),
INTEGRAL(3, "积分"), INTEGRAL(3, "积分"),
THANK(4, "谢谢参与"); TIME(4, "时长"),
//赠送金额
MONEY(5, "金额"),
//赠送时长
THANK(6, "谢谢参与");
private Integer code; private Integer code;
private String name; private String name;
......
...@@ -74,4 +74,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> { ...@@ -74,4 +74,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
int giveDuration(ConsumerWallet consumerWallet); int giveDuration(ConsumerWallet consumerWallet);
public int giveIntegral(ConsumerWallet consumerWallet); public int giveIntegral(ConsumerWallet consumerWallet);
int giveAmount(ConsumerWallet consumerWallet);
} }
...@@ -583,4 +583,59 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -583,4 +583,59 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
return 1; return 1;
} }
} }
@Override
public int giveAmount(ConsumerWallet consumerWallet) {
ConsumerWallet oldConsumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, consumerWallet.getConsumerId()));
ConsumerMember oldConsumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, consumerWallet.getConsumerId()));
if (ObjectUtil.isNotEmpty(oldConsumerWallet) && ObjectUtil.isNotEmpty(oldConsumerMember)) {
GiftAmountLog giftAmountLog = new GiftAmountLog();
giftAmountLog.setConsumerId(consumerWallet.getConsumerId());
giftAmountLog.setCurrentAmount(oldConsumerWallet.getGiftAmount());
giftAmountLog.setVariableAmount(consumerWallet.getGiftAmount());
giftAmountLog.setOperationType(YesNoEnum.yes.getIndex());
giftAmountLog.setOperationTime(new Date());
giftAmountLog.setCreateTime(new Date());
oldConsumerWallet.setGiftAmount(oldConsumerWallet.getGiftAmount().add(consumerWallet.getGiftAmount()));
oldConsumerWallet.setBalance(oldConsumerWallet.getRechargeAmount().add(oldConsumerWallet.getGiftAmount()));
giftAmountLogService.save(giftAmountLog);
consumerWalletService.updateById(oldConsumerWallet);
return 1;
} else {
ConsumerWallet newConsumerWallet = new ConsumerWallet();
newConsumerWallet.setConsumerId(consumerWallet.getConsumerId());
newConsumerWallet.setRechargeAmount(BigDecimal.ZERO);
newConsumerWallet.setRemainingDuration(BigDecimal.ZERO);
GiftAmountLog giftAmountLog = new GiftAmountLog();
giftAmountLog.setConsumerId(consumerWallet.getConsumerId());
giftAmountLog.setCurrentAmount(BigDecimal.ZERO);
giftAmountLog.setVariableAmount(consumerWallet.getGiftAmount());
giftAmountLog.setOperationType(YesNoEnum.yes.getIndex());
giftAmountLog.setOperationTime(new Date());
giftAmountLog.setCreateTime(new Date());
newConsumerWallet.setBalance(consumerWallet.getGiftAmount());
newConsumerWallet.setGiftAmount(consumerWallet.getGiftAmount());
newConsumerWallet.setRemainingDuration(BigDecimal.ZERO);
newConsumerWallet.setRemainingIntegral(BigDecimal.ZERO);
newConsumerWallet.setEquityFund(BigDecimal.ZERO);
newConsumerWallet.setAccumulateEquityFund(BigDecimal.ZERO);
newConsumerWallet.setCreateTime(new Date());
ConsumerMember newConsumerMember = new ConsumerMember();
newConsumerMember.setConsumerId(consumerWallet.getConsumerId());
newConsumerMember.setMembershipLevel(0L);
String rechargeMembershipExpirationTime = sysConfigService.selectConfigByKey("rechargeMembershipExpirationTime");
newConsumerMember.setExpirationDate(DateUtils.addYears(new Date(), Integer.parseInt(rechargeMembershipExpirationTime)));
newConsumerMember.setMembershipProgress(BigDecimal.ZERO);
newConsumerMember.setIsRecharge(YesNoEnum.no.getIndex());
newConsumerMember.setIsRights(YesNoEnum.no.getIndex());
newConsumerMember.setCreateTime(new Date());
consumerWalletService.save(newConsumerWallet);
giftAmountLogService.save(giftAmountLog);
consumerMemberService.save(newConsumerMember);
return 1;
}
}
} }
...@@ -175,6 +175,28 @@ public class WheelGameServiceImpl extends ServiceImpl<WheelGameMapper, WheelGame ...@@ -175,6 +175,28 @@ public class WheelGameServiceImpl extends ServiceImpl<WheelGameMapper, WheelGame
log.setSendMsg(prize.getPrizeValue() + ":" + PrizeTypeEnum.INTEGRAL.getName() + "以发放"); log.setSendMsg(prize.getPrizeValue() + ":" + PrizeTypeEnum.INTEGRAL.getName() + "以发放");
lotteryRecordsLogService.save(log); lotteryRecordsLogService.save(log);
break; break;
case TIME:
ConsumerWallet durationrWallet = new ConsumerWallet();
durationrWallet.setConsumerId(user.getId());
durationrWallet.setRemainingDuration(new BigDecimal(prize.getPrizeValue()));
consumerWalletService.giveDuration(durationrWallet);
log.setIsHit(YesNoEnum.yes.getIndex());
log.setIsSend(YesNoEnum.yes.getIndex());
log.setHitPrize(PrizeTypeEnum.TIME.getName());
log.setSendMsg(prize.getPrizeValue() + ":" + PrizeTypeEnum.TIME.getName() + "以发放");
lotteryRecordsLogService.save(log);
break;
case MONEY:
ConsumerWallet giveAmountWallet = new ConsumerWallet();
giveAmountWallet.setConsumerId(user.getId());
giveAmountWallet.setGiftAmount(new BigDecimal(prize.getPrizeValue()));
consumerWalletService.giveAmount(giveAmountWallet);
log.setIsHit(YesNoEnum.yes.getIndex());
log.setIsSend(YesNoEnum.yes.getIndex());
log.setHitPrize(PrizeTypeEnum.MONEY.getName());
log.setSendMsg(prize.getPrizeValue() + ":" + PrizeTypeEnum.MONEY.getName() + "以发放");
lotteryRecordsLogService.save(log);
break;
case THANK: case THANK:
log.setIsHit(YesNoEnum.no.getIndex()); log.setIsHit(YesNoEnum.no.getIndex());
log.setIsSend(YesNoEnum.no.getIndex()); log.setIsSend(YesNoEnum.no.getIndex());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment