package com.ruoyi.order.controller.forepart;
|
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.order.service.impl.PaylogServiceImpl;
|
import com.ruoyi.system.api.domain.dto.PayInfoDTO;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import java.util.Map;
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* <p>
|
* 支付记录 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-05-22
|
*/
|
@RestController
|
@RequestMapping("/forepart/paylog")
|
@Api(value = "用户端-获取支付信息", tags = "用户端-获取支付信息", description = "用户端-获取支付信息")
|
public class ForepartPaylogController {
|
/**
|
* 获取支付信息
|
*
|
* @param userId
|
* 用户ID
|
* @param type
|
* 支付类型 1=支付宝,2 = 微信
|
* @param ordernum
|
* 订单编号
|
* @param price
|
* 金额
|
* @return
|
*/
|
|
|
@Resource
|
private PaylogServiceImpl paylogServiceImpl;
|
|
Logger log = LoggerFactory.getLogger(getClass());
|
@PostMapping("/getPayInfo")
|
@ApiOperation(value = "用户端-获取支付信息")
|
public R<Map<String, Object>> getPayInfo(@RequestBody PayInfoDTO payInfoDTO,
|
HttpServletRequest request) {
|
try {
|
return paylogServiceImpl.getPayInfo(payInfoDTO.getMemberId(), payInfoDTO.getType(),
|
payInfoDTO.getOrderNO(), payInfoDTO.getOpenId(), request);
|
} catch (Exception e) {
|
return R.fail("获取异常");
|
}
|
|
}
|
|
|
/**
|
* 服务器异步通知处理支付宝
|
*
|
* @param request
|
* @param res
|
*/
|
@RequestMapping("/alipay/notify")
|
public void notifyUrl(HttpServletRequest request, HttpServletResponse response) {
|
try {
|
paylogServiceImpl.notifyUrl(request,response);
|
} catch (Exception e) {
|
|
}
|
}
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
/**
|
* 微信支付回调(参考财付通回调接口)
|
*
|
* @param request
|
* @param response
|
*/
|
@RequestMapping("/wxpay/notify")
|
public void wxnotify(HttpServletRequest request, HttpServletResponse response) {
|
try {
|
paylogServiceImpl.wxnotify(request,response);
|
} catch (Exception e) {
|
|
}
|
}
|
|
|
|
|
}
|