Przeglądaj źródła

调整app回调

yys 2 dni temu
rodzic
commit
1b1b1a8eb2

+ 9 - 0
fs-service/src/main/java/com/fs/his/service/IFsStorePaymentService.java

@@ -146,4 +146,13 @@ public interface IFsStorePaymentService
     String integralV3TransferNotify(String notifyData, HttpServletRequest request);
 
     R sendAppRedPacket(WxSendRedPacketParam packetParam);
+
+    /**
+     * app回调
+     *
+     * @param notifyData
+     * @param request
+     * @return
+     */
+    String v3TransferNotifyApp(String notifyData, HttpServletRequest request);
 }

+ 43 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -1158,6 +1158,49 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
         }
     }
 
+
+
+    @Override
+    public String v3TransferNotifyApp(String notifyData, HttpServletRequest request) {
+        logger.info("zyp \n【收到转账回调V3】:{}",notifyData);
+        try {
+            String json = redisCache.getCacheObject("sys_config:redPacket.config.new");
+            if (StringUtil.isNullOrEmpty(json) || json.isEmpty()) {
+                json = configService.selectConfigByKey("his.AppRedPacket");
+            }
+            RedPacketConfig config = JSONUtil.toBean(json, RedPacketConfig.class);
+            //创建微信订单
+            WxPayConfig payConfig = new WxPayConfig();
+            BeanUtils.copyProperties(config,payConfig);
+            WxPayService wxPayService = new WxPayServiceImpl();
+            wxPayService.setConfig(payConfig);
+            SignatureHeader signatureHeader = new SignatureHeader();
+            signatureHeader.setTimeStamp(request.getHeader("Wechatpay-Timestamp"));
+            signatureHeader.setNonce(request.getHeader("Wechatpay-Nonce"));
+            signatureHeader.setSerial(request.getHeader("Wechatpay-Serial"));
+            signatureHeader.setSignature(request.getHeader("Wechatpay-Signature"));
+            TransferBillsNotifyResult result = wxPayService.parseTransferBillsNotifyV3Result(notifyData,signatureHeader);
+            logger.info("到零钱回调1:{}",result.getResult());
+            if (result.getResult().getState().equals("SUCCESS")) {
+                R r = redPacketLogService.syncRedPacket(result.getResult().getOutBillNo(),result.getResult().getTransferBillNo());
+                logger.info("result:{}",r);
+                if (r.get("code").equals(200)){
+                    return WxPayNotifyResponse.success("处理成功");
+                }else {
+                    return WxPayNotifyResponse.fail("");
+                }
+            }else {
+                return WxPayNotifyResponse.fail("");
+            }
+        } catch (WxPayException e) {
+            e.printStackTrace();
+            logger.error("zyp \n【转账回调异常】:{}", e.getReturnMsg());
+            return WxPayNotifyResponse.fail(e.getMessage());
+        }
+    }
+
+
+
     @Override
     public String v3TransferNotifyWithCompanyId(Long companyId, String notifyData, HttpServletRequest request) {
         logger.info("分公司回调V3::companyId:{}",companyId);

+ 37 - 0
fs-user-app/src/main/java/com/fs/app/controller/app/CourseTransferNotifyController.java

@@ -0,0 +1,37 @@
+package com.fs.app.controller.app;
+
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.course.service.IFsCourseRedPacketLogService;
+import com.fs.his.param.WxSendRedPacketParam;
+import com.fs.his.service.IFsStorePaymentService;
+import com.fs.sop.service.ISopUserLogsInfoService;
+import io.swagger.annotations.Api;
+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 CourseTransferNotifyController {
+    protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
+
+    @Autowired
+    private IFsStorePaymentService  paymentService;
+
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
+
+    @PostMapping( "/v3TransferNotifyApp")
+    public String v3TransferNotifyApp(@RequestBody String notifyData,HttpServletRequest request, HttpServletResponse response) throws Exception {
+        return paymentService.v3TransferNotifyApp(notifyData,request);
+    }
+
+}