|
|
|
@@ -113,20 +113,21 @@ public class WxCardPayController extends BaseController { |
|
|
|
return new ResultData(mapList); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "微信B端扫C端电子储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"cUserId\":\"String\",\"totalFee\":\"String(元)\"}") |
|
|
|
@PostMapping("order_create_ecard") |
|
|
|
public ResultData saveECardCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { |
|
|
|
@ApiOperation(value = "微信B端扫储值卡码支付订单", notes = "params:{\"cardId\":\"String\",\"cUserId\":\"String\",\"totalFee\":\"String(元)\"}") |
|
|
|
@PostMapping("scan_card") |
|
|
|
public ResultData scanCard(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { |
|
|
|
String cardIdStr = paramMap.get("cardId"); |
|
|
|
String cUserIdStr = paramMap.get("cUserId"); |
|
|
|
if (StringUtils.isBlank(cUserIdStr) || cUserIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
logger.error("cUserId不能为空"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cUserId不能为空"); |
|
|
|
} |
|
|
|
String totalFeeStr = paramMap.get("totalFee"); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(cardIdStr) || cardIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
logger.error("cardId不能为空"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isBlank(totalFeeStr) || totalFeeStr.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "totalFee不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
String _decodeCouponOrderId = WxCouponOrderCVo.getDecodeExpiredCouponOrderId(cardIdStr); |
|
|
|
if (_decodeCouponOrderId.contains(WxCouponOrderCVo.arg)) { |
|
|
|
String[] decodeids = _decodeCouponOrderId.split(WxCouponOrderCVo.arg); |
|
|
|
@@ -136,8 +137,17 @@ public class WxCardPayController extends BaseController { |
|
|
|
if (expiredtime.before(new Date())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"码已失效,请更新二维码后重试"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(cUserIdStr) || cUserIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
logger.error("cUserId不能为空"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cUserId不能为空"); |
|
|
|
} |
|
|
|
return saveECardCardPayOrder(cardIdStr,cUserIdStr,totalFeeStr); |
|
|
|
}else { |
|
|
|
return savePasswordCardPayOrder(cardIdStr,cUserIdStr,totalFeeStr); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private ResultData saveECardCardPayOrder(String cardIdStr,String cUserIdStr,String totalFeeStr) { |
|
|
|
Long cUserId = null; |
|
|
|
try { |
|
|
|
cUserId = Long.valueOf(cUserIdStr); |
|
|
|
@@ -145,7 +155,6 @@ public class WxCardPayController extends BaseController { |
|
|
|
logger.error("cardId convert failed:" + cardIdStr); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败"); |
|
|
|
} |
|
|
|
String totalFeeStr = paramMap.get("totalFee"); |
|
|
|
WxMerchantBUser merchantBUser = getLoginBUser(); |
|
|
|
Long cardId = null; |
|
|
|
try { |
|
|
|
@@ -162,6 +171,38 @@ public class WxCardPayController extends BaseController { |
|
|
|
} |
|
|
|
return saveCardPayOrder(cUserId,cardInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultData savePasswordCardPayOrder(String cardIdStr,String cUserIdStr,String totalFeeStr) { |
|
|
|
Long cardId = null; |
|
|
|
try { |
|
|
|
cardId = Long.valueOf(cardIdStr); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("cardId convert failed:" + cardIdStr); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败"); |
|
|
|
} |
|
|
|
|
|
|
|
WxMerchantBUser merchantBUser = getLoginBUser(); |
|
|
|
|
|
|
|
WxCouponPassword couponPassword = wxCouponPassword.getById(cardId); |
|
|
|
if (null == couponPassword) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "卡未查询到"); |
|
|
|
} |
|
|
|
if (EnumYesOrNo.YES.getCode().intValue() == couponPassword.getIsStop().intValue()) { |
|
|
|
return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡已被禁用."); |
|
|
|
} |
|
|
|
|
|
|
|
WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); |
|
|
|
if (coupon == null) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
if (coupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { |
|
|
|
logger.error("此券已作废:" + coupon.getId()); |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); |
|
|
|
} |
|
|
|
|
|
|
|
WxCardInfo carInfo = wxCardInfoService.cardCreateByOffline(couponPassword, coupon); |
|
|
|
return saveCardPayOrder(Constant.defaultCUserId,carInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT); |
|
|
|
} |
|
|
|
|
|
|
|
private ResultData saveCardPayOrder(Long cUserId,WxCardInfo cardInfo,WxMerchantBUser merchantBUser,String totalFeeStr,EnumPayWay payWay) { |
|
|
|
|
|
|
|
@@ -249,44 +290,6 @@ public class WxCardPayController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "微信B端扫C端实体储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"totalFee\":\"String(元)\"}") |
|
|
|
@PostMapping("order_create_card") |
|
|
|
public ResultData saveCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { |
|
|
|
String cardIdStr = paramMap.get("cardId"); |
|
|
|
String totalFeeStr = paramMap.get("totalFee"); |
|
|
|
if (StringUtils.isBlank(cardIdStr) || cardIdStr.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
logger.error("cardId不能为空"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空"); |
|
|
|
} |
|
|
|
Long cardId = null; |
|
|
|
try { |
|
|
|
cardId = Long.valueOf(cardIdStr); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("cardId convert failed:" + cardIdStr); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败"); |
|
|
|
} |
|
|
|
|
|
|
|
WxMerchantBUser merchantBUser = getLoginBUser(); |
|
|
|
|
|
|
|
WxCouponPassword couponPassword = wxCouponPassword.getById(cardId); |
|
|
|
if (null == couponPassword) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "卡未查询到"); |
|
|
|
} |
|
|
|
if (EnumYesOrNo.YES.getCode().intValue() == couponPassword.getIsStop().intValue()) { |
|
|
|
return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡已被禁用."); |
|
|
|
} |
|
|
|
|
|
|
|
WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); |
|
|
|
if (coupon == null) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
if (coupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { |
|
|
|
logger.error("此券已作废:" + coupon.getId()); |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); |
|
|
|
} |
|
|
|
|
|
|
|
WxCardInfo carInfo = wxCardInfoService.cardCreateByOffline(couponPassword, coupon); |
|
|
|
return saveCardPayOrder(Constant.defaultCUserId,carInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |