| @@ -340,7 +340,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| // 库存加锁 | |||
| if (!redisLock.lock(couponIdStr, timeStr)) { | |||
| logger.error("此券被锁定, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.TOO_MANY_REQUEST); | |||
| throw new MallinkException(ErrorCode.TOO_MANY_REQUEST.getCode(), coupon.getTitle() + ErrorCode.TOO_MANY_REQUEST.getMessage()); | |||
| } | |||
| JSONObject jo = JSONObject.parseObject(wxCouponSendVo.getConditions()) ; | |||
| @@ -352,7 +352,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| logger.error("此券库存为0, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.REMAIN_IS_EMPTY); | |||
| throw new MallinkException(ErrorCode.REMAIN_IS_EMPTY.getCode(), coupon.getTitle() + ErrorCode.REMAIN_IS_EMPTY.getMessage()); | |||
| } | |||
| int count = 0; | |||
| @@ -385,7 +385,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(), coupon.getTitle() + ErrorCode.ORDER_IS_LIMITED.getMessage()); | |||
| } | |||
| try { | |||
| @@ -393,7 +393,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| wxCouponSendService.reduceMerchantSend(wxCouponSendVo.getId(), merchantRemain,merchantSend,1); | |||
| } catch (RuntimeException e) { | |||
| logger.error("此券减库存失败, couponId: {}, error: {}", couponIdStr, e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(), coupon.getTitle() + ErrorCode.ORDER_IS_LIMITED.getMessage()); | |||
| } finally { | |||
| //解锁 | |||
| redisLock.unlock(couponIdStr, timeStr); | |||
| @@ -747,11 +747,11 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| if (coupon.getStatus() == EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()) { | |||
| logger.error("券已下架, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF.getCode(), coupon.getTitle() + ErrorCode.COUPON_IS_TAKE_OFF.getMessage()); | |||
| } | |||
| if (coupon.getSalePrice() != 0) { | |||
| logger.error("券不免费, couponId: " + couponIdStr); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_NOT_FREE); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_NOT_FREE.getCode(), coupon.getTitle() + ErrorCode.COUPON_IS_NOT_FREE.getMessage()); | |||
| } | |||
| if (Objects.nonNull(wxCouponSendVo) && Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), wxCouponSendVo.getSendType())) { | |||
| @@ -792,7 +792,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| wxOrderMapper.insertSelective(record); | |||
| } catch (Exception e) { | |||
| logger.error("保存订单:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | |||
| throw new MallinkException(ErrorCode.ORDER_SAVE_ERR.getCode(), coupon.getTitle() + ErrorCode.ORDER_SAVE_ERR.getMessage()); | |||
| } | |||
| // 创建couponOrder | |||
| @@ -801,7 +801,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| couponOrder = createCouponOrder(record, user, coupon); | |||
| } catch (Exception e) { | |||
| logger.error("保存订单:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR.getCode(), coupon.getTitle() + ErrorCode.COUPON_ORDER_SAVE_ERR.getMessage()); | |||
| } | |||
| return couponOrder; | |||