mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
Jeecg-Boot 2.1.2版本发布
This commit is contained in:
@ -3,12 +3,12 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-boot-module-system</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
|
||||
@ -1,35 +1,55 @@
|
||||
package org.jeecg;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@Slf4j
|
||||
@EnableSwagger2
|
||||
@SpringBootApplication
|
||||
@EnableAutoConfiguration
|
||||
public class JeecgApplication {
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
||||
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||
"swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
|
||||
"Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
//System.setProperty("spring.devtools.restart.enabled", "true");
|
||||
|
||||
}
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
||||
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||
"swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
|
||||
"Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tomcat-embed-jasper引用后提示jar找不到的问题
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
return new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -116,10 +116,13 @@ public class ShiroConfig {
|
||||
//测试示例
|
||||
filterChainDefinitionMap.put("/test/jeecgDemo/html", "anon"); //模板页面
|
||||
filterChainDefinitionMap.put("/test/jeecgDemo/redis/**", "anon"); //redis测试
|
||||
|
||||
|
||||
//排除Online请求
|
||||
filterChainDefinitionMap.put("/auto/cgform/**", "anon");
|
||||
|
||||
//websocket排除
|
||||
filterChainDefinitionMap.put("/websocket/**", "anon");
|
||||
|
||||
|
||||
// 添加自己的过滤器并且取名为jwt
|
||||
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
|
||||
filterMap.put("jwt", new JwtFilter());
|
||||
@ -205,7 +208,9 @@ public class ShiroConfig {
|
||||
public RedisManager redisManager() {
|
||||
log.info("===============(2)创建RedisManager,连接Redis..URL= " + host + ":" + port);
|
||||
RedisManager redisManager = new RedisManager();
|
||||
redisManager.setHost(host + ":" + port);//老版本是分别setHost和setPort,新版本只需要setHost就可以了
|
||||
redisManager.setHost(host);
|
||||
redisManager.setPort(oConvertUtils.getInt(port));
|
||||
redisManager.setTimeout(0);
|
||||
if (!StringUtils.isEmpty(redisPassword)) {
|
||||
redisManager.setPassword(redisPassword);
|
||||
}
|
||||
|
||||
@ -136,35 +136,23 @@ public class MybatisInterceptor implements Interceptor {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
if ("updateBy".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_updateBy = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_updateBy == null || local_updateBy.equals("")) {
|
||||
String updateBy = "jeecg";
|
||||
// 获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
updateBy = sysUser.getUsername();
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(updateBy)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, updateBy);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
//获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
String updateBy = sysUser.getUsername();
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, updateBy);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
if ("updateTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_updateDate = field.get(parameter);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
if (local_updateDate == null || local_updateDate.equals("")) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
import org.jeecg.config.oss.OSSAutoConfiguration.OSSConfigurationImportSelector;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.ImportSelector;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
|
||||
/**
|
||||
* Object Storage Service auto configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(OSSProperties.class)
|
||||
@Import(OSSConfigurationImportSelector.class)
|
||||
public class OSSAutoConfiguration {
|
||||
|
||||
/**
|
||||
* {@link ImportSelector} to add {@link OSSType} configuration classes.
|
||||
*/
|
||||
static class OSSConfigurationImportSelector implements ImportSelector {
|
||||
|
||||
@Override
|
||||
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
|
||||
OSSType[] types = OSSType.values();
|
||||
String[] imports = new String[types.length];
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
imports[i] = OSSConfigurations.getConfigurationClass(types[i]);
|
||||
}
|
||||
return imports;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
|
||||
import org.springframework.boot.context.properties.bind.BindException;
|
||||
import org.springframework.boot.context.properties.bind.BindResult;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.core.type.ClassMetadata;
|
||||
|
||||
/**
|
||||
* General OSS condition used with all OSS configuration classes.
|
||||
*/
|
||||
public class OSSCondition extends SpringBootCondition {
|
||||
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
String sourceClass = "";
|
||||
if (metadata instanceof ClassMetadata) {
|
||||
sourceClass = ((ClassMetadata) metadata).getClassName();
|
||||
}
|
||||
ConditionMessage.Builder message = ConditionMessage.forCondition("OSS", sourceClass);
|
||||
Environment environment = context.getEnvironment();
|
||||
try {
|
||||
BindResult<OSSType> specified = Binder.get(environment).bind("oss.type", OSSType.class);
|
||||
if (!specified.isBound()) {
|
||||
return ConditionOutcome.match(message.because("automatic OSS type"));
|
||||
}
|
||||
OSSType required = OSSConfigurations.getType(((AnnotationMetadata) metadata).getClassName());
|
||||
if (specified.get() == required) {
|
||||
return ConditionOutcome.match(message.because(specified.get() + " OSS type"));
|
||||
}
|
||||
}
|
||||
catch (BindException ex) {
|
||||
}
|
||||
return ConditionOutcome.noMatch(message.because("unknown OSS type"));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jeecg.config.oss.aliyun.AliYunOSSAutoConfiguration;
|
||||
import org.jeecg.config.oss.tencent.QcCOSAutoConfiguration;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Mappings between {@link OSSType} and {@code @Configuration}.
|
||||
*/
|
||||
final class OSSConfigurations {
|
||||
|
||||
private static final Map<OSSType, Class<?>> MAPPINGS;
|
||||
|
||||
static {
|
||||
Map<OSSType, Class<?>> mappings = new EnumMap<>(OSSType.class);
|
||||
mappings.put(OSSType.ALIYUN, AliYunOSSAutoConfiguration.class);
|
||||
mappings.put(OSSType.QC, QcCOSAutoConfiguration.class);
|
||||
MAPPINGS = Collections.unmodifiableMap(mappings);
|
||||
}
|
||||
|
||||
private OSSConfigurations() {
|
||||
}
|
||||
|
||||
public static String getConfigurationClass(OSSType ossType) {
|
||||
Class<?> configurationClass = MAPPINGS.get(ossType);
|
||||
Assert.state(configurationClass != null, () -> "Unknown OSS type " + ossType);
|
||||
return configurationClass.getName();
|
||||
}
|
||||
|
||||
public static OSSType getType(String configurationClassName) {
|
||||
for (Map.Entry<OSSType, Class<?>> entry : MAPPINGS.entrySet()) {
|
||||
if (entry.getValue().getName().equals(configurationClassName)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Unknown configuration class " + configurationClassName);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 简单上传,删除对象接口.
|
||||
* 可扩展
|
||||
*/
|
||||
public interface OSSManager {
|
||||
|
||||
void upload(String fileName, InputStream inputStream);
|
||||
|
||||
void delete(String fileName);
|
||||
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Configuration properties for OSS support.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "jeecg.oss")
|
||||
public class OSSProperties {
|
||||
|
||||
/**
|
||||
* OSS type.
|
||||
*/
|
||||
private OSSType type;
|
||||
|
||||
/**
|
||||
* OSS Endpoint.
|
||||
*/
|
||||
private String endpoint;
|
||||
|
||||
/**
|
||||
* OSS Access key.
|
||||
*/
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* OSS Secret key.
|
||||
*/
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* OSS Bucket Name.
|
||||
*/
|
||||
private String bucketName;
|
||||
|
||||
/**
|
||||
* Additional OSS properties.
|
||||
*/
|
||||
private Map<String, String> properties = new HashMap<>();
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
/**
|
||||
* Supported OSS types.
|
||||
*/
|
||||
public enum OSSType {
|
||||
|
||||
ALIYUN, QC
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package org.jeecg.config.oss;
|
||||
|
||||
import org.jeecg.common.util.oss.OssBootUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class OssBootConfiguration {
|
||||
|
||||
@Value("${jeecg.oss.endpoint}")
|
||||
private String endpoint;
|
||||
@Value("${jeecg.oss.accessKey}")
|
||||
private String accessKeyId;
|
||||
@Value("${jeecg.oss.secretKey}")
|
||||
private String accessKeySecret;
|
||||
@Value("${jeecg.oss.bucketName}")
|
||||
private String bucketName;
|
||||
@Value("${jeecg.oss.staticDomain}")
|
||||
private String staticDomain;
|
||||
|
||||
|
||||
@Bean
|
||||
public void initOssBootConfiguration() {
|
||||
OssBootUtil.setEndPoint(endpoint);
|
||||
OssBootUtil.setAccessKeyId(accessKeyId);
|
||||
OssBootUtil.setAccessKeySecret(accessKeySecret);
|
||||
OssBootUtil.setBucketName(bucketName);
|
||||
OssBootUtil.setStaticDomain(staticDomain);
|
||||
}
|
||||
}
|
||||
@ -1,81 +0,0 @@
|
||||
package org.jeecg.config.oss.aliyun;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.aliyun.oss.ClientBuilderConfiguration;
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.common.comm.Protocol;
|
||||
import org.jeecg.config.oss.OSSCondition;
|
||||
import org.jeecg.config.oss.OSSManager;
|
||||
import org.jeecg.config.oss.OSSProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* AliYun OSS configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ OSS.class })
|
||||
@ConditionalOnProperty(prefix = "jeecg.oss", name = "type",havingValue = "aliyun")
|
||||
@Conditional(OSSCondition.class)
|
||||
public class AliYunOSSAutoConfiguration {
|
||||
|
||||
private final OSSProperties properties;
|
||||
|
||||
public AliYunOSSAutoConfiguration(OSSProperties ossProperties) {
|
||||
this.properties = ossProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ClientBuilderConfiguration clientConfiguration(OSSProperties ossProperties) {
|
||||
Properties properties = asProperties(ossProperties.getProperties());
|
||||
ClientBuilderConfiguration configuration = new ClientBuilderConfiguration();
|
||||
configuration.setMaxConnections(Integer.parseInt(properties.getProperty("aliyun.maxConnections", "5")));
|
||||
configuration.setSocketTimeout(Integer.parseInt(properties.getProperty("aliyun.socketTimeout", "50000")));
|
||||
configuration
|
||||
.setConnectionTimeout(Integer.parseInt(properties.getProperty("aliyun.connectionTimeout", "50000")));
|
||||
configuration.setConnectionRequestTimeout(
|
||||
Integer.parseInt(properties.getProperty("aliyun.connectionRequestTimeout", "-1")));
|
||||
configuration
|
||||
.setIdleConnectionTime(Integer.parseInt(properties.getProperty("aliyun.idleConnectionTime", "60000")));
|
||||
configuration.setMaxErrorRetry(Integer.parseInt(properties.getProperty("aliyun.maxErrorRetry", "3")));
|
||||
configuration.setSupportCname(Boolean.parseBoolean(properties.getProperty("aliyun.supportCname", "false")));
|
||||
configuration.setSLDEnabled(Boolean.parseBoolean(properties.getProperty("aliyun.sldEnabled", "false")));
|
||||
configuration.setProtocol(Protocol.HTTP);
|
||||
if (Protocol.HTTPS.toString().equals(properties.getProperty("aliyun.protocol"))) {
|
||||
configuration.setProtocol(Protocol.HTTPS);
|
||||
}
|
||||
if (properties.getProperty("aliyun.userAgent") != null) {
|
||||
configuration.setUserAgent(properties.getProperty("aliyun.userAgent"));
|
||||
}
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
@ConditionalOnMissingBean
|
||||
public OSS ossClient(ClientBuilderConfiguration clientConfiguration) {
|
||||
return new OSSClientBuilder().build(this.properties.getEndpoint(), this.properties.getAccessKey(),
|
||||
this.properties.getSecretKey(), clientConfiguration);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public OSSManager ossManager(OSS ossClient) {
|
||||
return new AliYunOSSManager(ossClient, this.properties);
|
||||
}
|
||||
|
||||
private Properties asProperties(Map<String, String> source) {
|
||||
Properties properties = new Properties();
|
||||
properties.putAll(source);
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package org.jeecg.config.oss.aliyun;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import org.jeecg.config.oss.OSSManager;
|
||||
import org.jeecg.config.oss.OSSProperties;
|
||||
|
||||
/**
|
||||
* Object Storage Service of AliYun.
|
||||
*/
|
||||
public class AliYunOSSManager implements OSSManager {
|
||||
|
||||
private OSS client;
|
||||
|
||||
private OSSProperties properties;
|
||||
|
||||
AliYunOSSManager(OSS client, OSSProperties properties) {
|
||||
this.client = client;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upload(String fileName, InputStream inputStream) {
|
||||
this.client.putObject(this.properties.getBucketName(), fileName, inputStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String fileName) {
|
||||
this.client.deleteObject(this.properties.getBucketName(), fileName);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package org.jeecg.config.oss.tencent;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.qcloud.cos.COS;
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||
import com.qcloud.cos.auth.COSCredentials;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import org.jeecg.config.oss.OSSCondition;
|
||||
import org.jeecg.config.oss.OSSManager;
|
||||
import org.jeecg.config.oss.OSSProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass({ COS.class })
|
||||
@ConditionalOnProperty(prefix = "jeecg.oss", name = "type",havingValue = "qc")
|
||||
@Conditional(OSSCondition.class)
|
||||
public class QcCOSAutoConfiguration {
|
||||
|
||||
private final OSSProperties properties;
|
||||
|
||||
public QcCOSAutoConfiguration(OSSProperties ossProperties) {
|
||||
this.properties = ossProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ClientConfig clientConfiguration(OSSProperties ossProperties) {
|
||||
Properties properties = asProperties(ossProperties.getProperties());
|
||||
ClientConfig configuration = new ClientConfig();
|
||||
configuration.setMaxConnectionsCount(Integer.parseInt(properties.getProperty("qc.maxConnectionsCount", "5")));
|
||||
configuration.setSocketTimeout(Integer.parseInt(properties.getProperty("qc.socketTimeout", "50000")));
|
||||
configuration.setConnectionTimeout(Integer.parseInt(properties.getProperty("qc.connectionTimeout", "50000")));
|
||||
configuration.setConnectionRequestTimeout(
|
||||
Integer.parseInt(properties.getProperty("qc.connectionRequestTimeout", "-1")));
|
||||
configuration.setRegion(new Region(properties.getProperty("qc.region")));
|
||||
if (properties.getProperty("qc.userAgent") != null) {
|
||||
configuration.setUserAgent(properties.getProperty("qc.userAgent"));
|
||||
}
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
@ConditionalOnMissingBean
|
||||
public COS ossClient(ClientConfig clientConfig) {
|
||||
COSCredentials cred = new BasicCOSCredentials(this.properties.getAccessKey(), this.properties.getSecretKey());
|
||||
return new COSClient(cred, clientConfig);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public OSSManager ossManager(COS client) {
|
||||
return new QcCOSManager(client, this.properties);
|
||||
}
|
||||
|
||||
private Properties asProperties(Map<String, String> source) {
|
||||
Properties properties = new Properties();
|
||||
properties.putAll(source);
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
package org.jeecg.config.oss.tencent;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.qcloud.cos.COS;
|
||||
import com.qcloud.cos.model.ObjectMetadata;
|
||||
import org.jeecg.config.oss.OSSManager;
|
||||
import org.jeecg.config.oss.OSSProperties;
|
||||
|
||||
/**
|
||||
* Object Storage Service of Tencent cloud.
|
||||
*/
|
||||
public class QcCOSManager implements OSSManager {
|
||||
|
||||
private COS client;
|
||||
|
||||
private OSSProperties properties;
|
||||
|
||||
QcCOSManager(COS client, OSSProperties properties) {
|
||||
this.client = client;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upload(String fileName, InputStream inputStream) {
|
||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||
objectMetadata.setContentLength(10);
|
||||
objectMetadata.setContentType("application/octet-stream");
|
||||
this.client.putObject(this.properties.getBucketName(),
|
||||
this.properties.getProperties().get("qc.prefix") + "/" + fileName, inputStream, objectMetadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String fileName) {
|
||||
this.client.deleteObject(this.properties.getBucketName(),
|
||||
this.properties.getProperties().get("qc.prefix") + "/" + fileName);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,41 +1,33 @@
|
||||
package org.jeecg.modules.oss.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.config.oss.OSSManager;
|
||||
import org.jeecg.config.oss.OSSProperties;
|
||||
import org.jeecg.common.util.oss.OssBootUtil;
|
||||
import org.jeecg.modules.oss.entity.OSSFile;
|
||||
import org.jeecg.modules.oss.mapper.OSSFileMapper;
|
||||
import org.jeecg.modules.oss.service.IOSSFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Service("ossFileService")
|
||||
public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> implements IOSSFileService {
|
||||
|
||||
@Autowired
|
||||
private OSSManager ossManager;
|
||||
|
||||
@Autowired
|
||||
private OSSProperties properties;
|
||||
|
||||
@Override
|
||||
public void upload(MultipartFile multipartFile) throws IOException {
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setFileName(fileName);
|
||||
ossFile.setUrl("https://" + properties.getBucketName() + "." + properties.getEndpoint() + "/" + fileName);
|
||||
String url = OssBootUtil.upload(multipartFile,"upload/test");
|
||||
ossFile.setUrl(url);
|
||||
this.save(ossFile);
|
||||
ossManager.upload(fileName, multipartFile.getInputStream());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(OSSFile ossFile) {
|
||||
try {
|
||||
this.removeById(ossFile.getId());
|
||||
ossManager.delete(ossFile.getFileName());
|
||||
OssBootUtil.deleteUrl(ossFile.getUrl());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return false;
|
||||
|
||||
@ -14,6 +14,7 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
import org.jeecg.common.system.util.JeecgDataAutorUtils;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.SysPermissionDataRuleModel;
|
||||
import org.jeecg.common.system.vo.SysUserCacheInfo;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
@ -92,12 +93,15 @@ public class PermissionDataAspect {
|
||||
//3.通过用户名+菜单ID 找到权限配置信息 放到request中去
|
||||
if(currentSyspermission!=null && currentSyspermission.size()>0) {
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
List<SysPermissionDataRule> dataRules = new ArrayList<SysPermissionDataRule>();
|
||||
List<SysPermissionDataRuleModel> dataRules = new ArrayList<SysPermissionDataRuleModel>();
|
||||
for (SysPermission sysPermission : currentSyspermission) {
|
||||
// update-begin--Author:scott Date:20191119 for:数据权限规则编码不规范,项目存在相同包名和类名 #722
|
||||
List<SysPermissionDataRule> temp = sysPermissionDataRuleService.queryPermissionDataRules(username, sysPermission.getId());
|
||||
if(temp!=null && temp.size()>0) {
|
||||
dataRules.addAll(temp);
|
||||
//dataRules.addAll(temp);
|
||||
dataRules = oConvertUtils.entityListToModelList(temp,SysPermissionDataRuleModel.class);
|
||||
}
|
||||
// update-end--Author:scott Date:20191119 for:数据权限规则编码不规范,项目存在相同包名和类名 #722
|
||||
}
|
||||
if(dataRules!=null && dataRules.size()>0) {
|
||||
JeecgDataAutorUtils.installDataSearchConditon(request, dataRules);
|
||||
|
||||
@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
@ -117,7 +118,11 @@ public class LoginController {
|
||||
//清空用户登录Token缓存
|
||||
redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
|
||||
//清空用户登录Shiro权限缓存
|
||||
redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());
|
||||
redisUtil.del(CommonConstant.PREFIX_USER_SHIRO_CACHE + sysUser.getId());
|
||||
//清空用户的缓存信息(包括部门信息),例如sys:cache:user::<username>
|
||||
redisUtil.del(String.format("%s::%s", CacheConstant.SYS_USERS_CACHE, sysUser.getUsername()));
|
||||
//调用shiro的logout
|
||||
SecurityUtils.getSubject().logout();
|
||||
return Result.ok("退出登录成功!");
|
||||
}else {
|
||||
return Result.error("Token无效!");
|
||||
|
||||
@ -0,0 +1,213 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.FillRuleUtil;
|
||||
import org.jeecg.modules.system.entity.SysFillRule;
|
||||
import org.jeecg.modules.system.service.ISysFillRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 填值规则
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-11-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "填值规则")
|
||||
@RestController
|
||||
@RequestMapping("/sys/fillRule")
|
||||
public class SysFillRuleController extends JeecgController<SysFillRule, ISysFillRuleService> {
|
||||
@Autowired
|
||||
private ISysFillRuleService sysFillRuleService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysFillRule
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "填值规则-分页列表查询")
|
||||
@ApiOperation(value = "填值规则-分页列表查询", notes = "填值规则-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysFillRule sysFillRule,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysFillRule> queryWrapper = QueryGenerator.initQueryWrapper(sysFillRule, req.getParameterMap());
|
||||
Page<SysFillRule> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SysFillRule> pageList = sysFillRuleService.page(page, queryWrapper);
|
||||
return Result.ok(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 ruleCode
|
||||
*
|
||||
* @param ruleCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/testFillRule")
|
||||
public Result testFillRule(@RequestParam("ruleCode") String ruleCode) {
|
||||
Object result = FillRuleUtil.executeRule(ruleCode, new JSONObject());
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysFillRule
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "填值规则-添加")
|
||||
@ApiOperation(value = "填值规则-添加", notes = "填值规则-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysFillRule sysFillRule) {
|
||||
sysFillRuleService.save(sysFillRule);
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysFillRule
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "填值规则-编辑")
|
||||
@ApiOperation(value = "填值规则-编辑", notes = "填值规则-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody SysFillRule sysFillRule) {
|
||||
sysFillRuleService.updateById(sysFillRule);
|
||||
return Result.ok("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "填值规则-通过id删除")
|
||||
@ApiOperation(value = "填值规则-通过id删除", notes = "填值规则-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysFillRuleService.removeById(id);
|
||||
return Result.ok("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "填值规则-批量删除")
|
||||
@ApiOperation(value = "填值规则-批量删除", notes = "填值规则-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysFillRuleService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.ok("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "填值规则-通过id查询")
|
||||
@ApiOperation(value = "填值规则-通过id查询", notes = "填值规则-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysFillRule sysFillRule = sysFillRuleService.getById(id);
|
||||
return Result.ok(sysFillRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysFillRule
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysFillRule sysFillRule) {
|
||||
return super.exportXls(request, sysFillRule, SysFillRule.class, "填值规则");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysFillRule.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 ruleCode 执行自定义填值规则
|
||||
*
|
||||
* @param ruleCode 要执行的填值规则编码
|
||||
* @param formData 表单数据,可根据表单数据的不同生成不同的填值结果
|
||||
* @return 运行后的结果
|
||||
*/
|
||||
@PutMapping("/executeRuleByCode/{ruleCode}")
|
||||
public Result executeByRuleCode(@PathVariable("ruleCode") String ruleCode, @RequestBody JSONObject formData) {
|
||||
Object result = FillRuleUtil.executeRule(ruleCode, formData);
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量通过 ruleCode 执行自定义填值规则
|
||||
*
|
||||
* @param ruleData 要执行的填值规则JSON数组:
|
||||
* 示例: { "commonFormData": {}, rules: [ { "ruleCode": "xxx", "formData": null } ] }
|
||||
* @return 运行后的结果,返回示例: [{"ruleCode": "order_num_rule", "result": "CN2019111117212984"}]
|
||||
*
|
||||
*/
|
||||
@PutMapping("/executeRuleByCodeBatch")
|
||||
public Result executeByRuleCodeBatch(@RequestBody JSONObject ruleData) {
|
||||
JSONObject commonFormData = ruleData.getJSONObject("commonFormData");
|
||||
JSONArray rules = ruleData.getJSONArray("rules");
|
||||
// 遍历 rules ,批量执行规则
|
||||
JSONArray results = new JSONArray(rules.size());
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
JSONObject rule = rules.getJSONObject(i);
|
||||
String ruleCode = rule.getString("ruleCode");
|
||||
JSONObject formData = rule.getJSONObject("formData");
|
||||
// 如果没有传递 formData,就用common的
|
||||
if (formData == null) {
|
||||
formData = commonFormData;
|
||||
}
|
||||
// 执行填值规则
|
||||
Object result = FillRuleUtil.executeRule(ruleCode, formData);
|
||||
JSONObject obj = new JSONObject(rules.size());
|
||||
obj.put("ruleCode", ruleCode);
|
||||
obj.put("result", result);
|
||||
results.add(obj);
|
||||
}
|
||||
return Result.ok(results);
|
||||
}
|
||||
|
||||
}
|
||||
@ -182,6 +182,7 @@ public class SysPermissionController {
|
||||
log.info(" ------ 通过令牌获取用户拥有的访问菜单 ---- TOKEN ------ " + token);
|
||||
String username = JwtUtil.getUsername(token);
|
||||
List<SysPermission> metaList = sysPermissionService.queryByUser(username);
|
||||
//添加首页路由
|
||||
PermissionDataUtil.addIndexPage(metaList);
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray menujsonArray = new JSONArray();
|
||||
@ -196,8 +197,11 @@ public class SysPermissionController {
|
||||
List<SysPermission> allAuthList = sysPermissionService.list(query);
|
||||
JSONArray allauthjsonArray = new JSONArray();
|
||||
this.getAllAuthJsonArray(allauthjsonArray, allAuthList);
|
||||
//路由菜单
|
||||
json.put("menu", menujsonArray);
|
||||
//按钮权限
|
||||
json.put("auth", authjsonArray);
|
||||
//全部权限配置(按钮权限,访问权限)
|
||||
json.put("allAuth", allauthjsonArray);
|
||||
result.setResult(json);
|
||||
result.success("查询成功");
|
||||
@ -517,7 +521,12 @@ public class SysPermissionController {
|
||||
}
|
||||
}
|
||||
|
||||
private JSONObject getPermissionJsonObject(SysPermission permission) {
|
||||
/**
|
||||
* 根据菜单配置生成路由json
|
||||
* @param permission
|
||||
* @return
|
||||
*/
|
||||
private JSONObject getPermissionJsonObject(SysPermission permission) {
|
||||
JSONObject json = new JSONObject();
|
||||
// 类型(0:一级菜单 1:子菜单 2:按钮)
|
||||
if (permission.getMenuType().equals(CommonConstant.MENU_TYPE_2)) {
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 填值规则
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-11-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_fill_rule")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "sys_fill_rule对象", description = "填值规则")
|
||||
public class SysFillRule {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ID_WORKER_STR)
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private java.lang.String id;
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
@Excel(name = "规则名称", width = 15)
|
||||
@ApiModelProperty(value = "规则名称")
|
||||
private java.lang.String ruleName;
|
||||
/**
|
||||
* 规则Code
|
||||
*/
|
||||
@Excel(name = "规则Code", width = 15)
|
||||
@ApiModelProperty(value = "规则Code")
|
||||
private java.lang.String ruleCode;
|
||||
/**
|
||||
* 规则实现类
|
||||
*/
|
||||
@Excel(name = "规则实现类", width = 15)
|
||||
@ApiModelProperty(value = "规则实现类")
|
||||
private java.lang.String ruleClass;
|
||||
/**
|
||||
* 规则参数
|
||||
*/
|
||||
@Excel(name = "规则参数", width = 15)
|
||||
@ApiModelProperty(value = "规则参数")
|
||||
private java.lang.String ruleParams;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Excel(name = "修改人", width = 15)
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private java.lang.String updateBy;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private java.util.Date updateTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Excel(name = "创建人", width = 15)
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
}
|
||||
@ -47,10 +47,10 @@ public class SysPosition {
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
@Excel(name = "职级", width = 15)
|
||||
@Excel(name = "职级", width = 15,dicCode ="position_rank")
|
||||
@ApiModelProperty(value = "职级")
|
||||
@Dict(dicCode = "position_rank")
|
||||
private java.lang.String rank;
|
||||
private java.lang.String postRank;
|
||||
/**
|
||||
* 公司id
|
||||
*/
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysFillRule;
|
||||
|
||||
/**
|
||||
* @Description: 填值规则
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-11-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysFillRuleMapper extends BaseMapper<SysFillRule> {
|
||||
|
||||
}
|
||||
@ -58,9 +58,9 @@
|
||||
select id as "value",depart_name as "text" from sys_depart where del_flag = '0'
|
||||
</select>
|
||||
|
||||
<!-- 查询部门信息 作为字典数据 -->
|
||||
<!-- 查询用户信息 作为字典数据 -->
|
||||
<select id="queryAllUserBackDictModel" resultType="org.jeecg.common.system.vo.DictModel">
|
||||
select username as "value",realname as "text" from sys_depart where del_flag = '0'
|
||||
select username as "value",realname as "text" from sys_user where del_flag = '0'
|
||||
</select>
|
||||
|
||||
<!--通过查询指定table的 text code 获取字典数据,且支持关键字查询 -->
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.system.mapper.SysFillRuleMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysFillRule;
|
||||
|
||||
/**
|
||||
* @Description: 填值规则
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-11-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysFillRuleService extends IService<SysFillRule> {
|
||||
|
||||
}
|
||||
@ -21,6 +21,7 @@ import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.vo.ComboModel;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.system.vo.SysDepartModel;
|
||||
import org.jeecg.common.util.IPUtils;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
@ -283,6 +284,27 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComboModel> queryAllUser(String[] userIds) {
|
||||
List<ComboModel> list = new ArrayList<ComboModel>();
|
||||
List<SysUser> userList = userMapper.selectList(new QueryWrapper<SysUser>().eq("status","1").eq("del_flag","0"));
|
||||
for(SysUser user : userList){
|
||||
ComboModel model = new ComboModel();
|
||||
model.setUsername(user.getUsername());
|
||||
model.setTitle(user.getRealname());
|
||||
model.setId(user.getId());
|
||||
if(oConvertUtils.isNotEmpty(userIds)){
|
||||
for(int i = 0; i<userIds.length;i++){
|
||||
if(userIds[i].equals(user.getId())){
|
||||
model.setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
list.add(model);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComboModel> queryAllRole() {
|
||||
List<ComboModel> list = new ArrayList<ComboModel>();
|
||||
@ -296,6 +318,26 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComboModel> queryAllRole(String[] roleIds) {
|
||||
List<ComboModel> list = new ArrayList<ComboModel>();
|
||||
List<SysRole> roleList = roleMapper.selectList(new QueryWrapper<SysRole>());
|
||||
for(SysRole role : roleList){
|
||||
ComboModel model = new ComboModel();
|
||||
model.setTitle(role.getRoleName());
|
||||
model.setId(role.getId());
|
||||
if(oConvertUtils.isNotEmpty(roleIds)) {
|
||||
for (int i = 0; i < roleIds.length; i++) {
|
||||
if (roleIds[i].equals(role.getId())) {
|
||||
model.setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
list.add(model);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRoleIdsByUsername(String username) {
|
||||
return sysUserRoleMapper.getRoleIdByUserName(username);
|
||||
@ -312,4 +354,16 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
DictModel model = new DictModel(depart.getId(),depart.getParentId());
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDepartModel> getAllSysDepart() {
|
||||
List<SysDepartModel> departModelList = new ArrayList<SysDepartModel>();
|
||||
List<SysDepart> departList = departMapper.selectList(new QueryWrapper<SysDepart>().eq("del_flag","0"));
|
||||
for(SysDepart depart : departList){
|
||||
SysDepartModel model = new SysDepartModel();
|
||||
BeanUtils.copyProperties(depart,model);
|
||||
departModelList.add(model);
|
||||
}
|
||||
return departModelList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.system.entity.SysFillRule;
|
||||
import org.jeecg.modules.system.mapper.SysFillRuleMapper;
|
||||
import org.jeecg.modules.system.service.ISysFillRuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 填值规则
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-11-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service("sysFillRuleServiceImpl")
|
||||
public class SysFillRuleServiceImpl extends ServiceImpl<SysFillRuleMapper, SysFillRule> implements ISysFillRuleService {
|
||||
|
||||
}
|
||||
@ -60,12 +60,14 @@ public class SysPermissionDataRuleImpl extends ServiceImpl<SysPermissionDataRule
|
||||
@Override
|
||||
public List<SysPermissionDataRule> queryPermissionDataRules(String username,String permissionId) {
|
||||
List<String> idsList = this.baseMapper.queryDataRuleIds(username, permissionId);
|
||||
if(idsList==null || idsList.size()==0 || idsList.get(0)==null ) {
|
||||
//update-begin--Author:scott Date:20191119 for:数据权限失效问题处理--------------------
|
||||
if(idsList==null || idsList.size()==0) {
|
||||
return null;
|
||||
}
|
||||
//update-end--Author:scott Date:20191119 for:数据权限失效问题处理--------------------
|
||||
Set<String> set = new HashSet<String>();
|
||||
for (String ids : idsList) {
|
||||
if(ids==null) {
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
continue;
|
||||
}
|
||||
String[] arr = ids.split(",");
|
||||
|
||||
@ -260,6 +260,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
|
||||
|
||||
@Override
|
||||
@CacheEvict(value= {CacheConstant.SYS_USERS_CACHE}, key="#username")
|
||||
public void updateUserDepart(String username,String orgCode) {
|
||||
baseMapper.updateUserDepart(username, orgCode);
|
||||
}
|
||||
|
||||
@ -4,9 +4,10 @@ server:
|
||||
max-swallow-size: -1
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
@ -95,7 +96,7 @@ spring:
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot-os?characterEncoding=UTF-8&useUnicode=true&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
@ -147,33 +148,15 @@ jeecg :
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
type: aliyun
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKey: ??
|
||||
accessKey: WegDpuKzOuPK6D3N
|
||||
secretKey: ??
|
||||
bucketName: jeecgos
|
||||
properties:
|
||||
aliyun:
|
||||
protocol: https
|
||||
staticDomain: ??
|
||||
# ElasticSearch 设置
|
||||
elasticsearch:
|
||||
cluster-name: my-application
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
# #腾讯云cos存储配置
|
||||
# oss:
|
||||
# type: qc
|
||||
# #跟地区有关
|
||||
# endpoint: cos.ap-beijing-1.myqcloud.com
|
||||
# accessKey: ??
|
||||
# secretKey: ??
|
||||
# bucketName: jeecg-1251108935
|
||||
# properties:
|
||||
# qc:
|
||||
# #地区
|
||||
# region: ap-beijing-1
|
||||
# #存储路径
|
||||
# prefix: jeecgboot
|
||||
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
|
||||
@ -4,9 +4,10 @@ server:
|
||||
max-swallow-size: -1
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
@ -138,38 +139,21 @@ jeecg :
|
||||
webapp: /opt/jeecg-boot/webapp
|
||||
#短信秘钥
|
||||
sms:
|
||||
accessKeyId: ??
|
||||
accessKeyId: LTAIpW4gUG7xYDNI
|
||||
accessKeySecret: ??
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
type: aliyun
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKey: ???
|
||||
secretKey: ???
|
||||
bucketName: ???
|
||||
properties:
|
||||
aliyun:
|
||||
protocol: https
|
||||
accessKey: WegDpuKzOuPK6D3N
|
||||
secretKey: ??
|
||||
bucketName: jeecgos
|
||||
staticDomain: ??
|
||||
# ElasticSearch 设置
|
||||
elasticsearch:
|
||||
cluster-name: my-application
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
# #腾讯云cos存储配置
|
||||
# oss:
|
||||
# type: qc
|
||||
# #跟地区有关
|
||||
# endpoint: cos.ap-beijing.myqcloud.com
|
||||
# accessKey: yourSecretKeyId
|
||||
# secretKey: yourSecretKey
|
||||
# bucketName: yourBucketName
|
||||
# properties:
|
||||
# qc:
|
||||
# #地区
|
||||
# region: ap-beijing
|
||||
# #存储路径
|
||||
# prefix: project
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
port: 8080
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
@ -141,39 +142,21 @@ jeecg :
|
||||
webapp: D://webapp
|
||||
#短信秘钥
|
||||
sms:
|
||||
accessKeyId: ??
|
||||
accessKeyId: LTAIpW4gUG7xYDNI
|
||||
accessKeySecret: ??
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
type: aliyun
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKey: ???
|
||||
secretKey: ???
|
||||
bucketName: ???
|
||||
properties:
|
||||
aliyun:
|
||||
protocol: https
|
||||
accessKey: WegDpuKzOuPK6D3N
|
||||
secretKey: ??
|
||||
bucketName: jeecgos
|
||||
staticDomain: ??
|
||||
# ElasticSearch 设置
|
||||
elasticsearch:
|
||||
cluster-name: my-application
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
# #腾讯云cos存储配置
|
||||
# oss:
|
||||
# type: qc
|
||||
# #跟地区有关
|
||||
# endpoint: cos.ap-beijing.myqcloud.com
|
||||
# accessKey: yourSecretKeyId
|
||||
# secretKey: yourSecretKey
|
||||
# bucketName: yourBucketName
|
||||
# properties:
|
||||
# qc:
|
||||
# #地区
|
||||
# region: ap-beijing
|
||||
# #存储路径
|
||||
# prefix: project
|
||||
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
@ -9,6 +9,6 @@ ${AnsiColor.BRIGHT_BLUE}
|
||||
|
||||
|
||||
${AnsiColor.BRIGHT_GREEN}
|
||||
Jeecg Boot Version: 2.1.1
|
||||
Jeecg Boot Version: 2.1.2
|
||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
||||
${AnsiColor.BLACK}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#code_generate_project_path
|
||||
project_path=E:\\eclipse2018-workspace\\jeecg-boot
|
||||
project_path=E:\\workspace-ui\\jeecg-boot-framework\\jeecg-boot-module-system
|
||||
#bussi_package[User defined]
|
||||
bussi_package=org.jeecg.modules.demo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user