Search in sources :

Example 1 with Config

use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.

the class SettingController method emailSetting.

@GetMapping("/emailSetting")
@PreAuthorize("@permissionService.hasPermission('system:setting:emailSetting:query')")
public AjaxResult emailSetting() {
    Config config = configService.selectConfigByKey(ConfigKey.CONFIG_KEY_EMAIL_SETTING);
    // convert to site setting
    if (config != null) {
        EmailSetting emailSetting = JSON.parseObject(config.getConfigValue(), EmailSetting.class);
        emailSetting.setPassword("*************************");
        return AjaxResult.success(emailSetting);
    }
    return AjaxResult.success(new EmailSetting());
}
Also used : Config(com.dimple.project.system.domain.Config) EmailSetting(com.dimple.project.system.domain.EmailSetting) GetMapping(org.springframework.web.bind.annotation.GetMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 2 with Config

use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.

the class SettingController method editSiteSetting.

@PutMapping("siteSetting")
@PreAuthorize("@permissionService.hasPermission('system:setting:siteSetting:edit')")
@Log(title = "系统设置-网站设置", businessType = BusinessType.UPDATE)
public AjaxResult editSiteSetting(@RequestBody SiteSetting siteSetting) {
    String jsonString = JSON.toJSONString(siteSetting);
    Config config = new Config();
    config.setConfigKey(ConfigKey.CONFIG_KEY_SITE_SETTING);
    config.setConfigValue(jsonString);
    return AjaxResult.success(configService.updateConfigByConfigKey(config));
}
Also used : Config(com.dimple.project.system.domain.Config) Log(com.dimple.framework.aspectj.lang.annotation.Log) PutMapping(org.springframework.web.bind.annotation.PutMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 3 with Config

use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.

the class QiNiuServiceImpl method updateQiNiuConfig.

@Override
public int updateQiNiuConfig(QiNiuConfig qiNiuConfig) {
    String qiNiuConfigString = JSON.toJSONString(qiNiuConfig);
    Config config = new Config();
    config.setConfigKey(ConfigKey.CONFIG_KEY_QI_NIU);
    config.setConfigValue(qiNiuConfigString);
    config.setUpdateBy(SecurityUtils.getUsername());
    return configService.updateConfigByConfigKey(config);
}
Also used : Config(com.dimple.project.system.domain.Config) QiNiuConfig(com.dimple.project.common.domain.QiNiuConfig)

Example 4 with Config

use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.

the class QiNiuServiceImpl method getQiNiuConfig.

@Override
public QiNiuConfig getQiNiuConfig() {
    Config config = configService.selectConfigByKey(ConfigKey.CONFIG_KEY_QI_NIU);
    // 七牛云Config的配置Json
    String configValue = config.getConfigValue();
    if (StringUtils.isEmpty(configValue)) {
        return new QiNiuConfig();
    }
    return JSON.parseObject(configValue, QiNiuConfig.class);
}
Also used : Config(com.dimple.project.system.domain.Config) QiNiuConfig(com.dimple.project.common.domain.QiNiuConfig) QiNiuConfig(com.dimple.project.common.domain.QiNiuConfig)

Example 5 with Config

use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.

the class ConfigServiceImpl method checkConfigKeyUnique.

@Override
public String checkConfigKeyUnique(Config config) {
    Long id = StringUtils.isNull(config.getId()) ? -1L : config.getId();
    Config info = configMapper.checkConfigKeyUnique(config.getConfigKey());
    if (StringUtils.isNotNull(info) && info.getId().longValue() != id.longValue()) {
        return UserConstants.NOT_UNIQUE;
    }
    return UserConstants.UNIQUE;
}
Also used : Config(com.dimple.project.system.domain.Config)

Aggregations

Config (com.dimple.project.system.domain.Config)10 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 Log (com.dimple.framework.aspectj.lang.annotation.Log)3 PutMapping (org.springframework.web.bind.annotation.PutMapping)3 QiNiuConfig (com.dimple.project.common.domain.QiNiuConfig)2 CustomException (com.dimple.common.exception.CustomException)1 CacheExpire (com.dimple.framework.config.redis.CacheExpire)1 EmailSetting (com.dimple.project.system.domain.EmailSetting)1 Cacheable (org.springframework.cache.annotation.Cacheable)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1