1. 优化
This commit is contained in:
parent
ce50a1fd2e
commit
efcba7241a
13
Readme.md
13
Readme.md
|
|
@ -27,6 +27,17 @@ sanyicloud -->
|
||||||
└── -sentinel -- 流量高可用 [5003] , 并进行了 nacos 持久化配置, 默认的 group 为 SENTINEL_GROUP
|
└── -sentinel -- 流量高可用 [5003] , 并进行了 nacos 持久化配置, 默认的 group 为 SENTINEL_GROUP
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```txt
|
||||||
|
业务逻辑---
|
||||||
|
单独的终端表
|
||||||
|
单独的商户表 -- 商户绑定
|
||||||
|
单独的项目 区域 人员 商户
|
||||||
|
单独的员工表 --
|
||||||
|
单独的工单表 -- 员工绑定, 商户绑定
|
||||||
|
|
||||||
|
大区 项目(银行) 区域 人员 商户, 人员分为员工和管理等
|
||||||
|
```
|
||||||
|
|
||||||
hadoop 安装教程 https://www.cnblogs.com/jhno1/p/15218656.html
|
hadoop 安装教程 https://www.cnblogs.com/jhno1/p/15218656.html
|
||||||
mongo 单节点开启事务 https://www.jianshu.com/p/5a03b956ce1c
|
mongo 单节点开启事务 https://www.jianshu.com/p/5a03b956ce1c
|
||||||
|
|
||||||
|
|
@ -197,4 +208,4 @@ jvm 查看
|
||||||
</plugins>
|
</plugins>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
</build>
|
</build>
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,11 @@
|
||||||
<artifactId>chushang-common-mybatis</artifactId>
|
<artifactId>chushang-common-mybatis</artifactId>
|
||||||
<version>${common.version}</version>
|
<version>${common.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-mybatis-plugin</artifactId>
|
||||||
|
<version>${common.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>chushang-common-log</artifactId>
|
<artifactId>chushang-common-log</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>chushang-common</artifactId>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>chushang-common-mybatis-plugin</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.chushang.common.mybatis;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import com.chushang.common.mybatis.config.MybatisPlusMapperRefresh;
|
||||||
|
import com.chushang.common.mybatis.config.MybatisPlusMetaObjectHandler;
|
||||||
|
import com.chushang.common.mybatis.resolver.SqlFilterArgumentResolver;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lengleng
|
||||||
|
* @date 2020-03-14
|
||||||
|
* <p>
|
||||||
|
* mybatis plus 统一配置
|
||||||
|
*/
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
public class PluginAutoConfiguration {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MybatisPlusProperties mybatisPlusProperties;
|
||||||
|
@Value("${mybatis-plus.global-config.refresh.enable:false}")
|
||||||
|
private boolean refreshMapper;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusMapperRefresh mybatisPlusMapperRefresh(ApplicationContext applicationContext, SqlSessionFactory sqlSessionFactory){
|
||||||
|
Set<Resource> mapperLocations = new LinkedHashSet<>();
|
||||||
|
for (String xx : mybatisPlusProperties.getMapperLocations()) {
|
||||||
|
try {
|
||||||
|
mapperLocations.addAll(Arrays.asList(applicationContext.getResources(xx)));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new MybatisPlusMapperRefresh(mapperLocations.toArray(new Resource[mapperLocations.size()]),
|
||||||
|
sqlSessionFactory,
|
||||||
|
10,
|
||||||
|
5, refreshMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,275 @@
|
||||||
|
package com.chushang.common.mybatis.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.SystemClock;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.ibatis.binding.MapperRegistry;
|
||||||
|
import org.apache.ibatis.builder.xml.XMLMapperBuilder;
|
||||||
|
import org.apache.ibatis.builder.xml.XMLMapperEntityResolver;
|
||||||
|
import org.apache.ibatis.executor.ErrorContext;
|
||||||
|
import org.apache.ibatis.executor.keygen.SelectKeyGenerator;
|
||||||
|
import org.apache.ibatis.io.Resources;
|
||||||
|
import org.apache.ibatis.mapping.MappedStatement;
|
||||||
|
import org.apache.ibatis.parsing.XNode;
|
||||||
|
import org.apache.ibatis.parsing.XPathParser;
|
||||||
|
import org.apache.ibatis.session.Configuration;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.core.io.UrlResource;
|
||||||
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static java.lang.Thread.sleep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Mybatis 映射文件热加载(发生变动后自动重新加载).</p>
|
||||||
|
* <p>方便开发时使用,不用每次修改xml文件后都要去重启应用.</p>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class MybatisPlusMapperRefresh implements Runnable {
|
||||||
|
/**
|
||||||
|
* 记录jar包存在的mapper
|
||||||
|
*/
|
||||||
|
private static final Map<String, List<Resource>> jarMapper = new HashMap<>();
|
||||||
|
private final SqlSessionFactory sqlSessionFactory;
|
||||||
|
private final Resource[] mapperLocations;
|
||||||
|
private volatile Long beforeTime = 0L;
|
||||||
|
private Configuration configuration;
|
||||||
|
/**
|
||||||
|
* xml文件目录
|
||||||
|
*/
|
||||||
|
private Set<String> fileSet;
|
||||||
|
/**
|
||||||
|
* 延迟加载时间
|
||||||
|
*/
|
||||||
|
private int delaySeconds = 10;
|
||||||
|
/**
|
||||||
|
* 刷新间隔时间
|
||||||
|
*/
|
||||||
|
private int sleepSeconds = 20;
|
||||||
|
private boolean refreshMapper;
|
||||||
|
|
||||||
|
public MybatisPlusMapperRefresh(Resource[] mapperLocations, SqlSessionFactory sqlSessionFactory, int delaySeconds,
|
||||||
|
int sleepSeconds, boolean refreshMapper) {
|
||||||
|
this.mapperLocations = mapperLocations.clone();
|
||||||
|
this.sqlSessionFactory = sqlSessionFactory;
|
||||||
|
this.delaySeconds = delaySeconds;
|
||||||
|
this.sleepSeconds = sleepSeconds;
|
||||||
|
this.configuration = sqlSessionFactory.getConfiguration();
|
||||||
|
this.refreshMapper = refreshMapper;
|
||||||
|
this.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MybatisPlusMapperRefresh(Resource[] mapperLocations, SqlSessionFactory sqlSessionFactory) {
|
||||||
|
this.mapperLocations = mapperLocations.clone();
|
||||||
|
this.sqlSessionFactory = sqlSessionFactory;
|
||||||
|
this.configuration = sqlSessionFactory.getConfiguration();
|
||||||
|
this.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
if (refreshMapper) {
|
||||||
|
beforeTime = SystemClock.now();
|
||||||
|
final MybatisPlusMapperRefresh runnable = this;
|
||||||
|
new Thread(() -> {
|
||||||
|
if (fileSet == null) {
|
||||||
|
fileSet = new HashSet<>();
|
||||||
|
if (mapperLocations != null) {
|
||||||
|
for (Resource mapperLocation : mapperLocations) {
|
||||||
|
try {
|
||||||
|
if (ResourceUtils.isJarURL(mapperLocation.getURL())) {
|
||||||
|
String key = new UrlResource(
|
||||||
|
ResourceUtils.extractJarFileURL(mapperLocation.getURL())).getFile()
|
||||||
|
.getPath();
|
||||||
|
fileSet.add(key);
|
||||||
|
if (jarMapper.get(key) != null) {
|
||||||
|
jarMapper.get(key).add(mapperLocation);
|
||||||
|
} else {
|
||||||
|
List<Resource> resourcesList = new ArrayList<>();
|
||||||
|
resourcesList.add(mapperLocation);
|
||||||
|
jarMapper.put(key, resourcesList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fileSet.add(mapperLocation.getFile().getPath());
|
||||||
|
}
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
sleep(delaySeconds * 1000L);
|
||||||
|
} catch (InterruptedException interruptedException) {
|
||||||
|
interruptedException.printStackTrace();
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
try {
|
||||||
|
for (String filePath : fileSet) {
|
||||||
|
File file = new File(filePath);
|
||||||
|
if (file.isFile() && file.lastModified() > beforeTime) {
|
||||||
|
// 记录上次重新加载时间防止重复加载已经重载的文件
|
||||||
|
beforeTime = file.lastModified();
|
||||||
|
List<Resource> removeList = jarMapper.get(filePath);
|
||||||
|
if (removeList != null && !removeList.isEmpty()) {
|
||||||
|
for (Resource resource : removeList) {
|
||||||
|
runnable.refresh(resource);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
runnable.refresh(new FileSystemResource(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
sleep(sleepSeconds * 1000L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
} while (true);
|
||||||
|
}, "mybatis-plus MapperRefresh").start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新mapper
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private void refresh(Resource resource)
|
||||||
|
throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||||
|
this.configuration = sqlSessionFactory.getConfiguration();
|
||||||
|
boolean isSupper = configuration.getClass().getSuperclass() == Configuration.class;
|
||||||
|
try {
|
||||||
|
Field loadedResourcesField = isSupper
|
||||||
|
? configuration.getClass().getSuperclass().getDeclaredField("loadedResources")
|
||||||
|
: configuration.getClass().getDeclaredField("loadedResources");
|
||||||
|
loadedResourcesField.setAccessible(true);
|
||||||
|
Set loadedResourcesSet = ((Set) loadedResourcesField.get(configuration));
|
||||||
|
XPathParser xPathParser = new XPathParser(resource.getInputStream(), true, configuration.getVariables(),
|
||||||
|
new XMLMapperEntityResolver());
|
||||||
|
XNode context = xPathParser.evalNode("/mapper");
|
||||||
|
String namespace = context.getStringAttribute("namespace");
|
||||||
|
Field field = MapperRegistry.class.getDeclaredField("knownMappers");
|
||||||
|
field.setAccessible(true);
|
||||||
|
Map mapConfig = (Map) field.get(configuration.getMapperRegistry());
|
||||||
|
|
||||||
|
mapConfig.remove(Resources.classForName(namespace));
|
||||||
|
loadedResourcesSet.remove(resource.toString());
|
||||||
|
configuration.getCacheNames().remove(namespace);
|
||||||
|
|
||||||
|
cleanParameterMap(context.evalNodes("/mapper/parameterMap"), namespace);
|
||||||
|
cleanResultMap(context.evalNodes("/mapper/resultMap"), namespace);
|
||||||
|
cleanKeyGenerators(context.evalNodes("insert|update|select|delete"), namespace);
|
||||||
|
cleanSqlElement(context.evalNodes("/mapper/sql"), namespace);
|
||||||
|
XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(resource.getInputStream(),
|
||||||
|
sqlSessionFactory.getConfiguration(), resource.toString(),
|
||||||
|
sqlSessionFactory.getConfiguration().getSqlFragments());
|
||||||
|
xmlMapperBuilder.parse();
|
||||||
|
log.debug("refresh: '" + resource + "', success!");
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Refresh IOException :" + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
ErrorContext.instance().reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理parameterMap
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param namespace
|
||||||
|
*/
|
||||||
|
private void cleanParameterMap(List<XNode> list, String namespace) {
|
||||||
|
for (XNode parameterMapNode : list) {
|
||||||
|
String id = parameterMapNode.getStringAttribute("id");
|
||||||
|
configuration.getParameterMaps().remove(String.format("%s.%s", namespace, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理resultMap
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param namespace
|
||||||
|
*/
|
||||||
|
private void cleanResultMap(List<XNode> list, String namespace) {
|
||||||
|
for (XNode resultMapNode : list) {
|
||||||
|
String id = resultMapNode.getStringAttribute("id", resultMapNode.getValueBasedIdentifier());
|
||||||
|
configuration.getResultMapNames().remove(id);
|
||||||
|
configuration.getResultMapNames().remove(namespace + "." + id);
|
||||||
|
clearResultMap(resultMapNode, namespace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearResultMap(XNode xNode, String namespace) {
|
||||||
|
for (XNode resultChild : xNode.getChildren()) {
|
||||||
|
if ("association".equals(resultChild.getName()) || "collection".equals(resultChild.getName())
|
||||||
|
|| "case".equals(resultChild.getName())) {
|
||||||
|
if (resultChild.getStringAttribute("select") == null) {
|
||||||
|
configuration.getResultMapNames()
|
||||||
|
.remove(resultChild.getStringAttribute("id", resultChild.getValueBasedIdentifier()));
|
||||||
|
configuration.getResultMapNames().remove(namespace + "."
|
||||||
|
+ resultChild.getStringAttribute("id", resultChild.getValueBasedIdentifier()));
|
||||||
|
if (resultChild.getChildren() != null && !resultChild.getChildren().isEmpty()) {
|
||||||
|
clearResultMap(resultChild, namespace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理selectKey
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param namespace
|
||||||
|
*/
|
||||||
|
private void cleanKeyGenerators(List<XNode> list, String namespace) {
|
||||||
|
for (XNode context : list) {
|
||||||
|
String id = context.getStringAttribute("id");
|
||||||
|
configuration.getKeyGeneratorNames().remove(id + SelectKeyGenerator.SELECT_KEY_SUFFIX);
|
||||||
|
configuration.getKeyGeneratorNames().remove(namespace + "." + id + SelectKeyGenerator.SELECT_KEY_SUFFIX);
|
||||||
|
|
||||||
|
Collection<MappedStatement> mappedStatements = configuration.getMappedStatements();
|
||||||
|
List<MappedStatement> objects = new ArrayList<>();
|
||||||
|
for (Object object : mappedStatements) {
|
||||||
|
if (object instanceof MappedStatement) {
|
||||||
|
MappedStatement mappedStatement = (MappedStatement) object;
|
||||||
|
if (mappedStatement.getId().equals(namespace + "." + id)) {
|
||||||
|
objects.add(mappedStatement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mappedStatements.removeAll(objects);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理sql节点缓存
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param namespace
|
||||||
|
*/
|
||||||
|
private void cleanSqlElement(List<XNode> list, String namespace) {
|
||||||
|
for (XNode context : list) {
|
||||||
|
String id = context.getStringAttribute("id");
|
||||||
|
configuration.getSqlFragments().remove(id);
|
||||||
|
configuration.getSqlFragments().remove(namespace + "." + id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
|
com.chushang.common.mybatis.PluginAutoConfiguration
|
||||||
|
|
@ -145,10 +145,7 @@ public class TokenService
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
if (expireTime - currentTime <= 15 * 24 * MILLIS_HOUR)
|
if (expireTime - currentTime <= 15 * 24 * MILLIS_HOUR)
|
||||||
{
|
{
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
refreshToken(loginUser);
|
refreshToken(loginUser);
|
||||||
long end = System.currentTimeMillis();
|
|
||||||
log.info("TokenService verifyToken {}", end - start);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +157,8 @@ public class TokenService
|
||||||
public void refreshToken(LoginUser loginUser)
|
public void refreshToken(LoginUser loginUser)
|
||||||
{
|
{
|
||||||
long expireTime = 15 * 24 * MILLIS_HOUR ;
|
long expireTime = 15 * 24 * MILLIS_HOUR ;
|
||||||
log.info("expireTime : {}", expireTime);
|
if (log.isDebugEnabled())
|
||||||
|
log.debug("TokenService refreshToken");
|
||||||
loginUser.setLoginTime(System.currentTimeMillis());
|
loginUser.setLoginTime(System.currentTimeMillis());
|
||||||
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime);
|
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime);
|
||||||
// 根据uuid将loginUser缓存
|
// 根据uuid将loginUser缓存
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
<module>chushang-common-mail</module>
|
<module>chushang-common-mail</module>
|
||||||
<module>chushang-common-mongo</module>
|
<module>chushang-common-mongo</module>
|
||||||
<module>chushang-common-mybatis</module>
|
<module>chushang-common-mybatis</module>
|
||||||
|
<module>chushang-common-mybatis-plugin</module>
|
||||||
<module>chushang-common-redis</module>
|
<module>chushang-common-redis</module>
|
||||||
<module>chushang-common-security</module>
|
<module>chushang-common-security</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,16 @@
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>system-feign</artifactId>
|
<artifactId>system-feign</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-mybatis-plugin</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-mybatis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>chushang-module-gateway</artifactId>
|
<artifactId>gateway-service</artifactId>
|
||||||
<description>
|
<description>
|
||||||
网关
|
网关
|
||||||
</description>
|
</description>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
@Component
|
@Component
|
||||||
public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
|
public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
|
||||||
{
|
{
|
||||||
private final static String[] VALIDATE_URL = new String[] { "/sanyi/auth/login", "/sanyi/auth/register" };
|
private final static String[] VALIDATE_URL = new String[] { "/auth/login", "/auth/register" };
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ValidateCodeService validateCodeService;
|
private ValidateCodeService validateCodeService;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.chushang.oss.service.impl;
|
package com.chushang.oss.service.impl;
|
||||||
|
|
||||||
|
import com.chushang.oss.service.OssService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/4/29 10:25
|
* @date: 2024/4/29 10:25
|
||||||
|
|
@ -11,5 +14,9 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class FileSourceService {
|
public class FileSourceService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OssService ossService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,61 @@
|
||||||
package com.chushang.oss.service.impl;
|
package com.chushang.oss.service.impl;
|
||||||
|
|
||||||
|
import com.chushang.oss.service.OssService;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/4/28 19:53
|
* @date: 2024/4/28 19:53
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class LocalServiceImpl {
|
@ConditionalOnExpression("'${oss.storage}'.equals('local')")
|
||||||
|
public class LocalServiceImpl implements OssService {
|
||||||
|
@Override
|
||||||
|
public String upload(byte[] data, String path) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadSuffix(byte[] data, String suffix) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadSuffix(byte[] data, String suffix, String filename) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadPrefix(byte[] data, String prefix, String suffix, String filename) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadPrefix(byte[] data, String prefix, String filename) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String upload(InputStream inputStream, String path) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadSuffix(InputStream inputStream, String suffix) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delFile(String path) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> delFileBatch(List<String> keys) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>chushang-common-mybatis</artifactId>
|
<artifactId>chushang-common-mybatis-plugin</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ package com.chushang.system.constants;
|
||||||
*/
|
*/
|
||||||
public interface SystemConstants {
|
public interface SystemConstants {
|
||||||
String SYSTEM_SERVICE = "system-service";
|
String SYSTEM_SERVICE = "system-service";
|
||||||
String APPLICATION_NAME = "/cs/system";
|
String APPLICATION_NAME = "/system";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,9 @@ public class DataScopeAspect {
|
||||||
|
|
||||||
@Before("dataScopePointCut()")
|
@Before("dataScopePointCut()")
|
||||||
public void doBefore(JoinPoint point) throws Throwable {
|
public void doBefore(JoinPoint point) throws Throwable {
|
||||||
log.info("数据权限before 进入");
|
if (log.isDebugEnabled()){
|
||||||
|
log.debug("数据权限before 进入");
|
||||||
|
}
|
||||||
clearDataScope(point);
|
clearDataScope(point);
|
||||||
handleDataScope(point);
|
handleDataScope(point);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class DeptController {
|
||||||
/**
|
/**
|
||||||
* 获取部门下拉树列表
|
* 获取部门下拉树列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/tree/select")
|
@GetMapping("/tree")
|
||||||
public AjaxResult treeSelect(ListDeptDTO listDept)
|
public AjaxResult treeSelect(ListDeptDTO listDept)
|
||||||
{
|
{
|
||||||
List<SysDept> deptList = sysDeptService.selectDeptList(listDept);
|
List<SysDept> deptList = sysDeptService.selectDeptList(listDept);
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
@EnableAdminServer
|
@EnableAdminServer
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SanyiAdminApplication {
|
public class AdminApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(SanyiAdminApplication.class,args);
|
SpringApplication.run(AdminApplication.class,args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,11 +25,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @author Carpenter Lee
|
* @author Carpenter Lee
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SanyiSentinelApplication {
|
public class SentinelApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
triggerSentinelInit();
|
triggerSentinelInit();
|
||||||
SpringApplication.run(SanyiSentinelApplication.class, args);
|
SpringApplication.run(SentinelApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void triggerSentinelInit() {
|
private static void triggerSentinelInit() {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import com.alibaba.csp.sentinel.dashboard.SanyiSentinelApplication;
|
import com.alibaba.csp.sentinel.dashboard.SentinelApplication;
|
||||||
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity;
|
||||||
import com.chushang.common.mongo.annotation.MongoDel;
|
import com.chushang.common.mongo.annotation.MongoDel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -8,7 +8,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = SanyiSentinelApplication.class)
|
@SpringBootTest(classes = SentinelApplication.class)
|
||||||
public class Test {
|
public class Test {
|
||||||
|
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue