瀏覽代碼

分公司V3回调

zyp 2 天之前
父節點
當前提交
69c171d684

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

@@ -119,6 +119,10 @@ public interface IFsStorePaymentService
     String v3TransferNotify(String notifyData, HttpServletRequest request);
 
 
+    String v3TransferNotifyWithCompanyId(Long companyId,String notifyData, HttpServletRequest request);
+
+
+
     R sendRedPacketTest(WxSendRedPacketParam param);
 
     List<FsStorePaymentVO> selectFsStorePaymentListQueryVO(FsStorePaymentParam fsStorePayment);

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

@@ -1135,6 +1135,45 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
         }
     }
 
+    @Override
+    public String v3TransferNotifyWithCompanyId(Long companyId, String notifyData, HttpServletRequest request) {
+        logger.info("分公司回调V3::companyId:{}",companyId);
+        logger.info("zyp \n【收到转账回调V3::分公司】:{}",notifyData);
+        try {
+//            String json = configService.selectConfigByKey("redPacket.config");
+            String json = companyConfigMapper.selectRedPacketConfigByKey(companyId);
+            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
     @Transactional
     public R sendRedPacketTest(WxSendRedPacketParam param) {

+ 15 - 0
fs-user-app/src/main/java/com/fs/app/controller/course/CourseTransferController.java

@@ -71,6 +71,21 @@ public class CourseTransferController {
         return paymentService.TransferNotifyWithCompanyId(companyId,notifyData,request);
     }
 
+    /**
+     * 分公司配置回调地址
+     * @param companyId
+     * @param notifyData
+     * @param request
+     * @param response
+     * @return
+     * @throws Exception
+     */
+    @PostMapping( "/v3TransferNotifyWithCompanyId/{companyId}")
+    public String v3TransferNotifyWithCompanyId(@PathVariable("companyId") Long companyId,@RequestBody String notifyData,HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+        return paymentService.TransferNotifyWithCompanyId(companyId,notifyData,request);
+    }
+
     @Autowired
     private IFsCourseRedPacketLogService fsCourseRedPacketLogService;