| | |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.util.payment.model.RefundCallbackResult; |
| | | import com.ruoyi.order.util.payment.model.UniPayCallbackResult; |
| | | import com.ruoyi.order.util.payment.wechat.PayMoneyUtil; |
| | | import com.ruoyi.order.util.payment.wx.WechatPayService; |
| | | import com.ruoyi.order.util.payment.wx.vo.PayResult; |
| | | import com.ruoyi.order.util.vo.MapTrackKD100Vo; |
| | | import com.ruoyi.order.util.vo.ShopAnalysisVO; |
| | | import com.ruoyi.order.vo.*; |
| | |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | |
| | | @Resource |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Resource |
| | | private WechatPayService wechatPayService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | * 订单支付回调通知 |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/orderPaymentCallback") |
| | | public void orderPaymentCallback(UniPayCallbackResult uniPayCallbackResult, HttpServletResponse response){ |
| | | String jsonString = JSONObject.toJSONString(uniPayCallbackResult); |
| | | @PostMapping("/orderPaymentCallback") |
| | | public void orderPaymentCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | // String jsonString = JSONObject.toJSONString(uniPayCallbackResult); |
| | | System.err.println("1111111111111"); |
| | | PayResult payResult= null; |
| | | try { |
| | | payResult = wechatPayService.processNotify(request); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | System.out.println("1111111111111111111111"); |
| | | System.out.println(jsonString); |
| | | R callback = orderService.orderPaymentCallback(uniPayCallbackResult); |
| | | // System.out.println(jsonString); |
| | | R callback = orderService.orderPaymentCallback(payResult); |
| | | if(callback.getCode() == 200){ |
| | | response.setStatus(200); |
| | | PrintWriter out = null; |
| | |
| | | */ |
| | | /** |
| | | * 订单取消支付回退 |
| | | * |
| | | * @param refundCallbackResult |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/refundPayMoneyCallback") |
| | | public void refundPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response) { |
| | | R callback = orderService.refundPayMoneyCallback(refundCallbackResult); |
| | | @PostMapping("/refundPayMoneyCallback") |
| | | public String refundPayMoneyCallback( @RequestBody(required = false) String xmlData) { |
| | | R callback = orderService.refundPayMoneyCallback(xmlData); |
| | | if (callback.getCode() == 200) { |
| | | response.setStatus(200); |
| | | PrintWriter out = null; |
| | | try { |
| | | out = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | out.println("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | }else { |
| | | System.err.println("支付回退错误:"+callback.getMsg()); |
| | | return "<xml><return_code><![CDATA[FAIL]]></return_code></xml>"; |
| | | } |
| | | } |
| | | |
| | |
| | | return R.ok(orderService.getMap(queryWrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 获取商户RSA加密公钥 |
| | | */ |
| | | |
| | | @GetMapping("/getRsaPublicKey") |
| | | public R<Void> getRsaPublicKey(){ |
| | | wechatPayService.getRsaPublicKey(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |