| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.service.IPaylogService; |
| | | import com.ruoyi.order.service.impl.PaylogServiceImpl; |
| | | import com.ruoyi.order.util.DateUtil; |
| | | import com.ruoyi.order.util.SinataUtil; |
| | | import com.ruoyi.order.util.alipay.config.AlipayConfig; |
| | | import com.ruoyi.order.util.alipay.util.PayDemoActivity; |
| | | import com.ruoyi.order.util.tencent.common.Configure; |
| | | import com.ruoyi.order.util.tencent.common.Signature; |
| | | import com.ruoyi.order.util.tencent.common.XMLParser; |
| | | import com.ruoyi.order.util.tencent.protocol.AppPayReqData; |
| | | import com.ruoyi.order.util.tencent.protocol.UnifiedorderReqData; |
| | | import com.ruoyi.system.api.domain.dto.PayInfoDTO; |
| | | 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.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/paylog") |
| | | public class PaylogController { |
| | | /** |
| | | * 获取支付信息 |
| | | * |
| | | * @param userId |
| | | * 用户ID |
| | | * @param type |
| | | * 支付类型 1=支付宝,2 = 微信 |
| | | * @param ordernum |
| | | * 订单编号 |
| | | * @param price |
| | | * 金额 |
| | | * @return |
| | | */ |
| | | |
| | | @Resource |
| | | private IPaylogService iPaylogService; |
| | | |
| | | |
| | | @Resource |
| | | private PaylogServiceImpl paylogServiceImpl; |
| | | |
| | | Logger log = LoggerFactory.getLogger(getClass()); |
| | | @ResponseBody |
| | | @RequestMapping("/getPayInfo") |
| | | @ApiOperation(value = "获取支付信息") |
| | | public R<Map<String, Object>> getPayInfo(PayInfoDTO payInfoDTO, |
| | | HttpServletRequest request) { |
| | | try { |
| | | return paylogServiceImpl.getPayInfo(Integer.valueOf(payInfoDTO.getMemberId().intValue()), payInfoDTO.getType(), payInfoDTO.getSubject(), payInfoDTO.getBody(), 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.notifyUrl(request,response); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |