mirror of https://gitee.com/stylefeng/roses
commit
ff4369a6f7
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
*/
|
*/
|
||||||
package cn.stylefeng.roses.kernel.rule.enums.permission;
|
package cn.stylefeng.roses.kernel.rule.enums.permission;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.base.ReadableEnum;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.enums.DataScopeExceptionEnum;
|
import cn.stylefeng.roses.kernel.rule.exception.enums.DataScopeExceptionEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -35,7 +38,7 @@ import lombok.Getter;
|
||||||
* @since 2020/11/5 15:22
|
* @since 2020/11/5 15:22
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum DataScopeTypeEnum {
|
public enum DataScopeTypeEnum implements ReadableEnum<DataScopeTypeEnum> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅本人数据
|
* 仅本人数据
|
||||||
|
@ -58,9 +61,21 @@ public enum DataScopeTypeEnum {
|
||||||
COMPANY_WITH_CHILD(31, "本公司及以下数据"),
|
COMPANY_WITH_CHILD(31, "本公司及以下数据"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定部门数据
|
* 指定机构层级及以下
|
||||||
|
* <p>
|
||||||
|
* 基于当前人所属的部门所在的机构层级,以及以下的机构下的数据
|
||||||
*/
|
*/
|
||||||
DEFINE(40, "指定部门数据"),
|
DEFINE_ORG_LEVEL_WITH_CHILD(32, "指定机构层级及以下"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定机构集合数据
|
||||||
|
*/
|
||||||
|
DEFINE(40, "指定机构集合数据"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定机构及以下
|
||||||
|
*/
|
||||||
|
DEFINE_ORG_WITH_CHILD(41, "指定机构及以下"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全部数据
|
* 全部数据
|
||||||
|
@ -93,4 +108,26 @@ public enum DataScopeTypeEnum {
|
||||||
throw new ServiceException(DataScopeExceptionEnum.DATA_SCOPE_ERROR);
|
throw new ServiceException(DataScopeExceptionEnum.DATA_SCOPE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKey() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getName() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataScopeTypeEnum parseToEnum(String originValue) {
|
||||||
|
if (ObjectUtil.isEmpty(originValue)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (DataScopeTypeEnum value : DataScopeTypeEnum.values()) {
|
||||||
|
if (value.code.equals(Convert.toInt(originValue))) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,12 @@ import cn.stylefeng.roses.kernel.rule.tree.factory.base.AbstractSortedTreeNode;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 带排序功能的树构造器
|
* 带排序功能的树构造器
|
||||||
|
@ -54,22 +57,14 @@ public class SortedTreeBuildFactory<T extends AbstractSortedTreeNode<T>> extends
|
||||||
public List<T> doTreeBuild(List<T> nodes) {
|
public List<T> doTreeBuild(List<T> nodes) {
|
||||||
|
|
||||||
// 先对列表进行排序
|
// 先对列表进行排序
|
||||||
nodes.sort(Comparator.comparing(AbstractSortedTreeNode::getSort));
|
nodes.sort(Comparator.comparing(itemNode -> Optional.ofNullable((itemNode).getSort()).orElse(new BigDecimal(Integer.MAX_VALUE))));
|
||||||
|
|
||||||
// 将每个节点构造一个子树
|
// 将每个节点构造一个子树
|
||||||
for (T treeNode : nodes) {
|
for (T treeNode : nodes) {
|
||||||
this.buildChildNodes(nodes, treeNode, new ArrayList<>());
|
this.buildChildNodes(nodes, treeNode, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只保留上级是根节点的节点,也就是只留下所有一级节点
|
return findTops(nodes);
|
||||||
ArrayList<T> results = new ArrayList<>();
|
|
||||||
for (T node : nodes) {
|
|
||||||
if (node.getNodeParentId().equals(getRootParentId())) {
|
|
||||||
results.add(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,7 +76,7 @@ public class SortedTreeBuildFactory<T extends AbstractSortedTreeNode<T>> extends
|
||||||
List<T> nodeSubLists = getSubChildsLevelOne(totalNodes, node);
|
List<T> nodeSubLists = getSubChildsLevelOne(totalNodes, node);
|
||||||
|
|
||||||
// 对子节点进行排序
|
// 对子节点进行排序
|
||||||
nodeSubLists.sort(Comparator.comparing(AbstractSortedTreeNode::getSort));
|
nodeSubLists.sort(Comparator.comparing(itemNode -> Optional.ofNullable((itemNode).getSort()).orElse(new BigDecimal(Integer.MAX_VALUE))));
|
||||||
|
|
||||||
if (!nodeSubLists.isEmpty()) {
|
if (!nodeSubLists.isEmpty()) {
|
||||||
for (T nodeSubList : nodeSubLists) {
|
for (T nodeSubList : nodeSubLists) {
|
||||||
|
@ -93,4 +88,19 @@ public class SortedTreeBuildFactory<T extends AbstractSortedTreeNode<T>> extends
|
||||||
node.setChildrenNodes(childNodeLists);
|
node.setChildrenNodes(childNodeLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 找到最顶级的节点,指定node列表中,不存在的父级id则为顶级节点
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2024/12/11 15:35
|
||||||
|
*/
|
||||||
|
private List<T> findTops(List<T> nodes) {
|
||||||
|
|
||||||
|
List<T> totalParentList = nodes.stream().filter((itemNode) -> null != itemNode.getNodeParentId()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<String> totalNodeIdList = nodes.stream().map(AbstractSortedTreeNode::getNodeId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return totalParentList.stream().filter((item) -> !totalNodeIdList.contains(item.getNodeParentId())).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,9 @@
|
||||||
/*
|
|
||||||
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
|
||||||
*
|
|
||||||
* 1.请不要删除和修改根目录下的LICENSE文件。
|
|
||||||
* 2.请不要删除和修改Guns源码头部的版权声明。
|
|
||||||
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
|
||||||
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
|
||||||
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
|
||||||
* 6.若您的项目无法满足以上几点,可申请商业授权
|
|
||||||
*/
|
|
||||||
package cn.stylefeng.roses.kernel.rule.util;
|
package cn.stylefeng.roses.kernel.rule.util;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.aop.framework.AdvisedSupport;
|
import org.springframework.aop.framework.Advised;
|
||||||
import org.springframework.aop.framework.AopProxy;
|
|
||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取代理原始对象的工具
|
* 获取代理原始对象的工具
|
||||||
*
|
*
|
||||||
|
@ -73,12 +46,10 @@ public class AopTargetUtils {
|
||||||
* @since 2020/10/19 16:21
|
* @since 2020/10/19 16:21
|
||||||
*/
|
*/
|
||||||
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
|
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
|
||||||
Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
|
if (proxy instanceof Advised advised) {
|
||||||
h.setAccessible(true);
|
return advised.getTargetSource().getTarget();
|
||||||
Object dynamicAdvisedInterceptor = h.get(proxy);
|
}
|
||||||
Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
|
throw new IllegalArgumentException("Not a CGLIB proxy");
|
||||||
advised.setAccessible(true);
|
|
||||||
return ((AdvisedSupport) advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,12 +59,10 @@ public class AopTargetUtils {
|
||||||
* @since 2020/10/19 16:22
|
* @since 2020/10/19 16:22
|
||||||
*/
|
*/
|
||||||
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
|
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
|
||||||
Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
|
if (proxy instanceof Advised advised) {
|
||||||
h.setAccessible(true);
|
return advised.getTargetSource().getTarget();
|
||||||
AopProxy aopProxy = (AopProxy) h.get(proxy);
|
}
|
||||||
Field advised = aopProxy.getClass().getDeclaredField("advised");
|
throw new IllegalArgumentException("Not a JDK dynamic proxy");
|
||||||
advised.setAccessible(true);
|
|
||||||
return ((AdvisedSupport) advised.get(aopProxy)).getTargetSource().getTarget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-auth</artifactId>
|
<artifactId>kernel-d-auth</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public enum AuthExceptionEnum implements AbstractExceptionEnum {
|
||||||
/**
|
/**
|
||||||
* 密码重试次数过多,帐号被锁定
|
* 密码重试次数过多,帐号被锁定
|
||||||
*/
|
*/
|
||||||
LOGIN_LOCKED(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "18", "账号或密码错误!");
|
LOGIN_LOCKED(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "18", "暂时无法登录,请稍后重试");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误编码
|
* 错误编码
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-auth</artifactId>
|
<artifactId>kernel-d-auth</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-auth</artifactId>
|
<artifactId>kernel-d-auth</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-cache</artifactId>
|
<artifactId>kernel-d-cache</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -67,4 +67,9 @@ public interface CacheConstants {
|
||||||
*/
|
*/
|
||||||
String DEFAULT_STRING_CACHE_PREFIX = "DEFAULT:STRINGS:";
|
String DEFAULT_STRING_CACHE_PREFIX = "DEFAULT:STRINGS:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认缓存的过期时间,60分钟
|
||||||
|
*/
|
||||||
|
Long DEFAULT_EXP_SECONDS = 60L * 60L;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-cache</artifactId>
|
<artifactId>kernel-d-cache</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-cache</artifactId>
|
<artifactId>kernel-d-cache</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-cache</artifactId>
|
<artifactId>kernel-d-cache</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-cache</artifactId>
|
<artifactId>kernel-d-cache</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-config</artifactId>
|
<artifactId>kernel-d-config</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-config</artifactId>
|
<artifactId>kernel-d-config</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-config</artifactId>
|
<artifactId>kernel-d-config</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-config</artifactId>
|
<artifactId>kernel-d-config</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-config</artifactId>
|
<artifactId>kernel-d-config</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-db</artifactId>
|
<artifactId>kernel-d-db</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-db</artifactId>
|
<artifactId>kernel-d-db</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-db</artifactId>
|
<artifactId>kernel-d-db</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,18 @@
|
||||||
package cn.stylefeng.roses.kernel.db.mp.datascope;
|
package cn.stylefeng.roses.kernel.db.mp.datascope;
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.stylefeng.roses.kernel.db.mp.datascope.config.DataScopeConfig;
|
import cn.stylefeng.roses.kernel.db.mp.datascope.config.DataScopeConfig;
|
||||||
import cn.stylefeng.roses.kernel.db.mp.datascope.holder.DataScopeHolder;
|
import cn.stylefeng.roses.kernel.db.mp.datascope.holder.DataScopeHolder;
|
||||||
import cn.stylefeng.roses.kernel.rule.enums.permission.DataScopeTypeEnum;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.handler.MultiDataPermissionHandler;
|
import com.baomidou.mybatisplus.extension.plugins.handler.MultiDataPermissionHandler;
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
import net.sf.jsqlparser.expression.LongValue;
|
import net.sf.jsqlparser.expression.LongValue;
|
||||||
import net.sf.jsqlparser.expression.StringValue;
|
import net.sf.jsqlparser.expression.Parenthesis;
|
||||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.LikeExpression;
|
|
||||||
import net.sf.jsqlparser.schema.Column;
|
import net.sf.jsqlparser.schema.Column;
|
||||||
import net.sf.jsqlparser.schema.Table;
|
import net.sf.jsqlparser.schema.Table;
|
||||||
import net.sf.jsqlparser.statement.select.LateralSubSelect;
|
|
||||||
import net.sf.jsqlparser.statement.select.PlainSelect;
|
|
||||||
import net.sf.jsqlparser.statement.select.SelectItem;
|
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -54,118 +48,40 @@ public class ProjectDataScopeHandler implements MultiDataPermissionHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据校验处理
|
// 如果是全部权限,则不校验
|
||||||
dataScopeConfig = this.validateDataScopeConfig(dataScopeConfig);
|
if (dataScopeConfig.isTotalDataScope()) {
|
||||||
if (dataScopeConfig == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取数据范围的类型
|
Expression dataScopeExpression = null;
|
||||||
DataScopeTypeEnum dataScopeTypeEnum = dataScopeConfig.getDataScopeType();
|
|
||||||
switch (dataScopeTypeEnum) {
|
|
||||||
|
|
||||||
// 如果是全部数据,返回空,不对sql进行处理
|
// 如果是需要校验仅创建人数据
|
||||||
case ALL:
|
if (dataScopeConfig.isDoCreateUserValidate()) {
|
||||||
return null;
|
|
||||||
|
|
||||||
// 如果是本部门数据,则限制查询只能查询本部门数据
|
// 获取创建人ID
|
||||||
case DEPT:
|
Long currentUserId = dataScopeConfig.getUserId();
|
||||||
return getEqualsTo(dataScopeConfig.getOrgIdFieldName(), dataScopeConfig.getUserDeptId());
|
|
||||||
|
|
||||||
// 如果是本部门及以下部门
|
// 生成创建人条件表达式
|
||||||
case DEPT_WITH_CHILD:
|
dataScopeExpression = getEqualsTo(dataScopeConfig.getUserIdFieldName(), currentUserId);
|
||||||
return deptWithChildScope(dataScopeConfig, dataScopeConfig.getUserDeptId());
|
}
|
||||||
|
|
||||||
// 本公司及以下数据
|
// 如果是需要校验指定部门数据
|
||||||
case COMPANY_WITH_CHILD:
|
if (dataScopeConfig.isDoOrgScopeValidate()) {
|
||||||
return deptWithChildScope(dataScopeConfig, dataScopeConfig.getUserCompanyId());
|
|
||||||
|
|
||||||
// 指定部门数据
|
// 获取组织范围条件表达式
|
||||||
case DEFINE:
|
InExpression orgScopeCondition = getInExpression(dataScopeConfig);
|
||||||
return getInExpression(dataScopeConfig);
|
|
||||||
|
|
||||||
// 仅本人数据
|
// 如果已经有创建人条件,需要合并
|
||||||
case SELF:
|
if (dataScopeExpression != null) {
|
||||||
return getEqualsTo(dataScopeConfig.getUserIdFieldName(), dataScopeConfig.getUserId());
|
// 使用 OrExpression 合并条件
|
||||||
|
dataScopeExpression = new AndExpression(dataScopeExpression, orgScopeCondition);
|
||||||
// 其他情况
|
} else {
|
||||||
default:
|
// 否则仅使用组织范围条件
|
||||||
return null;
|
dataScopeExpression = orgScopeCondition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return dataScopeExpression;
|
||||||
* 校验数据范围配置是否正确
|
|
||||||
*
|
|
||||||
* @author fengshuonan
|
|
||||||
* @since 2024-02-29 11:00
|
|
||||||
*/
|
|
||||||
private DataScopeConfig validateDataScopeConfig(DataScopeConfig dataScopeConfig) {
|
|
||||||
if (dataScopeConfig == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataScopeTypeEnum dataScopeType = dataScopeConfig.getDataScopeType();
|
|
||||||
if (dataScopeType == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果数据范围为全部,直接返回空,也就是不进行数据范围sql拦截器
|
|
||||||
if (DataScopeTypeEnum.ALL.equals(dataScopeType)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果数据范围是本人,则查询本人id是否传递
|
|
||||||
else if (DataScopeTypeEnum.SELF.equals(dataScopeType)) {
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getUserId())) {
|
|
||||||
dataScopeConfig.setUserId(NONE_ID_VALUE);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getUserIdFieldName())) {
|
|
||||||
dataScopeConfig.setUserIdFieldName(DEFAULT_USER_ID_FIELD_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是本公司及以下数据,则查询公司id是否传递
|
|
||||||
else if (DataScopeTypeEnum.COMPANY_WITH_CHILD.equals(dataScopeType)) {
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getUserCompanyId())) {
|
|
||||||
dataScopeConfig.setUserCompanyId(NONE_ID_VALUE);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
|
|
||||||
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是本部门及以下数据,则查询部门id是否传递
|
|
||||||
else if (DataScopeTypeEnum.DEPT_WITH_CHILD.equals(dataScopeType)) {
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getUserDeptId())) {
|
|
||||||
dataScopeConfig.setUserDeptId(NONE_ID_VALUE);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
|
|
||||||
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是本部门数据,则查询部门id是否传递
|
|
||||||
else if (DataScopeTypeEnum.DEPT.equals(dataScopeType)) {
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getUserDeptId())) {
|
|
||||||
dataScopeConfig.setUserDeptId(NONE_ID_VALUE);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
|
|
||||||
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是指定部门数据,则查询部门id是否传递
|
|
||||||
else if (DataScopeTypeEnum.DEFINE.equals(dataScopeType)) {
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getSpecificOrgIds())) {
|
|
||||||
dataScopeConfig.setSpecificOrgIds(ListUtil.list(true, NONE_ID_VALUE));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
|
|
||||||
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dataScopeConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,52 +113,13 @@ public class ProjectDataScopeHandler implements MultiDataPermissionHandler {
|
||||||
|
|
||||||
// 创建 IN 表达式的值列表
|
// 创建 IN 表达式的值列表
|
||||||
ExpressionList expressionList = new ExpressionList();
|
ExpressionList expressionList = new ExpressionList();
|
||||||
expressionList.setExpressions(dataScopeConfig.getSpecificOrgIds().stream().map(LongValue::new).collect(Collectors.toList()));
|
expressionList.setExpressions(dataScopeConfig.getUserOrgIdList().stream().map(LongValue::new).collect(Collectors.toList()));
|
||||||
|
|
||||||
// 创建 IN 表达式
|
// 创建 IN 表达式
|
||||||
InExpression inExpression = new InExpression();
|
InExpression inExpression = new InExpression();
|
||||||
inExpression.setLeftExpression(orgIdColumn);
|
inExpression.setLeftExpression(orgIdColumn);
|
||||||
inExpression.setRightExpression(expressionList);
|
inExpression.setRightExpression(new Parenthesis(expressionList));
|
||||||
return inExpression;
|
return inExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取本部门及以下
|
|
||||||
* <p>
|
|
||||||
* 拼接条件最终效果如下:org_id in (select org_id from sys_hr_organization where org_pids like "%[id]%" or org_id = id)
|
|
||||||
*
|
|
||||||
* @author fengshuonan
|
|
||||||
* @since 2024-02-29 20:14
|
|
||||||
*/
|
|
||||||
private static Expression deptWithChildScope(DataScopeConfig dataScopeConfig, Long deptOrCompanyId) {
|
|
||||||
|
|
||||||
// 创建 org_id 列
|
|
||||||
Column orgIdColumn = new Column(dataScopeConfig.getOrgIdFieldName());
|
|
||||||
|
|
||||||
// 创建子查询 select 部分
|
|
||||||
LateralSubSelect subSelect = new LateralSubSelect();
|
|
||||||
PlainSelect selectBody = new PlainSelect();
|
|
||||||
selectBody.setSelectItems(ListUtil.of(new SelectItem<>(orgIdColumn)));
|
|
||||||
selectBody.setFromItem(new Table("sys_hr_organization"));
|
|
||||||
|
|
||||||
// 创建 LIKE 表达式
|
|
||||||
LikeExpression likeExpression = new LikeExpression();
|
|
||||||
likeExpression.setLeftExpression(new Column("org_pids"));
|
|
||||||
likeExpression.setRightExpression(new StringValue("%[" + deptOrCompanyId + "]%"));
|
|
||||||
|
|
||||||
// 设置等于表达式
|
|
||||||
EqualsTo equalsTo = new EqualsTo();
|
|
||||||
equalsTo.setLeftExpression(orgIdColumn);
|
|
||||||
equalsTo.setRightExpression(new LongValue(deptOrCompanyId));
|
|
||||||
|
|
||||||
// 创建 OR 表达式
|
|
||||||
OrExpression orExpression = new OrExpression(likeExpression, equalsTo);
|
|
||||||
|
|
||||||
// 设置子查询的 WHERE 条件
|
|
||||||
selectBody.setWhere(orExpression);
|
|
||||||
subSelect.setSelect(selectBody);
|
|
||||||
|
|
||||||
// 创建 IN 表达式
|
|
||||||
return new InExpression(orgIdColumn, subSelect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.db.mp.datascope;
|
package cn.stylefeng.roses.kernel.db.mp.datascope;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.mp.datascope.config.DataScopeConfig;
|
import cn.stylefeng.roses.kernel.db.mp.datascope.config.DataScopeConfig;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.enums.permission.DataScopeTypeEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户角色的数据范围
|
* 获取用户角色的数据范围
|
||||||
|
@ -18,4 +19,12 @@ public interface UserRoleDataScopeApi {
|
||||||
*/
|
*/
|
||||||
DataScopeConfig getUserRoleDataScopeConfig();
|
DataScopeConfig getUserRoleDataScopeConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户的,规定指定类型的数据范围的配置
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/27 23:32
|
||||||
|
*/
|
||||||
|
DataScopeConfig getUserPointDataScopeConfig(DataScopeTypeEnum dataScopeTypeEnum);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package cn.stylefeng.roses.kernel.db.mp.datascope.config;
|
package cn.stylefeng.roses.kernel.db.mp.datascope.config;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.mp.datascope.ProjectDataScopeHandler;
|
import cn.stylefeng.roses.kernel.db.mp.datascope.ProjectDataScopeHandler;
|
||||||
import cn.stylefeng.roses.kernel.rule.enums.permission.DataScopeTypeEnum;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据范围权限配置
|
* 数据范围权限配置
|
||||||
|
@ -16,38 +15,48 @@ import java.util.List;
|
||||||
public class DataScopeConfig {
|
public class DataScopeConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户的数据范围权限类型
|
* 是否是全部的数据范围
|
||||||
|
* <p>
|
||||||
|
* 不限制数据范围的查询
|
||||||
*/
|
*/
|
||||||
private DataScopeTypeEnum dataScopeType;
|
private boolean totalDataScope = false;
|
||||||
|
|
||||||
|
//-------------------------------针对限制的用户的数据范围进行校验-------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限制的用户id
|
* 是否对创建人进行校验
|
||||||
|
*/
|
||||||
|
private boolean doCreateUserValidate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户拥有权限的用户id
|
||||||
|
* <p>
|
||||||
|
* 一般为用户自己的id
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户所在部门id
|
|
||||||
*/
|
|
||||||
private Long userDeptId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户所在公司id
|
|
||||||
*/
|
|
||||||
private Long userCompanyId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 指定机构的ID列表,仅在数据范围类型为 DEFINE 时使用
|
|
||||||
*/
|
|
||||||
private List<Long> specificOrgIds;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 限制组织机构范围的字段名称
|
|
||||||
*/
|
|
||||||
private String orgIdFieldName = ProjectDataScopeHandler.DEFAULT_ORG_ID_FIELD_NAME;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用来限制只查询自己数据的字段名称
|
* 用来限制只查询自己数据的字段名称
|
||||||
*/
|
*/
|
||||||
private String userIdFieldName = ProjectDataScopeHandler.DEFAULT_USER_ID_FIELD_NAME;
|
private String userIdFieldName = ProjectDataScopeHandler.DEFAULT_USER_ID_FIELD_NAME;
|
||||||
|
|
||||||
|
//-------------------------------针对限制的部门集合数据范围进行校验-------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否对机构的数据范围进行校验
|
||||||
|
*/
|
||||||
|
private boolean doOrgScopeValidate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户拥有权限的组织机构id集合
|
||||||
|
* <p>
|
||||||
|
* 通过角色权限表,计算出来的最终结果
|
||||||
|
*/
|
||||||
|
private Set<Long> userOrgIdList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限制组织机构范围的字段名称
|
||||||
|
*/
|
||||||
|
private String orgIdFieldName = ProjectDataScopeHandler.DEFAULT_ORG_ID_FIELD_NAME;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-db</artifactId>
|
<artifactId>kernel-d-db</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-ds-container</artifactId>
|
<artifactId>kernel-d-ds-container</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-ds-container</artifactId>
|
<artifactId>kernel-d-ds-container</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-ds-container</artifactId>
|
<artifactId>kernel-d-ds-container</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-ds-container</artifactId>
|
<artifactId>kernel-d-ds-container</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-email</artifactId>
|
<artifactId>kernel-d-email</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-email</artifactId>
|
<artifactId>kernel-d-email</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-email</artifactId>
|
<artifactId>kernel-d-email</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-email</artifactId>
|
<artifactId>kernel-d-email</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-event</artifactId>
|
<artifactId>kernel-d-event</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-event</artifactId>
|
<artifactId>kernel-d-event</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-event</artifactId>
|
<artifactId>kernel-d-event</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -82,4 +82,16 @@ public interface FileConstants {
|
||||||
*/
|
*/
|
||||||
String DEFAULT_AVATAR_FILE_OBJ_NAME = "defaultAvatar.png";
|
String DEFAULT_AVATAR_FILE_OBJ_NAME = "defaultAvatar.png";
|
||||||
|
|
||||||
|
//-------------------------------缓存相关-------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件信息缓存的前缀
|
||||||
|
*/
|
||||||
|
String FILE_INFO_CACHE_NAME_PREFIX = "FILE_INFO:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件信息缓存的过期时间
|
||||||
|
*/
|
||||||
|
Long FILE_CACHE_TIMEOUT_SECONDS = 3600L * 24 * 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对文件id的包装处理,返回文件可以访问的地址和文件的名称
|
* 针对文件id的包装处理,返回文件可以访问的地址和文件的名称
|
||||||
|
* <p>
|
||||||
|
* 通过缓存加速获取文件信息
|
||||||
*
|
*
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @since 2023/11/13 17:49
|
* @since 2023/11/13 17:49
|
||||||
|
|
|
@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Json响应,针对返回的文件信息,响应一个文件的具体url
|
* Json响应,针对返回的文件信息,响应一个文件的具体url
|
||||||
|
* <p>
|
||||||
|
* 通过缓存加速获取文件详情
|
||||||
*
|
*
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @since 2023/3/28 9:30
|
* @since 2023/3/28 9:30
|
||||||
|
|
|
@ -126,6 +126,12 @@ public class SysFileInfoResponse {
|
||||||
@ChineseDescription("存储路径")
|
@ChineseDescription("存储路径")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件的md5值
|
||||||
|
*/
|
||||||
|
@ChineseDescription("文件的md5值")
|
||||||
|
private String fileMd5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件访问的路径,如果是私密文件,则返回带鉴权的url,如果不是私密文件,则返回公网能直接访问的url
|
* 文件访问的路径,如果是私密文件,则返回带鉴权的url,如果不是私密文件,则返回公网能直接访问的url
|
||||||
*/
|
*/
|
||||||
|
@ -150,10 +156,4 @@ public class SysFileInfoResponse {
|
||||||
@ChineseDescription("上传时间")
|
@ChineseDescription("上传时间")
|
||||||
private Date uploadTime;
|
private Date uploadTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件的md5值
|
|
||||||
*/
|
|
||||||
@ChineseDescription("文件的md5值")
|
|
||||||
private String fileMd5;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -61,6 +61,20 @@
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--内存或者redis的缓存-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.javaguns.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-memory</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.javaguns.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-redis</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.stylefeng.roses.kernel.file.modular.cache;
|
||||||
|
|
||||||
|
import cn.hutool.cache.impl.TimedCache;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件信息的内存缓存
|
||||||
|
* <p>
|
||||||
|
* key是文件id,value是SysFileInfoResponse
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/14 16:58
|
||||||
|
*/
|
||||||
|
public class FileInfoMemoryCache extends AbstractMemoryCacheOperator<SysFileInfoResponse> {
|
||||||
|
|
||||||
|
public FileInfoMemoryCache(TimedCache<String, SysFileInfoResponse> timedCache) {
|
||||||
|
super(timedCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommonKeyPrefix() {
|
||||||
|
return FileConstants.FILE_INFO_CACHE_NAME_PREFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.stylefeng.roses.kernel.file.modular.cache;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件信息的Redis缓存
|
||||||
|
* <p>
|
||||||
|
* key是文件id,value是SysFileInfoResponse
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/14 16:58
|
||||||
|
*/
|
||||||
|
public class FileInfoRedisCache extends AbstractRedisCacheOperator<SysFileInfoResponse> {
|
||||||
|
|
||||||
|
public FileInfoRedisCache(RedisTemplate<String, SysFileInfoResponse> redisTemplate) {
|
||||||
|
super(redisTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommonKeyPrefix() {
|
||||||
|
return FileConstants.FILE_INFO_CACHE_NAME_PREFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.digest.MD5;
|
import cn.hutool.crypto.digest.MD5;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||||
|
@ -58,6 +59,7 @@ import cn.stylefeng.roses.kernel.file.modular.mapper.SysFileInfoMapper;
|
||||||
import cn.stylefeng.roses.kernel.file.modular.service.SysFileInfoService;
|
import cn.stylefeng.roses.kernel.file.modular.service.SysFileInfoService;
|
||||||
import cn.stylefeng.roses.kernel.file.modular.service.SysFileStorageService;
|
import cn.stylefeng.roses.kernel.file.modular.service.SysFileStorageService;
|
||||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
import cn.stylefeng.roses.kernel.rule.util.StrFilterUtil;
|
import cn.stylefeng.roses.kernel.rule.util.StrFilterUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
@ -100,40 +102,41 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
@Resource
|
@Resource
|
||||||
private SysFileStorageService sysFileStorageService;
|
private SysFileStorageService sysFileStorageService;
|
||||||
|
|
||||||
|
@Resource(name = "fileInfoCache")
|
||||||
|
private CacheOperatorApi<SysFileInfoResponse> fileInfoCache;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysFileInfoResponse getFileInfoResult(Long fileId) {
|
public SysFileInfoResponse getFileInfoResult(Long fileId) {
|
||||||
|
|
||||||
// 查询库中文件信息
|
// 查询库中文件信息
|
||||||
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
|
SysFileInfoResponse fileInfo = this.getFileInfoWithoutContent(fileId);
|
||||||
sysFileInfoRequest.setFileId(fileId);
|
if (fileInfo == null) {
|
||||||
SysFileInfo sysFileInfo = this.querySysFileInfo(sysFileInfoRequest);
|
throw new ServiceException(FileExceptionEnum.FILE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
// 获取文件字节码
|
// 获取文件字节码
|
||||||
byte[] fileBytes;
|
byte[] fileBytes;
|
||||||
try {
|
try {
|
||||||
// 如果是存储在数据库,从数据库中获取,其他的方式走FileOperatorApi
|
// 如果是存储在数据库,从数据库中获取,其他的方式走FileOperatorApi
|
||||||
if (FileLocationEnum.DB.getCode().equals(sysFileInfo.getFileLocation())) {
|
if (FileLocationEnum.DB.getCode().equals(fileInfo.getFileLocation())) {
|
||||||
SysFileStorage storage = sysFileStorageService.getById(fileId);
|
SysFileStorage storage = sysFileStorageService.getById(fileId);
|
||||||
// 如果在数据库中找不到这条记录,则从本地资源路径中找,因为有的文件字节较大不宜往数据库中存储
|
// 如果在数据库中找不到这条记录,则从本地资源路径中找,因为有的文件字节较大不宜往数据库中存储
|
||||||
if (storage == null) {
|
if (storage == null) {
|
||||||
fileBytes = ResourceUtil.readBytes("pics/" + sysFileInfo.getFileId() + "." + sysFileInfo.getFileSuffix());
|
fileBytes = ResourceUtil.readBytes("pics/" + fileInfo.getFileId() + "." + fileInfo.getFileSuffix());
|
||||||
} else {
|
} else {
|
||||||
fileBytes = storage.getFileBytes();
|
fileBytes = storage.getFileBytes();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileBytes = fileOperatorApi.getFileBytes(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName());
|
fileBytes = fileOperatorApi.getFileBytes(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取文件流异常,具体信息为:{}", e.getMessage());
|
log.error("获取文件异常,具体信息为:{}", e.getMessage());
|
||||||
throw new FileException(FileExceptionEnum.FILE_STREAM_ERROR, e.getMessage());
|
throw new FileException(FileExceptionEnum.FILE_STREAM_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置文件字节码
|
// 设置文件字节码
|
||||||
SysFileInfoResponse sysFileInfoResult = new SysFileInfoResponse();
|
fileInfo.setFileBytes(fileBytes);
|
||||||
BeanUtil.copyProperties(sysFileInfo, sysFileInfoResult);
|
return fileInfo;
|
||||||
sysFileInfoResult.setFileBytes(fileBytes);
|
|
||||||
|
|
||||||
return sysFileInfoResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -182,6 +185,9 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
// 存储新版本文件信息
|
// 存储新版本文件信息
|
||||||
this.save(newFileInfo);
|
this.save(newFileInfo);
|
||||||
|
|
||||||
|
// 删除文件信息的缓存
|
||||||
|
fileInfoCache.remove(oldFileInfo.getFileId().toString());
|
||||||
|
|
||||||
// 返回文件信息体
|
// 返回文件信息体
|
||||||
SysFileInfoResponse fileUploadInfoResult = new SysFileInfoResponse();
|
SysFileInfoResponse fileUploadInfoResult = new SysFileInfoResponse();
|
||||||
BeanUtil.copyProperties(newFileInfo, fileUploadInfoResult);
|
BeanUtil.copyProperties(newFileInfo, fileUploadInfoResult);
|
||||||
|
@ -231,6 +237,10 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
this.fileOperatorApi.deleteFile(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
|
this.fileOperatorApi.deleteFile(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除文件缓存
|
||||||
|
List<String> fileIdListString = fileInfos.stream().map(SysFileInfo::getFileId).map(String::valueOf).collect(Collectors.toList());
|
||||||
|
fileInfoCache.remove(fileIdListString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -440,15 +450,30 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
@Override
|
@Override
|
||||||
public SysFileInfoResponse getFileInfoWithoutContent(Long fileId) {
|
public SysFileInfoResponse getFileInfoWithoutContent(Long fileId) {
|
||||||
|
|
||||||
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
|
if (fileId == null) {
|
||||||
sysFileInfoRequest.setFileId(fileId);
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取文件的基本信息
|
// 先从缓存中获取文件信息详情
|
||||||
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
|
SysFileInfoResponse cachedResult = fileInfoCache.get(fileId.toString());
|
||||||
|
if (cachedResult != null) {
|
||||||
|
return cachedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SysFileInfo> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SysFileInfo::getFileId, fileId);
|
||||||
|
wrapper.select(SysFileInfo::getFileId, SysFileInfo::getFileCode, SysFileInfo::getFileVersion, SysFileInfo::getFileStatus, SysFileInfo::getFileSuffix, SysFileInfo::getFileSizeKb,
|
||||||
|
SysFileInfo::getFileSizeInfo, SysFileInfo::getSecretFlag, SysFileInfo::getFileObjectName, SysFileInfo::getFileLocation, SysFileInfo::getFileBucket, SysFileInfo::getFileOriginName,
|
||||||
|
SysFileInfo::getFilePath, SysFileInfo::getFileMd5);
|
||||||
|
SysFileInfo sysFileInfo = this.getOne(wrapper, false);
|
||||||
|
if (sysFileInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 转化实体
|
// 转化实体
|
||||||
SysFileInfoResponse sysFileInfoResponse = new SysFileInfoResponse();
|
SysFileInfoResponse sysFileInfoResponse = new SysFileInfoResponse();
|
||||||
BeanUtil.copyProperties(sysFileInfo, sysFileInfoResponse);
|
BeanUtil.copyProperties(sysFileInfo, sysFileInfoResponse);
|
||||||
|
fileInfoCache.put(fileId.toString(), sysFileInfoResponse, FileConstants.DEFAULT_FILE_TIMEOUT_SECONDS);
|
||||||
|
|
||||||
return sysFileInfoResponse;
|
return sysFileInfoResponse;
|
||||||
}
|
}
|
||||||
|
@ -461,33 +486,34 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
@Override
|
@Override
|
||||||
public String getFileAuthUrl(Long fileId, String token) {
|
public String getFileAuthUrl(Long fileId, String token) {
|
||||||
// 获取文件的基本信息
|
// 获取文件的基本信息
|
||||||
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
|
SysFileInfoResponse fileInfo = this.getFileInfoWithoutContent(fileId);
|
||||||
sysFileInfoRequest.setFileId(fileId);
|
if(fileInfo == null){
|
||||||
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
|
throw new ServiceException(FILE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
// 如果是数据库存储,则返回previewUrl
|
// 如果是数据库存储,则返回previewUrl
|
||||||
if (sysFileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
|
if (fileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
|
||||||
return this.sysFileStorageService.getFileAuthUrl(String.valueOf(fileId));
|
return this.sysFileStorageService.getFileAuthUrl(String.valueOf(fileId));
|
||||||
} else {
|
} else {
|
||||||
// 返回第三方存储文件url
|
// 返回第三方存储文件url
|
||||||
return fileOperatorApi.getFileAuthUrl(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName(),
|
return fileOperatorApi.getFileAuthUrl(fileInfo.getFileBucket(), fileInfo.getFileObjectName(), FileConfigExpander.getDefaultFileTimeoutSeconds());
|
||||||
FileConfigExpander.getDefaultFileTimeoutSeconds());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFileUnAuthUrl(Long fileId) {
|
public String getFileUnAuthUrl(Long fileId) {
|
||||||
// 获取文件的基本信息
|
// 获取文件的基本信息
|
||||||
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
|
SysFileInfoResponse fileInfo = this.getFileInfoWithoutContent(fileId);
|
||||||
sysFileInfoRequest.setFileId(fileId);
|
if(fileInfo == null){
|
||||||
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
|
throw new ServiceException(FILE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
// 如果是数据库存储,则返回previewUrl
|
// 如果是数据库存储,则返回previewUrl
|
||||||
if (sysFileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
|
if (fileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
|
||||||
return this.sysFileStorageService.getFileUnAuthUrl(String.valueOf(fileId));
|
return this.sysFileStorageService.getFileUnAuthUrl(String.valueOf(fileId));
|
||||||
} else {
|
} else {
|
||||||
// 返回第三方存储文件url
|
// 返回第三方存储文件url
|
||||||
return fileOperatorApi.getFileUnAuthUrl(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName());
|
return fileOperatorApi.getFileUnAuthUrl(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,10 +577,7 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
antdvFileInfo.setUid(String.valueOf(fileId));
|
antdvFileInfo.setUid(String.valueOf(fileId));
|
||||||
|
|
||||||
// 设置文件名称
|
// 设置文件名称
|
||||||
LambdaQueryWrapper<SysFileInfo> sysFileInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
SysFileInfoResponse sysFileInfo = this.getFileInfoWithoutContent(fileId);
|
||||||
sysFileInfoLambdaQueryWrapper.eq(SysFileInfo::getFileId, fileId);
|
|
||||||
sysFileInfoLambdaQueryWrapper.select(SysFileInfo::getFileOriginName, SysFileInfo::getFileSizeInfo, SysFileInfo::getFileSuffix);
|
|
||||||
SysFileInfo sysFileInfo = this.getOne(sysFileInfoLambdaQueryWrapper);
|
|
||||||
if (sysFileInfo == null) {
|
if (sysFileInfo == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-file</artifactId>
|
<artifactId>kernel-d-file</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -31,6 +31,20 @@
|
||||||
<version>${roses.version}</version>
|
<version>${roses.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--内存或者redis的缓存-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.javaguns.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-memory</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.javaguns.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-redis</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||||
|
*
|
||||||
|
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
|
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||||
|
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||||
|
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||||
|
*/
|
||||||
|
package cn.stylefeng.roses.kernel.file.starter.cache;
|
||||||
|
|
||||||
|
import cn.hutool.cache.CacheUtil;
|
||||||
|
import cn.hutool.cache.impl.TimedCache;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
|
||||||
|
import cn.stylefeng.roses.kernel.file.modular.cache.FileInfoMemoryCache;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件相关的缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/14 17:03
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnMissingClass("org.springframework.data.redis.connection.RedisConnectionFactory")
|
||||||
|
public class FileMemoryCacheAutoConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件相关的信息缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/14 17:04
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public CacheOperatorApi<SysFileInfoResponse> fileInfoCache() {
|
||||||
|
TimedCache<String, SysFileInfoResponse> cache = CacheUtil.newTimedCache(1000 * FileConstants.FILE_CACHE_TIMEOUT_SECONDS);
|
||||||
|
return new FileInfoMemoryCache(cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||||
|
*
|
||||||
|
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
|
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||||
|
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||||
|
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||||
|
*/
|
||||||
|
package cn.stylefeng.roses.kernel.file.starter.cache;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.redis.util.CreateRedisTemplateUtil;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
|
||||||
|
import cn.stylefeng.roses.kernel.file.modular.cache.FileInfoRedisCache;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件信息的缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/14 17:23
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(name = "org.springframework.data.redis.connection.RedisConnectionFactory")
|
||||||
|
public class FileRedisCacheAutoConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件信息的Redis缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2025/1/14 17:25
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public CacheOperatorApi<SysFileInfoResponse> fileInfoCache(RedisConnectionFactory redisConnectionFactory) {
|
||||||
|
RedisTemplate<String, SysFileInfoResponse> redisTemplate = CreateRedisTemplateUtil.createObject(redisConnectionFactory);
|
||||||
|
return new FileInfoRedisCache(redisTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,2 +1,4 @@
|
||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
cn.stylefeng.roses.kernel.file.starter.ProjectFileAutoConfiguration
|
cn.stylefeng.roses.kernel.file.starter.ProjectFileAutoConfiguration,\
|
||||||
|
cn.stylefeng.roses.kernel.file.starter.cache.FileRedisCacheAutoConfiguration,\
|
||||||
|
cn.stylefeng.roses.kernel.file.starter.cache.FileMemoryCacheAutoConfiguration
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-groovy</artifactId>
|
<artifactId>kernel-d-groovy</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-groovy</artifactId>
|
<artifactId>kernel-d-groovy</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-groovy</artifactId>
|
<artifactId>kernel-d-groovy</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-i18n</artifactId>
|
<artifactId>kernel-d-i18n</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-i18n</artifactId>
|
<artifactId>kernel-d-i18n</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-i18n</artifactId>
|
<artifactId>kernel-d-i18n</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-i18n</artifactId>
|
<artifactId>kernel-d-i18n</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-jwt</artifactId>
|
<artifactId>kernel-d-jwt</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-jwt</artifactId>
|
<artifactId>kernel-d-jwt</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-log</artifactId>
|
<artifactId>kernel-d-log</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-log</artifactId>
|
<artifactId>kernel-d-log</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-log</artifactId>
|
<artifactId>kernel-d-log</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||||
String searchText = logManagerRequest.getSearchText();
|
String searchText = logManagerRequest.getSearchText();
|
||||||
if (StrUtil.isNotEmpty(searchText)) {
|
if (StrUtil.isNotEmpty(searchText)) {
|
||||||
queryWrapper.nested(wrap -> {
|
queryWrapper.nested(wrap -> {
|
||||||
queryWrapper.likeRight(SysLog::getRequestUrl, searchText).or().likeRight(SysLog::getLogContent, searchText);
|
wrap.like(SysLog::getRequestUrl, searchText).or().like(SysLog::getLogContent, searchText);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-log</artifactId>
|
<artifactId>kernel-d-log</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-log</artifactId>
|
<artifactId>kernel-d-log</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-log</artifactId>
|
<artifactId>kernel-d-log</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-office</artifactId>
|
<artifactId>kernel-d-office</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-office</artifactId>
|
<artifactId>kernel-d-office</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-pinyin</artifactId>
|
<artifactId>kernel-d-pinyin</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-pinyin</artifactId>
|
<artifactId>kernel-d-pinyin</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-pinyin</artifactId>
|
<artifactId>kernel-d-pinyin</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-scanner</artifactId>
|
<artifactId>kernel-d-scanner</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-scanner</artifactId>
|
<artifactId>kernel-d-scanner</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-scanner</artifactId>
|
<artifactId>kernel-d-scanner</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>roses-kernel</artifactId>
|
<artifactId>roses-kernel</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-security</artifactId>
|
<artifactId>kernel-d-security</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-security</artifactId>
|
<artifactId>kernel-d-security</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-security</artifactId>
|
<artifactId>kernel-d-security</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-security</artifactId>
|
<artifactId>kernel-d-security</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.javaguns.roses</groupId>
|
<groupId>com.javaguns.roses</groupId>
|
||||||
<artifactId>kernel-d-security</artifactId>
|
<artifactId>kernel-d-security</artifactId>
|
||||||
<version>8.3.2</version>
|
<version>8.3.3</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue