查询订单状态
This commit is contained in:
parent
73852f43d6
commit
dd6915bd58
|
|
@ -121,7 +121,7 @@ public class OrderPayController {
|
|||
* 获取店铺订单支付URL
|
||||
*/
|
||||
@GetMapping("/shopPayApi/orderPayUrl")
|
||||
public CzgResult<String> getOrderPayUrl(@RequestHeader Long shopId,@RequestParam(required = false) String extend,
|
||||
public CzgResult<String> getOrderPayUrl(@RequestHeader Long shopId, @RequestParam(required = false) String extend,
|
||||
CheckOrderPay checkOrderPay) {
|
||||
AssertUtil.isNull(shopId, "店铺id不能为空");
|
||||
AssertUtil.isNull(checkOrderPay, "订单信息不能为空");
|
||||
|
|
@ -151,9 +151,17 @@ public class OrderPayController {
|
|||
return payService.js2PayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单状态
|
||||
* unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
@GetMapping("/queryOrderStatus")
|
||||
public CzgResult<String> queryOrderStatus(Long orderId) {
|
||||
return CzgResult.success(orderService.queryChain().select(OrderInfo::getStatus).eq(OrderInfo::getId, orderId).oneAs(String.class));
|
||||
}
|
||||
|
||||
@GetMapping("/queryOrderPay")
|
||||
public CzgResult<Map<String, Object>> queryOrderPay(Long orderId){
|
||||
public CzgResult<Map<String, Object>> queryOrderPay(Long orderId) {
|
||||
return payService.queryPayOrder(orderId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import lombok.Getter;
|
|||
@Getter
|
||||
public enum CzgRespCode {
|
||||
SUCCESS(200, "操作成功"),
|
||||
|
||||
WAIT_PAY(211, "等待用户付款"),
|
||||
FAILURE(500, "操作失败"),
|
||||
NOT_LOGIN(501, "登录失效"),
|
||||
SYSTEM_ERROR(555, "系统内部错误"),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.czg.order.enums.PayEnums;
|
|||
import com.czg.order.service.OrderDetailService;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.resp.CzgRespCode;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.CzgPayService;
|
||||
import com.czg.service.RedisService;
|
||||
|
|
@ -718,11 +719,14 @@ public class PayServiceImpl implements PayService {
|
|||
Map<String, Object> map = new HashMap<>();
|
||||
switch (data) {
|
||||
case CzgMicroPayResp ignored -> {
|
||||
if (!"TRADE_SUCCESS".equals(data.getState())) {
|
||||
result.setCode(500);
|
||||
if ("TRADE_SUCCESS".equals(data.getState())) {
|
||||
return result;
|
||||
} else if ("TRADE_AWAIT".equals(data.getState())) {
|
||||
result.setCode(CzgRespCode.WAIT_PAY.getCode());
|
||||
result.setMsg("等待用户付款");
|
||||
} else {
|
||||
result.setCode(CzgRespCode.FAILURE.getCode());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
case CzgH5PayResp h5PayResp ->
|
||||
map = JSONObject.parseObject(JSONObject.toJSONString(h5PayResp.getPayInfo()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue