Преглед изворни кода

多商户配置后台,表结构启动的时候自动创建,需要将菜单和表数据配置上

(cherry picked from commit 295c8320b5339bf1f9c05478ff9e7eacda5b74f3)
yfh пре 3 месеци
родитељ
комит
dd76021068

+ 4 - 7
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -1038,7 +1038,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         }
 
         if (user != null
-                && ( "appPay".equals(payConfigDTO.getType()) // appPay类型:跳过openId校验
+                && ( "appPay".equals(merchantAppConfig.getMerchantType()) // appPay类型:跳过openId校验
                 || StringUtils.isNotEmpty(openId) )) {
             if(fsPackageOrder.getPayMoney().compareTo(new BigDecimal(0))==1){
                 String payCode =  OrderCodeUtils.getOrderSn();
@@ -1052,7 +1052,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 storePayment.setPayCode(payCode);
                 storePayment.setPayMoney(fsPackageOrder.getPayMoney());
                 storePayment.setCreateTime(new Date());
-                storePayment.setPayTypeCode(!"appPay".equals(payConfigDTO.getType()) ? "weixin" : param.getPayType());
+                storePayment.setPayTypeCode(!"appPay".equals(merchantAppConfig.getMerchantType()) ? "weixin" : param.getPayType());
                 storePayment.setBusinessType(3);
                 storePayment.setCompanyId(fsPackageOrder.getCompanyId());
                 storePayment.setCompanyUserId(fsPackageOrder.getCompanyUserId());
@@ -1161,11 +1161,9 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         mt.setAppId(appId);
                         storePaymentService.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "hf");
-                    } else if (payConfigDTO.getType().equals("appPay") && "wx".equals(param.getPayType())) {
+                    } else if (merchantAppConfig.getMerchantType().equals("appPay") && "wx".equals(param.getPayType())) {
                         //创建微信订单
                         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.getWxAppMchId());
                         payConfig.setMchKey(fsPayConfig.getWxAppMchKey());
@@ -1189,10 +1187,9 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                             e.printStackTrace();
                             throw new CustomException("支付失败"+e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("appPay") && "ali".equals(param.getPayType())) {
+                    } else if (merchantAppConfig.getMerchantType().equals("appPay") && "ali".equals(param.getPayType())) {
                         // 实例化客户端
                         SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", fsPayConfig.getAliAppId(), fsPayConfig.getAliPrivateKey(), "json", "utf-8", fsPayConfig.getAliPublicKey(), "RSA2");
 
                         // 构造请求参数以调用接口

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

@@ -644,7 +644,6 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
             } else if ("appPay".equals(payment.getPayMode()) && "ali".equals(payment.getPayTypeCode())) {
                 // 实例化客户端
                 SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                 AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", fsPayConfig.getAliAppId(), fsPayConfig.getAliPrivateKey(), "json", "utf-8", fsPayConfig.getAliPublicKey(), "RSA2");
                 // 构造请求参数以调用接口
                 AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();

+ 5 - 6
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -2995,6 +2995,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             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)) {
@@ -3037,7 +3038,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 storePayment.setPayMoney(order.getPayMoney());
                 storePayment.setBusinessCode(order.getOrderCode());
                 storePayment.setCreateTime(new Date());
-                storePayment.setPayTypeCode(!"appPay".equals(payConfigDTO.getType()) ? "weixin" : param.getPayType());
+                storePayment.setPayTypeCode(!"appPay".equals(merchantAppConfig.getMerchantType()) ? "weixin" : param.getPayType());
                 storePayment.setBusinessType(2);
                 storePayment.setRemark("药品订单支付");
                 storePayment.setOpenId(openId);
@@ -3052,7 +3053,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         //创建微信订单
                         WxPayConfig payConfig = new WxPayConfig();
                         SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
+//                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         payConfig.setAppId(fsPayConfig.getAppId());
                         payConfig.setMchId(fsPayConfig.getWxMchId());
                         payConfig.setMchKey(fsPayConfig.getWxMchKey());
@@ -3136,11 +3137,10 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         mt.setAppId(appId);
                         storePaymentService.updateFsStorePayment(mt);
                         return R.ok().put("isPay", 0).put("data", result).put("type", "hf");
-                    } else if (payConfigDTO.getType().equals("appPay") && "wx".equals(param.getPayType())) {
+                    } else if (merchantAppConfig.getMerchantType().equals("appPay") && "wx".equals(param.getPayType())) {
                         //创建微信订单
                         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.getWxAppMchId());
                         payConfig.setMchKey(fsPayConfig.getWxAppMchKey());
