mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-08 21:26:40 +08:00
update SystemConfigService; update other config
This commit is contained in:
parent
12a4aae299
commit
60971d1cad
@ -111,12 +111,12 @@ public class CommonConst {
|
|||||||
/**
|
/**
|
||||||
* 公用读取文件夹 public
|
* 公用读取文件夹 public
|
||||||
*/
|
*/
|
||||||
public static final String FOLDER_PUBLIC = "xmf-crm/pu";
|
public static final String FOLDER_PUBLIC = "pu";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 私有读取文件夹 private
|
* 私有读取文件夹 private
|
||||||
*/
|
*/
|
||||||
public static final String FOLDER_PRIVATE = "xmf-crm/pr";
|
public static final String FOLDER_PRIVATE = "pr";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件夹格式
|
* 文件夹格式
|
||||||
|
@ -26,43 +26,13 @@ import java.time.format.DateTimeParseException;
|
|||||||
public class DateConfig {
|
public class DateConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public LocalDateTimeSerializer localDateTimeSerializer() {
|
public Jackson2ObjectMapperBuilderCustomizer customizer() {
|
||||||
return new LocalDateTimeSerializer(SmartDateFormatterEnum.YMD_HMS.getFormatter());
|
return builder -> {
|
||||||
}
|
builder.deserializers(new LocalDateDeserializer(SmartDateFormatterEnum.YMD.getFormatter()));
|
||||||
|
builder.deserializers(new LocalDateTimeDeserializer(SmartDateFormatterEnum.YMD_HMS.getFormatter()));
|
||||||
@Bean
|
builder.serializers(new LocalDateSerializer(SmartDateFormatterEnum.YMD.getFormatter()));
|
||||||
public Jackson2ObjectMapperBuilderCustomizer localDateTimeSerializerCustomizer() {
|
builder.serializers(new LocalDateTimeSerializer(SmartDateFormatterEnum.YMD_HMS.getFormatter()));
|
||||||
return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeSerializer());
|
};
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public LocalDateTimeDeserializer localDateTimeDeserializer() {
|
|
||||||
return new LocalDateTimeDeserializer(SmartDateFormatterEnum.YMD_HMS.getFormatter());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Jackson2ObjectMapperBuilderCustomizer localDateTimeDeserializerCustomizer() {
|
|
||||||
return builder -> builder.deserializerByType(LocalDateTime.class, localDateTimeDeserializer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public LocalDateSerializer localDateSerializer() {
|
|
||||||
return new LocalDateSerializer(SmartDateFormatterEnum.YMD.getFormatter());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Jackson2ObjectMapperBuilderCustomizer localDateSerializerCustomizer() {
|
|
||||||
return builder -> builder.serializerByType(LocalDate.class, localDateSerializer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public LocalDateDeserializer localDateDeserializer() {
|
|
||||||
return new LocalDateDeserializer(SmartDateFormatterEnum.YMD.getFormatter());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Jackson2ObjectMapperBuilderCustomizer localDateDeserializerCustomizer() {
|
|
||||||
return builder -> builder.deserializerByType(LocalDate.class, localDateDeserializer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
package net.lab1024.smartadmin.service.config;
|
||||||
|
|
||||||
|
import com.amazonaws.ClientConfiguration;
|
||||||
|
import com.amazonaws.Protocol;
|
||||||
|
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||||
|
import com.amazonaws.auth.BasicAWSCredentials;
|
||||||
|
import com.amazonaws.client.builder.AwsClientBuilder;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnProperty(prefix = "file.storage", name = {"mode"}, havingValue = "cloud")
|
||||||
|
public class SmartStorageCloudConfig {
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.region}")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.endpoint}")
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.bucket-name}")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.access-key}")
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.secret-key}")
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.url.expire}")
|
||||||
|
private Long urlExpire;
|
||||||
|
|
||||||
|
@Value("${file.storage.cloud.url.public}")
|
||||||
|
private String publicUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化 云oss client 配置
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public AmazonS3 initAmazonS3() {
|
||||||
|
ClientConfiguration clientConfig = new ClientConfiguration();
|
||||||
|
clientConfig.setProtocol(Protocol.HTTPS);
|
||||||
|
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
|
||||||
|
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
|
||||||
|
.withClientConfiguration(clientConfig)
|
||||||
|
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region))
|
||||||
|
.withPathStyleAccessEnabled(false)
|
||||||
|
.build();
|
||||||
|
return s3Client;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,14 +11,7 @@ import net.lab1024.smartadmin.service.common.constant.CommonConst;
|
|||||||
*/
|
*/
|
||||||
public enum FileFolderTypeEnum implements BaseEnum {
|
public enum FileFolderTypeEnum implements BaseEnum {
|
||||||
|
|
||||||
COMMON(1, CommonConst.FileFolderConst.FOLDER_PUBLIC + "/common/", "通用"),
|
COMMON(1, CommonConst.FileServiceConst.FOLDER_PUBLIC + "/common/", "通用"),
|
||||||
|
|
||||||
/**
|
|
||||||
* folder 后续添加斜杠
|
|
||||||
*/
|
|
||||||
ERP_STOCK(301, CommonConst.FileFolderConst.FOLDER_PUBLIC + "/help/", "erp货物"),
|
|
||||||
|
|
||||||
ERP_CUSTOMER(302, CommonConst.FileFolderConst.FOLDER_PUBLIC + "/news/", "erp客商"),
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import net.lab1024.smartadmin.service.common.codeconst.FileResponseCodeConst;
|
|||||||
import net.lab1024.smartadmin.service.common.codeconst.ResponseCodeConst;
|
import net.lab1024.smartadmin.service.common.codeconst.ResponseCodeConst;
|
||||||
import net.lab1024.smartadmin.service.common.constant.CommonConst;
|
import net.lab1024.smartadmin.service.common.constant.CommonConst;
|
||||||
import net.lab1024.smartadmin.service.common.domain.ResponseDTO;
|
import net.lab1024.smartadmin.service.common.domain.ResponseDTO;
|
||||||
|
import net.lab1024.smartadmin.service.config.SmartStorageCloudConfig;
|
||||||
import net.lab1024.smartadmin.service.module.support.file.domain.dto.FileDownloadDTO;
|
import net.lab1024.smartadmin.service.module.support.file.domain.dto.FileDownloadDTO;
|
||||||
import net.lab1024.smartadmin.service.module.support.file.domain.dto.FileMetadataDTO;
|
import net.lab1024.smartadmin.service.module.support.file.domain.dto.FileMetadataDTO;
|
||||||
import net.lab1024.smartadmin.service.module.support.file.domain.vo.FileUploadVO;
|
import net.lab1024.smartadmin.service.module.support.file.domain.vo.FileUploadVO;
|
||||||
@ -120,7 +121,7 @@ public class FileStorageCloudServiceImpl implements IFileStorageService {
|
|||||||
if (StringUtils.isBlank(fileKey)) {
|
if (StringUtils.isBlank(fileKey)) {
|
||||||
return ResponseDTO.wrap(ResponseCodeConst.ERROR_PARAM);
|
return ResponseDTO.wrap(ResponseCodeConst.ERROR_PARAM);
|
||||||
}
|
}
|
||||||
if (!fileKey.startsWith(CommonConst.FileFolderConst.FOLDER_PRIVATE)) {
|
if (!fileKey.startsWith(CommonConst.FileServiceConst.FOLDER_PRIVATE)) {
|
||||||
// 不是私有的 都公共读
|
// 不是私有的 都公共读
|
||||||
return ResponseDTO.succData(cloudConfig.getPublicUrl() + fileKey);
|
return ResponseDTO.succData(cloudConfig.getPublicUrl() + fileKey);
|
||||||
}
|
}
|
||||||
@ -182,7 +183,7 @@ public class FileStorageCloudServiceImpl implements IFileStorageService {
|
|||||||
*/
|
*/
|
||||||
private CannedAccessControlList getACL(String fileKey) {
|
private CannedAccessControlList getACL(String fileKey) {
|
||||||
// 公用读
|
// 公用读
|
||||||
if (fileKey.contains(CommonConst.FileFolderConst.FOLDER_PUBLIC)) {
|
if (fileKey.contains(CommonConst.FileServiceConst.FOLDER_PUBLIC)) {
|
||||||
return CannedAccessControlList.PublicRead;
|
return CannedAccessControlList.PublicRead;
|
||||||
}
|
}
|
||||||
// 其他默认私有读写
|
// 其他默认私有读写
|
||||||
|
@ -5,7 +5,7 @@ import net.lab1024.smartadmin.service.common.codeconst.FileResponseCodeConst;
|
|||||||
import net.lab1024.smartadmin.service.common.domain.ResponseDTO;
|
import net.lab1024.smartadmin.service.common.domain.ResponseDTO;
|
||||||
import net.lab1024.smartadmin.service.module.support.file.domain.dto.FileDownloadDTO;
|
import net.lab1024.smartadmin.service.module.support.file.domain.dto.FileDownloadDTO;
|
||||||
import net.lab1024.smartadmin.service.module.support.file.domain.vo.FileUploadVO;
|
import net.lab1024.smartadmin.service.module.support.file.domain.vo.FileUploadVO;
|
||||||
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigConst;
|
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigKeyEnum;
|
||||||
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigService;
|
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigService;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -82,7 +82,7 @@ public class FileStorageLocalServiceImpl implements IFileStorageService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String generateFileUrl(String fileKey) {
|
public String generateFileUrl(String fileKey) {
|
||||||
String configValue = systemConfigService.getConfigValue(SystemConfigConst.Key.LOCAL_UPLOAD_URL_PREFIX);
|
String configValue = systemConfigService.getConfigValue(SystemConfigKeyEnum.LOCAL_UPLOAD_URL_PREFIX);
|
||||||
String fileUrl = configValue + fileKey;
|
String fileUrl = configValue + fileKey;
|
||||||
return fileUrl;
|
return fileUrl;
|
||||||
}
|
}
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
package net.lab1024.smartadmin.service.module.support.systemconfig;
|
|
||||||
|
|
||||||
import net.lab1024.smartadmin.service.common.constant.BaseEnum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [ 系统配置常量类 ]
|
|
||||||
*
|
|
||||||
* @author 罗伊
|
|
||||||
* @version 1.0
|
|
||||||
* @date
|
|
||||||
* @since JDK1.8
|
|
||||||
*/
|
|
||||||
public class SystemConfigConst {
|
|
||||||
|
|
||||||
|
|
||||||
public enum Key implements BaseEnum {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 超管id
|
|
||||||
*/
|
|
||||||
EMPLOYEE_SUPERMAN("employee_superman", "超管id"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 本地上传路径前缀
|
|
||||||
*/
|
|
||||||
LOCAL_UPLOAD_URL_PREFIX("local_upload_url_prefix", "本地上传路径前缀"),
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String val;
|
|
||||||
|
|
||||||
private final String desc;
|
|
||||||
|
|
||||||
Key(String val, String desc) {
|
|
||||||
this.val = val;
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getValue() {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Group implements BaseEnum {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* system 默认系统
|
|
||||||
*/
|
|
||||||
SYSTEM("system", "默认系统"),
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String val;
|
|
||||||
|
|
||||||
private final String desc;
|
|
||||||
|
|
||||||
Group(String val, String desc) {
|
|
||||||
this.val = val;
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getValue() {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,34 @@
|
|||||||
|
package net.lab1024.smartadmin.service.module.support.systemconfig;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.lab1024.smartadmin.service.common.constant.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [ 系统配置常量类 ]
|
||||||
|
*
|
||||||
|
* @author 罗伊
|
||||||
|
* @version 1.0
|
||||||
|
* @date
|
||||||
|
* @since JDK1.8
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum SystemConfigKeyEnum implements BaseEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超管id
|
||||||
|
*/
|
||||||
|
EMPLOYEE_SUPERMAN("employee_superman", "超管id"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地上传路径前缀
|
||||||
|
*/
|
||||||
|
LOCAL_UPLOAD_URL_PREFIX("local_upload_url_prefix", "本地上传路径前缀"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
private final String desc;
|
||||||
|
}
|
@ -24,8 +24,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
/**
|
/**
|
||||||
* 系统配置业务类
|
* 系统配置业务类
|
||||||
*
|
*
|
||||||
* @author 1024lab
|
* @author huke
|
||||||
* @date 2017-12-23 15:09
|
* @date 2021年9月23日 20:49:13
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -54,7 +54,7 @@ public class SystemConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化系统设置缓存
|
* 刷新系统设置缓存
|
||||||
*/
|
*/
|
||||||
private void refreshConfigCache(Long configId) {
|
private void refreshConfigCache(Long configId) {
|
||||||
Optional<SystemConfigEntity> optional = this.CONFIG_CACHE.values().stream().filter(e -> Objects.equals(configId, e.getConfigId())).findFirst();
|
Optional<SystemConfigEntity> optional = this.CONFIG_CACHE.values().stream().filter(e -> Objects.equals(configId, e.getConfigId())).findFirst();
|
||||||
@ -88,7 +88,7 @@ public class SystemConfigService {
|
|||||||
* @param configKey
|
* @param configKey
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public SystemConfigDTO getConfig(SystemConfigConst.Key configKey) {
|
public SystemConfigDTO getConfig(SystemConfigKeyEnum configKey) {
|
||||||
return this.getConfig(configKey.getValue());
|
return this.getConfig(configKey.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,12 +99,11 @@ public class SystemConfigService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public SystemConfigDTO getConfig(String configKey) {
|
public SystemConfigDTO getConfig(String configKey) {
|
||||||
boolean check = SmartBaseEnumUtil.checkEnum(configKey, SystemConfigConst.Key.class);
|
boolean check = SmartBaseEnumUtil.checkEnum(configKey, SystemConfigKeyEnum.class);
|
||||||
Assert.isTrue(check, "config key error");
|
Assert.isTrue(check, "config key error");
|
||||||
|
|
||||||
SystemConfigEntity entity = this.CONFIG_CACHE.get(configKey);
|
SystemConfigEntity entity = this.CONFIG_CACHE.get(configKey);
|
||||||
Assert.notNull(entity, "缺少系统配置[" + configKey + "]");
|
Assert.notNull(entity, "缺少系统配置[" + configKey + "]");
|
||||||
Assert.isTrue(!entity.getDisabledFlag(), "系统配置[" + configKey + "]已被禁用");
|
|
||||||
|
|
||||||
return SmartBeanUtil.copy(entity, SystemConfigDTO.class);
|
return SmartBeanUtil.copy(entity, SystemConfigDTO.class);
|
||||||
}
|
}
|
||||||
@ -115,19 +114,19 @@ public class SystemConfigService {
|
|||||||
* @param configKey
|
* @param configKey
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getConfigValue(SystemConfigConst.Key configKey) {
|
public String getConfigValue(SystemConfigKeyEnum configKey) {
|
||||||
return this.getConfig(configKey).getConfigValue();
|
return this.getConfig(configKey).getConfigValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据参数key获得一条数据 并转换为 对象
|
* 根据参数key查询 并转换为对象
|
||||||
*
|
*
|
||||||
* @param configKey
|
* @param configKey
|
||||||
* @param clazz
|
* @param clazz
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public <T> T getConfigValue2Obj(SystemConfigConst.Key configKey, Class<T> clazz) {
|
public <T> T getConfigValue2Obj(SystemConfigKeyEnum configKey, Class<T> clazz) {
|
||||||
String configValue = this.getConfigValue(configKey);
|
String configValue = this.getConfigValue(configKey);
|
||||||
return JSON.parseObject(configValue, clazz);
|
return JSON.parseObject(configValue, clazz);
|
||||||
}
|
}
|
||||||
@ -140,11 +139,10 @@ public class SystemConfigService {
|
|||||||
*/
|
*/
|
||||||
public ResponseDTO<String> add(SystemConfigAddDTO configAddDTO) {
|
public ResponseDTO<String> add(SystemConfigAddDTO configAddDTO) {
|
||||||
SystemConfigEntity entity = systemConfigDao.selectByKey(configAddDTO.getConfigKey());
|
SystemConfigEntity entity = systemConfigDao.selectByKey(configAddDTO.getConfigKey());
|
||||||
if (entity != null) {
|
if (null != entity) {
|
||||||
return ResponseDTO.wrap(ResponseCodeConst.ALREADY_EXIST);
|
return ResponseDTO.wrap(ResponseCodeConst.ALREADY_EXIST);
|
||||||
}
|
}
|
||||||
entity = SmartBeanUtil.copy(configAddDTO, SystemConfigEntity.class);
|
entity = SmartBeanUtil.copy(configAddDTO, SystemConfigEntity.class);
|
||||||
entity.setDisabledFlag(true);
|
|
||||||
systemConfigDao.insert(entity);
|
systemConfigDao.insert(entity);
|
||||||
|
|
||||||
// 刷新缓存
|
// 刷新缓存
|
||||||
@ -185,7 +183,7 @@ public class SystemConfigService {
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ResponseDTO<String> updateValueByKey(SystemConfigConst.Key key, String value) {
|
public ResponseDTO<String> updateValueByKey(SystemConfigKeyEnum key, String value) {
|
||||||
SystemConfigDTO config = this.getConfig(key);
|
SystemConfigDTO config = this.getConfig(key);
|
||||||
if (null == config) {
|
if (null == config) {
|
||||||
return ResponseDTO.wrap(ResponseCodeConst.NOT_EXISTS);
|
return ResponseDTO.wrap(ResponseCodeConst.NOT_EXISTS);
|
||||||
|
@ -33,11 +33,6 @@ public class SystemConfigAddDTO {
|
|||||||
@Length(max = 255, message = "参数名称最多255个字符")
|
@Length(max = 255, message = "参数名称最多255个字符")
|
||||||
private String configName;
|
private String configName;
|
||||||
|
|
||||||
@ApiModelProperty("参数类别")
|
|
||||||
@NotBlank(message = "参数类别不能为空")
|
|
||||||
@Length(max = 255, message = "参数类别最多255个字符")
|
|
||||||
private String configGroup;
|
|
||||||
|
|
||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
@Length(max = 255, message = "备注最多255个字符")
|
@Length(max = 255, message = "备注最多255个字符")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
@ -6,11 +6,8 @@ import lombok.Data;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [ ]
|
|
||||||
*
|
|
||||||
* @author 罗伊
|
* @author 罗伊
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*
|
|
||||||
* @date
|
* @date
|
||||||
* @since JDK1.8
|
* @since JDK1.8
|
||||||
*/
|
*/
|
||||||
@ -29,12 +26,6 @@ public class SystemConfigDTO {
|
|||||||
@ApiModelProperty("参数名称")
|
@ApiModelProperty("参数名称")
|
||||||
private String configName;
|
private String configName;
|
||||||
|
|
||||||
@ApiModelProperty("参数类别")
|
|
||||||
private String configGroup;
|
|
||||||
|
|
||||||
@ApiModelProperty("是否禁用")
|
|
||||||
private Boolean disabledFlag;
|
|
||||||
|
|
||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@ -35,16 +35,6 @@ public class SystemConfigEntity {
|
|||||||
*/
|
*/
|
||||||
private String configName;
|
private String configName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数类别
|
|
||||||
*/
|
|
||||||
private String configGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否禁用
|
|
||||||
*/
|
|
||||||
private Boolean disabledFlag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package net.lab1024.smartadmin.service.module.support.systemconfig.domain;
|
package net.lab1024.smartadmin.service.module.support.systemconfig.domain;
|
||||||
|
|
||||||
import net.lab1024.smartadmin.service.common.domain.PageBaseDTO;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.lab1024.smartadmin.service.common.domain.PageBaseDTO;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询 系统配置
|
* 分页查询 系统配置
|
||||||
*
|
*
|
||||||
* @author 罗伊
|
* @author 罗伊
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*
|
|
||||||
* @date
|
* @date
|
||||||
* @since JDK1.8
|
* @since JDK1.8
|
||||||
*/
|
*/
|
||||||
@ -17,8 +17,6 @@ import lombok.Data;
|
|||||||
public class SystemConfigQueryDTO extends PageBaseDTO {
|
public class SystemConfigQueryDTO extends PageBaseDTO {
|
||||||
|
|
||||||
@ApiModelProperty("参数KEY")
|
@ApiModelProperty("参数KEY")
|
||||||
|
@Length(max = 50, message = "参数Key最多50字符")
|
||||||
private String configKey;
|
private String configKey;
|
||||||
|
|
||||||
@ApiModelProperty("参数类别")
|
|
||||||
private String configGroup;
|
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,13 @@
|
|||||||
package net.lab1024.smartadmin.service.module.support.systemconfig.domain;
|
package net.lab1024.smartadmin.service.module.support.systemconfig.domain;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [ ]
|
* 系统配置 vo
|
||||||
*
|
*
|
||||||
* @author 罗伊
|
* @author huke
|
||||||
* @version 1.0
|
|
||||||
*
|
|
||||||
* @date
|
|
||||||
* @since JDK1.8
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SystemConfigVO {
|
public class SystemConfigVO extends SystemConfigDTO {
|
||||||
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
private Long configId;
|
|
||||||
|
|
||||||
@ApiModelProperty("参数key")
|
|
||||||
private String configKey;
|
|
||||||
|
|
||||||
@ApiModelProperty("参数的值")
|
|
||||||
private String configValue;
|
|
||||||
|
|
||||||
@ApiModelProperty("参数名称")
|
|
||||||
private String configName;
|
|
||||||
|
|
||||||
@ApiModelProperty("参数分组")
|
|
||||||
private String configGroup;
|
|
||||||
|
|
||||||
@ApiModelProperty("是否禁用")
|
|
||||||
private Boolean disabledFlag;
|
|
||||||
|
|
||||||
@ApiModelProperty("备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@ApiModelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@ApiModelProperty("上次修改时间")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.lab1024.smartadmin.service.module.system.menu;
|
package net.lab1024.smartadmin.service.module.system.menu;
|
||||||
|
|
||||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
||||||
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigConst;
|
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigKeyEnum;
|
||||||
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigService;
|
import net.lab1024.smartadmin.service.module.support.systemconfig.SystemConfigService;
|
||||||
import net.lab1024.smartadmin.service.module.system.employee.EmployeeService;
|
import net.lab1024.smartadmin.service.module.system.employee.EmployeeService;
|
||||||
import net.lab1024.smartadmin.service.module.system.login.domain.EmployeeLoginInfoDTO;
|
import net.lab1024.smartadmin.service.module.system.login.domain.EmployeeLoginInfoDTO;
|
||||||
@ -102,7 +102,7 @@ public class MenuEmployeeService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean isSuperman(Long employeeId) {
|
public Boolean isSuperman(Long employeeId) {
|
||||||
String systemConfigValue = systemConfigService.getConfigValue(SystemConfigConst.Key.EMPLOYEE_SUPERMAN);
|
String systemConfigValue = systemConfigService.getConfigValue(SystemConfigKeyEnum.EMPLOYEE_SUPERMAN);
|
||||||
List<Long> superManIdsList = SmartStringUtil.splitConverToLongList(systemConfigValue, ",");
|
List<Long> superManIdsList = SmartStringUtil.splitConverToLongList(systemConfigValue, ",");
|
||||||
return superManIdsList.contains(employeeId);
|
return superManIdsList.contains(employeeId);
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@
|
|||||||
<if test="query.configKey != null and query.configKey != ''">
|
<if test="query.configKey != null and query.configKey != ''">
|
||||||
AND INSTR(config_key,#{query.configKey})
|
AND INSTR(config_key,#{query.configKey})
|
||||||
</if>
|
</if>
|
||||||
<if test="query.configGroup != null">
|
|
||||||
AND config_group = #{query.configGroup}
|
|
||||||
</if>
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user