Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
690dffa779 | ||
|
|
3ccbd6cd8e |
18
pom.xml
18
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -58,49 +58,49 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-role</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-role</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.14</version>
|
||||
<version>2.0.15</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
@@ -4,13 +4,11 @@ package com.tiesheng.web.controller.system;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import com.tiesheng.util.pojos.PageDTO;
|
||||
import com.tiesheng.web.pojos.dao.CoreConfigSystem;
|
||||
import com.tiesheng.web.pojos.dto.config.ConfigSystemDTO;
|
||||
import com.tiesheng.web.service.CoreConfigService;
|
||||
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -26,8 +24,6 @@ public class ConfigSystemController {
|
||||
|
||||
@Autowired
|
||||
CoreConfigService coreConfigService;
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
|
||||
|
||||
/**
|
||||
@@ -57,21 +53,7 @@ public class ConfigSystemController {
|
||||
*/
|
||||
@PostMapping("/system/update")
|
||||
public ApiResp<String> systemUpdate(@RequestBody ConfigSystemDTO dto) {
|
||||
|
||||
CoreConfigSystem configKey = coreConfigService.getOneByColumn("config_key", dto.getConfigKey());
|
||||
if (configKey == null) {
|
||||
throw new ApiException("该配置不存在,请检查");
|
||||
}
|
||||
if (configKey.getReadOnly() == 1) {
|
||||
throw new ApiException("该配置只读,不可修改");
|
||||
}
|
||||
configKey.setConfigVal(dto.getConfigVal());
|
||||
configKey.setRemark(dto.getRemark());
|
||||
configKey.setExtra(dto.getExtra());
|
||||
|
||||
tieshengWebConfigurer.configSystemCheck(configKey);
|
||||
coreConfigService.updateById(configKey);
|
||||
|
||||
coreConfigService.updateConfigSystem(dto);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.tiesheng.web.service;
|
||||
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.service.TsCacheService;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
import com.tiesheng.web.mapper.CoreConfigEnumMapper;
|
||||
import com.tiesheng.web.mapper.CoreConfigSystemMapper;
|
||||
import com.tiesheng.web.pojos.dao.CoreConfigSystem;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
import com.tiesheng.web.pojos.dto.config.ConfigSystemDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@@ -15,6 +20,12 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
|
||||
|
||||
@Autowired
|
||||
CoreConfigEnumMapper coreConfigEnumMapper;
|
||||
@Resource
|
||||
TsCacheService tsCacheService;
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
|
||||
private static final String CONFIG_SYSTEM_PREFIX = "CONFIG:SYSTEM:";
|
||||
|
||||
public CoreConfigEnumMapper getEnumMapper() {
|
||||
return coreConfigEnumMapper;
|
||||
@@ -28,7 +39,14 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
|
||||
* @return
|
||||
*/
|
||||
public CoreConfigSystem getTextOrCreate(String configKey, String defaultValue) {
|
||||
CoreConfigSystem oneByColumn = getOneByColumn("config_key", configKey);
|
||||
CoreConfigSystem oneByColumn = tsCacheService.getObj(CONFIG_SYSTEM_PREFIX + configKey,
|
||||
CoreConfigSystem.class, -1);
|
||||
|
||||
if (oneByColumn != null) {
|
||||
return oneByColumn;
|
||||
}
|
||||
|
||||
oneByColumn = getOneByColumn("config_key", configKey);
|
||||
if (oneByColumn == null) {
|
||||
oneByColumn = new CoreConfigSystem();
|
||||
oneByColumn.setId(configKey);
|
||||
@@ -38,7 +56,35 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
|
||||
oneByColumn.setConfigType(0);
|
||||
save(oneByColumn);
|
||||
}
|
||||
|
||||
tsCacheService.putObj(CONFIG_SYSTEM_PREFIX + configKey, oneByColumn, 10 * 60);
|
||||
|
||||
return oneByColumn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
public void updateConfigSystem(ConfigSystemDTO dto) {
|
||||
CoreConfigSystem configKey = getOneByColumn("config_key", dto.getConfigKey());
|
||||
if (configKey == null) {
|
||||
throw new ApiException("该配置不存在,请检查");
|
||||
}
|
||||
if (configKey.getReadOnly() == 1) {
|
||||
throw new ApiException("该配置只读,不可修改");
|
||||
}
|
||||
configKey.setConfigVal(dto.getConfigVal());
|
||||
configKey.setRemark(dto.getRemark());
|
||||
configKey.setExtra(dto.getExtra());
|
||||
|
||||
tieshengWebConfigurer.configSystemCheck(configKey);
|
||||
updateById(configKey);
|
||||
|
||||
tsCacheService.putObj(CONFIG_SYSTEM_PREFIX + configKey, configKey, 10 * 60);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user