会员购买补充
This commit is contained in:
parent
a59f76cd76
commit
9c877ea969
|
|
@ -40,19 +40,19 @@ public class OrderPayController {
|
|||
@DubboReference
|
||||
private SysParamsService paramsService;
|
||||
|
||||
// @PostMapping("/creditPay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Object> creditPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.creditPayOrder(payParam);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/cashPay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Object> cashPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.cashPayOrder(payParam);
|
||||
// }
|
||||
@PostMapping("/creditPay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Object> creditPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.creditPayOrder(payParam);
|
||||
}
|
||||
|
||||
@PostMapping("/cashPay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Object> cashPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.cashPayOrder(payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值并付款
|
||||
|
|
@ -66,128 +66,128 @@ public class OrderPayController {
|
|||
return payService.rechargePayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 会员支付
|
||||
// * payType 必填
|
||||
// * <p>
|
||||
// * scanCode(收银机使用) 会员码支付 authCode 必填
|
||||
// * userPay(收银机使用) 选择用户支付 userId必填
|
||||
// * <p>
|
||||
// * accountPay(小程序使用) 密码支付 用户密码pwd 必填
|
||||
// */
|
||||
// @PostMapping("/vipPay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Object> vipPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// AssertUtil.isBlank(payParam.getPayType(), "支付类型不可为空");
|
||||
// return payService.vipPayOrder(payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * h5支付
|
||||
// */
|
||||
// @PostMapping("/h5Pay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Map<String, Object>> h5PayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.h5PayOrder(ServletUtil.getClientIP(request, ""), payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * js支付
|
||||
// * <p>
|
||||
// * payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
// * openId 必填
|
||||
// */
|
||||
// @PostMapping("/jsPay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Map<String, Object>> jsPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.jsPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 小程序支付
|
||||
// * payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
// * openId 必填
|
||||
// */
|
||||
// @PostMapping("/ltPayOrder")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Map<String, Object>> ltPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 正扫
|
||||
// */
|
||||
// @PostMapping("/scanPay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Map<String, Object>> scanPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.scanPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 反扫
|
||||
// * authCode 必填 扫描码
|
||||
// */
|
||||
// @PostMapping("/microPay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Map<String, Object>> microPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
// payParam.setShopId(shopId);
|
||||
// return payService.microPayOrder(payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取店铺订单支付URL
|
||||
// */
|
||||
// @GetMapping("/shopPayApi/orderPayUrl")
|
||||
// @Debounce(value = "#checkOrderPay.orderId")
|
||||
// public CzgResult<String> getOrderPayUrl(@RequestHeader Long shopId, @RequestParam(required = false) String extend,
|
||||
// CheckOrderPay checkOrderPay) {
|
||||
// AssertUtil.isNull(shopId, "店铺id不能为空");
|
||||
// AssertUtil.isNull(checkOrderPay, "订单信息不能为空");
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("shopId", shopId);
|
||||
// map.put("orderId", checkOrderPay.getOrderId());
|
||||
// map.put("payAmount", checkOrderPay.getOrderAmount());
|
||||
// map.put("extend", StrUtil.isEmpty(extend) ? "" : extend);
|
||||
// if (checkOrderPay.getOrderId() != null) {
|
||||
// OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
|
||||
// map.put("payAmount", orderInfo.getOrderAmount());
|
||||
// }
|
||||
// String baseUrl = paramsService.getSysParamValue(SysParamCodeEnum.SHOP_ORDER_PAY_BASE_URL.getCode());
|
||||
// String buildUrl = URLUtil.buildQuery(map, Charset.defaultCharset());
|
||||
// String fullUrl = baseUrl.concat("?").concat(buildUrl);
|
||||
// return CzgResult.success(fullUrl);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
// * openId 必填
|
||||
// * checkOrderPay.orderAmount 必填
|
||||
// */
|
||||
// @PostMapping("/shopPayApi/js2Pay")
|
||||
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
// public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
|
||||
// return payService.js2PayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取订单状态
|
||||
// * unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
// */
|
||||
// @GetMapping("/queryOrderStatus")
|
||||
// public CzgResult<String> queryOrderStatus(Long orderId) {
|
||||
// CzgResult<String> result = CzgResult.success();
|
||||
// String status = orderInfoService.queryChain().select(OrderInfo::getStatus).eq(OrderInfo::getId, orderId).oneAs(String.class);
|
||||
// result.setData(status);
|
||||
// switch (status) {
|
||||
// case "unpaid" -> result.setMsg("等待用户付款");
|
||||
// case "done" -> result.setMsg("支付完成");
|
||||
// case "cancelled" -> result.setMsg("订单已取消");
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
/**
|
||||
* 会员支付
|
||||
* payType 必填
|
||||
* <p>
|
||||
* scanCode(收银机使用) 会员码支付 authCode 必填
|
||||
* userPay(收银机使用) 选择用户支付 userId必填
|
||||
* <p>
|
||||
* accountPay(小程序使用) 密码支付 用户密码pwd 必填
|
||||
*/
|
||||
@PostMapping("/vipPay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Object> vipPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
AssertUtil.isBlank(payParam.getPayType(), "支付类型不可为空");
|
||||
return payService.vipPayOrder(payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* h5支付
|
||||
*/
|
||||
@PostMapping("/h5Pay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> h5PayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.h5PayOrder(ServletUtil.getClientIP(request, ""), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* js支付
|
||||
* <p>
|
||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
* openId 必填
|
||||
*/
|
||||
@PostMapping("/jsPay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> jsPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.jsPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
* openId 必填
|
||||
*/
|
||||
@PostMapping("/ltPayOrder")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> ltPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 正扫
|
||||
*/
|
||||
@PostMapping("/scanPay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> scanPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.scanPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反扫
|
||||
* authCode 必填 扫描码
|
||||
*/
|
||||
@PostMapping("/microPay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> microPayOrder(@RequestHeader Long shopId, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.microPayOrder(payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺订单支付URL
|
||||
*/
|
||||
@GetMapping("/shopPayApi/orderPayUrl")
|
||||
@Debounce(value = "#checkOrderPay.orderId")
|
||||
public CzgResult<String> getOrderPayUrl(@RequestHeader Long shopId, @RequestParam(required = false) String extend,
|
||||
CheckOrderPay checkOrderPay) {
|
||||
AssertUtil.isNull(shopId, "店铺id不能为空");
|
||||
AssertUtil.isNull(checkOrderPay, "订单信息不能为空");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("shopId", shopId);
|
||||
map.put("orderId", checkOrderPay.getOrderId());
|
||||
map.put("payAmount", checkOrderPay.getOrderAmount());
|
||||
map.put("extend", StrUtil.isEmpty(extend) ? "" : extend);
|
||||
if (checkOrderPay.getOrderId() != null) {
|
||||
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
|
||||
map.put("payAmount", orderInfo.getOrderAmount());
|
||||
}
|
||||
String baseUrl = paramsService.getSysParamValue(SysParamCodeEnum.SHOP_ORDER_PAY_BASE_URL.getCode());
|
||||
String buildUrl = URLUtil.buildQuery(map, Charset.defaultCharset());
|
||||
String fullUrl = baseUrl.concat("?").concat(buildUrl);
|
||||
return CzgResult.success(fullUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
* openId 必填
|
||||
* checkOrderPay.orderAmount 必填
|
||||
*/
|
||||
@PostMapping("/shopPayApi/js2Pay")
|
||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||
public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
|
||||
return payService.js2PayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单状态
|
||||
* unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
@GetMapping("/queryOrderStatus")
|
||||
public CzgResult<String> queryOrderStatus(Long orderId) {
|
||||
CzgResult<String> result = CzgResult.success();
|
||||
String status = orderInfoService.queryChain().select(OrderInfo::getStatus).eq(OrderInfo::getId, orderId).oneAs(String.class);
|
||||
result.setData(status);
|
||||
switch (status) {
|
||||
case "unpaid" -> result.setMsg("等待用户付款");
|
||||
case "done" -> result.setMsg("支付完成");
|
||||
case "cancelled" -> result.setMsg("订单已取消");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue