| | |
| | | import com.ruoyi.errand.object.dto.app.VipPaymentDTO; |
| | | import com.ruoyi.errand.service.VipOrderService; |
| | | import com.ruoyi.errand.utils.UniPayCallbackResult; |
| | | import com.ruoyi.errand.utils.wx.PayResult; |
| | | import com.ruoyi.errand.utils.wx.WechatPayService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | |
| | | public class VipOrderController { |
| | | @Autowired |
| | | private VipOrderService vipOrderService; |
| | | |
| | | @Autowired |
| | | private WechatPayService wechatPayService; |
| | | |
| | | |
| | | /** |
| | |
| | | * 订单支付回调通知 |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/orderPaymentCallback") |
| | | public void orderPaymentCallback(UniPayCallbackResult uniPayCallbackResult, HttpServletResponse response){ |
| | | String jsonString = JSONObject.toJSONString(uniPayCallbackResult); |
| | | log.info("订单支付回调json:{}", jsonString); |
| | | R callback = vipOrderService.orderPaymentCallback(uniPayCallbackResult); |
| | | @PostMapping("/orderPaymentCallback") |
| | | public void orderPaymentCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | 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 = vipOrderService.orderPaymentCallback(payResult); |
| | | if(callback.getCode() == 200){ |
| | | response.setStatus(200); |
| | | PrintWriter out = null; |