| @@ -92,28 +92,35 @@ public class WxOrderController extends BaseController { | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| String couponChannelIdStr = paramMap.get("couponChannelId"); | String couponChannelIdStr = paramMap.get("couponChannelId"); | ||||
| String couponIdStr = paramMap.get("couponId"); | String couponIdStr = paramMap.get("couponId"); | ||||
| /* | |||||
| // TODO 修改支持banner图,获取不到couponChannelId问题 | |||||
| if (StringUtils.isBlank(couponChannelIdStr)) { | if (StringUtils.isBlank(couponChannelIdStr)) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); | ||||
| } | } | ||||
| */ | |||||
| Long couponChannelId = 0L, couponId = 0L; | 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 { | try { | ||||
| couponId = Long.valueOf(couponIdStr); | couponId = Long.valueOf(couponIdStr); | ||||
| } catch (NumberFormatException e) { | } 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()); | 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(); | WxCUser user = getUser(); | ||||
| try { | try { | ||||