2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-10-20 4e76b9737e036c18e8a9e840dc443615ffcec348
ximon-admin/src/main/java/com/sandu/ximon/admin/pay/wxpay/UsrWxPayConfigService.java
@@ -43,7 +43,7 @@
        //未设置支付参数,则使用默认支付参数
        config = getOne(Wrappers.lambdaQuery(WxConfigEntity.class).eq(WxConfigEntity::getClientId, pole.getClientId()).eq(WxConfigEntity::getState, 1));
//        if (pole.getClientId() == null) {
              //没有归属的灯杆使用默认配置
        //没有归属的灯杆使用默认配置
//            config = getById(15);
//        }
        if (config == null) {
@@ -52,9 +52,22 @@
        return config;
    }
    public WxConfigEntity getConfigByAppId(String appId) {
        if (appId == null) {
            throw new BusinessException("回调失败,未解析到appid");
        }
        WxConfigEntity config;
        //未设置支付参数,则使用默认支付参数
        config = getOne(Wrappers.lambdaQuery(WxConfigEntity.class).eq(WxConfigEntity::getAppappid, appId).eq(WxConfigEntity::getState, 1));
    public static UsrWxPayConfigService getBean() {
        return (UsrWxPayConfigService) SpringContextUtil.getBean("UsrWxPayConfigService");
        if (config == null) {
            throw new BusinessException("未找到支付配置或配置未启用,请联系管理员!");
        }
//        if (pole.getClientId() == null) {
        //没有归属的灯杆使用默认配置
//            config = getById(15);
//        }
        return config;
    }
@@ -139,16 +152,16 @@
            );
        }
        List<WxConfigEntity> list = list(wrapper);
        list.forEach(
                wxConfigEntity -> {
                    //设置支付参数中的appid和appappid  mchId和privateKey中的部分替换为*
                    wxConfigEntity.setAppid(wxConfigEntity.getAppid().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
                    wxConfigEntity.setAppappid(wxConfigEntity.getAppappid().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
                    wxConfigEntity.setMchId(wxConfigEntity.getMchId().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
                    wxConfigEntity.setPrivateKey(wxConfigEntity.getPrivateKey().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
                    wxConfigEntity.setAppSecret(wxConfigEntity.getAppSecret().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
                }
        );
//        list.forEach(
//                wxConfigEntity -> {
//                    //设置支付参数中的appid和appappid  mchId和privateKey中的部分替换为*
//                    wxConfigEntity.setAppid(wxConfigEntity.getAppid().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
//                    wxConfigEntity.setAppappid(wxConfigEntity.getAppappid().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
//                    wxConfigEntity.setMchId(wxConfigEntity.getMchId().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
//                    wxConfigEntity.setPrivateKey(wxConfigEntity.getPrivateKey().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
//                    wxConfigEntity.setAppSecret(wxConfigEntity.getAppSecret().replaceAll("(?<=.{4}).*(?=.{4})", "*"));
//                }
//        );
        return list;
    }