| @@ -45,6 +45,9 @@ public class WxCardPayController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCardSpendService wxCardSpendService; | WxCardSpendService wxCardSpendService; | ||||
| @Autowired | |||||
| WxCouponOrderService wxCouponOrderService; | |||||
| @ApiOperation(value = "C端扫B端储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"merchantId\":\"String\",\"totalFee\":\"String(元)\"}") | @ApiOperation(value = "C端扫B端储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"merchantId\":\"String\",\"totalFee\":\"String(元)\"}") | ||||
| @PostMapping("order_create") | @PostMapping("order_create") | ||||
| public ResultData saveCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { | public ResultData saveCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { | ||||
| @@ -87,6 +90,8 @@ public class WxCardPayController extends BaseController { | |||||
| Integer payment = totalFee.multiply(new BigDecimal(100)).intValue(); | Integer payment = totalFee.multiply(new BigDecimal(100)).intValue(); | ||||
| WxCUser user = getUser(); | |||||
| WxCardInfo cardInfo = wxCardInfoService.getById(cardId); | WxCardInfo cardInfo = wxCardInfoService.getById(cardId); | ||||
| if(cardInfo == null) { | if(cardInfo == null) { | ||||
| logger.error("卡不存在: " + cardIdStr); | logger.error("卡不存在: " + cardIdStr); | ||||
| @@ -98,14 +103,19 @@ public class WxCardPayController extends BaseController { | |||||
| return new ResultData(ErrorCode.CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH); | return new ResultData(ErrorCode.CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH); | ||||
| } | } | ||||
| //查看所有者与扫码者是否为一致 | |||||
| WxCouponOrder couponOrder = wxCouponOrderService.getById(cardId); | |||||
| if (couponOrder.getOwnerId().equals(user.getId())) { | |||||
| logger.error("卡已被领取: " + cardIdStr); | |||||
| return new ResultData(ErrorCode.CARD_TRANSFERED); | |||||
| } | |||||
| WxCouponMerchant couponMerchant = wxCardSpendService.checkMerchantInCoupon(cardInfo, merchantId); | WxCouponMerchant couponMerchant = wxCardSpendService.checkMerchantInCoupon(cardInfo, merchantId); | ||||
| if(couponMerchant == null) { | if(couponMerchant == null) { | ||||
| logger.error("商户不支持此卡 " + cardIdStr); | logger.error("商户不支持此卡 " + cardIdStr); | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_MERANT_IS_NULL.getCode(), "商户不支持此卡"); | return new ResultData(ErrorCode.COUPON_ORDER_MERANT_IS_NULL.getCode(), "商户不支持此卡"); | ||||
| } | } | ||||
| WxCUser user = getUser(); | |||||
| WxMerchant merchant = wxMerchantService.getById(merchantId); | WxMerchant merchant = wxMerchantService.getById(merchantId); | ||||
| if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) { | if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) { | ||||
| logger.error("商户已禁用, merchantId: " + merchant.getId()); | logger.error("商户已禁用, merchantId: " + merchant.getId()); | ||||