Browse Source

多小程序 多支付调整

xgb 3 days ago
parent
commit
08b0cd1d76

+ 1 - 0
fs-admin/src/main/java/com/fs/hisStore/controller/FsStorePaymentScrmController.java

@@ -244,6 +244,7 @@ public class FsStorePaymentScrmController extends BaseController
                 extendInfoMap.put("org_party_order_id", payment.getBankSerialNo());
                 request.setExtendInfo(extendInfoMap);
                 logger.info("请求参数:"+request);
+                request.setAppId(payment.getAppId());
                 HuiFuRefundResult refund = huiFuService.refund(request);
                 logger.info("退款:"+refund);
                 if((refund.getResp_code().equals("00000000")||refund.getResp_code().equals("00000100"))&&(refund.getTrans_stat().equals("S")||refund.getTrans_stat().equals("P"))){

+ 1 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java

@@ -586,6 +586,7 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
                 }
 
                 request.setExtendInfo(extendInfoMap);
+                request.setAppId(payment.getAppId());
                 HuiFuRefundResult refund = huiFuService.refund(request);
                 logger.info("订单退款返回结果:退款订单id:" + order.getOrderId() + refund);
                 if ((refund.getResp_code().equals("00000000") || refund.getResp_code().equals("00000100")) && (refund.getTrans_stat().equals("S") || refund.getTrans_stat().equals("P"))) {

+ 14 - 0
fs-service/src/main/java/com/fs/huifuPay/sdk/opps/core/request/V2TradePaymentScanpayRefundRequest.java

@@ -51,6 +51,12 @@ public class V2TradePaymentScanpayRefundRequest extends BaseRequest {
     @JSONField(name = "acct_split_bunch")
     private String acctSplitBunch;
 
+    /**
+     *分账对象
+     * **/
+    @JSONField(name = "app_id")
+    private String appId;
+
 
     @Override
     public FunctionCodeEnum getFunctionCode() {
@@ -69,6 +75,14 @@ public class V2TradePaymentScanpayRefundRequest extends BaseRequest {
         this.acctSplitBunch = acctSplitBunch;
     }
 
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
     public String getReqDate() {
         return reqDate;
     }

+ 1 - 1
fs-service/src/main/java/com/fs/huifuPay/service/impl/HuiFuServiceImpl.java

@@ -160,7 +160,7 @@ public class HuiFuServiceImpl implements HuiFuService {
     public HuiFuRefundResult refund(V2TradePaymentScanpayRefundRequest request) {
         HuiFuRefundResult huiFuRefundResult=null;
         try {
-            doInit(getMerConfig());
+            doInit(getMerConfig(request.getAppId()));
             request.setReqDate(DateTools.getCurrentDateYYYYMMDD());
             Map<String, Object> response = doExecute(request);
             String jsonString = JSONObject.toJSONString(response);

+ 1 - 1
fs-service/src/main/resources/mapper/MerchantAppConfigMapper.xml

@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="merchantId != null and merchantId != ''"> and merchant_id = #{merchantId}</if>
             <if test="merchantType != null  and merchantType != ''"> and merchant_type = #{merchantType}</if>
-            <if test="appId != null  and appId != ''"> and app_id = #{appId}</if>
+            <if test="appId != null  and appId != ''"> and  FIND_IN_SET(#{appId},app_id)  </if>
             <if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if>
             <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
              <if test="id != null"> and id = #{id}</if>

+ 8 - 29
fs-user-app/src/main/java/com/fs/app/controller/WxPayController.java

@@ -1,51 +1,30 @@
 package com.fs.app.controller;
 
 
-import cn.hutool.json.JSONUtil;
+import com.fs.common.core.controller.BaseController;
 import com.fs.company.service.ICompanyRechargeService;
 import com.fs.core.config.WxPayProperties;
-import com.fs.course.config.RedPacketConfig;
-import com.fs.course.domain.FsCourseRedPacketLog;
 import com.fs.course.service.IFsCourseProductOrderService;
 import com.fs.course.service.IFsCourseRedPacketLogService;
-import com.fs.his.param.WxSendRedPacketParam;
-import com.fs.common.core.controller.BaseController;
-
-import com.fs.common.core.domain.R;
 import com.fs.course.service.IFsUserCourseOrderService;
 import com.fs.course.service.IFsUserVipOrderService;
-import com.fs.his.domain.FsPayConfig;
 import com.fs.his.service.*;
 import com.fs.sop.service.ISopUserLogsInfoService;
-import com.fs.system.domain.SysConfig;
 import com.fs.system.service.ISysConfigService;
-import com.github.binarywang.wxpay.bean.notify.SignatureHeader;
 import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
 import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
-import com.github.binarywang.wxpay.bean.notify.WxPayTransferBatchesNotifyV3Result;
-import com.github.binarywang.wxpay.config.WxPayConfig;
-import com.github.binarywang.wxpay.constant.WxPayConstants;
-import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.WxPayService;
-import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
-import com.github.binarywang.wxpay.util.SignUtils;
-import com.google.gson.Gson;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import lombok.Synchronized;
-import me.chanjar.weixin.common.bean.WxJsapiSignature;
-import me.chanjar.weixin.common.error.WxErrorException;
 import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
-import java.util.Map;
 
 @Api("微信支付接口")
 @RestController
@@ -89,6 +68,8 @@ public class WxPayController {
     /**
      * 微信回调
      * 回调接口代码内部自动校验结果签名和业务代码
+     * 经测试这个方法不可用 2025/12/10 请用 /store/app/wxpay/wxPayNotify
+     *
      * @param request
      * @return
      * @throws Exception
@@ -99,14 +80,12 @@ public class WxPayController {
 
         try {
             String xmlResult = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding());
+            logger.info("微信回调结果{}", xmlResult);
             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":
@@ -131,7 +110,7 @@ public class WxPayController {
             }
 
         } catch (Exception e) {
-            logger.error("微信回调结果异常,异常原因{}", e.getMessage());
+            logger.error("微信回调结果异常", e);
             return WxPayNotifyResponse.fail(e.getMessage());
         }
     }