提交 3fb261e3 作者: xiaowang

修改api

上级 2f32e68e
...@@ -30,7 +30,7 @@ public class WechatPayController extends BaseController { ...@@ -30,7 +30,7 @@ public class WechatPayController extends BaseController {
@ApiOperation(value = "小程序调起支付API") @ApiOperation(value = "小程序调起支付API")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("pay") @PostMapping("pay")
public ResultBody orderPay(@RequestBody OrderRequestParamsVO orderRequestParamsVO, HttpServletRequest request) throws IOException { public Map orderPay(@RequestBody OrderRequestParamsVO orderRequestParamsVO, HttpServletRequest request) throws IOException {
return wechatPayService.orderPay(orderRequestParamsVO, this.getUserLoginInfoFromRedis(request).getUserAccountId(), request); return wechatPayService.orderPay(orderRequestParamsVO, this.getUserLoginInfoFromRedis(request).getUserAccountId(), request);
} }
......
...@@ -63,7 +63,7 @@ public class WechatPayServiceImpl implements WechatPayService { ...@@ -63,7 +63,7 @@ public class WechatPayServiceImpl implements WechatPayService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultBody orderPay(OrderRequestParamsVO orderRequestParamsVO, Integer userAccountId, HttpServletRequest request) throws IOException { public Map orderPay(OrderRequestParamsVO orderRequestParamsVO, Integer userAccountId, HttpServletRequest request) {
UserAccountSimpleDTO userSimpleInfo = userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader("token")); UserAccountSimpleDTO userSimpleInfo = userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader("token"));
if (userSimpleInfo == null) { if (userSimpleInfo == null) {
throw new RuntimeException("服务器内部错误!"); throw new RuntimeException("服务器内部错误!");
...@@ -72,7 +72,7 @@ public class WechatPayServiceImpl implements WechatPayService { ...@@ -72,7 +72,7 @@ public class WechatPayServiceImpl implements WechatPayService {
// 查询该订单是否已下单 // 查询该订单是否已下单
WxPayLogDO wxPayLogDO = wechatPayDao.selectWxPayInfoByOrderNo(orderRequestParamsVO.getOrderNo()); WxPayLogDO wxPayLogDO = wechatPayDao.selectWxPayInfoByOrderNo(orderRequestParamsVO.getOrderNo());
if (wxPayLogDO != null && wxPayLogDO.getTradeState().equals(OrderPayStatus.SUCCESS.getStatus())) { if (wxPayLogDO != null && wxPayLogDO.getTradeState().equals(OrderPayStatus.SUCCESS.getStatus())) {
return ResultBody.error("订单已支付!"); throw new RuntimeException("订单已支付!");
} else if (wxPayLogDO == null) { } else if (wxPayLogDO == null) {
// 构建service // 构建service
JsapiService jsapiService = new JsapiService.Builder().config(config).build(); JsapiService jsapiService = new JsapiService.Builder().config(config).build();
...@@ -105,10 +105,10 @@ public class WechatPayServiceImpl implements WechatPayService { ...@@ -105,10 +105,10 @@ public class WechatPayServiceImpl implements WechatPayService {
// 往数据库插入下单的日志信息 // 往数据库插入下单的日志信息
wechatPayDao.insertWxPayLog(wxPrepayLogDO); wechatPayDao.insertWxPayLog(wxPrepayLogDO);
Map<String, Object> map = getSignInfoMap(config, prepayId); Map<String, Object> map = getSignInfoMap(config, prepayId);
return ResultBody.success(map); return map;
} else { } else {
Map<String, Object> map = getSignInfoMap(config, wxPayLogDO.getPrepayId()); Map<String, Object> map = getSignInfoMap(config, wxPayLogDO.getPrepayId());
return ResultBody.success(map); return map;
} }
} }
......
...@@ -14,7 +14,7 @@ import java.util.Map; ...@@ -14,7 +14,7 @@ import java.util.Map;
* 概要: * 概要:
*/ */
public interface WechatPayService { public interface WechatPayService {
ResultBody orderPay(OrderRequestParamsVO orderRequestParamsVO, Integer userAccountId, HttpServletRequest request) throws IOException; Map orderPay(OrderRequestParamsVO orderRequestParamsVO, Integer userAccountId, HttpServletRequest request) throws IOException;
Map payCallback(HttpServletRequest request); Map payCallback(HttpServletRequest request);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论