@@ -3163,10 +3163,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                             e.printStackTrace();
                             throw new CustomException("支付失败"+e.getMessage());
                         }
-                    } else if (payConfigDTO.getType().equals("appPay") && "ali".equals(param.getPayType())) {
+                    } else if (merchantAppConfig.getMerchantType().equals("appPay") && "ali".equals(param.getPayType())) {
                         // 实例化客户端
                         SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                        FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                         AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", fsPayConfig.getAliAppId(), fsPayConfig.getAliPrivateKey(), "json", "utf-8", fsPayConfig.getAliPublicKey(), "RSA2");
 
                         // 构造请求参数以调用接口

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

@@ -4433,7 +4433,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 return R.error("此订单已支付");
             }
 //            String payCode =  OrderCodeUtils.getOrderSn();
-            String json = configService.selectConfigByKey(STORE_PAY_CONF);
+//            String json = configService.selectConfigByKey(STORE_PAY_CONF);
 //            FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
             String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
             if (StringUtils.isBlank(param.getAppId())) {

+ 4 - 8
fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -344,7 +344,7 @@ public class InquiryOrderController extends  AppBaseController {
 //            }
 //        }
 
-        if ((!"appPay".equals(payConfigDTO.getType()) && StringUtils.isBlank(openId))) {
+        if ((!"appPay".equals(merchantAppConfig.getMerchantType()) && StringUtils.isBlank(openId))) {
             return R.error("用户OPENID不存在");
         }
 
@@ -366,7 +366,7 @@ public class InquiryOrderController extends  AppBaseController {
             storePayment.setBusinessCode(order.getOrderSn());
             storePayment.setPayMoney(order.getPayMoney());
             storePayment.setCreateTime(new Date());
-            storePayment.setPayTypeCode(!"appPay".equals(payConfigDTO.getType()) ? "weixin" : param.getPayType());
+            storePayment.setPayTypeCode(!"appPay".equals(merchantAppConfig.getMerchantType()) ? "weixin" : param.getPayType());
             storePayment.setBusinessType(1);
             storePayment.setRemark("问诊订单支付");
             storePayment.setOpenId(openId);
@@ -464,11 +464,9 @@ public class InquiryOrderController extends  AppBaseController {
                     mt.setAppId(appId);
                     storePaymentService.updateFsStorePayment(mt);
                     return R.ok().put("isPay",0).put("data",result).put("type","hf");
-                } else if (payConfigDTO.getType().equals("appPay") && "wx".equals(param.getPayType())) {
+                } else if (merchantAppConfig.getMerchantType().equals("appPay") && "wx".equals(param.getPayType())) {
                     //创建微信订单
                     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.getWxAppMchId());
                     payConfig.setMchKey(fsPayConfig.getWxAppMchKey());
@@ -492,10 +490,8 @@ public class InquiryOrderController extends  AppBaseController {
                         e.printStackTrace();
                         throw new CustomException("支付失败"+e.getMessage());
                     }
-                } else if (payConfigDTO.getType().equals("appPay") && "ali".equals(param.getPayType())) {
+                } else if (merchantAppConfig.getMerchantType().equals("appPay") && "ali".equals(param.getPayType())) {
                     // 实例化客户端
-                    SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.pay");
-                    FsPayConfig fsPayConfig = new Gson().fromJson(sysConfig.getConfigValue(), FsPayConfig.class);
                     AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", fsPayConfig.getAliAppId(), fsPayConfig.getAliPrivateKey(), "json", "utf-8", fsPayConfig.getAliPublicKey(), "RSA2");
 
                     // 构造请求参数以调用接口