Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/Payment-Configuration' into Payment-Configuration

# Conflicts:
#	fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java
xgb 1 giorno fa
parent
commit
415db8c85f
68 ha cambiato i file con 1089 aggiunte e 449 eliminazioni
  1. 18 6
      fs-admin/src/main/java/com/fs/course/controller/FsCourseAnswerLogsController.java
  2. 15 6
      fs-admin/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java
  3. 17 6
      fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java
  4. 58 12
      fs-admin/src/main/java/com/fs/hisStore/controller/FsStorePaymentScrmController.java
  5. 1 0
      fs-admin/src/main/java/com/fs/live/controller/LiveAfterSalesController.java
  6. 18 7
      fs-admin/src/main/java/com/fs/qw/controller/QwSopController.java
  7. 17 6
      fs-admin/src/main/java/com/fs/qw/controller/QwSopTempController.java
  8. 8 1
      fs-admin/src/main/java/com/fs/web/controller/common/CommonController.java
  9. 1 1
      fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java
  10. 5 0
      fs-company/src/main/java/com/fs/company/controller/qw/QwExternalContactController.java
  11. 1 0
      fs-framework/src/main/java/com/fs/framework/config/SecurityConfig.java
  12. 0 1
      fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java
  13. 2 1
      fs-live-app/src/main/java/com/fs/live/controller/LiveController.java
  14. 4 2
      fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java
  15. 2 0
      fs-service/src/main/java/com/fs/course/mapper/FsCoursePlaySourceConfigMapper.java
  16. 2 2
      fs-service/src/main/java/com/fs/course/param/FsCourseAnswerLogsParam.java
  17. 2 0
      fs-service/src/main/java/com/fs/course/param/FsCourseRedPacketLogParam.java
  18. 4 0
      fs-service/src/main/java/com/fs/course/param/FsCourseWatchLogListParam.java
  19. 7 0
      fs-service/src/main/java/com/fs/course/service/IFsCoursePlaySourceConfigService.java
  20. 5 0
      fs-service/src/main/java/com/fs/course/service/impl/FsCoursePlaySourceConfigServiceImpl.java
  21. 41 16
      fs-service/src/main/java/com/fs/course/service/impl/FsCourseProductOrderServiceImpl.java
  22. 41 17
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseOrderServiceImpl.java
  23. 45 25
      fs-service/src/main/java/com/fs/course/service/impl/FsUserVipOrderServiceImpl.java
  24. 3 0
      fs-service/src/main/java/com/fs/his/mapper/FsUserWxMapper.java
  25. 5 0
      fs-service/src/main/java/com/fs/his/param/PayOrderParam.java
  26. 81 32
      fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java
  27. 21 4
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java
  28. 41 16
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java
  29. 36 6
      fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java
  30. 19 6
      fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java
  31. 2 0
      fs-service/src/main/java/com/fs/hisStore/domain/FsPayConfigScrm.java
  32. 4 0
      fs-service/src/main/java/com/fs/hisStore/param/FsStoreOrderOtherPayParam.java
  33. 36 4
      fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreAfterSalesScrmServiceImpl.java
  34. 83 15
      fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java
  35. 0 3
      fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java
  36. 9 4
      fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java
  37. 2 0
      fs-service/src/main/java/com/fs/qw/mapper/QwIpadServerUserMapper.java
  38. 4 0
      fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java
  39. 2 0
      fs-service/src/main/java/com/fs/qw/service/IQwIpadServerUserService.java
  40. 3 0
      fs-service/src/main/java/com/fs/qw/service/IQwUserService.java
  41. 5 0
      fs-service/src/main/java/com/fs/qw/service/impl/QwIpadServerUserServiceImpl.java
  42. 52 0
      fs-service/src/main/java/com/fs/qw/service/impl/QwUserServiceImpl.java
  43. 4 0
      fs-service/src/main/java/com/fs/qw/vo/QwExternalContactVO.java
  44. 4 0
      fs-service/src/main/java/com/fs/sop/domain/QwSop.java
  45. 2 0
      fs-service/src/main/java/com/fs/sop/domain/QwSopTemp.java
  46. 2 0
      fs-service/src/main/java/com/fs/wxcid/dto/admin/GenAuthKey3Request.java
  47. 23 23
      fs-service/src/main/java/com/fs/wxcid/service/FriendService.java
  48. 14 14
      fs-service/src/main/java/com/fs/wxcid/service/LoginService.java
  49. 6 6
      fs-service/src/main/java/com/fs/wxcid/service/MessageCallbackService.java
  50. 22 22
      fs-service/src/main/java/com/fs/wxcid/service/MessageService.java
  51. 28 28
      fs-service/src/main/java/com/fs/wxcid/service/impl/FriendServiceImpl.java
  52. 34 34
      fs-service/src/main/java/com/fs/wxcid/service/impl/LoginServiceImpl.java
  53. 14 14
      fs-service/src/main/java/com/fs/wxcid/service/impl/MessageCallbackServiceImpl.java
  54. 50 50
      fs-service/src/main/java/com/fs/wxcid/service/impl/MessageServiceImpl.java
  55. 1 1
      fs-service/src/main/resources/application-config-druid-bjzm-test.yml
  56. 6 0
      fs-service/src/main/resources/application-config-druid-cfryt.yml
  57. 1 1
      fs-service/src/main/resources/application-config-druid-gzzdy.yml
  58. 8 0
      fs-service/src/main/resources/mapper/course/FsCoursePlaySourceConfigMapper.xml
  59. 1 1
      fs-service/src/main/resources/mapper/course/FsCourseTrafficLogMapper.xml
  60. 4 0
      fs-service/src/main/resources/mapper/his/FsUserWxMapper.xml
  61. 6 0
      fs-service/src/main/resources/mapper/qw/QwIpadServerUserMapper.xml
  62. 13 0
      fs-service/src/main/resources/mapper/qw/QwUserMapper.xml
  63. 48 22
      fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java
  64. 2 0
      fs-user-app/src/main/java/com/fs/app/controller/course/CourseQwLoginController.java
  65. 43 23
      fs-user-app/src/main/java/com/fs/app/controller/live/LiveOrderController.java
  66. 2 10
      fs-user-app/src/main/java/com/fs/app/controller/store/CompanyUserScrmController.java
  67. 27 1
      fs-user-app/src/main/java/com/fs/app/controller/store/UserScrmController.java
  68. 2 0
      fs-user-app/src/main/java/com/fs/app/controller/store/WxUserScrmController.java

+ 18 - 6
fs-admin/src/main/java/com/fs/course/controller/FsCourseAnswerLogsController.java

@@ -3,6 +3,7 @@ package com.fs.course.controller;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
@@ -10,6 +11,8 @@ import com.fs.course.domain.FsCourseAnswerLogs;
 import com.fs.course.param.FsCourseAnswerLogsParam;
 import com.fs.course.service.IFsCourseAnswerLogsService;
 import com.fs.course.vo.FsCourseAnswerLogsListVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -35,17 +38,26 @@ public class FsCourseAnswerLogsController extends BaseController
      * 查询答题日志列表
      */
     @PreAuthorize("@ss.hasPermi('course:courseAnswerLog:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(FsCourseAnswerLogsParam param)
+    @PostMapping("/list")
+    public R list(@RequestBody  FsCourseAnswerLogsParam param)
     {
-        startPage();
+        if(param.getPageNum() == null) {
+            param.setPageNum(1);
+        }
+        if(param.getPageSize() == null) {
+            param.setPageSize(10);
+        }
 
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(encryptPhone(param.getPhoneMk()));
         }
 
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
         List<FsCourseAnswerLogsListVO> list = fsCourseAnswerLogsService.selectFsCourseAnswerLogsListVO(param);
-        return getDataTable(list);
+
+        return R.ok().put("data",new PageInfo<>(list));
     }
 
     /**
@@ -53,8 +65,8 @@ public class FsCourseAnswerLogsController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('course:courseAnswerLog:export')")
     @Log(title = "答题日志", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(FsCourseAnswerLogsParam param)
+    @PostMapping("/export")
+    public AjaxResult export(@RequestBody FsCourseAnswerLogsParam param)
     {
         if (param.getPhoneMk() != null && param.getPhoneMk() != "") {
             param.setPhone(encryptPhone(param.getPhoneMk()));

+ 15 - 6
fs-admin/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java

@@ -17,6 +17,8 @@ import com.fs.framework.web.service.TokenService;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.OptionsVO;
 import com.fs.system.service.ISysConfigService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -62,21 +64,28 @@ public class FsCourseRedPacketLogController extends BaseController
      * 查询短链课程看课记录列表
      */
     @PreAuthorize("@ss.hasPermi('course:courseRedPacketLog:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(FsCourseRedPacketLogParam fsCourseRedPacketLog)
+    @PostMapping("/list")
+    public R list(@RequestBody FsCourseRedPacketLogParam fsCourseRedPacketLog)
     {
-        startPage();
+        if(fsCourseRedPacketLog.getPageNum() == null) {
+            fsCourseRedPacketLog.setPageNum(1);
+        }
+        if(fsCourseRedPacketLog.getPageSize() == null) {
+            fsCourseRedPacketLog.setPageSize(10);
+        }
+
 
         if (fsCourseRedPacketLog.getPhoneMk() != null && fsCourseRedPacketLog.getPhoneMk() != "") {
             fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));
         }
+        PageHelper.startPage(fsCourseRedPacketLog.getPageNum(), fsCourseRedPacketLog.getPageSize());
 
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
 
             fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
         }
-        return getDataTable(list);
+        return R.ok().put("data",new PageInfo<>(list));
     }
 
     /**
@@ -84,8 +93,8 @@ public class FsCourseRedPacketLogController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('course:courseRedPacketLog:export')")
     @Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(FsCourseRedPacketLogParam fsCourseRedPacketLog)
+    @PostMapping("/export")
+    public AjaxResult export(@RequestBody FsCourseRedPacketLogParam fsCourseRedPacketLog)
     {
         if (fsCourseRedPacketLog.getPhoneMk()!=null&&fsCourseRedPacketLog.getPhoneMk()!=""){
             fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));

+ 17 - 6
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import com.fs.common.constant.HttpStatus;
+import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.ServletUtils;
 import com.fs.course.param.FsCourseOverParam;
@@ -14,6 +15,8 @@ import com.fs.course.vo.FsCourseWatchLogListVO;
 import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
 import com.fs.qw.param.QwWatchLogStatisticsListParam;
 import com.fs.qw.service.IQwWatchLogService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -52,12 +55,20 @@ public class FsCourseWatchLogController extends BaseController
      * 查询短链课程看课记录列表
      */
     @PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(FsCourseWatchLogListParam param)
+    @PostMapping("/list")
+    public R list(@RequestBody FsCourseWatchLogListParam param)
     {
-        startPage();
+        if(param.getPageNum() == null) {
+            param.setPageNum(1);
+        }
+        if(param.getPageSize() == null) {
+            param.setPageSize(10);
+        }
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
         List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
-        return getDataTable(list);
+
+        return R.ok().put("data",new PageInfo<>(list));
     }
 
     @GetMapping("/qwWatchLogAllStatisticsList")
