| | |
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
|
| | |
| | | try {
|
| | | redPackBalanceService.subRedPack(uid, amount, RedPackDetailFactory.createGiveOthers(giveRecord));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new RedPackGiveRecordException(1, "红包创建失败");
|
| | | }
|
| | |
|
| | | UserRedPackGiftMQMsg msg = new UserRedPackGiftMQMsg();
|
| | | msg.setId(giveRecord.getId());
|
| | | 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, "红包创建失败");
|
| | | |
| | | // 发送消息(非测试下)
|
| | | if (!Constant.IS_TEST) {
|
| | | UserRedPackGiftMQMsg msg = new UserRedPackGiftMQMsg();
|
| | | msg.setId(giveRecord.getId());
|
| | | 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) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new RedPackGiveRecordException(1, "红包创建失败");
|
| | | }
|
| | | }
|
| | | |
| | | return tips;
|
| | | }
|
| | |
|