2021与蓝度共同重构项目,服务端
liuhaonan
2022-08-23 923c9cec3403ae2abcc523ea73918f243977e546
ximon-admin/src/main/java/com/sandu/ximon/admin/pay/wxpay/UsrWxPayConfigService.java
@@ -42,12 +42,31 @@
        WxConfigEntity config;
        //未设置支付参数,则使用默认支付参数
        config = getOne(Wrappers.lambdaQuery(WxConfigEntity.class).eq(WxConfigEntity::getClientId, pole.getClientId()).eq(WxConfigEntity::getState, 1));
        if (pole.getClientId() == null) {
            config = getById(15);  // todo 暂时写死,后续需要改成配置文件
        }
//        if (pole.getClientId() == null) {
        //没有归属的灯杆使用默认配置
//            config = getById(15);
//        }
        if (config == null) {
            throw new BusinessException("用户未配置支付配置,请配置后重试");
        }
        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));
        if (config == null) {
            throw new BusinessException("未找到支付配置或配置未启用,请联系管理员!");
        }
//        if (pole.getClientId() == null) {
        //没有归属的灯杆使用默认配置
//            config = getById(15);
//        }
        return config;
    }
@@ -63,12 +82,12 @@
        config.setAppid(configParam.getAppId());
        config.setAppappid(configParam.getAppAppId());
        if (SecurityUtils.getClientId() != null) {
            config.setCreateUserId(SecurityUtils.getUserId());
            if (clientService.findClientId()) {
                config.setClientId(clientService.getClientId());
            } else {
                config.setClientId(SecurityUtils.getUserId());
            }
            config.setCreateUserId(SecurityUtils.getUserId());
        } else {
            config.setClientId(SecurityUtils.getUserId());
            config.setCreateUserId(SecurityUtils.getUserId());
@@ -145,6 +164,7 @@
                    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;