@@ -114,8 +125,8 @@ public class FsCourseWatchLogController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('course:courseWatchLog:export')")
     @Log(title = "短链课程看课记录", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(FsCourseWatchLogListParam param)
+    @PostMapping("/export")
+    public AjaxResult export(@RequestBody FsCourseWatchLogListParam param)
     {
         List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
         ExcelUtil<FsCourseWatchLogListVO> util = new ExcelUtil<FsCourseWatchLogListVO>(FsCourseWatchLogListVO.class);

+ 58 - 12
fs-admin/src/main/java/com/fs/hisStore/controller/FsStorePaymentScrmController.java

@@ -1,5 +1,6 @@
 package com.fs.hisStore.controller;
 
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alipay.api.AlipayApiException;
@@ -12,15 +13,20 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.CloudHostUtils;
+import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.common.utils.spring.SpringUtils;
 import com.fs.company.service.ICompanyService;
 import com.fs.config.cloud.CloudHostProper;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.his.domain.FsHfpayConfig;
+import com.fs.his.domain.FsPayConfig;
+import com.fs.his.domain.MerchantAppConfig;
 import com.fs.his.mapper.FsHfpayConfigMapper;
-import com.fs.hisStore.domain.FsPayConfigScrm;
+import com.fs.his.service.IMerchantAppConfigService;
 import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
 import com.fs.huifuPay.domain.HuiFuRefundResult;
 import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayQueryRequest;
@@ -32,6 +38,13 @@ import com.fs.hisStore.service.IFsStoreOrderScrmService;
 import com.fs.hisStore.service.IFsStorePaymentScrmService;
 import com.fs.hisStore.vo.FsStorePaymentVO;
 import com.fs.system.service.ISysConfigService;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
+import com.github.binarywang.wxpay.config.WxPayConfig;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
 import com.ijpay.alipay.AliPayApi;
 import com.ijpay.alipay.AliPayApiConfig;
 import com.ijpay.alipay.AliPayApiConfigKit;
@@ -63,10 +76,16 @@ public class FsStorePaymentScrmController extends BaseController
     private IFsStorePaymentScrmService fsStorePaymentService;
     @Autowired
     private AliPayBean aliPayBean;
-
+    @Autowired
+    private WxPayService wxPayService;
     @Autowired
     private ICompanyService companyService;
-
+    @Autowired
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+    @Autowired
+    private IMerchantAppConfigService merchantAppConfigService;
+    @Autowired
+    IFsStorePaymentScrmService paymentService;
     @Autowired
     private IFsStoreOrderScrmService orderService;
     @Autowired
@@ -193,16 +212,14 @@ public class FsStorePaymentScrmController extends BaseController
         }
 
         if(payment.getPayTypeCode().equals("weixin")){
-            String json;
-//            if (CloudHostUtils.hasCloudHostName("康年堂")){
-                json = configService.selectConfigByKey("his.pay");
-//            } else {
-//                json = configService.selectConfigByKey("store.pay");
-//            }
-            if (StringUtils.isBlank(json)) {
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigByAppId(fsStorePayment.getAppId());
+            MerchantAppConfig merchantAppConfig = merchantAppConfigService.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+
+            if (ObjectUtil.isEmpty(merchantAppConfig)) {
                 return R.error("缺少支付相关配置");
             }
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+
             if (payment.getPayMode()!=null&&payment.getPayMode().equals("hf")){
                 String huifuId="";
                 FsHfpayConfigMapper fsHfpayConfigMapper = SpringUtils.getBean(FsHfpayConfigMapper.class);
@@ -246,7 +263,36 @@ public class FsStorePaymentScrmController extends BaseController
 
             }
             else if (payment.getPayMode()!=null&&payment.getPayMode().equals("wx")){
-
+                WxPayConfig payConfig = new WxPayConfig();
+                payConfig.setAppId(fsPayConfig.getAppId());
+                payConfig.setMchId(fsPayConfig.getWxMchId());
+                payConfig.setMchKey(fsPayConfig.getWxMchKey());
+                payConfig.setKeyPath(fsPayConfig.getKeyPath());
+                payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
+                payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
+                wxPayService.setConfig(payConfig);
+                WxPayRefundRequest refundRequest = new WxPayRefundRequest();
+                refundRequest.setOutTradeNo("store-"+payment.getPayCode());
+                refundRequest.setOutRefundNo("store-"+payment.getPayCode());
+                refundRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(payment.getPayMoney().toString()));
+                refundRequest.setRefundFee(WxPayUnifiedOrderRequest.yuanToFen(fsStorePayment.getRefundMoney().toString()));
+                try {
+                    WxPayRefundResult refundResult = wxPayService.refund(refundRequest);
+                    WxPayRefundQueryResult refundQueryResult = wxPayService.refundQuery("", refundResult.getOutTradeNo(), refundResult.getOutRefundNo(), refundResult.getRefundId());
+                    if(refundQueryResult!=null&&refundQueryResult.getResultCode().equals("SUCCESS")){
+                        FsStorePaymentScrm paymentMap=new FsStorePaymentScrm();
+                        paymentMap.setPaymentId(payment.getPaymentId());
+                        paymentMap.setStatus(-1);
+                        paymentMap.setRefundTime(DateUtils.getNowDate());
+                        paymentMap.setRefundMoney(fsStorePayment.getRefundMoney());
+                        paymentService.updateFsStorePayment(paymentMap);
+                    }
+                    else {
+                        return R.error("退款请求失败"+refundQueryResult.getErrCodeDes());
+                    }
+                } catch (WxPayException e) {
+                    return R.error("退款请求失败"+e.getErrCodeDes());
+                }
             }
 
             //小雨点退款

+ 1 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveAfterSalesController.java

@@ -193,6 +193,7 @@ public class LiveAfterSalesController extends BaseController
         logs.setOperator(loginUser.getUser().getNickName());
         logs.setStoreAfterSalesId(liveAfterSales.getId());
         logs.setChangeMessage(FsStoreAfterSalesStatusEnum.STATUS_2.getDesc());
+        liveAfterSales.setStatus(FsStoreAfterSalesStatusEnum.STATUS_2.getValue());
         liveAfterSalesLogsService.insertLiveAfterSalesLogs(logs);
         return toAjax(liveAfterSalesService.updateLiveAfterSales(liveAfterSales));
     }

+ 18 - 7
fs-admin/src/main/java/com/fs/qw/controller/QwSopController.java

@@ -21,6 +21,8 @@ import com.fs.sop.params.QwSopAutoTime;
 import com.fs.sop.params.QwSopEditQwUserParam;
 import com.fs.sop.service.IQwSopService;
 import com.fs.sop.vo.SopVoiceListVo;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -59,8 +61,8 @@ public class QwSopController extends BaseController
      * 查询企微sop列表
      */
     @PreAuthorize("@ss.hasPermi('qw:sop:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(QwSop qwSop)
+    @PostMapping("/list")
+    public R list(@RequestBody  QwSop qwSop)
     {
         List<String> userIds = qwSop.getUserIds();
         if (userIds != null && !userIds.isEmpty()) {
@@ -68,14 +70,23 @@ public class QwSopController extends BaseController
             if (longs != null && !longs.isEmpty()) {
                 qwSop.getQwUserIdList().addAll(longs);
             }else {
-                return getDataTable(new ArrayList<>());
+                return R.ok().put("data",new ArrayList<>());
             }
         }
 
 
-        startPage();
+        if(qwSop.getPageNum() == null) {
+            qwSop.setPageNum(1);
+        }
+        if(qwSop.getPageSize() == null) {
+            qwSop.setPageSize(10);
+        }
+
+        PageHelper.startPage(qwSop.getPageNum(), qwSop.getPageSize());
+
         List<QwSop> list = qwSopService.selectQwSopList(qwSop);
-        return getDataTable(list);
+
+        return R.ok().put("data",new PageInfo<>(list));
     }
 
     /**
@@ -117,8 +128,8 @@ public class QwSopController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('qw:sop:export')")
     @Log(title = "企微sop", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(QwSop qwSop)
+    @PostMapping("/export")
+    public AjaxResult export(@RequestBody QwSop qwSop)
     {
         List<QwSop> list = qwSopService.selectQwSopList(qwSop);
         ExcelUtil<QwSop> util = new ExcelUtil<QwSop>(QwSop.class);

+ 17 - 6
fs-admin/src/main/java/com/fs/qw/controller/QwSopTempController.java

@@ -22,6 +22,8 @@ import com.fs.sop.params.QwSopShareTempParam;
 import com.fs.sop.service.IQwSopTempService;
 import com.fs.sop.vo.UpdateRedVo;
 import com.fs.voice.utils.StringUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -51,10 +53,10 @@ public class QwSopTempController extends BaseController
      * 查询sop模板列表
      */
     @PreAuthorize("@ss.hasPermi('qw:sopTemp:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(QwSopTemp qwSopTemp)
+    @PostMapping("/list")
+    public R list(@RequestBody QwSopTemp qwSopTemp)
     {
-        startPage();
+
 //        List<QwSopTemp> list = qwSopTempService.selectQwSopTempList(qwSopTemp);
         List<QwSopTemp> list = qwSopTempService.selectQwSopTempListNew(qwSopTemp);
         // 收集所有需要查询的用户ID
@@ -85,7 +87,16 @@ public class QwSopTempController extends BaseController
             });
         }
 
-        return getDataTable(list);
+        if(qwSopTemp.getPageNum() == null) {
+            qwSopTemp.setPageNum(1);
+        }
+        if(qwSopTemp.getPageSize() == null) {
+            qwSopTemp.setPageSize(10);
+        }
+
+        PageHelper.startPage(qwSopTemp.getPageNum(), qwSopTemp.getPageSize());
+
+        return R.ok().put("data",new PageInfo<>(list));
     }
 
     /**
@@ -93,8 +104,8 @@ public class QwSopTempController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('qw:sopTemp:export')")
     @Log(title = "sop模板", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(QwSopTemp qwSopTemp)
+    @PostMapping("/export")
+    public AjaxResult export(@RequestBody QwSopTemp qwSopTemp)
     {
         List<QwSopTemp> list = qwSopTempService.selectQwSopTempList(qwSopTemp);
         ExcelUtil<QwSopTemp> util = new ExcelUtil<QwSopTemp>(QwSopTemp.class);

+ 8 - 1
fs-admin/src/main/java/com/fs/web/controller/common/CommonController.java

@@ -12,12 +12,12 @@ import com.fs.framework.config.ServerConfig;
 import com.fs.his.domain.FsExportTask;
 import com.fs.his.service.IFsExportTaskService;
 import com.fs.im.service.OpenIMService;
+import com.fs.qw.service.IQwUserService;
 import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
 
 import com.fs.web.vo.WangUploadVO;
 
-import com.huaweicloud.sdk.vod.v1.model.BaseInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -72,6 +72,9 @@ public class CommonController
     public RedisTemplate redisTemplate;
 
     org.slf4j.Logger logger= LoggerFactory.getLogger(getClass());
+    @Autowired
+    private IQwUserService qwUserService;
+
     @GetMapping(value = "common/getTask/{taskId}")
     public R getTask(@PathVariable("taskId") Long taskId)
     {
@@ -305,4 +308,8 @@ public class CommonController
 
     }
 
+    @PostMapping("/common/unbindQwUserByServerIds")
+    public R unbindQwUserByServerIds(@RequestBody List<String> serverIds){
+        return qwUserService.unbindQwUserByServerIds(serverIds);
+    }
 }

+ 1 - 1
fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java

@@ -135,7 +135,7 @@ public class LiveDataController extends BaseController
     @PostMapping("/listLiveData")
     public R listLiveData(@RequestBody LiveDataParam param, HttpServletRequest request)
     {
-        param.setCompanyId(tokenService.getLoginUser(request).getUser().getCompanyId());
+//        param.setCompanyId(tokenService.getLoginUser(request).getUser().getCompanyId());
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
         return liveDataService.listLiveData(param);
     }

+ 5 - 0
fs-company/src/main/java/com/fs/company/controller/qw/QwExternalContactController.java

@@ -7,6 +7,7 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.DictUtils;
 import com.fs.common.utils.PubFun;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
@@ -370,6 +371,10 @@ public class QwExternalContactController extends BaseController
 
             if (!StringUtil.strIsNullOrEmpty(item.getState()) && !wayList.isEmpty()) {
                 item.setState(item.getState()+"-"+getContactWayNameStream(item.getState(), wayList));
+
+            }
+            if (item.getStatus()!=null){
+                item.setStatusName(DictUtils.getDictLabel("sys_qw_external_contact_status", String.valueOf(item.getStatus())));
             }
         });
         ExcelUtil<QwExternalContactVO> util = new ExcelUtil<QwExternalContactVO>(QwExternalContactVO.class);

+ 1 - 0
fs-framework/src/main/java/com/fs/framework/config/SecurityConfig.java

@@ -137,6 +137,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/common/uploadWang**").anonymous()
                 .antMatchers("/common/download**").anonymous()
                 .antMatchers("/common/download/resource**").anonymous()
+                .antMatchers("/common/unbindQwUserByServerIds").anonymous()
                 .antMatchers("/swagger-ui.html").anonymous()
                 .antMatchers("/swagger-resources/**").anonymous()
                 .antMatchers("/webjars/**").anonymous()

+ 0 - 1
fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java

@@ -12,7 +12,6 @@ import com.fs.company.domain.CompanyMiniapp;
 import com.fs.company.service.ICompanyMiniappService;
 import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.domain.FsCourseWatchLog;
-import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.course.service.IFsCourseWatchLogService;
 import com.fs.his.domain.FsUser;

+ 2 - 1
fs-live-app/src/main/java/com/fs/live/controller/LiveController.java

@@ -120,12 +120,13 @@ public class LiveController {
 
 	@PostMapping("/videoUpload")
 	public R videoUpload(HttpServletRequest request, @RequestBody  Map<String, Object> params) {
+		String videoUrl = "https://bjzmkytcpv.ylrzcloud.com/";
 		log.info("请求参数:{}", params);
 		if(!params.containsKey("WorkflowExecution")) return R.error("参数错误");
 
 		LinkedHashMap<String,Object> result = (LinkedHashMap<String,Object>) params.get("WorkflowExecution");
 		String string = result.get("Object").toString();
-		videoService.updateFinishStatus("https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/" + string.replace(".mp4", ".m3u8"));
+		videoService.updateFinishStatus(videoUrl + string.replace(".mp4", "-1080.m3u8"));
 
 		return R.ok();
 //		{app=200149.push.tlivecloud.com, appid=1319721001, appname=live, channel_id=673,

+ 4 - 2
fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java

@@ -105,6 +105,8 @@ public class FsCoursePlaySourceConfig {
      */
     private Integer status;
 
-    // 商户支付配置id
-    private Integer merchantConfigId;
+    /**
+     * 商户支付配置id
+     */
+    private Long merchantConfigId;
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/mapper/FsCoursePlaySourceConfigMapper.java

@@ -14,4 +14,6 @@ public interface FsCoursePlaySourceConfigMapper extends BaseMapper<FsCoursePlayS
      * 查询点播配置列表
      */
     List<FsCoursePlaySourceConfigVO> selectCoursePlaySourceConfigVOListByMap(@Param("params") Map<String, Object> params);
+
+    FsCoursePlaySourceConfig selectCoursePlaySourceConfigByAppId(String appId);
 }

+ 2 - 2
fs-service/src/main/java/com/fs/course/param/FsCourseAnswerLogsParam.java

@@ -36,8 +36,8 @@ public class FsCourseAnswerLogsParam  extends BaseEntity  {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date sTime;
 
-    private Long pageNum;
-    private Long pageSize;
+    private Integer pageNum;
+    private Integer pageSize;
 
     /**
      * 用户(昵称_id组合)

+ 2 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseRedPacketLogParam.java

@@ -41,6 +41,8 @@ public class FsCourseRedPacketLogParam {
     @TableField(exist = false)
     private List<String> companyUserIds=new ArrayList<>();
 
+    private Integer pageNum;
+    private Integer pageSize;
 
     public List<String> getCompanyUserIds() {
         if (companyUserIds == null || companyUserIds.isEmpty()) {

+ 4 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseWatchLogListParam.java

@@ -110,6 +110,10 @@ public class FsCourseWatchLogListParam implements Serializable {
     private List<Long> deptIds;
     private String ids;
 
+
+    private Integer pageNum;
+    private Integer pageSize;
+
     @TableField(exist = false)
     private List<String> userIds = new ArrayList<>();
 

+ 7 - 0
fs-service/src/main/java/com/fs/course/service/IFsCoursePlaySourceConfigService.java

@@ -15,4 +15,11 @@ public interface IFsCoursePlaySourceConfigService extends IService<FsCoursePlayS
     List<FsCoursePlaySourceConfigVO> selectCoursePlaySourceConfigVOListByMap(Map<String, Object> params);
 
     List<FsCoursePlaySourceConfig> selectByAppIds(List<String> miniAppList);
+
+    /**
+     * 根据appId查询
+     * @param appId
+     * @return
+     */
+    FsCoursePlaySourceConfig selectCoursePlaySourceConfigByAppId(String appId);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsCoursePlaySourceConfigServiceImpl.java

@@ -30,4 +30,9 @@ public class FsCoursePlaySourceConfigServiceImpl extends ServiceImpl<FsCoursePla
     public List<FsCoursePlaySourceConfig> selectByAppIds(List<String> miniAppList) {
         return baseMapper.selectList(new QueryWrapper<FsCoursePlaySourceConfig>().in("appid", miniAppList));
     }
+
+    @Override
+    public FsCoursePlaySourceConfig selectCoursePlaySourceConfigByAppId(String appId) {
+        return baseMapper.selectCoursePlaySourceConfigByAppId(appId);
+    }
 }

+ 41 - 16
fs-service/src/main/java/com/fs/course/service/impl/FsCourseProductOrderServiceImpl.java

@@ -18,7 +18,9 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.ip.IpUtils;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.domain.FsCourseProduct;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.course.mapper.FsCourseProductMapper;
 import com.fs.course.param.FsCourseProductOrderCreateParam;
 import com.fs.course.param.FsCourseProductOrderListParam;
@@ -30,6 +32,7 @@ import com.fs.his.dto.PayConfigDTO;
 import com.fs.his.enums.FsCourseProductOrderStatusEnum;
 import com.fs.his.mapper.FsStorePaymentMapper;
 import com.fs.his.mapper.FsUserWxMapper;
+import com.fs.his.mapper.MerchantAppConfigMapper;
 import com.fs.his.param.ApplyCourseProductOrderRefundParam;
 import com.fs.his.param.FsCourseProductOrderComputeParam;
 import com.fs.his.param.FsCourseProductOrderDoPayParam;
@@ -38,6 +41,7 @@ import com.fs.his.service.IFsStorePaymentService;
 import com.fs.his.service.IFsUserService;
 import com.fs.his.service.IFsUserWxService;
 import com.fs.his.utils.PhoneUtil;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuiFuRefundResult;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
@@ -94,6 +98,11 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
 
     @Autowired FsCourseProductOrderMapper courseProductOrderMapper;
 
+    @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
+
     @Autowired
     private IFsUserService userService;
 
@@ -277,9 +286,18 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
             return R.error("订单状态不正确");
         }
         FsUser user = userService.selectFsUserByUserId(courseProductOrder.getUserId());
