|
|
|
@@ -45,6 +45,9 @@ public class WxCardPayController extends BaseController { |
|
|
|
@Autowired |
|
|
|
WxCardSpendService wxCardSpendService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponOrderService wxCouponOrderService; |
|
|
|
|
|
|
|
@ApiOperation(value = "C端扫B端储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"merchantId\":\"String\",\"totalFee\":\"String(元)\"}") |
|
|
|
@PostMapping("order_create") |
|
|
|
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(); |
|
|
|
|
|
|
|
WxCUser user = getUser(); |
|
|
|
|
|
|
|
WxCardInfo cardInfo = wxCardInfoService.getById(cardId); |
|
|
|
if(cardInfo == null) { |
|
|
|
logger.error("卡不存在: " + cardIdStr); |
|
|
|
@@ -98,14 +103,19 @@ public class WxCardPayController extends BaseController { |
|
|
|
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); |
|
|
|
if(couponMerchant == null) { |
|
|
|
logger.error("商户不支持此卡 " + cardIdStr); |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_MERANT_IS_NULL.getCode(), "商户不支持此卡"); |
|
|
|
} |
|
|
|
|
|
|
|
WxCUser user = getUser(); |
|
|
|
|
|
|
|
WxMerchant merchant = wxMerchantService.getById(merchantId); |
|
|
|
if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) { |
|
|
|
logger.error("商户已禁用, merchantId: " + merchant.getId()); |
|
|
|
|