取消支付接口
This commit is contained in:
@@ -2,12 +2,13 @@ package com.chaozhanggui.system.cashierservice.controller;
|
|||||||
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@@ -17,6 +18,11 @@ import java.util.Map;
|
|||||||
public class NotifyController {
|
public class NotifyController {
|
||||||
|
|
||||||
|
|
||||||
|
private final OrderService orderService;
|
||||||
|
|
||||||
|
public NotifyController(OrderService orderService) {
|
||||||
|
this.orderService = orderService;
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("notifyPay")
|
@RequestMapping("notifyPay")
|
||||||
public String notifyPay(@RequestBody Map<String,Object> map){
|
public String notifyPay(@RequestBody Map<String,Object> map){
|
||||||
@@ -24,4 +30,13 @@ public class NotifyController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付取消
|
||||||
|
* @return 影响数量
|
||||||
|
*/
|
||||||
|
@PostMapping("cancel")
|
||||||
|
public Result notifyCancel(@RequestBody HashMap<String, Integer> data) {
|
||||||
|
return Result.success(CodeEnum.SUCCESS, orderService.cancelOrder(data.get("orderId")));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ public class SignInterceptor implements HandlerInterceptor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestUri.contains("/notify/cancel")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String token=request.getHeader("token");
|
String token=request.getHeader("token");
|
||||||
String loginName=request.getHeader("loginName");
|
String loginName=request.getHeader("loginName");
|
||||||
String clientType=request.getHeader("clientType");
|
String clientType=request.getHeader("clientType");
|
||||||
|
|||||||
@@ -1838,4 +1838,11 @@ public class OrderService {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object cancelOrder(Integer orderId) {
|
||||||
|
return mPOrderInfoMapper.update(null, new LambdaUpdateWrapper<TbOrderInfo>()
|
||||||
|
.eq(TbOrderInfo::getId, orderId)
|
||||||
|
.eq(TbOrderInfo::getStatus, "paying")
|
||||||
|
.set(TbOrderInfo::getStatus, "unpaid"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user