-
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
         String openId = null;
         String appId = param.getAppId();
         if (StringUtils.isNotBlank(appId)) {
@@ -293,7 +311,7 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -354,8 +372,19 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
         FsUser user = userService.selectFsUserByUserId(param.getUserId());
         logger.info("用户信息==============={}",user);
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+        FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
         String openId = null;
         String appId = param.getAppId();
         if (StringUtils.isNotBlank(appId)) {
@@ -369,7 +398,7 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -388,15 +417,13 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
 //        if (user != null && fsUserWx != null && StringUtils.isNotEmpty(fsUserWx.getOpenId())) {
         if (user != null && StringUtils.isNotEmpty(openId)) {
             if (courseProduct.getProductPrice().compareTo(new BigDecimal(0))==1) {
-//                String json = configService.selectConfigByKey("his.pay");
-//                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 String payCode =  OrderCodeUtils.getOrderSn();
                 if(StringUtils.isEmpty(payCode)){
                     return R.error("订单生成失败,请重试");
                 }
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(courseProductOrder.getOrderCode());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(courseProduct.getProductPrice());
@@ -410,11 +437,9 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
                 storePayment.setUserId(user.getUserId());
                 storePayment.setBusinessId(courseProductOrder.getCourseOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
-                    if (payConfigDTO.getType().equals("wx")) {
+                    if (merchantAppConfig.getMerchantType().equals("wx")) {
                         //创建微信订单
                         WxPayConfig payConfig = new WxPayConfig();
-                        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         payConfig.setAppId(appId);
                         payConfig.setMchId(fsPayConfig.getWxMchId());
                         payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -439,7 +464,7 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
                             e.printStackTrace();
                             throw new CustomException("支付失败" + e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("yb")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("yb")) {
                         WxJspayDTO p = new WxJspayDTO();
                         // 使用setter方法为对象赋值
                         p.setPayMoney(storePayment.getPayMoney().toString());
@@ -460,7 +485,7 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
                         } else {
                             throw new CustomException("支付失败");
                         }
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("product" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -485,7 +510,7 @@ public class FsCourseProductOrderServiceImpl extends ServiceImpl<FsCourseProduct
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         logger.info("创建汇付订单");
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");

+ 41 - 17
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseOrderServiceImpl.java

@@ -80,6 +80,10 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
     @Autowired
     private FsUserCourseOrderMapper fsUserCourseOrderMapper;
     @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
+    @Autowired
     private FsUserMapper fsUserMapper;
     @Autowired
     private FsUserCourseMapper fsUserCourseMapper;
@@ -374,8 +378,20 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
         }
         FsUser user=fsUserMapper.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+        FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
 //        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
 //        if (StringUtils.isBlank(openId)){
@@ -400,7 +416,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -424,7 +440,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                 }
                 FsStorePayment storePayment = new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(order.getPayMoney());
@@ -436,11 +452,9 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                 storePayment.setUserId(user.getUserId());
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
-                    if (payConfigDTO.getType().equals("wx")) {
+                    if (merchantAppConfig.getMerchantType().equals("wx")) {
                         //创建微信订单
                         WxPayConfig payConfig = new WxPayConfig();
-                        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         payConfig.setAppId(fsPayConfig.getAppId());
                         payConfig.setMchId(fsPayConfig.getWxMchId());
                         payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -465,7 +479,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                             e.printStackTrace();
                             throw new CustomException("支付失败" + e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("yb")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("yb")) {
                         WxJspayDTO p = new WxJspayDTO();
                         // 使用setter方法为对象赋值
                         p.setPayMoney(storePayment.getPayMoney().toString());
@@ -485,7 +499,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                         } else {
                             throw new CustomException("支付失败");
                         }
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("course" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -505,7 +519,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    } else if (payConfigDTO.getType().equals("hf")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
                         o.setOpenid(openId);
@@ -550,8 +564,18 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
 //        }
         FsUser user=fsUserMapper.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
         String openId = null;
         String appId = param.getAppId();
         if (StringUtils.isNotBlank(appId)) {
@@ -564,7 +588,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -587,7 +611,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
 //                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(order.getPayMoney());
@@ -600,9 +624,9 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if(storePaymentService.insertFsStorePayment(storePayment)>0){
 
-                    if (payConfigDTO.getType().equals("yb")) {
+                    if (merchantAppConfig.getMerchantType().equals("yb")) {
                         return R.error("支付暂不可用!");
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("course" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -623,7 +647,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("A_NATIVE");
 //                        o.setOpenid(user.getMaOpenId());

+ 45 - 25
fs-service/src/main/java/com/fs/course/service/impl/FsUserVipOrderServiceImpl.java

@@ -10,6 +10,7 @@ import java.util.Objects;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.core.domain.R;
@@ -20,8 +21,10 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.ip.IpUtils;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.domain.FsUserCourseOrder;
 import com.fs.course.domain.FsUserVipPackage;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.course.mapper.FsUserVipPackageMapper;
 import com.fs.course.param.FsUserVipOrderCreateUParam;
 import com.fs.course.param.FsUserVipOrderParam;
@@ -29,11 +32,9 @@ import com.fs.course.param.FsUserVipOrderPayUParam;
 import com.fs.course.vo.FsUserVipOrderListPVO;
 import com.fs.his.domain.*;
 import com.fs.his.dto.PayConfigDTO;
-import com.fs.his.mapper.FsStorePaymentErrorMapper;
-import com.fs.his.mapper.FsStorePaymentMapper;
-import com.fs.his.mapper.FsUserMapper;
-import com.fs.his.mapper.FsUserWxMapper;
+import com.fs.his.mapper.*;
 import com.fs.his.service.IFsStorePaymentService;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
 import com.fs.huifuPay.service.HuiFuService;
@@ -81,12 +82,10 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
     private FsUserVipPackageMapper fsUserVipPackageMapper;
     @Autowired
     private FsUserMapper userMapper;
-
     @Autowired
-    private ISysConfigService configService;
-
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
     @Autowired
-    private SysConfigMapper sysConfigMapper;
+    private MerchantAppConfigMapper merchantAppConfigMapper;
 
     @Autowired
     private IFsStorePaymentService storePaymentService;
@@ -233,8 +232,20 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
         }
         FsUser user = userMapper.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+        FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
 //        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
 //        if (StringUtils.isBlank(openId)){
@@ -258,7 +269,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -282,7 +293,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                 }
                 FsStorePayment storePayment = new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(order.getPayMoney());
@@ -294,11 +305,9 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                 storePayment.setUserId(user.getUserId());
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
-                    if (payConfigDTO.getType().equals("wx")) {
+                    if (merchantAppConfig.getMerchantType().equals("wx")) {
                         //创建微信订单
                         WxPayConfig payConfig = new WxPayConfig();
-                        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         payConfig.setAppId(fsPayConfig.getAppId());
                         payConfig.setMchId(fsPayConfig.getWxMchId());
                         payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -323,7 +332,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                             e.printStackTrace();
                             throw new CustomException("支付失败" + e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("yb")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("yb")) {
                         WxJspayDTO p = new WxJspayDTO();
                         // 使用setter方法为对象赋值
                         p.setPayMoney(storePayment.getPayMoney().toString());
@@ -343,7 +352,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                         } else {
                             throw new CustomException("支付失败");
                         }
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("appvip" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -363,7 +372,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    } else if (payConfigDTO.getType().equals("hf")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
                         o.setOpenid(openId);
@@ -399,8 +408,19 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
         }
         FsUser user = userMapper.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
         String openId = null;
         String appId = param.getAppId();
@@ -414,7 +434,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -437,7 +457,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
 //                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(order.getPayMoney());
@@ -450,9 +470,9 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if(storePaymentService.insertFsStorePayment(storePayment)>0){
 
-                    if (payConfigDTO.getType().equals("yb")) {
+                    if (merchantAppConfig.getMerchantType().equals("yb")) {
                         return R.error("支付暂不可用!");
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("appvip" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -473,7 +493,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("A_NATIVE");
 //                        o.setOpenid(user.getMaOpenId());

+ 3 - 0
fs-service/src/main/java/com/fs/his/mapper/FsUserWxMapper.java

@@ -2,6 +2,7 @@ package com.fs.his.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.his.domain.FsUserWx;
+import org.apache.ibatis.annotations.Param;
 
 public interface FsUserWxMapper extends BaseMapper<FsUserWx> {
 
@@ -10,4 +11,6 @@ public interface FsUserWxMapper extends BaseMapper<FsUserWx> {
      * @param wx    配置信息
      */
     void insertOrUpdateByUniqueKey(FsUserWx wx);
+
+    FsUserWx getFsUserWcByUserIdAndAppId(@Param("fsUserId") Long userId,@Param("appId") String appId );
 }

+ 5 - 0
fs-service/src/main/java/com/fs/his/param/PayOrderParam.java

@@ -36,6 +36,11 @@ public class PayOrderParam {
      * 用户ID
      */
     private Long userId;
+
+    /**
+     * appId
+     */
+    private String appId;
     /**
      * 支付方式
      */

+ 81 - 32
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -33,6 +33,8 @@ import com.fs.config.cloud.CloudHostProper;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.dto.PackageConfigDTO;
@@ -47,6 +49,7 @@ import com.fs.his.utils.ConfigUtil;
 import com.fs.his.utils.HttpUtil;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.*;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
 import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
@@ -98,6 +101,11 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
     private WxPayService wxPayService;
     @Autowired
     private WxPayProperties wxPayProperties;
+
+    @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
     @Autowired
     IPayService payService;
     @Autowired
@@ -866,7 +874,6 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
             List<FsStorePayment> payments = fsStorePaymentMapper.selectFsStorePaymentByPay(3,orderId);
             if(payments!=null&&payments.size()==1){
                 FsStorePayment payment=payments.get(0);
-                String json=configService.selectConfigByKey("his.pay");
                 if(payment.getPayMode().equals("wx")){
                     WxPayConfig payConfig = new WxPayConfig();
                     payConfig.setAppId(wxPayProperties.getAppId());
@@ -979,8 +986,20 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
 
         FsUser user=userService.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+        FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
         //金牛多小程序支付
         String openId = null;
@@ -995,7 +1014,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = fsPayConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -1016,7 +1035,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 }
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(fsPackageOrder.getOrderSn());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(fsPackageOrder.getPayMoney());
@@ -1031,11 +1050,9 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 storePayment.setStoreId(fsPackageOrder.getStoreId());
                 storePayment.setBusinessId(fsPackageOrder.getOrderId().toString());
                 if(storePaymentService.insertFsStorePayment(storePayment)>0){
-                    if (payConfigDTO.getType().equals("wx")) {
+                    if (merchantAppConfig.getMerchantType().equals("wx")) {
                         //创建微信订单
                         WxPayConfig payConfig = new WxPayConfig();
-                        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         payConfig.setAppId(appId);
                         payConfig.setMchId(fsPayConfig.getWxMchId());
                         payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -1060,7 +1077,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                             e.printStackTrace();
                             throw new CustomException("支付失败" + e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("yb")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("yb")) {
                         WxJspayDTO p = new WxJspayDTO();
                         // 使用setter方法为对象赋值
                         p.setPayMoney(storePayment.getPayMoney().toString());
@@ -1081,7 +1098,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         } else {
                             throw new CustomException("支付失败");
                         }
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("package" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -1106,7 +1123,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         logger.info("创建汇付订单");
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
@@ -1211,8 +1228,18 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 if(StringUtils.isEmpty(payCode)){
                     return R.error("订单生成失败,请重试");
                 }
-                String json = configService.selectConfigByKey("his.pay");
-                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+                if (StringUtils.isBlank(param.getAppId())) {
+                    throw new IllegalArgumentException("appId不能为空");
+                }
+                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+                if (fsCoursePlaySourceConfig == null) {
+                    throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+                }
+                Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+                if (merchantConfigId == null || merchantConfigId <= 0) {
+                    throw new CustomException("小程序没有配置商户信息");
+                }
+                MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
                 String openId = null;
                 String appId = param.getAppId();
                 if (StringUtils.isNotBlank(appId)) {
@@ -1225,7 +1252,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         openId = fsUserWx.getOpenId();
                     }
                 } else {
-                    appId = payConfigDTO.getAppId();
+                    appId = merchantAppConfig.getAppId();
                     openId = Objects.isNull(user) ? "" : user.getMaOpenId();
                     if (StringUtils.isBlank(openId)){
                         Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -1240,7 +1267,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
 
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(fsPackageOrder.getOrderSn());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(fsPackageOrder.getPayMoney());
@@ -1256,9 +1283,9 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 storePayment.setBusinessId(fsPackageOrder.getOrderId().toString());
                 if(storePaymentService.insertFsStorePayment(storePayment)>0){
 
-                    if (payConfigDTO.getType().equals("yb")) {
+                    if (merchantAppConfig.getMerchantType().equals("yb")) {
                         return R.error("支付暂不可用!");
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("package" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -1279,7 +1306,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         logger.info("创建汇付订单");
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("A_NATIVE");
@@ -1320,8 +1347,19 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         //如果存在优惠券  判断优惠券是否已使用
         FsUser user=userService.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
         String openId = null;
         String appId = param.getAppId();
@@ -1335,7 +1373,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -1358,7 +1396,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 }
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(fsPackageOrder.getOrderSn());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(fsPackageOrder.getPayMoney());
@@ -1373,9 +1411,9 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 storePayment.setStoreId(fsPackageOrder.getStoreId());
                 storePayment.setBusinessId(fsPackageOrder.getOrderId().toString());
                 if(storePaymentService.insertFsStorePayment(storePayment)>0){
-                    if (payConfigDTO.getType().equals("yb")) {
+                    if (merchantAppConfig.getMerchantType().equals("yb")) {
                         return R.error("支付暂不可用!");
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("package" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -1396,7 +1434,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         logger.info("创建汇付订单");
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_JSAPI");
@@ -1439,8 +1477,19 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         //如果存在优惠券  判断优惠券是否已使用
         FsUser user=userService.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
         //金牛多小程序支付
         String openId = null;
@@ -1455,7 +1504,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -1478,7 +1527,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
 //                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 FsStorePayment storePayment=new FsStorePayment();
                 storePayment.setStatus(0);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setBusinessCode(fsPackageOrder.getOrderSn());
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(fsPackageOrder.getPayMoney());
@@ -1494,9 +1543,9 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 storePayment.setBusinessId(fsPackageOrder.getOrderId().toString());
                 if(storePaymentService.insertFsStorePayment(storePayment)>0){
 
-                    if (payConfigDTO.getType().equals("yb")) {
+                    if (merchantAppConfig.getMerchantType().equals("yb")) {
                         return R.error("支付暂不可用!");
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("package" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -1517,7 +1566,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    }else if (payConfigDTO.getType().equals("hf")) {
+                    }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         logger.info("创建汇付订单");
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("A_NATIVE");

+ 21 - 4
fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java

@@ -31,6 +31,8 @@ import com.fs.company.service.impl.CompanyServiceImpl;
 import com.fs.company.vo.FsStoreOrderStatisticsVO;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.config.StoreConfig;
 import com.fs.erp.dto.BaseResponse;
@@ -48,6 +50,7 @@ import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.*;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.huifuPay.domain.HuiFuRefundResult;
 import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
 import com.fs.huifuPay.sdk.opps.core.utils.HuiFuUtils;
@@ -96,6 +99,10 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
     @Autowired
     private FsStoreAfterSalesLogsMapper fsStoreAfterSalesLogsMapper;
     @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
+    @Autowired
     private FsStoreOrderMapper fsStoreOrderMapper;
     @Autowired
     private FsStoreOrderLogsMapper fsStoreOrderLogsMapper;
@@ -475,11 +482,21 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
             if (reMoney.compareTo(payment.getPayMoney()) > 0) {
                 throw new CustomException("退款金额不能大于实际支付金额"); //退款金额不能大于实际支付金额
             }
-            String json = configService.selectConfigByKey("his.pay");
+            if (StringUtils.isBlank(payment.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             if (payment.getPayMode().equals("wx")) {
                 WxPayConfig payConfig = new WxPayConfig();
-                SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                 payConfig.setAppId(fsPayConfig.getAppId());
                 payConfig.setMchId(fsPayConfig.getWxMchId());
                 payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -762,7 +779,7 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
         fsStoreAfterSalesLogsMapper.insertFsStoreAfterSalesLogs(logs);
         fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.REFUND_ORDER_APPLY.getValue(),
                 FsStoreOrderLogEnum.REFUND_ORDER_APPLY.getDesc());
-        if (order.getExtendOrderId() != null) {
+        if (order.getExtendOrderId() != null && !"".equals(order.getExtendOrderId())) {
             ErpRefundUpdateRequest request = new ErpRefundUpdateRequest();
             request.setTid(order.getOrderCode());
             request.setOid(order.getOrderCode());

+ 41 - 16
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -28,6 +28,8 @@ import com.fs.config.ai.AiHostProper;
 import com.fs.config.cloud.CloudHostProper;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.erp.domain.*;
 import com.fs.erp.dto.*;
 import com.fs.erp.dto.df.*;
@@ -45,6 +47,7 @@ import com.fs.his.service.*;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.*;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.hisStore.domain.FsStoreOrderScrm;
 import com.fs.hisStore.domain.FsStorePaymentScrm;
 import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
@@ -153,7 +156,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     private FsStoreOrderMapper fsStoreOrderMapper;
 
     @Autowired
-    private FsStoreOrderScrmMapper fsStoreOrderScrmMapper;
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
 
     @Autowired
     private FsStoreOrderItemMapper fsStoreOrderItemMapper;
@@ -2960,8 +2965,18 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
 //        }
         FsUser user = userService.selectFsUserByUserId(param.getUserId());
         //在线支付
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
         String openId = null;
         String appId = param.getAppId();
         if (StringUtils.isNotBlank(appId)) {
@@ -2974,7 +2989,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -3000,7 +3015,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 FsStorePayment storePayment = new FsStorePayment();
                 storePayment.setStatus(0);
                 storePayment.setPayCode(payCode);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setPayMoney(order.getPayMoney());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setCreateTime(new Date());
@@ -3015,7 +3030,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
 
-                    if (payConfigDTO.getType().equals("wx")) {
+                    if (merchantAppConfig.getMerchantType().equals("wx")) {
                         //创建微信订单
                         WxPayConfig payConfig = new WxPayConfig();
                         SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
@@ -3044,7 +3059,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                             e.printStackTrace();
                             throw new CustomException("支付失败" + e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("yb")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("yb")) {
                         WxJspayDTO p = new WxJspayDTO();
                         // 使用setter方法为对象赋值
                         p.setPayMoney(storePayment.getPayMoney().toString());
@@ -3064,7 +3079,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         } else {
                             throw new CustomException("支付失败");
                         }
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("store" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -3089,7 +3104,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    } else if (payConfigDTO.getType().equals("hf")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
                         o.setOpenid(openId);
@@ -3126,8 +3141,18 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
 
         FsUser user = userService.selectFsUserByUserId(param.getUserId());
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
 
         String openId = null;
         String appId = param.getAppId();
@@ -3141,7 +3166,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -3171,7 +3196,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 FsStorePayment storePayment = new FsStorePayment();
                 storePayment.setStatus(0);
                 storePayment.setPayCode(payCode);
-                storePayment.setPayMode(payConfigDTO.getType());
+                storePayment.setPayMode(merchantAppConfig.getMerchantType());
                 storePayment.setPayMoney(order.getPayMoney());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setCreateTime(new Date());
@@ -3185,9 +3210,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 storePayment.setStoreId(order.getStoreId());
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
-                    if (payConfigDTO.getType().equals("yb")) {
+                    if (merchantAppConfig.getMerchantType().equals("yb")) {
                         return R.error("支付暂不可用!");
-                    } else if (payConfigDTO.getType().equals("tz")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                         PayCreateOrder o = new PayCreateOrder();
                         o.setOrderNo("store" + storePayment.getPayCode()); // 业务系统订单号
                         o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -3207,7 +3232,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         mt.setTradeNo(result.getBody().getOrderFlowNo());
                         fsStorePaymentMapper.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                    } else if (payConfigDTO.getType().equals("hf")) {
+                    } else if (merchantAppConfig.getMerchantType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("A_NATIVE");
                         o.setOpenid(openId);

+ 36 - 6
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -41,6 +41,8 @@ import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
 import com.fs.course.config.RedPacketConfig;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.course.service.IFsCourseRedPacketLogService;
 import com.fs.course.service.IFsUserCourseOrderService;
 import com.fs.course.service.IFsUserVipOrderService;
@@ -61,6 +63,7 @@ import com.fs.his.service.IFsStorePaymentService;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsStorePaymentExcelVO;
 import com.fs.his.vo.FsStorePaymentVO;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.hisStore.domain.FsStorePaymentScrm;
 import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
 import com.fs.hisStore.param.FsStorePaymentGetWxaCodeParam;
@@ -136,6 +139,11 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     private FsStorePaymentMapper fsStorePaymentMapper;
     @Autowired
     private FsStorePaymentScrmMapper fsStorePaymentScrmMapper;
+
+    @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
     @Autowired
     private TzBankService tzBankService;
     @Autowired
@@ -1195,9 +1203,21 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
             throw new CustomException("用户不存在");
         }
 
-        String json = configService.selectConfigByKey("his.pay");
-        logger.debug("支付配置 his.pay: {}", json);
-        FsPayConfig payConfig = JSONUtil.toBean(json, FsPayConfig.class);
+        if (StringUtils.isBlank(payOrderParam.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payOrderParam.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + payOrderParam.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());        FsPayConfig payConfig =JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+        payConfig.setType(merchantAppConfig.getMerchantType());
+        logger.debug("支付配置 his.pay: {}", payConfig);
+//        FsPayConfig payConfig = JSONUtil.toBean(json, FsPayConfig.class);
 
         if (isWechatPayment(payOrderParam.getPaymentMethod())) {
             String openId = getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod(), payConfig);
@@ -1625,8 +1645,18 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
             return R.error("用户不存在!");
         }
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
         String openId = null;
         String appId = param.getAppId();
         if (StringUtils.isNotBlank(appId)) {
@@ -1639,7 +1669,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()

+ 19 - 6
fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -22,6 +22,8 @@ import com.fs.company.service.ICompanyUserService;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.dto.FsUserInformationCollectionDTO;
@@ -32,6 +34,7 @@ import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.*;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.huifuPay.domain.HuiFuRefundResult;
 import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentDelaytransConfirmrefundRequest;
 import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
@@ -80,11 +83,11 @@ import java.util.stream.Collectors;
 public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserInformationCollectionMapper, FsUserInformationCollection> implements IFsUserInformationCollectionService {
     Logger logger= LoggerFactory.getLogger(getClass());
 
-    @Autowired
-    private ISysConfigService configService;
 
     @Autowired
-    SysConfigMapper sysConfigMapper;
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
 
     @Autowired
     private WxPayProperties wxPayProperties;
@@ -827,11 +830,21 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
 
         if (payments != null && !payments.isEmpty()) {
             FsStorePayment payment = payments.get(0);
-            String json = configService.selectConfigByKey("his.pay");
             if (payment.getPayMode().equals("wx")) {
                 WxPayConfig payConfig = new WxPayConfig();
-                SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
+                if (StringUtils.isBlank(payment.getAppId())) {
+                    throw new IllegalArgumentException("appId不能为空");
+                }
+                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
+                if (fsCoursePlaySourceConfig == null) {
+                    throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
+                }
+                Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+                if (merchantConfigId == null || merchantConfigId <= 0) {
+                    throw new CustomException("小程序没有配置商户信息");
+                }
+                MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+                FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
                 payConfig.setAppId(fsPayConfig.getAppId());
                 payConfig.setMchId(fsPayConfig.getWxMchId());
                 payConfig.setMchKey(fsPayConfig.getWxMchKey());

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/domain/FsPayConfigScrm.java

@@ -35,4 +35,6 @@ public class FsPayConfigScrm {
     private String notifyUrlScrm;
     private String publicKeyPath;
     private String publicKeyId;
+
+
 }

+ 4 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreOrderOtherPayParam.java

@@ -17,5 +17,9 @@ public class FsStoreOrderOtherPayParam implements Serializable
     @NotNull(message = "code")
     private String code;
 
+    /**
+     * appId
+     */
+    private String appId;
 
 }

+ 36 - 4
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreAfterSalesScrmServiceImpl.java

@@ -20,6 +20,8 @@ import com.fs.company.service.ICompanyService;
 import com.fs.config.cloud.CloudHostProper;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.erp.constant.AfterSalesOrderStatusEnum;
 import com.fs.erp.domain.FsJstAftersalePush;
 import com.fs.erp.dto.BaseResponse;
@@ -105,6 +107,12 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
     private ICompanyService companyService;
     @Autowired
     private FsStoreAfterSalesScrmMapper fsStoreAfterSalesMapper;
+
+
+    @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
     @Autowired
     private IFsStoreAfterSalesItemScrmService afterSalesItemService;
     @Autowired
@@ -783,9 +791,22 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
         if(order.getPayMoney().compareTo(BigDecimal.ZERO)==1){
             List<FsStorePaymentScrm> payments=paymentService.selectFsStorePaymentByOrderId(order.getId());
             if(payments!=null){
-                String json = configService.selectConfigByKey("his.pay");
-                FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+
                 for(FsStorePaymentScrm payment:payments){
+                    if (StringUtils.isBlank(payment.getAppId())) {
+                        throw new IllegalArgumentException("appId不能为空");
+                    }
+                    FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
+                    if (fsCoursePlaySourceConfig == null) {
+                        throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
+                    }
+                    Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+                    if (merchantConfigId == null || merchantConfigId <= 0) {
+                        throw new CustomException("小程序没有配置商户信息");
+                    }
+                    MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+                    FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+
                     if (payment.getPayMode()==null||payment.getPayMode().equals("wx")){
                         WxPayConfig payConfig = new WxPayConfig();
                         payConfig.setAppId(fsPayConfig.getAppId());
@@ -1466,8 +1487,19 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
         if (payments != null && payments.size() > 0) {
             FsStorePaymentScrm payment = payments.get(0);
 //            String json = configService.selectConfigByKey("store.pay");
-            String json = configService.selectConfigByKey("his.pay");
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            if (StringUtils.isBlank(payment.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             if (payment.getPayMode().equals("wx")) {
                 WxPayConfig payConfig = new WxPayConfig();
                 //SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");

+ 83 - 15
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -48,8 +48,10 @@ import com.fs.config.cloud.CloudHostProper;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.dto.FsOrderDeliveryNoteDTO;
 import com.fs.course.dto.OrderOpenIdTransDTO;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.erp.domain.*;
 import com.fs.erp.dto.*;
 import com.fs.erp.dto.df.*;
@@ -179,7 +181,6 @@ import static com.fs.hisStore.constants.StoreConstants.DELIVERY;
 @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
 @Slf4j
 public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
-    private static final String STORE_PAY_CONF = "his.pay";
 
     Logger logger = LoggerFactory.getLogger(getClass());
     @Autowired
@@ -188,6 +189,10 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
     @Autowired
     private CompanyUserUserMapper companyUserUserMapper;
     @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
+    @Autowired
     private IFsStoreOrderStatusScrmService orderStatusService;
     @Autowired
     private FsStoreCartScrmMapper cartMapper;
@@ -2239,11 +2244,19 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
         }
         erpOrder.setDetails(details);
         erpOrder.setReceiver_name(order.getRealName());
-        if (order.getUserPhone().length() > 11) {
-            erpOrder.setReceiver_phone(order.getUserPhone());
+        //2025.6.27 金牛要求erp推送电话可以设置默认 不影响其他推送
+        String phone = null;
+        if (CloudHostUtils.hasCloudHostName("康年堂") && StringUtils.isNotBlank(order.getErpPhone())) {
+            phone = order.getErpPhone();
+        } else {
+            phone = order.getUserPhone();
+        }
+        if (phone.length() > 11) {
+            erpOrder.setReceiver_phone(phone);
         } else {
-            erpOrder.setReceiver_mobile(order.getUserPhone());
+            erpOrder.setReceiver_mobile(phone);
         }
+
         String[] address = order.getUserAddress().split(" ");
         erpOrder.setReceiver_province(address[0]);
         erpOrder.setReceiver_city(address[1]);
@@ -2436,10 +2449,21 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
             //将钱退还给用户
             List<FsStorePaymentScrm> payments = paymentService.selectFsStorePaymentByOrderId(order.getId());
             if (payments != null) {
-                String json = configService.selectConfigByKey("his.pay");
-
-                FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
                 for (FsStorePaymentScrm payment : payments) {
+                    if (StringUtils.isBlank(payment.getAppId())) {
+                        throw new IllegalArgumentException("appId不能为空");
+                    }
+                    FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
+                    if (fsCoursePlaySourceConfig == null) {
+                        throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
+                    }
+                    Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+                    if (merchantConfigId == null || merchantConfigId <= 0) {
+                        throw new CustomException("小程序没有配置商户信息");
+                    }
+                    MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+                    FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+
                     if (payment.getPayMode() == null || payment.getPayMode().equals("wx")) {
                         WxPayConfig payConfig = new WxPayConfig();
                         payConfig.setAppId(fsPayConfig.getAppId());
@@ -4181,8 +4205,19 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
             }
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
             if((order.getPayType().equals("1")||order.getPayType().equals("2")||order.getPayType().equals("3")) && order.getPayMoney().compareTo(new BigDecimal(0))>0){
-                String json = configService.selectConfigByKey(STORE_PAY_CONF);
-                FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+                if (StringUtils.isBlank(param.getAppId())) {
+                    throw new IllegalArgumentException("appId不能为空");
+                }
+                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+                if (fsCoursePlaySourceConfig == null) {
+                    throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+                }
+                Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+                if (merchantConfigId == null || merchantConfigId <= 0) {
+                    throw new CustomException("小程序没有配置商户信息");
+                }
+                MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+                FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
                 FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
                 storePayment.setCompanyId(order.getCompanyId());
                 storePayment.setCompanyUserId(order.getCompanyUserId());
@@ -4319,8 +4354,19 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 return R.error("此订单已支付");
             }
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
-            String json = configService.selectConfigByKey(STORE_PAY_CONF);
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            if (StringUtils.isBlank(param.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
             storePayment.setCompanyId(order.getCompanyId());
             storePayment.setCompanyUserId(order.getCompanyUserId());
@@ -4435,8 +4481,19 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 return R.error("正在支付中...");
             }
 
-            String json = configService.selectConfigByKey(STORE_PAY_CONF);
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            if (StringUtils.isBlank(param.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
             //易宝支付
             FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
@@ -4537,8 +4594,19 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
         FsUserScrm user=userService.selectFsUserById(order.getUserId());
         if(user!=null){
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
-            String json = configService.selectConfigByKey(STORE_PAY_CONF);
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            if (StringUtils.isBlank(param.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
             storePayment.setCompanyId(order.getCompanyId());
             storePayment.setCompanyUserId(order.getCompanyUserId());

+ 0 - 3
fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java

@@ -580,9 +580,6 @@ public class LiveAfterSalesServiceImpl implements ILiveAfterSalesService {
     @Override
     public int updateLiveAfterSales(LiveAfterSales liveAfterSales)
     {
-        if (StringUtils.isNotEmpty(liveAfterSales.getDeliveryName()) && StringUtils.isNotEmpty(liveAfterSales.getDeliverySn()) && StringUtils.isNotEmpty(liveAfterSales.getDeliveryCode())) {
-            liveAfterSales.setStatus(2);
-        }
 
         return baseMapper.updateLiveAfterSales(liveAfterSales);
     }

+ 9 - 4
fs-service/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -1675,7 +1675,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         }
         erpOrder.setPlatform_code(order.getOrderCode());
         erpOrder.setWarehouse_code(erpConfig.getErpWarehouseCode());
-        erpOrder.setShop_code(erpConfig.getErpShopCode());
+        erpOrder.setShop_code(erpConfig.getErpJstShopCode());
         erpOrder.setBuyer_account(order.getUserName());
 
 //      erpOrder.setPost_fee(order.getTotalPostage().doubleValue());
@@ -1709,13 +1709,13 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
             order.setDeliverySn(express.getCode());
         }
         erpOrder.setPayments(payments);
-        if (order.getCompanyId() != null) {
+        if (order.getCompanyId() != null && order.getCompanyId() > 0L) {
             Company company = companyService.selectCompanyById(order.getCompanyId());
             if (company != null) {
                 erpOrder.setSeller_memo(company.getCompanyName());
             }
         }
-        if (order.getCompanyUserId() != null) {
+        if (order.getCompanyUserId() != null && order.getCompanyUserId() > 0L) {
             CompanyUser companyUser = companyUserService.selectCompanyUserById(order.getCompanyUserId());
             if (companyUser != null) {
                 CompanyDept dept = companyDeptService.selectCompanyDeptById(companyUser.getDeptId());
@@ -2467,6 +2467,9 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
     private BigDecimal handleDeliveryMoney(Long cityId, FsStoreProductScrm fsStoreProduct, String totalNumSize) {
         BigDecimal storePostage = BigDecimal.ZERO;
+        if (ObjectUtil.isNull(fsStoreProduct.getTempId())) {
+            return storePostage;
+        }
         List<Long> citys = new ArrayList<>();
         citys.add(cityId);
         citys.add(0l);
@@ -3487,6 +3490,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         if (attrValue != null) {
             attrValue.setStock(attrValue.getStock() - Integer.parseInt(liveOrder.getTotalNum()));
             attrValue.setSales(attrValue.getSales() + Integer.parseInt(liveOrder.getTotalNum()));
+            fsStoreProductAttrValueMapper.updateFsStoreProductAttrValue(attrValue);
         } else {
             // 更改店铺库存
             fsStoreProduct.setStock(fsStoreProduct.getStock()-Integer.parseInt(liveOrder.getTotalNum()));
@@ -3513,6 +3517,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         liveOrder.setCompanyUserId(liveUserFirstEntry.getCompanyUserId());
         liveOrder.setTuiUserId(liveUserFirstEntry.getCompanyUserId());
         String orderSn = OrderCodeUtils.getOrderSn();
+//        String orderSn = "123"; // todo yhq
         log.info("订单生成:"+orderSn);
         liveOrder.setOrderCode(orderSn);
         BigDecimal payPrice = fsStoreProduct.getPrice().multiply(new BigDecimal(liveOrder.getTotalNum()));
@@ -3561,7 +3566,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         liveOrder.setPayType("1");
         liveOrder.setTotalPrice(payPrice);
         liveOrder.setPayMoney(BigDecimal.ZERO);
-        liveOrder.setPayPrice(payPrice);
+        liveOrder.setPayPrice(payPrice.subtract(liveOrder.getDiscountMoney()));
         try {
             if (baseMapper.insertLiveOrder(liveOrder) > 0) {
                 LiveOrderItemDTO dto=new LiveOrderItemDTO();

+ 2 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwIpadServerUserMapper.java

@@ -5,6 +5,7 @@ import com.fs.qw.domain.QwIpadServerUser;
 import com.fs.qw.param.IPadServerUserParam;
 import com.fs.qw.vo.QwIPadServerUserVO;
 import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -73,4 +74,5 @@ public interface QwIpadServerUserMapper extends BaseMapper<QwIpadServerUser>{
     @Delete("DELETE FROM qw_ipad_server_user WHERE qw_user_id = #{id}")
     void deleteQwIpadServerUserByQwUserId(Long id);
 
+    void deleteQwIpadServerUserByQwUserIds(@Param("ids") List<Long> ids);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java

@@ -499,4 +499,8 @@ public interface QwUserMapper extends BaseMapper<QwUser>
             "            </if>" +
             "</script>")
     List<Long> selectQwUserListByCompanyUserIdS(@Param("userIds") List<String> userIds);
+
+    List<QwUser> selectQwUserByServerIds(@Param("serverIds")List<String> serverIds);
+
+    int batchUpdateUnbind(@Param("ids")List<Long> ids);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/qw/service/IQwIpadServerUserService.java

@@ -71,4 +71,6 @@ public interface IQwIpadServerUserService extends IService<QwIpadServerUser>{
     int deleteQwIpadServerUserById(Long id);
 
     void deleteQwIpadServerUserByQwUserId(Long id);
+
+    void deleteQwIpadServerUserByQwUserIds(List<Long> ids);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/qw/service/IQwUserService.java

@@ -205,4 +205,7 @@ public interface IQwUserService
 
     List<QwUser> selectQwUserByIds(List<Long> qwUserIdList);
     List<Long> selectQwUserListByCompanyUserIdS(List<String> userIds);
+
+    R unbindQwUserByServerIds(List<String> serverIds);
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwIpadServerUserServiceImpl.java

@@ -106,4 +106,9 @@ public class QwIpadServerUserServiceImpl extends ServiceImpl<QwIpadServerUserMap
     public void deleteQwIpadServerUserByQwUserId(Long id) {
         qwIpadServerUserMapper.deleteQwIpadServerUserByQwUserId(id);
     }
+
+    @Override
+    public void deleteQwIpadServerUserByQwUserIds(List<Long> ids) {
+        qwIpadServerUserMapper.deleteQwIpadServerUserByQwUserIds(ids);
+    }
 }

+ 52 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwUserServiceImpl.java

@@ -58,6 +58,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.io.*;
 import java.net.URL;
@@ -1569,6 +1570,57 @@ public class QwUserServiceImpl implements IQwUserService
         return qwUserMapper.selectQwUserListByCompanyUserIdS(userIds);
     }
 
+    @Override
+    @Transactional
+    public R unbindQwUserByServerIds(List<String> serverIds) {
+        if (serverIds!= null && !serverIds.isEmpty()) {
+            serverIds = serverIds.stream().distinct().collect(Collectors.toList()); //去重
+            //查询所有状态为 绑定了AI主机的
+            List<QwUser> list = qwUserMapper.selectQwUserByServerIds(serverIds);
+            if (list != null && !list.isEmpty()) {
+                for (QwUser qwUser : list) {
+
+                    try {
+                        QwIpadServerLog qwIpadServerLog = new QwIpadServerLog();
+                        qwIpadServerLog.setType(2);
+                        qwIpadServerLog.setTilie("退订解绑");
+                        qwIpadServerLog.setServerId(qwUser.getServerId());
+                        qwIpadServerLog.setQwUserId(qwUser.getId());
+                        qwIpadServerLog.setCompanyUserId(qwUser.getCompanyUserId());
+                        qwIpadServerLog.setCompanyId(qwUser.getCompanyId());
+                        qwIpadServerLog.setCreateTime(new Date());
+                        qwIpadServerLogService.insertQwIpadServerLog(qwIpadServerLog);
+//                        WxWorkGetQrCodeDTO wxWorkGetQrCodeDTO = new WxWorkGetQrCodeDTO();
+//                        wxWorkGetQrCodeDTO.setUuid(qwUser.getUid());
+//                        wxWorkService.LoginOut(wxWorkGetQrCodeDTO,qwUser.getServerId());
+                    } catch (Exception e) {
+                        log.error("企微用户:{},解绑ipad报错:{}", JSON.toJSONString(qwUser), e);
+                    }
+                }
+                List<Long> ids = list.stream().map(QwUser::getId).collect(Collectors.toList());
+                qwUserMapper.batchUpdateUnbind(ids); //修改qwUser的serverId和绑定状态
+//                ipadServerService.addServers(serverIds); // ipad数量退订归100
+                qwIpadServerUserService.deleteQwIpadServerUserByQwUserIds(ids); //删除 qwIpadServerUser
+                Long[] array = serverIds.stream()
+                        .map(str -> {
+                            if (str != null && !str.trim().isEmpty()) {
+                                try {
+                                    return Long.valueOf(str.trim());
+                                } catch (NumberFormatException e) {
+                                    return null; // 或抛出异常
+                                }
+                            }
+                            return null;
+                        })
+                        .toArray(Long[]::new);
+                ipadServerService.deleteQwIpadServerByIds(array); // 删除ipad
+            }
+
+
+        }
+        return R.ok();
+    }
+
     /**
      * 根据销售公司和企微ID查询企微用户
      */

+ 4 - 0
fs-service/src/main/java/com/fs/qw/vo/QwExternalContactVO.java

@@ -95,12 +95,16 @@ public class QwExternalContactVO {
     private Long companyId;
 
     private Integer transferStatus;
+    /*状态名称 用于excel导出*/
+    @Excel(name = "状态")
+    private String statusName;
     private Integer status;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "流失时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date lossTime;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date delTime;

+ 4 - 0
fs-service/src/main/java/com/fs/sop/domain/QwSop.java

@@ -161,6 +161,10 @@ public class QwSop implements Serializable
     @TableField(exist = false)
     private List<String> userIds = new ArrayList<>();
 
+
+    private Integer pageNum;
+    private Integer pageSize;
+
     public List<String> getUserIds() {
         if (userIds == null || userIds.isEmpty()) {
             return userIds;

+ 2 - 0
fs-service/src/main/java/com/fs/sop/domain/QwSopTemp.java

@@ -114,6 +114,8 @@ public class QwSopTemp implements Serializable
     @TableField(exist = false)
     private List<String> companyUserIds=new ArrayList<>();
 
+    private Integer pageNum;
+    private Integer pageSize;
 
     public List<String> getCompanyUserIds() {
         if (companyUserIds == null || companyUserIds.isEmpty()) {

+ 2 - 0
fs-service/src/main/java/com/fs/wxcid/dto/admin/GenAuthKey3Request.java

@@ -5,9 +5,11 @@ import lombok.Data;
 
 @Data
 public class GenAuthKey3Request {
+    //要生成 AuthKey 的个数; Count小于1默认设置为1
     @JsonProperty("Count")
     private Integer Count;
 
+    //类型 1日 7 周 30月 90季 180 半年 365年 30000永久(数字为标识,非准确天数)
     @JsonProperty("Type")
     private Integer Type;
 }

+ 23 - 23
fs-service/src/main/java/com/fs/wxcid/service/FriendService.java

@@ -10,7 +10,7 @@ import com.fs.wxcid.dto.friend.*;
  * <p>
  * 本接口封装了微信私有协议中 /friend 路径下的所有好友相关操作,
  * 包括:添加/同意好友、删除好友、查询联系人、搜索、上传通讯录等。
- * 所有方法均需传入账号唯一标识 key,并返回统一格式的 ApiResponse。
+ * 所有方法均需传入账号唯一标识 authKey,并返回统一格式的 ApiResponse。
  * </p>
  */
 public interface FriendService {
@@ -22,11 +22,11 @@ public interface FriendService {
      * 通常用于处理来自他人的加好友申请,需提供 V3/V4 等加密参数。
      * </p>
      *
-     * @param key    账号唯一标识(query 参数)
+     * @param authKey    账号唯一标识(query 参数)
      * @param request 同意请求参数(包含 V3、V4、Scene 等)
      * @return 统一响应结果
      */
-    ApiResponse agreeAdd(String key, AgreeAddRequest request);
+    ApiResponse agreeAdd(String authKey, AgreeAddRequest request);
 
     /**
      * 删除好友
@@ -35,11 +35,11 @@ public interface FriendService {
      * 从联系人列表中移除指定用户。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 删除请求参数(含 DelUserName)
      * @return 统一响应结果
      */
-    ApiResponse delContact(String key, DelContactRequest request);
+    ApiResponse delContact(String authKey, DelContactRequest request);
 
     /**
      * 批量获取联系人详细信息
@@ -48,11 +48,11 @@ public interface FriendService {
      * 可同时查询多个用户或群聊的详细资料。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 查询参数(支持 UserNames 和 RoomWxIDList)
      * @return 统一响应结果
      */
-    ApiResponse getContactDetailsList(String key, GetContactDetailsListRequest request);
+    ApiResponse getContactDetailsList(String authKey, GetContactDetailsListRequest request);
 
     /**
      * 分页获取全部联系人(包括好友和群聊)
@@ -61,11 +61,11 @@ public interface FriendService {
      * 通过序列号实现分页加载,避免一次性拉取过多数据。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 分页参数(CurrentWxcontactSeq / CurrentChatRoomContactSeq)
      * @return 统一响应结果
      */
-    ApiResponse getContactList(String key, GetContactListRequest request);
+    ApiResponse getContactList(String authKey, GetContactListRequest request);
 
     /**
      * 查询与指定用户的好友关系状态
@@ -74,11 +74,11 @@ public interface FriendService {
      * 可判断是否为单向/双向好友、是否被拉黑等。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 目标用户名(UserName)
      * @return 统一响应结果(含关系状态码)
      */
-    ApiResponse getFriendRelation(String key, GetFriendRelationRequest request);
+    ApiResponse getFriendRelation(String authKey, GetFriendRelationRequest request);
 
     /**
      * 获取已关注的公众号列表
@@ -87,10 +87,10 @@ public interface FriendService {
      * 返回当前账号关注的所有公众号信息。
      * </p>
      *
-     * @param key 账号唯一标识
+     * @param authKey 账号唯一标识
      * @return 统一响应结果
      */
-    ApiResponse getGHList(String key);
+    ApiResponse getGHList(String authKey);
 
     /**
      * 获取手机通讯录中匹配的微信好友
@@ -99,10 +99,10 @@ public interface FriendService {
      * 需提前上传通讯录(UploadMContact),否则可能返回空。
      * </p>
      *
-     * @param key 账号唯一标识
+     * @param authKey 账号唯一标识
      * @return 统一响应结果
      */
-    ApiResponse getMFriend(String key);
+    ApiResponse getMFriend(String authKey);
 
     /**
      * 获取已保存的群聊列表
@@ -111,10 +111,10 @@ public interface FriendService {
      * 返回当前账号参与并保存的所有群聊。
      * </p>
      *
-     * @param key 账号唯一标识
+     * @param authKey 账号唯一标识
      * @return 统一响应结果
      */
-    ApiResponse getGroupList(String key);
+    ApiResponse getGroupList(String authKey);
 
     /**
      * 搜索联系人
@@ -123,11 +123,11 @@ public interface FriendService {
      * 支持按昵称、微信号、手机号等模糊搜索。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 搜索参数(UserName + 场景配置)
      * @return 统一响应结果
      */
-    ApiResponse searchContact(String key, SearchContactRequest request);
+    ApiResponse searchContact(String authKey, SearchContactRequest request);
 
     /**
      * 上传手机通讯录用于匹配微信好友
@@ -136,11 +136,11 @@ public interface FriendService {
      * 上传后可调用 GetMFriend 获取匹配结果。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 通讯录号码列表(MobileList)
      * @return 统一响应结果
      */
-    ApiResponse uploadMContact(String key, UploadMContactRequest request);
+    ApiResponse uploadMContact(String authKey, UploadMContactRequest request);
 
     /**
      * 发起好友验证或添加请求
@@ -150,9 +150,9 @@ public interface FriendService {
      * 若无 V3/V4,部分场景可能无法添加。
      * </p>
      *
-     * @param key    账号唯一标识
+     * @param authKey    账号唯一标识
      * @param request 添加请求参数(含 V3、V4、Scene、验证语等)
      * @return 统一响应结果
      */
-    ApiResponse verifyUser(String key, VerifyUserRequest request);
+    ApiResponse verifyUser(String authKey, VerifyUserRequest request);
 }

+ 14 - 14
fs-service/src/main/java/com/fs/wxcid/service/LoginService.java

@@ -12,28 +12,28 @@ import com.fs.wxcid.dto.login.VerifyCodeRequest;
 public interface LoginService {
 
     // —————— 账号密码 / 62 / A16 登录 ——————
-    ApiResponse a16Login(String key, LoginRequest request);
-    ApiResponse deviceLogin(String key, LoginRequest request);
+    ApiResponse a16Login(String authKey, LoginRequest request);
+    ApiResponse deviceLogin(String authKey, LoginRequest request);
 
     // —————— 二维码登录(iPad / Mac / 车载) ——————
-    ApiResponse getLoginQrCodeNew(String key, QrCodeRequest request);// iPad
-    ApiResponse getLoginQrCodeNewDirect(String key, QrCodeRequest request); // 直登
-    ApiResponse macLogin(String key, QrCodeRequest request);// Mac
-    ApiResponse carLogin(String key, QrCodeRequest request);// iPad
+    ApiResponse getLoginQrCodeNew(String authKey, QrCodeRequest request);// iPad
+    ApiResponse getLoginQrCodeNewDirect(String authKey, QrCodeRequest request); // 直登
+    ApiResponse macLogin(String authKey, QrCodeRequest request);// Mac
+    ApiResponse carLogin(String authKey, QrCodeRequest request);// iPad
 
     // ------------------ 状态检测 ------------------
-    ApiResponse checkCanSetAlias(String key);// 检测是否可设昵称(判断登录环境)
-    ApiResponse checkLoginStatus(String key);// 检测扫码是否完成
-    ApiResponse getLoginStatus(String key);// 获取当前在线状态
+    ApiResponse checkCanSetAlias(String authKey);// 检测是否可设昵称(判断登录环境)
+    ApiResponse checkLoginStatus(String authKey);// 检测扫码是否完成
+    ApiResponse getLoginStatus(String authKey);// 获取当前在线状态
 
     // —————— 数据管理 ——————
-    ApiResponse get62Data(String key);            // 提取 62 数据(用于免密登录)
+    ApiResponse get62Data(String authKey);            // 提取 62 数据(用于免密登录)
 
     // —————— 验证码与滑块 ——————
-    ApiResponse verifyCode(String key, VerifyCodeRequest request);
-    ApiResponse verifyCodeSlide(String key, SlideVerifyRequest request);
+    ApiResponse verifyCode(String authKey, VerifyCodeRequest request);
+    ApiResponse verifyCodeSlide(String authKey, SlideVerifyRequest request);
 
     // —————— 控制 ——————
-    ApiResponse wakeUpLogin(String key, QrCodeRequest request); // 唤醒扫码登录
-    ApiResponse logOut(String key);                // 退出登录
+    ApiResponse wakeUpLogin(String authKey, QrCodeRequest request); // 唤醒扫码登录
+    ApiResponse logOut(String authKey);                // 退出登录
 }

+ 6 - 6
fs-service/src/main/java/com/fs/wxcid/service/MessageCallbackService.java

@@ -20,28 +20,28 @@ public interface MessageCallbackService {
      * 设置消息回调地址并启用/禁用推送
      * <p>对应接口:POST /message/SetCallback</p>
      *
-     * @param key     账号唯一标识
+     * @param authKey     账号唯一标识
      * @param config 回调配置(URL + 启用状态)
      * @return 统一响应结果
      */
-    ApiResponse setCallback(String key, CallbackConfigRequest config);
+    ApiResponse setCallback(String authKey, CallbackConfigRequest config);
 
     /**
      * 获取当前账号的消息回调配置
      * <p>对应接口:GET /message/GetCallback</p>
      *
-     * @param key 账号唯一标识
+     * @param authKey 账号唯一标识
      * @return 包含 CallbackURL 和 Enabled 状态的响应
      */
-    ApiResponse getCallback(String key);
+    ApiResponse getCallback(String authKey);
 
     /**
      * 删除(清空)消息回调配置
      * <p>执行后将不再推送任何消息到原回调地址</p>
      * <p>对应接口:GET /message/DeleteCallback</p>
      *
-     * @param key 账号唯一标识
+     * @param authKey 账号唯一标识
      * @return 操作结果
      */
-    ApiResponse deleteCallback(String key);
+    ApiResponse deleteCallback(String authKey);
 }

+ 22 - 22
fs-service/src/main/java/com/fs/wxcid/service/MessageService.java

@@ -7,26 +7,26 @@ import com.fs.wxcid.dto.message.*;
 
 public interface MessageService {
 
-    ApiResponse addMessageMgr(String key, AddMessageMgrRequest request);
-    ApiResponse cdnUploadVideo(String key, CdnUploadVideoRequest request);
-    ApiResponse downloadEmojiGif(String key, DownloadEmojiGifRequest request);
-    ApiResponse forwardEmoji(String key, ForwardEmojiRequest request);
-    ApiResponse forwardImageMessage(String key, ForwardImageMessageRequest request);
-    ApiResponse forwardVideoMessage(String key, ForwardVideoMessageRequest request);
-    ApiResponse getMsgBigImg(String key, GetMsgBigImgRequest request);
-    ApiResponse getMsgVideo(String key, GetMsgVideoRequest request);
-    ApiResponse getMsgVoice(String key, GetMsgVoiceRequest request);
-    ApiResponse groupMassMsgImage(String key, GroupMassMsgImageRequest request);
-    ApiResponse groupMassMsgText(String key, GroupMassMsgTextRequest request);
-    ApiResponse httpSyncMsg(String key, HttpSyncMsgRequest request);
-    ApiResponse newSyncHistoryMessage(String key); // 无 body
-    ApiResponse revokeMsg(String key, RevokeMsgRequest request);
-    ApiResponse revokeMsgNew(String key, RevokeMsgNewRequest request);
-    ApiResponse sendAppMessage(String key, SendAppMessageRequest request);
-    ApiResponse sendEmojiMessage(String key, SendEmojiMessageRequest request);
-    ApiResponse sendImageMessage(String key, SendImageMessageRequest request);
-    ApiResponse sendImageNewMessage(String key, SendImageNewMessageRequest request);
-    ApiResponse sendTextMessage(String key, SendTextMessageRequest request);
-    ApiResponse sendVoice(String key, SendVoiceRequest request);
-    ApiResponse shareCardMessage(String key, ShareCardMessageRequest request);
+    ApiResponse addMessageMgr(String authKey, AddMessageMgrRequest request);
+    ApiResponse cdnUploadVideo(String authKey, CdnUploadVideoRequest request);
+    ApiResponse downloadEmojiGif(String authKey, DownloadEmojiGifRequest request);
+    ApiResponse forwardEmoji(String authKey, ForwardEmojiRequest request);
+    ApiResponse forwardImageMessage(String authKey, ForwardImageMessageRequest request);
+    ApiResponse forwardVideoMessage(String authKey, ForwardVideoMessageRequest request);
+    ApiResponse getMsgBigImg(String authKey, GetMsgBigImgRequest request);
+    ApiResponse getMsgVideo(String authKey, GetMsgVideoRequest request);
+    ApiResponse getMsgVoice(String authKey, GetMsgVoiceRequest request);
+    ApiResponse groupMassMsgImage(String authKey, GroupMassMsgImageRequest request);
+    ApiResponse groupMassMsgText(String authKey, GroupMassMsgTextRequest request);
+    ApiResponse httpSyncMsg(String authKey, HttpSyncMsgRequest request);
+    ApiResponse newSyncHistoryMessage(String authKey); // 无 body
+    ApiResponse revokeMsg(String authKey, RevokeMsgRequest request);
+    ApiResponse revokeMsgNew(String authKey, RevokeMsgNewRequest request);
+    ApiResponse sendAppMessage(String authKey, SendAppMessageRequest request);
+    ApiResponse sendEmojiMessage(String authKey, SendEmojiMessageRequest request);
+    ApiResponse sendImageMessage(String authKey, SendImageMessageRequest request);
+    ApiResponse sendImageNewMessage(String authKey, SendImageNewMessageRequest request);
+    ApiResponse sendTextMessage(String authKey, SendTextMessageRequest request);
+    ApiResponse sendVoice(String authKey, SendVoiceRequest request);
+    ApiResponse shareCardMessage(String authKey, ShareCardMessageRequest request);
 }

+ 28 - 28
fs-service/src/main/java/com/fs/wxcid/service/impl/FriendServiceImpl.java

@@ -22,58 +22,58 @@ public class FriendServiceImpl implements FriendService {
 
 
     @Override
-    public ApiResponse agreeAdd(String key, AgreeAddRequest request) {
-        return post("/friend/AgreeAdd", key, request);
+    public ApiResponse agreeAdd(String authKey, AgreeAddRequest request) {
+        return post("/friend/AgreeAdd", authKey, request);
     }
 
     @Override
-    public ApiResponse delContact(String key, DelContactRequest request) {
-        return post("/friend/DelContact", key, request);
+    public ApiResponse delContact(String authKey, DelContactRequest request) {
+        return post("/friend/DelContact", authKey, request);
     }
 
     @Override
-    public ApiResponse getContactDetailsList(String key, GetContactDetailsListRequest request) {
-        return post("/friend/GetContactDetailsList", key, request);
+    public ApiResponse getContactDetailsList(String authKey, GetContactDetailsListRequest request) {
+        return post("/friend/GetContactDetailsList", authKey, request);
     }
 
     @Override
-    public ApiResponse getContactList(String key, GetContactListRequest request) {
-        return post("/friend/GetContactList", key, request);
+    public ApiResponse getContactList(String authKey, GetContactListRequest request) {
+        return post("/friend/GetContactList", authKey, request);
     }
 
     @Override
-    public ApiResponse getFriendRelation(String key, GetFriendRelationRequest request) {
-        return post("/friend/GetFriendRelation", key, request);
+    public ApiResponse getFriendRelation(String authKey, GetFriendRelationRequest request) {
+        return post("/friend/GetFriendRelation", authKey, request);
     }
 
     @Override
-    public ApiResponse getGHList(String key) {
-        return get("/friend/GetGHList", key);
+    public ApiResponse getGHList(String authKey) {
+        return get("/friend/GetGHList", authKey);
     }
 
     @Override
-    public ApiResponse getMFriend(String key) {
-        return get("/friend/GetMFriend", key);
+    public ApiResponse getMFriend(String authKey) {
+        return get("/friend/GetMFriend", authKey);
     }
 
     @Override
-    public ApiResponse getGroupList(String key) {
-        return get("/friend/GroupList", key);
+    public ApiResponse getGroupList(String authKey) {
+        return get("/friend/GroupList", authKey);
     }
 
     @Override
-    public ApiResponse searchContact(String key, SearchContactRequest request) {
-        return post("/friend/SearchContact", key, request);
+    public ApiResponse searchContact(String authKey, SearchContactRequest request) {
+        return post("/friend/SearchContact", authKey, request);
     }
 
     @Override
-    public ApiResponse uploadMContact(String key, UploadMContactRequest request) {
-        return post("/friend/UploadMContact", key, request);
+    public ApiResponse uploadMContact(String authKey, UploadMContactRequest request) {
+        return post("/friend/UploadMContact", authKey, request);
     }
 
     @Override
-    public ApiResponse verifyUser(String key, VerifyUserRequest request) {
-        return post("/friend/VerifyUser", key, request);
+    public ApiResponse verifyUser(String authKey, VerifyUserRequest request) {
+        return post("/friend/VerifyUser", authKey, request);
     }
 
     // ------------------ 工具方法 ------------------
@@ -81,12 +81,12 @@ public class FriendServiceImpl implements FriendService {
      * 通用 POST 请求方法
      *
      * @param path   接口路径,如 "/friend/AgreeAdd"
-     * @param key    账号唯一标识(query 参数)
+     * @param authKey    账号唯一标识(query 参数)
      * @param request 请求体对象
      * @return 统一响应结果
      */
-    private ApiResponse post(String path, String key, Object request) {
-        String url = BASE_URL + path + "?key=" + key;
+    private ApiResponse post(String path, String authKey, Object request) {
+        String url = BASE_URL + path + "?key=" + authKey;
         return WxWorkHttpUtil.postWithType(url, request, new TypeReference<ApiResponse>() {});
     }
 
@@ -94,13 +94,13 @@ public class FriendServiceImpl implements FriendService {
      * 通用 GET 请求方法(无请求体)
      *
      * @param path 接口路径
-     * @param key  账号唯一标识
+     * @param authKey  账号唯一标识
      * @return 统一响应结果
      */
-    private ApiResponse get(String path, String key) {
+    private ApiResponse get(String path, String authKey) {
         String url = BASE_URL + path;
         Map<String, Object> params = new HashMap<>();
-        params.put("key", key);
+        params.put("authKey", authKey);
         String resp = WxWorkHttpUtil.get(url, params);
         return com.alibaba.fastjson.JSON.parseObject(resp, ApiResponse.class);
     }

+ 34 - 34
fs-service/src/main/java/com/fs/wxcid/service/impl/LoginServiceImpl.java

@@ -20,66 +20,66 @@ public class LoginServiceImpl implements LoginService {
 
     // ------------------ 账号密码登录 ------------------
 
-    public ApiResponse a16Login(String key, LoginRequest request) {
-        return post("/login/A16Login", key, request);
+    public ApiResponse a16Login(String authKey, LoginRequest request) {
+        return post("/login/A16Login", authKey, request);
     }
 
-    public ApiResponse deviceLogin(String key, LoginRequest request) {
-        return post("/login/DeviceLogin", key, request);
+    public ApiResponse deviceLogin(String authKey, LoginRequest request) {
+        return post("/login/DeviceLogin", authKey, request);
     }
 
     // ------------------ 二维码登录 ------------------
 
-    public ApiResponse getLoginQrCodeNew(String key, QrCodeRequest request) {
-        return post("/login/GetLoginQrCodeNew", key, request);
+    public ApiResponse getLoginQrCodeNew(String authKey, QrCodeRequest request) {
+        return post("/login/GetLoginQrCodeNew", authKey, request);
     }
 
-    public ApiResponse getLoginQrCodeNewDirect(String key, QrCodeRequest request) {
-        return post("/login/GetLoginQrCodeNewDirect", key, request);
+    public ApiResponse getLoginQrCodeNewDirect(String authKey, QrCodeRequest request) {
+        return post("/login/GetLoginQrCodeNewDirect", authKey, request);
     }
 
-    public ApiResponse macLogin(String key, QrCodeRequest request) {
-        return post("/login/MacLogin", key, request);
+    public ApiResponse macLogin(String authKey, QrCodeRequest request) {
+        return post("/login/MacLogin", authKey, request);
     }
 
-    public ApiResponse carLogin(String key, QrCodeRequest request) {
-        return post("/login/CarLogin", key, request);
+    public ApiResponse carLogin(String authKey, QrCodeRequest request) {
+        return post("/login/CarLogin", authKey, request);
     }
 
-    public ApiResponse wakeUpLogin(String key, QrCodeRequest request) {
-        return post("/login/WakeUpLogin", key, request);
+    public ApiResponse wakeUpLogin(String authKey, QrCodeRequest request) {
+        return post("/login/WakeUpLogin", authKey, request);
     }
 
     // ------------------ 状态检测 ------------------
 
-    public ApiResponse checkCanSetAlias(String key) {
-        return get("/login/CheckCanSetAlias", key);
+    public ApiResponse checkCanSetAlias(String authKey) {
+        return get("/login/CheckCanSetAlias", authKey);
     }
 
-    public ApiResponse checkLoginStatus(String key) {
-        return get("/login/CheckLoginStatus", key);
+    public ApiResponse checkLoginStatus(String authKey) {
+        return get("/login/CheckLoginStatus", authKey);
     }
 
-    public ApiResponse getLoginStatus(String key) {
-        return get("/login/GetLoginStatus", key);
+    public ApiResponse getLoginStatus(String authKey) {
+        return get("/login/GetLoginStatus", authKey);
     }
 
-    public ApiResponse get62Data(String key) {
-        return get("/login/Get62Data", key);
+    public ApiResponse get62Data(String authKey) {
+        return get("/login/Get62Data", authKey);
     }
 
-    public ApiResponse logOut(String key) {
-        return get("/login/LogOut", key);
+    public ApiResponse logOut(String authKey) {
+        return get("/login/LogOut", authKey);
     }
 
     // ------------------ 验证 ------------------
 
-    public ApiResponse verifyCode(String key, VerifyCodeRequest request) {
-        return post("/login/VerifyCode", key, request);
+    public ApiResponse verifyCode(String authKey, VerifyCodeRequest request) {
+        return post("/login/VerifyCode", authKey, request);
     }
 
-    public ApiResponse verifyCodeSlide(String key, SlideVerifyRequest request) {
-        return post("/login/VerifyCodeSlide", key, request);
+    public ApiResponse verifyCodeSlide(String authKey, SlideVerifyRequest request) {
+        return post("/login/VerifyCodeSlide", authKey, request);
     }
 
     // ------------------ 工具方法 ------------------
@@ -87,12 +87,12 @@ public class LoginServiceImpl implements LoginService {
      * 通用 POST 请求方法
      *
      * @param path   接口路径,如 "/friend/AgreeAdd"
-     * @param key    账号唯一标识(query 参数)
+     * @param authKey    账号唯一标识(query 参数)
      * @param request 请求体对象
      * @return 统一响应结果
      */
-    private ApiResponse post(String path, String key, Object request) {
-        String url = BASE_URL + path + "?key=" + key;
+    private ApiResponse post(String path, String authKey, Object request) {
+        String url = BASE_URL + path + "?key=" + authKey;
         return WxWorkHttpUtil.postWithType(url, request, new TypeReference<ApiResponse>() {});
     }
 
@@ -100,13 +100,13 @@ public class LoginServiceImpl implements LoginService {
      * 通用 GET 请求方法(无请求体)
      *
      * @param path 接口路径
-     * @param key  账号唯一标识
+     * @param authKey  账号唯一标识
      * @return 统一响应结果
      */
-    private ApiResponse get(String path, String key) {
+    private ApiResponse get(String path, String authKey) {
         String url = BASE_URL + path;
         Map<String, Object> params = new HashMap<>();
-        params.put("key", key);
+        params.put("authKey", authKey);
         String resp = WxWorkHttpUtil.get(url, params);
         return com.alibaba.fastjson.JSON.parseObject(resp, ApiResponse.class);
     }

+ 14 - 14
fs-service/src/main/java/com/fs/wxcid/service/impl/MessageCallbackServiceImpl.java

@@ -20,8 +20,8 @@ public class MessageCallbackServiceImpl implements MessageCallbackService {
 
     @Override
     public ReturnMessage returnMessage(Map<String, Object> callback) {
-        // 安全地获取 key
-        String key = (String) callback.get("key");
+        // 安全地获取 authKey
+        String authKey = (String) callback.get("authKey");
 
         // 获取 message 子对象(也是一个 Map)
         Map<String, Object> message = (Map<String, Object>) callback.get("message");
@@ -45,22 +45,22 @@ public class MessageCallbackServiceImpl implements MessageCallbackService {
     /**
      * 设置消息回调
      */
-    public ApiResponse setCallback(String key, CallbackConfigRequest config) {
-        return post("/message/SetCallback", key, config);
+    public ApiResponse setCallback(String authKey, CallbackConfigRequest config) {
+        return post("/message/SetCallback", authKey, config);
     }
 
     /**
      * 获取消息回调配置
      */
-    public ApiResponse getCallback(String key) {
-        return get("/message/GetCallback", key);
+    public ApiResponse getCallback(String authKey) {
+        return get("/message/GetCallback", authKey);
     }
 
     /**
      * 删除消息回调配置
      */
-    public ApiResponse deleteCallback(String key) {
-        return get("/message/DeleteCallback", key);
+    public ApiResponse deleteCallback(String authKey) {
+        return get("/message/DeleteCallback", authKey);
     }
 
 
@@ -69,12 +69,12 @@ public class MessageCallbackServiceImpl implements MessageCallbackService {
      * 通用 POST 请求方法
      *
      * @param path   接口路径,如 "/friend/AgreeAdd"
-     * @param key    账号唯一标识(query 参数)
+     * @param authKey    账号唯一标识(query 参数)
      * @param request 请求体对象
      * @return 统一响应结果
      */
-    private ApiResponse post(String path, String key, Object request) {
-        String url = BASE_URL + path + "?key=" + key;
+    private ApiResponse post(String path, String authKey, Object request) {
+        String url = BASE_URL + path + "?key=" + authKey;
         return WxWorkHttpUtil.postWithType(url, request, new TypeReference<ApiResponse>() {});
     }
 
@@ -82,13 +82,13 @@ public class MessageCallbackServiceImpl implements MessageCallbackService {
      * 通用 GET 请求方法(无请求体)
      *
      * @param path 接口路径
-     * @param key  账号唯一标识
+     * @param authKey  账号唯一标识
      * @return 统一响应结果
      */
-    private ApiResponse get(String path, String key) {
+    private ApiResponse get(String path, String authKey) {
         String url = BASE_URL + path;
         Map<String, Object> params = new HashMap<>();
-        params.put("key", key);
+        params.put("authKey", authKey);
         String resp = WxWorkHttpUtil.get(url, params);
         return com.alibaba.fastjson.JSON.parseObject(resp, ApiResponse.class);
     }

+ 50 - 50
fs-service/src/main/java/com/fs/wxcid/service/impl/MessageServiceImpl.java

@@ -18,113 +18,113 @@ public class MessageServiceImpl implements MessageService {
 
 
     @Override
-    public ApiResponse addMessageMgr(String key, AddMessageMgrRequest request) {
-        return post("/message/AddMessageMgr", key, request);
+    public ApiResponse addMessageMgr(String authKey, AddMessageMgrRequest request) {
+        return post("/message/AddMessageMgr", authKey, request);
     }
 
     @Override
-    public ApiResponse cdnUploadVideo(String key, CdnUploadVideoRequest request) {
-        return post("/message/CdnUploadVideo", key, request);
+    public ApiResponse cdnUploadVideo(String authKey, CdnUploadVideoRequest request) {
+        return post("/message/CdnUploadVideo", authKey, request);
     }
 
     @Override
-    public ApiResponse downloadEmojiGif(String key, DownloadEmojiGifRequest request) {
-        return post("/message/DownloadEmojiGif", key, request);
+    public ApiResponse downloadEmojiGif(String authKey, DownloadEmojiGifRequest request) {
+        return post("/message/DownloadEmojiGif", authKey, request);
     }
 
     @Override
-    public ApiResponse forwardEmoji(String key, ForwardEmojiRequest request) {
-        return post("/message/ForwardEmoji", key, request);
+    public ApiResponse forwardEmoji(String authKey, ForwardEmojiRequest request) {
+        return post("/message/ForwardEmoji", authKey, request);
     }
 
     @Override
-    public ApiResponse forwardImageMessage(String key, ForwardImageMessageRequest request) {
-        return post("/message/ForwardImageMessage", key, request);
+    public ApiResponse forwardImageMessage(String authKey, ForwardImageMessageRequest request) {
+        return post("/message/ForwardImageMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse forwardVideoMessage(String key, ForwardVideoMessageRequest request) {
-        return post("/message/ForwardVideoMessage", key, request);
+    public ApiResponse forwardVideoMessage(String authKey, ForwardVideoMessageRequest request) {
+        return post("/message/ForwardVideoMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse getMsgBigImg(String key, GetMsgBigImgRequest request) {
-        return post("/message/GetMsgBigImg", key, request);
+    public ApiResponse getMsgBigImg(String authKey, GetMsgBigImgRequest request) {
+        return post("/message/GetMsgBigImg", authKey, request);
     }
 
     @Override
-    public ApiResponse getMsgVideo(String key, GetMsgVideoRequest request) {
-        return post("/message/GetMsgVideo", key, request);
+    public ApiResponse getMsgVideo(String authKey, GetMsgVideoRequest request) {
+        return post("/message/GetMsgVideo", authKey, request);
     }
 
     @Override
-    public ApiResponse getMsgVoice(String key, GetMsgVoiceRequest request) {
-        return post("/message/GetMsgVoice", key, request);
+    public ApiResponse getMsgVoice(String authKey, GetMsgVoiceRequest request) {
+        return post("/message/GetMsgVoice", authKey, request);
     }
 
     @Override
-    public ApiResponse groupMassMsgImage(String key, GroupMassMsgImageRequest request) {
-        return post("/message/GroupMassMsgImage", key, request);
+    public ApiResponse groupMassMsgImage(String authKey, GroupMassMsgImageRequest request) {
+        return post("/message/GroupMassMsgImage", authKey, request);
     }
 
     @Override
-    public ApiResponse groupMassMsgText(String key, GroupMassMsgTextRequest request) {
-        return post("/message/GroupMassMsgText", key, request);
+    public ApiResponse groupMassMsgText(String authKey, GroupMassMsgTextRequest request) {
+        return post("/message/GroupMassMsgText", authKey, request);
     }
 
     @Override
-    public ApiResponse httpSyncMsg(String key, HttpSyncMsgRequest request) {
-        return post("/message/HttpSyncMsg", key, request);
+    public ApiResponse httpSyncMsg(String authKey, HttpSyncMsgRequest request) {
+        return post("/message/HttpSyncMsg", authKey, request);
     }
 
     @Override
-    public ApiResponse newSyncHistoryMessage(String key) {
-        return post("/message/NewSyncHistoryMessage", key, new Object()); // 无 body,传空对象或自定义
+    public ApiResponse newSyncHistoryMessage(String authKey) {
+        return post("/message/NewSyncHistoryMessage", authKey, new Object()); // 无 body,传空对象或自定义
     }
 
     @Override
-    public ApiResponse revokeMsg(String key, RevokeMsgRequest request) {
-        return post("/message/RevokeMsg", key, request);
+    public ApiResponse revokeMsg(String authKey, RevokeMsgRequest request) {
+        return post("/message/RevokeMsg", authKey, request);
     }
 
     @Override
-    public ApiResponse revokeMsgNew(String key, RevokeMsgNewRequest request) {
-        return post("/message/RevokeMsgNew", key, request);
+    public ApiResponse revokeMsgNew(String authKey, RevokeMsgNewRequest request) {
+        return post("/message/RevokeMsgNew", authKey, request);
     }
 
     @Override
-    public ApiResponse sendAppMessage(String key, SendAppMessageRequest request) {
-        return post("/message/SendAppMessage", key, request);
+    public ApiResponse sendAppMessage(String authKey, SendAppMessageRequest request) {
+        return post("/message/SendAppMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse sendEmojiMessage(String key, SendEmojiMessageRequest request) {
-        return post("/message/SendEmojiMessage", key, request);
+    public ApiResponse sendEmojiMessage(String authKey, SendEmojiMessageRequest request) {
+        return post("/message/SendEmojiMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse sendImageMessage(String key, SendImageMessageRequest request) {
-        return post("/message/SendImageMessage", key, request);
+    public ApiResponse sendImageMessage(String authKey, SendImageMessageRequest request) {
+        return post("/message/SendImageMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse sendImageNewMessage(String key, SendImageNewMessageRequest request) {
-        return post("/message/SendImageNewMessage", key, request);
+    public ApiResponse sendImageNewMessage(String authKey, SendImageNewMessageRequest request) {
+        return post("/message/SendImageNewMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse sendTextMessage(String key, SendTextMessageRequest request) {
-        return post("/message/SendTextMessage", key, request);
+    public ApiResponse sendTextMessage(String authKey, SendTextMessageRequest request) {
+        return post("/message/SendTextMessage", authKey, request);
     }
 
     @Override
-    public ApiResponse sendVoice(String key, SendVoiceRequest request) {
-        return post("/message/SendVoice", key, request);
+    public ApiResponse sendVoice(String authKey, SendVoiceRequest request) {
+        return post("/message/SendVoice", authKey, request);
     }
 
     @Override
-    public ApiResponse shareCardMessage(String key, ShareCardMessageRequest request) {
-        return post("/message/ShareCardMessage", key, request);
+    public ApiResponse shareCardMessage(String authKey, ShareCardMessageRequest request) {
+        return post("/message/ShareCardMessage", authKey, request);
     }
 
     // ------------------ 工具方法 ------------------
@@ -132,12 +132,12 @@ public class MessageServiceImpl implements MessageService {
      * 通用 POST 请求方法
      *
      * @param path   接口路径,如 "/friend/AgreeAdd"
-     * @param key    账号唯一标识(query 参数)
+     * @param authKey    账号唯一标识(query 参数)
      * @param request 请求体对象
      * @return 统一响应结果
      */
-    private ApiResponse post(String path, String key, Object request) {
-        String url = BASE_URL + path + "?key=" + key;
+    private ApiResponse post(String path, String authKey, Object request) {
+        String url = BASE_URL + path + "?key=" + authKey;
         return WxWorkHttpUtil.postWithType(url, request, new TypeReference<ApiResponse>() {});
     }
 
@@ -145,13 +145,13 @@ public class MessageServiceImpl implements MessageService {
      * 通用 GET 请求方法(无请求体)
      *
      * @param path 接口路径
-     * @param key  账号唯一标识
+     * @param authKey  账号唯一标识
      * @return 统一响应结果
      */
-    private ApiResponse get(String path, String key) {
+    private ApiResponse get(String path, String authKey) {
         String url = BASE_URL + path;
         Map<String, Object> params = new HashMap<>();
-        params.put("key", key);
+        params.put("authKey", authKey);
         String resp = WxWorkHttpUtil.get(url, params);
         return com.alibaba.fastjson.JSON.parseObject(resp, ApiResponse.class);
     }

+ 1 - 1
fs-service/src/main/resources/application-config-druid-bjzm-test.yml

@@ -71,7 +71,7 @@ nuonuo:
 tencent_cloud_config:
   secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
   secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
-  bucket: bjzm-1323137866
+  bucket: bjzmky-1323137866
   app_id: 1323137866
   region: ap-chongqing
   proxy: bjzm

+ 6 - 0
fs-service/src/main/resources/application-config-druid-cfryt.yml

@@ -62,6 +62,12 @@ watch:
 fs :
   commonApi: http://172.26.180.67:7771
   h5CommonApi: http://172.26.180.67:7771
+  jwt:
+    # 加密秘钥
+    secret: f4e2e52034348f86b6d81e581c19jeb4
+    # token有效时长,7天,单位秒
+    expire: 31536000
+    header: AppToken
 nuonuo:
   key: 10924508
   secret: A2EB20764D304D16

+ 1 - 1
fs-service/src/main/resources/application-config-druid-gzzdy.yml

@@ -87,7 +87,7 @@ cloud_host:
 headerImg:
   imgUrl:
 ipad:
-  ipadUrl: http://ipad.dingdangtcm.cn
+  ipadUrl: http://175.178.218.55:8667
   aiApi: http://
   voiceApi: http://123.207.48.104:8009
   commonApi: http://123.207.48.104:7771

+ 8 - 0
fs-service/src/main/resources/mapper/course/FsCoursePlaySourceConfigMapper.xml

@@ -29,4 +29,12 @@
         </if>
         order by fcpsc.id desc
     </select>
+
+    <select id="selectCoursePlaySourceConfigByAppId" resultType="com.fs.course.domain.FsCoursePlaySourceConfig">
+        select
+            fcpsc.*
+        from fs_course_play_source_config fcpsc
+        where fcpsc.is_del = 0 and fcpsc.appid= #{appid}
+       limit 1
+    </select>
 </mapper>

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

@@ -253,7 +253,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="startDate != null and endDate != null">
                 and DATE_FORMAT(create_time, '%Y-%m-%d') between #{startDate} AND #{endDate}
             </if>
-            <if test='companyId !=null'>
+            <if test="companyId !=null">
                 and company_id = #{companyId}
             </if>
             <if test="courseId != null">

+ 4 - 0
fs-service/src/main/resources/mapper/his/FsUserWxMapper.xml

@@ -16,4 +16,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             open_id     = VALUES(open_id),
             update_time = VALUES(update_time)
     </insert>
+
+    <select id="getFsUserWcByUserIdAndAppId" resultType="com.fs.his.domain.FsUserWx">
+        select * from fs_user_wx where fs_user_id = #{fsUserId} and app_id = #{appId} limit 1
+    </select>
 </mapper>

+ 6 - 0
fs-service/src/main/resources/mapper/qw/QwIpadServerUserMapper.xml

@@ -88,4 +88,10 @@
             #{id}
         </foreach>
     </delete>
+    <delete id="deleteQwIpadServerUserByQwUserIds">
+        delete from qw_ipad_server_user where qw_user_id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

+ 13 - 0
fs-service/src/main/resources/mapper/qw/QwUserMapper.xml

@@ -257,6 +257,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateSendType">
         update qw_user set send_msg_type = #{type} where id in <foreach collection="ids" open="(" close=")" separator="," item="item">#{item}</foreach>
     </update>
+    <update id="batchUpdateUnbind">
+        update qw_user set server_id = null , server_status = 0 , ipad_status = 0 where id in
+        <foreach collection="ids" open="(" close=")" separator="," item="id">
+            #{id}
+        </foreach>
+    </update>
 
     <select id="selectOfflineUser" resultType="com.fs.qw.domain.QwUser">
         select * from qw_user where send_msg_type = 2 and server_id is not null and server_status = 1 and ipad_status = 1 limit 1
@@ -309,5 +315,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectQwUserVo"/>
         where  server_status = 1
     </select>
+    <select id="selectQwUserByServerIds" resultType="com.fs.qw.domain.QwUser">
+        <include refid="selectQwUserVo"/>
+        where  server_id in
+         <foreach collection="serverIds" item="serverId" open="(" close=")" separator=",">
+             #{serverId}
+         </foreach>
+    </select>
 
 </mapper>

+ 48 - 22
fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -2,6 +2,7 @@ package com.fs.app.controller;
 
 
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.app.annotation.Login;
@@ -15,6 +16,8 @@ import com.fs.common.utils.ip.IpUtils;
 import com.fs.company.service.ICompanyService;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.his.domain.*;
 import com.fs.his.dto.FsInquiryOrderPatientDTO;
 import com.fs.his.dto.PayConfigDTO;
@@ -26,6 +29,7 @@ import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsInquiryOrderListUVO;
 import com.fs.his.vo.FsInquiryOrderPingListUVO;
 import com.fs.his.vo.FsInquiryOrderReportUVO;
+import com.fs.hisStore.domain.FsPayConfigScrm;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
 import com.fs.huifuPay.service.HuiFuService;
@@ -93,8 +97,11 @@ public class InquiryOrderController extends  AppBaseController {
     private IFsInquiryTempService inquiryTempService;
     @Autowired
     private IFsInquiryOrderReportService orderReportService;
+
+    @Autowired
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
     @Autowired
-    private IFsInquiryOrderLogsService fsInquiryOrderLogsService;
+    private IMerchantAppConfigService merchantAppConfigService;
     @Autowired
     private IFsStorePaymentService storePaymentService;
     @Autowired
@@ -173,9 +180,6 @@ public class InquiryOrderController extends  AppBaseController {
     )
     {
         logger.info("支付"+param.getOrderId()+":"+param.getAppId());
-        String json=configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO= JSONUtil.toBean(json, PayConfigDTO.class);
-
         FsInquiryOrder order=inquiryOrderService.selectFsInquiryOrderByOrderId(param.getOrderId());
         if(order==null){
             return R.error("订单不存在");
@@ -256,8 +260,20 @@ public class InquiryOrderController extends  AppBaseController {
         param.setUserId(userId);
         FsUser user = userService.selectFsUserByUserId(userId);
         //在线支付
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigService.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+        FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 //        String openId = "";
 //        if (StringUtils.isNotEmpty(param.getAppId())) {
 //            FsUserWx fsUserWx = userWxService.selectByAppIdAndUserId(param.getAppId(), param.getUserId(), 1);
@@ -289,7 +305,7 @@ public class InquiryOrderController extends  AppBaseController {
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = merchantAppConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -334,7 +350,7 @@ public class InquiryOrderController extends  AppBaseController {
             }
             FsStorePayment storePayment=new FsStorePayment();
             storePayment.setStatus(0);
-            storePayment.setPayMode(payConfigDTO.getType());
+            storePayment.setPayMode(merchantAppConfig.getMerchantId());
             storePayment.setPayCode(payCode);
             storePayment.setCompanyId(order.getCompanyId());
             storePayment.setCompanyUserId(order.getCompanyUserId());
@@ -348,11 +364,9 @@ public class InquiryOrderController extends  AppBaseController {
             storePayment.setUserId(user.getUserId());
             storePayment.setBusinessId(order.getOrderId().toString());
             if(storePaymentService.insertFsStorePayment(storePayment)>0){
-                if(payConfigDTO.getType().equals("wx")){
+                if(merchantAppConfig.getMerchantId().equals("wx")){
                     //创建微信订单
                     WxPayConfig payConfig = new WxPayConfig();
-                    SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                    FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                     payConfig.setAppId(appId);
                     payConfig.setMchId(fsPayConfig.getWxMchId());
                     payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -378,7 +392,7 @@ public class InquiryOrderController extends  AppBaseController {
                         throw new CustomException("支付失败"+e.getMessage());
                     }
                 }
-                else if(payConfigDTO.getType().equals("yb")){
+                else if(merchantAppConfig.getMerchantId().equals("yb")){
                     WxJspayDTO p = new WxJspayDTO();
                     // 使用setter方法为对象赋值
                     p.setPayMoney(storePayment.getPayMoney().toString());
@@ -400,7 +414,7 @@ public class InquiryOrderController extends  AppBaseController {
                         throw new CustomException("支付失败");
                     }
                 }
-                else if(payConfigDTO.getType().equals("tz")){
+                else if(merchantAppConfig.getMerchantId().equals("tz")){
                     PayCreateOrder o = new PayCreateOrder();
                     o.setOrderNo("inquiry"+storePayment.getPayCode()); // 业务系统订单号
                     o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -425,7 +439,7 @@ public class InquiryOrderController extends  AppBaseController {
                     mt.setTradeNo(result.getBody().getOrderFlowNo());
                     storePaymentService.updateFsStorePayment(mt);
                     return R.ok().put("isPay",0).put("data",result).put("type","tz");
-                }else if(payConfigDTO.getType().equals("hf")){
+                }else if(merchantAppConfig.getMerchantId().equals("hf")){
                     HuiFuCreateOrder o = new HuiFuCreateOrder();
                     o.setTradeType("T_MINIAPP");
                     o.setOpenid(openId);
@@ -460,8 +474,20 @@ public class InquiryOrderController extends  AppBaseController {
         FsInquiryOrder order=inquiryOrderService.selectFsInquiryOrderByOrderId(param.getOrderId());
         FsUser user=userService.selectFsUserByUserId(Long.parseLong(getUserId()));
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+        if (StringUtils.isBlank(param.getAppId())) {
+            throw new IllegalArgumentException("appId不能为空");
+        }
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigByAppId(param.getAppId());
+        if (fsCoursePlaySourceConfig == null) {
+            throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+        }
+        Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+        if (merchantConfigId == null || merchantConfigId <= 0) {
+            throw new CustomException("小程序没有配置商户信息");
+        }
+        MerchantAppConfig merchantAppConfig = merchantAppConfigService.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+        FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
+//        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
 
         String openId = null;
         String appId = param.getAppId();
@@ -475,7 +501,7 @@ public class InquiryOrderController extends  AppBaseController {
                 openId = fsUserWx.getOpenId();
             }
         } else {
-            appId = payConfigDTO.getAppId();
+            appId = fsPayConfig.getAppId();
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
@@ -501,7 +527,7 @@ public class InquiryOrderController extends  AppBaseController {
 //            PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
             FsStorePayment storePayment=new FsStorePayment();
             storePayment.setStatus(0);
-            storePayment.setPayMode(payConfigDTO.getType());
+            storePayment.setPayMode(merchantAppConfig.getMerchantType());
             storePayment.setPayCode(payCode);
             storePayment.setCompanyId(order.getCompanyId());
             storePayment.setCompanyUserId(order.getCompanyUserId());
@@ -515,9 +541,9 @@ public class InquiryOrderController extends  AppBaseController {
             storePayment.setUserId(user.getUserId());
             storePayment.setBusinessId(order.getOrderId().toString());
             if(storePaymentService.insertFsStorePayment(storePayment)>0){
-                if (payConfigDTO.getType().equals("yb")) {
+                if (merchantAppConfig.getMerchantType().equals("yb")) {
                     return R.error("支付暂不可用!");
-                } else if (payConfigDTO.getType().equals("tz")) {
+                } else if (merchantAppConfig.getMerchantType().equals("tz")) {
                     PayCreateOrder o = new PayCreateOrder();
                     o.setOrderNo("inquiry" + storePayment.getPayCode()); // 业务系统订单号
                     o.setTrxAmt(storePayment.getPayMoney().doubleValue()); // 交易金额
@@ -537,7 +563,7 @@ public class InquiryOrderController extends  AppBaseController {
                     mt.setTradeNo(result.getBody().getOrderFlowNo());
                     storePaymentService.updateFsStorePayment(mt);
                     return R.ok().put("isPay", 0).put("data", result).put("type", "tz");
-                }else if (payConfigDTO.getType().equals("hf")) {
+                }else if (merchantAppConfig.getMerchantType().equals("hf")) {
                     HuiFuCreateOrder o = new HuiFuCreateOrder();
                     o.setTradeType("A_NATIVE");
                     o.setOpenid(openId);
@@ -548,7 +574,7 @@ public class InquiryOrderController extends  AppBaseController {
                     if (o.getAppId()!=null&& !o.getAppId().isEmpty()){
                         Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
                                 .eq(FsUserWx::getFsUserId, Long.parseLong(getUserId()))
-                                .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+                                .eq(FsUserWx::getAppId, fsPayConfig.getAppId());
                         FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
                         if (fsUserWx!=null){
                             o.setOpenid(fsUserWx.getOpenId());

+ 2 - 0
fs-user-app/src/main/java/com/fs/app/controller/course/CourseQwLoginController.java

@@ -119,6 +119,7 @@ public class CourseQwLoginController extends AppBaseController {
             if(user != null){
                 FsUser userMap = new FsUser();
                 userMap.setUserId(user.getUserId());
+                userMap.setMaOpenId(session.getOpenid());
 //                userMap.setCourseMaOpenId(session.getOpenid());
                 userMap.setUpdateTime(new DateTime());
                 userService.updateFsUser(userMap);
@@ -129,6 +130,7 @@ public class CourseQwLoginController extends AppBaseController {
                 user.setNickName("微信用户");
                 user.setAvatar("https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230725/a848605591384ec29d49773dd58d9345.jpg");
                 user.setStatus(1);
+                user.setMaOpenId(session.getOpenid());
 //                user.setCourseMaOpenId(session.getOpenid());
                 user.setUnionId(session.getUnionid());
                 user.setCreateTime(new Date());

+ 43 - 23
fs-user-app/src/main/java/com/fs/app/controller/live/LiveOrderController.java

@@ -4,13 +4,11 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
 import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
 import com.fs.app.annotation.Login;
 import com.fs.app.controller.AppBaseController;
-import com.fs.app.utils.JwtUtils;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.AjaxResult;
@@ -22,29 +20,27 @@ import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.ip.IpUtils;
-import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.core.config.WxMaConfiguration;
-import com.fs.erp.service.IErpOrderService;
-import com.fs.his.dto.ExpressInfoDTO;
-import com.fs.his.enums.ShipperCodeEnum;
-import com.fs.his.service.IFsExpressService;
-import com.fs.his.utils.ConfigUtil;
-import com.fs.hisStore.domain.*;
-import com.fs.hisStore.dto.FsStoreOrderComputeDTO;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
+import com.fs.his.domain.FsPayConfig;
+import com.fs.his.domain.MerchantAppConfig;
+import com.fs.his.mapper.MerchantAppConfigMapper;
+import com.fs.hisStore.domain.FsUserScrm;
 import com.fs.hisStore.enums.OrderInfoEnum;
-import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
 import com.fs.hisStore.param.*;
 import com.fs.hisStore.service.IFsUserScrmService;
-import com.fs.hisStore.vo.FsStoreOrderItemVO;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
 import com.fs.huifuPay.service.HuiFuService;
 import com.fs.live.domain.LiveOrder;
 import com.fs.live.domain.LiveOrderPayment;
 import com.fs.live.dto.LiveOrderComputeDTO;
-import com.fs.live.enums.LiveOrderCancleReason;
 import com.fs.live.mapper.LiveOrderPaymentMapper;
-import com.fs.live.param.*;
+import com.fs.live.param.FsMyLiveOrderQueryParam;
+import com.fs.live.param.LiveOrderComputedParam;
+import com.fs.live.param.LiveOrderConfirmParam;
+import com.fs.live.param.LiveOrderPayParam;
 import com.fs.live.service.ILiveAfterSalesService;
 import com.fs.live.service.ILiveOrderItemService;
 import com.fs.live.service.ILiveOrderService;
@@ -72,7 +68,6 @@ import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -126,7 +121,10 @@ public class LiveOrderController extends AppBaseController
     IPayService ybPayService;
     @Autowired
     private HuiFuService huiFuService;
-
+    @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
+    private MerchantAppConfigMapper merchantAppConfigMapper;
 
     /**
      * 查询订单列表
@@ -953,8 +951,19 @@ public class LiveOrderController extends AppBaseController
                 return R.error("正在支付中...");
             }
 
-            String json = configService.selectConfigByKey("his.pay");
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            if (StringUtils.isBlank(param.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
             //易宝支付
             LiveOrderPayment storePayment=new LiveOrderPayment();
@@ -962,7 +971,7 @@ public class LiveOrderController extends AppBaseController
             storePayment.setCompanyUserId(order.getCompanyUserId());
             storePayment.setStatus(0);
             storePayment.setPayCode(payCode);
-            storePayment.setPayMode(fsPayConfig.getType());
+            storePayment.setPayMode(merchantAppConfig.getMerchantType());
             storePayment.setPayMoney(order.getPayMoney());
             storePayment.setCreateTime(new Date());
             storePayment.setPayTypeCode("weixin");
@@ -973,7 +982,7 @@ public class LiveOrderController extends AppBaseController
             storePayment.setBusinessId(order.getOrderId().toString());
             liveOrderPaymentMapper.insertLiveOrderPayment(storePayment);
 
-            if (fsPayConfig.getType().equals("hf")){
+            if (merchantAppConfig.getMerchantType().equals("hf")){
                 HuiFuCreateOrder o = new HuiFuCreateOrder();
                 o.setTradeType("T_MINIAPP");
                 o.setOpenid(user.getMaOpenId());
@@ -996,7 +1005,7 @@ public class LiveOrderController extends AppBaseController
                 else{
                     return R.error(result.getResp_desc());
                 }
-            }else  if (fsPayConfig.getType().equals("wx")){
+            }else  if (merchantAppConfig.getMerchantType().equals("wx")){
                 //创建微信订单
                 WxPayConfig payConfig = new WxPayConfig();
                 payConfig.setAppId(fsPayConfig.getAppId());
@@ -1070,8 +1079,19 @@ public class LiveOrderController extends AppBaseController
             }
 
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
-            String json = configService.selectConfigByKey("his.pay");
-            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
+            if (StringUtils.isBlank(param.getAppId())) {
+                throw new IllegalArgumentException("appId不能为空");
+            }
+            FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
+            if (fsCoursePlaySourceConfig == null) {
+                throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
+            }
+            Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
+            if (merchantConfigId == null || merchantConfigId <= 0) {
+                throw new CustomException("小程序没有配置商户信息");
+            }
+            MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
+            FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
             LiveOrderPayment storePayment=new LiveOrderPayment();
             storePayment.setCompanyId(order.getCompanyId());
             storePayment.setCompanyUserId(order.getCompanyUserId());

+ 2 - 10
fs-user-app/src/main/java/com/fs/app/controller/store/CompanyUserScrmController.java

@@ -34,8 +34,6 @@ import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper;
 import com.fs.fastgptApi.util.AudioUtils;
 import com.fs.fastgptApi.vo.AudioVO;
 import com.fs.framework.security.SecurityUtils;
-import com.fs.his.dto.PayConfigDTO;
-import com.fs.his.service.IFsPrescribeService;
 import com.fs.sop.domain.QwSopTempVoice;
 import com.fs.sop.service.IQwSopTempVoiceService;
 import com.fs.system.oss.CloudStorageService;
@@ -76,7 +74,6 @@ public class CompanyUserScrmController extends AppBaseController {
     private FSConfig fsConfig;
     @Autowired
     RedisCache redisCache;
-
     @Autowired
     private ICompanyUserService companyUserService;
     @Autowired
@@ -89,8 +86,6 @@ public class CompanyUserScrmController extends AppBaseController {
     @Autowired
     private CompanyUserMapper companyUserMapper;
 
-    @Autowired
-    private IFsPrescribeService fsPrescribeService;
     @Autowired
     private IQwSopTempVoiceService voiceService;
     @Autowired
@@ -262,13 +257,10 @@ public class CompanyUserScrmController extends AppBaseController {
     @GetMapping("/getCompanyWxaCodeByPayment")
     public R getCompanyWxaCodeByPayment(@RequestParam("companyId")Long companyId,
                                         @RequestParam(value = "appId", required = false) String appId,
-                                        @RequestParam(required = false) Long companyUserId,
-                                        HttpServletRequest request){
+                                        @RequestParam(required = false) Long companyUserId){
 
-        String json = configService.selectConfigByKey("his.pay");
-        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
         if (appId == null || appId.trim().isEmpty() ) {
-            appId = payConfigDTO.getAppId();
+            return R.error("请联系管理员更新版本!");
         }
         //获取用户码
         String WxaCode;

+ 27 - 1
fs-user-app/src/main/java/com/fs/app/controller/store/UserScrmController.java

@@ -19,10 +19,14 @@ import com.fs.common.param.BaseQueryParam;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.course.param.newfs.FsUserCourseBeMemberParam;
 import com.fs.course.service.IFsUserCourseVideoService;
+import com.fs.his.domain.FsUserWx;
+import com.fs.his.mapper.FsUserWxMapper;
+import com.fs.his.utils.ConfigUtil;
 import com.fs.hisStore.domain.FsStoreOrderScrm;
 import com.fs.hisStore.domain.FsUserBillScrm;
 import com.fs.hisStore.domain.FsUserPromoterApplyScrm;
 import com.fs.hisStore.domain.FsUserScrm;
+import com.fs.hisStore.enums.SysConfigEnum;
 import com.fs.hisStore.param.*;
 import com.fs.hisStore.service.*;
 import com.fs.hisStore.vo.*;
@@ -95,6 +99,11 @@ public class UserScrmController extends AppBaseController {
     @Autowired
     private ILiveOrderService liveOrderService;
 
+    @Autowired
+    private ConfigUtil configUtil;
+
+    @Autowired
+    FsUserWxMapper fsUserWxMapper;
     /**
      * 获取用户信息
      * @param request
@@ -103,6 +112,15 @@ public class UserScrmController extends AppBaseController {
     @ApiOperation("获取用户信息")
     @GetMapping("/getUserInfo")
     public R getUserInfo(HttpServletRequest request){
+
+        String queryAppId = null;
+        // 获取请求头中的 appid
+        String appid = request.getHeader("appid");
+        if(StringUtils.isNotEmpty(appid)){
+                queryAppId =  appid;
+        }else{
+            queryAppId = configUtil.generateConfigByKey(SysConfigEnum.COURSE_MA_CONFIG.getKey()).getString("appid");
+        }
         try {
             FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
             if (user.getIsShow() !=null && user.getIsShow() == 0){
@@ -115,8 +133,16 @@ public class UserScrmController extends AppBaseController {
                         user.setIsShow(1);
                     }
                 }
-
             }
+            if( null != user && StringUtils.isBlank(user.getMaOpenId()) && null != user.getUserId() && null != queryAppId){
+                 log.info("用户没有maOpenId:{}",user);
+                 //从fsUserWx里面去进行查询数据
+                FsUserWx fsUserWx = fsUserWxMapper.getFsUserWcByUserIdAndAppId(user.getUserId(), queryAppId);
+                if(null != fsUserWx){
+                    user.setMaOpenId(fsUserWx.getOpenId());
+                }
+            }
+
             return R.ok().put("user",user);
         } catch (Exception e){
             log.error("【获取用户信息】:{}",e);

+ 2 - 0
fs-user-app/src/main/java/com/fs/app/controller/store/WxUserScrmController.java

@@ -280,6 +280,7 @@ public class WxUserScrmController extends AppBaseController {
         final WxMaService wxService = WxMaConfiguration.getMaService(courseMa_appId);
         try {
             WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
+            logger.info("session 得到:{}" , session);
             // 解密
             WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
             FsUserScrm user=new FsUserScrm();
@@ -320,6 +321,7 @@ public class WxUserScrmController extends AppBaseController {
                     if (!updatedAppId.equals(checkPhone.getAppId())) {
                         userMap.setAppId(updatedAppId);
                     }
+                    logger.info("=====用户======:{}",updatedAppId);
                     userService.updateFsUser(userMap);
                 }
                 else{