| | |
| | | throw new RedPackGiveRecordException(1, "余额不足");
|
| | |
|
| | | Date nowDate = new Date();
|
| | | Date endTime = DateUtil.plusDayDate(Constant.TOKEN_DAYS, new Date());
|
| | | // 赠送记录
|
| | | RedPackGiveRecord giveRecord = new RedPackGiveRecord();
|
| | | giveRecord.setAmount(amount);
|
| | | giveRecord.setGiveUid(uid);
|
| | | giveRecord.setState(RedPackGiveRecord.STATE_INIT);
|
| | | giveRecord.setGiveTime(nowDate);
|
| | | giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, new Date()));
|
| | | giveRecord.setEndTime(endTime);
|
| | | redPackGiveRecordMapper.insertSelective(giveRecord);
|
| | |
|
| | | // 口令记录
|
| | |
| | | tokenRecord.setIdentify(giveRecord.getId() + "");
|
| | | tokenRecord.setType(TokenTypeEnum.redPack);
|
| | | tokenRecord.setStartTime(nowDate);
|
| | | tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, new Date()));
|
| | | tokenRecord.setEndTime(endTime);
|
| | | tokenRecord.setState(0);
|
| | | tokenRecordService.insertSelective(tokenRecord);
|
| | |
|
| | |
| | | msg.setUid(uid);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.redPackGiftDrawback,
|
| | | msg);
|
| | | // 延迟一分钟
|
| | | message.setStartDeliverTime(endTime.getTime() + 1000 * 60);
|
| | | try {
|
| | | producer.send(message);
|
| | | } catch (Exception e) {
|
| | | throw new RedPackGiveRecordException(1, "红包创建失败");
|
| | | }
|
| | | |
| | |
|
| | | return tips;
|
| | | }
|
| | |
|