From 06cceb46b3cec36f006cd1e776f9f48c03884ab6 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 11:07:27 +0800 Subject: [PATCH] =?UTF-8?q?[banner=E5=9B=BE=E6=94=AF=E4=BB=98][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]:banner=E5=9B=BE=E5=88=B8=E6=94=AF=E4=BB=98=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxOrderController.java | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java index 3235b5246..ea3aa5857 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java @@ -92,28 +92,35 @@ public class WxOrderController extends BaseController { //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); String couponChannelIdStr = paramMap.get("couponChannelId"); String couponIdStr = paramMap.get("couponId"); + /* + // TODO 修改支持banner图,获取不到couponChannelId问题 if (StringUtils.isBlank(couponChannelIdStr)) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); } + */ Long couponChannelId = 0L, couponId = 0L; - try { - couponChannelId = Long.valueOf(couponChannelIdStr); - } catch (NumberFormatException e) { - logger.error("couponChannelId convert error, " + couponChannelIdStr + ", e:" + e.getMessage()); - return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponChannelId: " + couponChannelIdStr + ", e:" + e.getMessage()); - } - WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannelId); - if (wxCouponChannel == null) { - logger.error("couponChannelId convert error, " + couponChannelIdStr); - return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "找不到发布的频道"); - } - if (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { - logger.error("此券已下架:" + couponChannelIdStr); - return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(), "此券已下架"); + + if (!StringUtils.isBlank(couponChannelIdStr)) { + try { + couponChannelId = Long.valueOf(couponChannelIdStr); + } catch (NumberFormatException e) { + logger.error("couponChannelId convert error, " + couponChannelIdStr + ", e:" + e.getMessage()); + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponChannelId: " + couponChannelIdStr + ", e:" + e.getMessage()); + } + WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannelId); + if (wxCouponChannel == null) { + logger.error("couponChannelId convert error, " + couponChannelIdStr); + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "找不到发布的频道"); + } + if (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { + logger.error("此券已下架:" + couponChannelIdStr); + return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(), "此券已下架"); + } + if (StringUtils.isBlank(couponIdStr)) { + couponId = wxCouponChannel.getCouponId(); + } } - if (StringUtils.isBlank(couponIdStr)) { - couponId = wxCouponChannel.getCouponId(); - } else { + if (couponId <= 0 && !StringUtils.isBlank(couponIdStr)) { try { couponId = Long.valueOf(couponIdStr); } catch (NumberFormatException e) { @@ -121,6 +128,12 @@ public class WxOrderController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponId: " + couponIdStr + ", e:" + e.getMessage()); } } + + if (couponId <= 0) { + logger.error("couponChannelId或者couponId不能为空"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId或者couponId不能为空"); + } + WxCUser user = getUser(); try {