| | |
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | |
| | |
|
| | | @Override
|
| | | public int insertSelective(UserSystemCoupon record) {
|
| | | return userSystemCouponMapper.insertSelective(record);
|
| | |
| | | if (orderNo == null || orderNo.trim().length() == 0)
|
| | | throw new UserSystemCouponException(1, "订单号不存在");
|
| | |
|
| | | // 检查订单号是否维权
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(sourceType, orderNo);
|
| | | boolean weiquan = false;
|
| | | if (commonOrderList != null) {
|
| | | for (CommonOrder commonOrder : commonOrderList) {
|
| | | if (commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | weiquan = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (weiquan) {
|
| | | throw new UserSystemCouponException(1, "亲,很遗憾,售后维权订单不能使用返利奖励券~");
|
| | | }
|
| | |
|
| | | // 订单
|
| | | CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS,
|
| | | sourceType);
|
| | |
| | | UserSystemCouponUseMQMsg mqMsg = new UserSystemCouponUseMQMsg(userSystemCoupon.getId(), order.getOrderId(),
|
| | | sourceType, systemCoupon.getType().name());
|
| | | // 事务消息
|
| | | Message msg =MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.useSystemCoupon,
|
| | | mqMsg);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.useSystemCoupon, mqMsg);
|
| | | try {
|
| | | SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | | @Override
|
| | |
| | | UserSystemCouponUseMQMsg msg = new UserSystemCouponUseMQMsg();
|
| | | msg.setUserSystemCouponId(id);
|
| | | msg.setCouponType(type.name());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.systemCouponDrawback,
|
| | | msg);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.systemCouponDrawback, msg);
|
| | | try {
|
| | | producer.send(message);
|
| | | } catch (Exception e) {
|
| | |
| | | sendBackGiveCoupon(list);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#id")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | |
|
| | | // 口令失效
|
| | | tokenRecordService.invalidByCoupon(giveRecord.getId());
|
| | |
|
| | |
|
| | | Date now = new Date();
|
| | | Date endTime = userCoupon.getEndTime();
|
| | |
| | | msgOther.setReturnTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveRecord.getGiveUid(), beiZhu, msgOther);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void sendBackGiveCoupon(List<UserSystemCouponGiveRecord> overdueList) {
|