|
@@ -1,135 +0,0 @@
|
|
|
-package com.fs.app.controller;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-import com.fs.common.core.controller.BaseController;
|
|
|
|
|
-import com.fs.common.core.domain.R;
|
|
|
|
|
-import com.fs.course.service.IFsCourseRedPacketLogService;
|
|
|
|
|
-import com.fs.course.service.IFsUserCourseOrderService;
|
|
|
|
|
-import com.fs.course.service.IFsUserVipOrderService;
|
|
|
|
|
-import com.fs.his.param.WxSendRedPacketParam;
|
|
|
|
|
-import com.fs.his.service.IFsInquiryOrderService;
|
|
|
|
|
-import com.fs.his.service.IFsPackageOrderService;
|
|
|
|
|
-import com.fs.his.service.IFsStoreOrderService;
|
|
|
|
|
-import com.fs.his.service.IFsStorePaymentService;
|
|
|
|
|
-import com.fs.live.service.ILiveOrderService;
|
|
|
|
|
-import com.fs.sop.service.ISopUserLogsInfoService;
|
|
|
|
|
-import com.fs.system.service.ISysConfigService;
|
|
|
|
|
-import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
|
|
|
|
|
-import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
|
|
|
-import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
-import org.apache.commons.io.IOUtils;
|
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
-
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
-
|
|
|
|
|
-@Api("微信支付接口")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/app/wxpay")
|
|
|
|
|
-public class WxPayController {
|
|
|
|
|
- protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private WxPayService wxPayService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsInquiryOrderService inquiryOrderService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsStoreOrderService storeOrderService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsPackageOrderService packageOrderService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsUserCourseOrderService courseOrderService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsUserVipOrderService userVipOrderService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsStorePaymentService paymentService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IFsCourseRedPacketLogService redPacketLogService;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private ISysConfigService configService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private ISopUserLogsInfoService iSopUserLogsInfoService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private ILiveOrderService liveOrderService;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 微信回调
|
|
|
|
|
- * 回调接口代码内部自动校验结果签名和业务代码
|
|
|
|
|
- * @param request
|
|
|
|
|
- * @return
|
|
|
|
|
- * @throws Exception
|
|
|
|
|
- */
|
|
|
|
|
- @ApiOperation("微信回调")
|
|
|
|
|
- @PostMapping("/wxPayNotify")
|
|
|
|
|
- public String wxPayNotify(HttpServletRequest request) throws Exception {
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- String xmlResult = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding());
|
|
|
|
|
- WxPayOrderNotifyResult result = wxPayService.parseOrderNotifyResult(xmlResult);
|
|
|
|
|
- System.out.println(result.getReturnCode());
|
|
|
|
|
- if("SUCCESS".equals(result.getReturnCode())){
|
|
|
|
|
- //订单号
|
|
|
|
|
- String outtradeno = result.getOutTradeNo();
|
|
|
|
|
- String tradeNo = result.getTransactionId();
|
|
|
|
|
- System.out.println(outtradeno);
|
|
|
|
|
- System.out.println(tradeNo);
|
|
|
|
|
- String[] orderId=outtradeno.split("-");
|
|
|
|
|
- switch (orderId[0]){
|
|
|
|
|
- case "inquiry":
|
|
|
|
|
- inquiryOrderService.payConfirm("",orderId[1],tradeNo,"",1);
|
|
|
|
|
- case "store":
|
|
|
|
|
- storeOrderService.payConfirm("",orderId[1],tradeNo,"",1);
|
|
|
|
|
- case "package":
|
|
|
|
|
- packageOrderService.payConfirm("",orderId[1],tradeNo,"",1);
|
|
|
|
|
- case "course":
|
|
|
|
|
- courseOrderService.payConfirm("",orderId[1],tradeNo,"",1);
|
|
|
|
|
- case "appvip":
|
|
|
|
|
- userVipOrderService.payConfirm("",orderId[1],tradeNo,"",1);
|
|
|
|
|
- case "appLive":
|
|
|
|
|
- liveOrderService.payConfirm("",orderId[1],tradeNo,"",1);
|
|
|
|
|
- }
|
|
|
|
|
- return WxPayNotifyResponse.success("处理成功!");
|
|
|
|
|
- }else{
|
|
|
|
|
- return WxPayNotifyResponse.fail("");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- logger.error("微信回调结果异常,异常原因{}", e.getMessage());
|
|
|
|
|
- return WxPayNotifyResponse.fail(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/sendRedPacket")
|
|
|
|
|
- public R sendRedPacket(@RequestBody WxSendRedPacketParam param){
|
|
|
|
|
- return paymentService.sendRedPacketTest(param);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping( "/TransferNotify")
|
|
|
|
|
- public String TransferNotify(@RequestBody String notifyData,HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
- return paymentService.transferNotify(notifyData,request);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping( "/v3TransferNotify")
|
|
|
|
|
- public String v3TransferNotify(@RequestBody String notifyData,HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
- return paymentService.v3TransferNotify(notifyData,request);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/test")
|
|
|
|
|
- public void test(){
|
|
|
|
|
- iSopUserLogsInfoService.updateSopUserInfoByExternalId(1L,123456L);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|