| @@ -137,21 +137,26 @@ public class WxCouponOrderController extends BaseController { | |||||
| @ApiOperation(value = "卡转赠领取") | @ApiOperation(value = "卡转赠领取") | ||||
| @PostMapping("cardAccept") | @PostMapping("cardAccept") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "coupon_order_id", dataType = "Long", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "cUserId", value = "转赠者", dataType = "Long", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData cardAccept(@ModelAttribute WxCouponOrder wxCouponOrder) { | public ResultData cardAccept(@ModelAttribute WxCouponOrder wxCouponOrder) { | ||||
| //coupon_order_id判断 | //coupon_order_id判断 | ||||
| Long id = wxCouponOrder.getId(); | Long id = wxCouponOrder.getId(); | ||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id不能为空"); | |||||
| } | } | ||||
| //转赠人判断 | //转赠人判断 | ||||
| if (wxCouponOrder.getCUserId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| Long cUserId = wxCouponOrder.getCUserId(); | |||||
| if (cUserId == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cUserId不能为空"); | |||||
| } | } | ||||
| //当前领取人 | //当前领取人 | ||||
| wxCouponOrder.setOwnerId(getUserId()); | wxCouponOrder.setOwnerId(getUserId()); | ||||
| //转赠者与当前领取人是否为同一个 | //转赠者与当前领取人是否为同一个 | ||||
| if (wxCouponOrder.getCUserId().equals(wxCouponOrder.getOwnerId())) { | |||||
| if (cUserId.equals(wxCouponOrder.getOwnerId())) { | |||||
| logger.info("转赠人与卡所有者相同"); | logger.info("转赠人与卡所有者相同"); | ||||
| return new ResultData(ErrorCode.CARD_TRANSFER_INVALID.getCode(), "转赠人与卡所有者相同"); | return new ResultData(ErrorCode.CARD_TRANSFER_INVALID.getCode(), "转赠人与卡所有者相同"); | ||||
| } | } | ||||
| @@ -162,21 +167,26 @@ public class WxCouponOrderController extends BaseController { | |||||
| @ApiOperation(value = "查询转赠卡状态") | @ApiOperation(value = "查询转赠卡状态") | ||||
| @PostMapping("queryCardStatus") | @PostMapping("queryCardStatus") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "coupon_order_id", dataType = "Long", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "cUserId", value = "转赠者", dataType = "Long", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData queryCardStatus(@ModelAttribute WxCouponOrder wxCouponOrder) { | public ResultData queryCardStatus(@ModelAttribute WxCouponOrder wxCouponOrder) { | ||||
| //coupon_order_id判断 | //coupon_order_id判断 | ||||
| Long id = wxCouponOrder.getId(); | Long id = wxCouponOrder.getId(); | ||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id不能为空"); | |||||
| } | } | ||||
| //转赠人判断 | //转赠人判断 | ||||
| if (wxCouponOrder.getCUserId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| Long cUserId = wxCouponOrder.getCUserId(); | |||||
| if (cUserId == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cUserId不能为空"); | |||||
| } | } | ||||
| //当前领取人 | //当前领取人 | ||||
| wxCouponOrder.setOwnerId(getUserId()); | wxCouponOrder.setOwnerId(getUserId()); | ||||
| //转赠者与当前领取人是否为同一个 | //转赠者与当前领取人是否为同一个 | ||||
| if (wxCouponOrder.getCUserId().equals(wxCouponOrder.getOwnerId())) { | |||||
| if (cUserId.equals(wxCouponOrder.getOwnerId())) { | |||||
| logger.info("转赠人与卡所有者相同"); | logger.info("转赠人与卡所有者相同"); | ||||
| return new ResultData(ErrorCode.CARD_TRANSFER_INVALID.getCode(), "转赠人与卡所有者相同"); | return new ResultData(ErrorCode.CARD_TRANSFER_INVALID.getCode(), "转赠人与卡所有者相同"); | ||||
| } | } | ||||