From ab8506cb479e94dd0304cb8c61410062eb7cb8d7 Mon Sep 17 00:00:00 2001 From: Burce Date: Mon, 9 Sep 2019 17:58:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B0=83=E6=95=B4]=E5=95=86=E6=88=B7=E5=8F=91?= =?UTF-8?q?=E5=88=B8=E5=BC=82=E5=B8=B8=E6=97=B6=E6=8F=90=E7=A4=BA=E5=88=B8?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxOrderServiceImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index 7100e76d1..24c7b82a2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -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;