Merge branch 'dev-7.1.6'

pull/28/head
fengshuonan 2022-02-28 17:11:10 +08:00
commit b745ec3229
477 changed files with 9061 additions and 3943 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,45 @@
/*
* 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.
*
* GunsAPACHE 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.annotation;
import java.lang.annotation.*;
/**
*
*
* @author fengshuonan
* @date 2022/1/12 20:48
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface BusinessLog {
/**
*
*/
boolean openLog() default true;
}

View File

@ -22,7 +22,7 @@
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.scanner.api.annotation.field;
package cn.stylefeng.roses.kernel.rule.annotation;
import java.lang.annotation.*;

View File

@ -80,7 +80,7 @@ public interface RuleConstants {
/**
*
*/
String CHINES_TRAN_LANGUAGE_CODE = "chinese";
String CHINESE_TRAN_LANGUAGE_CODE = "chinese";
/**
*

View File

@ -44,10 +44,11 @@ public interface SymbolConstant {
String AND = "&";
String POINT = ".";
String DOT = ".";
String SLASH = "/";
String BACK_SLASH = "\\";
String SPACE = " ";
}

View File

@ -65,6 +65,11 @@ public class ServiceException extends RuntimeException {
*/
private String moduleName;
/**
*
*/
private Object data;
/**
*
*/
@ -97,4 +102,15 @@ public class ServiceException extends RuntimeException {
this.userTip = exception.getUserTip();
}
/**
*
*/
public ServiceException(String moduleName, String errorCode, String userTip, Object data) {
super(userTip);
this.errorCode = errorCode;
this.moduleName = moduleName;
this.userTip = userTip;
this.data = data;
}
}

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.rule.pojo.dict;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
/**
@ -44,16 +45,19 @@ public class SimpleDict {
/**
* id
*/
@ChineseDescription("id")
private Long id;
/**
*
*/
@ChineseDescription("名称")
private String name;
/**
*
*/
@ChineseDescription("编码")
private String code;
}

View File

@ -35,7 +35,7 @@ import lombok.EqualsAndHashCode;
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ErrorResponseData extends ResponseData {
public class ErrorResponseData<T> extends ResponseData<T> {
/**
*
@ -58,7 +58,7 @@ public class ErrorResponseData extends ResponseData {
super(Boolean.FALSE, code, message, null);
}
public ErrorResponseData(String code, String message, Object object) {
public ErrorResponseData(String code, String message, T object) {
super(Boolean.FALSE, code, message, object);
}

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.rule.pojo.response;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
/**
@ -33,32 +34,36 @@ import lombok.Data;
* @date 2020/10/17 17:33
*/
@Data
public class ResponseData {
public class ResponseData<T> {
/**
*
*/
@ChineseDescription("请求是否成功")
private Boolean success;
/**
*
*/
@ChineseDescription("响应状态码")
private String code;
/**
*
*/
@ChineseDescription("响应信息")
private String message;
/**
*
*/
private Object data;
@ChineseDescription("响应对象")
private T data;
public ResponseData() {
}
public ResponseData(Boolean success, String code, String message, Object data) {
public ResponseData(Boolean success, String code, String message, T data) {
this.success = success;
this.code = code;
this.message = message;

View File

@ -32,17 +32,17 @@ import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
* @author fengshuonan
* @date 2020/10/16 16:23
*/
public class SuccessResponseData extends ResponseData {
public class SuccessResponseData<T> extends ResponseData<T> {
public SuccessResponseData() {
super(Boolean.TRUE, RuleConstants.SUCCESS_CODE, RuleConstants.SUCCESS_MESSAGE, null);
}
public SuccessResponseData(Object object) {
public SuccessResponseData(T object) {
super(Boolean.TRUE, RuleConstants.SUCCESS_CODE, RuleConstants.SUCCESS_MESSAGE, object);
}
public SuccessResponseData(String code, String message, Object object) {
public SuccessResponseData(String code, String message, T object) {
super(Boolean.TRUE, code, message, object);
}
}

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.rule.tree.ztree;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
import cn.stylefeng.roses.kernel.rule.tree.factory.base.AbstractTreeNode;
import lombok.EqualsAndHashCode;
@ -48,11 +49,13 @@ public class ZTreeNode implements AbstractTreeNode<ZTreeNode> {
*/
@Getter
@Setter
@ChineseDescription("节点id")
private Long id;
/**
* id
*/
@ChineseDescription("父节点id")
private Long pId;
/**
@ -60,6 +63,7 @@ public class ZTreeNode implements AbstractTreeNode<ZTreeNode> {
*/
@Getter
@Setter
@ChineseDescription("节点名称")
private String name;
/**
@ -67,6 +71,7 @@ public class ZTreeNode implements AbstractTreeNode<ZTreeNode> {
*/
@Getter
@Setter
@ChineseDescription("是否打开节点")
private Boolean open;
/**
@ -74,6 +79,7 @@ public class ZTreeNode implements AbstractTreeNode<ZTreeNode> {
*/
@Getter
@Setter
@ChineseDescription("是否被选中")
private Boolean checked;
/**
@ -81,6 +87,7 @@ public class ZTreeNode implements AbstractTreeNode<ZTreeNode> {
*/
@Getter
@Setter
@ChineseDescription("节点图标")
private String iconSkin;
/**
@ -88,6 +95,7 @@ public class ZTreeNode implements AbstractTreeNode<ZTreeNode> {
*/
@Getter
@Setter
@ChineseDescription("子节点集合")
private List<ZTreeNode> children;
/**

View File

@ -56,6 +56,11 @@ public class HttpServletUtil {
*/
private static final String LOCAL_IP = "127.0.0.1";
/**
* NginxIP
*/
private static final String AGENT_SOURCE_IP = "Agent-Source-Ip";
/**
* ipipv6
*/
@ -73,7 +78,7 @@ public class HttpServletUtil {
* @date 2020/10/15 17:48
*/
public static HttpServletRequest getRequest() {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
throw new ServiceException(ServletExceptionEnum.HTTP_CONTEXT_ERROR);
} else {
@ -88,7 +93,7 @@ public class HttpServletUtil {
* @date 2020/10/15 17:48
*/
public static HttpServletResponse getResponse() {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
throw new ServiceException(ServletExceptionEnum.HTTP_CONTEXT_ERROR);
} else {
@ -108,7 +113,7 @@ public class HttpServletUtil {
if (ObjectUtil.isEmpty(request)) {
return LOCAL_IP;
} else {
String remoteHost = ServletUtil.getClientIP(request);
String remoteHost = ServletUtil.getClientIP(request, AGENT_SOURCE_IP);
return LOCAL_REMOTE_HOST.equals(remoteHost) ? LOCAL_IP : remoteHost;
}
}
@ -151,7 +156,7 @@ public class HttpServletUtil {
HttpRequest http = HttpUtil.createGet(String.format(ipGeoApi, ip));
http.header(requestApiHeader, appCodeSymbol + " " + ipGeoAppCode);
resultJson = http.timeout(3000).execute().body();
resultJson = String.join("", (List<String>) JSONPath.read(resultJson, jsonPath));
resultJson = String.join("", (List<String>)JSONPath.read(resultJson, jsonPath));
}
} catch (Exception e) {
log.error("根据ip定位异常具体信息为{}", e.getMessage());
@ -192,8 +197,7 @@ public class HttpServletUtil {
* @date 2021/2/22 22:37
*/
public static Boolean getNormalRequestFlag(HttpServletRequest request) {
return request.getHeader("Accept") == null
|| request.getHeader("Accept").toLowerCase().contains("text/html");
return request.getHeader("Accept") == null || request.getHeader("Accept").toLowerCase().contains("text/html");
}
/**
@ -206,8 +210,7 @@ public class HttpServletUtil {
* @date 2021/2/22 22:37
*/
public static Boolean getJsonRequestFlag(HttpServletRequest request) {
return request.getHeader("Accept") == null
|| request.getHeader("Accept").toLowerCase().contains("application/json");
return request.getHeader("Accept") == null || request.getHeader("Accept").toLowerCase().contains("application/json");
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-auth</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -114,4 +114,11 @@ public interface AuthServiceApi {
*/
void checkAuth(String token, String requestUrl);
/**
*
*
* @author xixiaowei
* @date 2022/1/22 16:37
*/
void cancelFreeze(LoginRequest loginRequest);
}

View File

@ -45,7 +45,6 @@ public interface SessionManagerApi {
*
* @param token token
* @param loginUser
* @param loginUser
* @author fengshuonan
* @date 2020/10/19 16:47
*/

View File

@ -0,0 +1,25 @@
package cn.stylefeng.roses.kernel.auth.api.constants;
/**
*
*
* @author xixiaowei
* @date 2022/1/22 17:37
*/
public interface LoginCacheConstants {
/**
*
*/
Integer MAX_LOGIN_COUNT = 5;
/**
*
*/
String LOGIN_CACHE_PREFIX = "login:";
/**
*
*/
Long LOGIN_CACHE_TIMEOUT_SECONDS = 1800L;
}

View File

@ -121,7 +121,12 @@ public enum AuthExceptionEnum implements AbstractExceptionEnum {
/**
* 访
*/
CANT_REQUEST_UN_OPEN_API(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "17", "无法访问未经授权的接口未授权url为{}");
CANT_REQUEST_UN_OPEN_API(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "17", "无法访问未经授权的接口未授权url为{}"),
/**
*
*/
EXCEED_MAX_LOGIN_COUNT(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "18", "超过最大登录次数,帐号被锁定");
/**
*

View File

@ -0,0 +1,22 @@
package cn.stylefeng.roses.kernel.auth.api.expander;
import cn.stylefeng.roses.kernel.config.api.context.ConfigContext;
/**
*
*
* @author xixiaowei
* @date 2022/1/24 15:47
*/
public class LoginConfigExpander {
/**
*
*
* @author xixiaowei
* @date 2022/1/24 15:48
*/
public static boolean getAccountErrorDetectionFlag() {
return ConfigContext.me().getSysConfigValueWithDefault("ACCOUNT_ERROR_DETECTION", Boolean.class, false);
}
}

View File

@ -24,8 +24,8 @@
*/
package cn.stylefeng.roses.kernel.auth.api.pojo.auth;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.scanner.api.annotation.field.ChineseDescription;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -26,7 +26,7 @@ package cn.stylefeng.roses.kernel.auth.api.pojo.auth;
import cn.hutool.core.bean.BeanUtil;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.scanner.api.annotation.field.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
/**

View File

@ -30,8 +30,8 @@ import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.auth.api.enums.DataScopeTypeEnum;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleRoleInfo;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleUserInfo;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.scanner.api.annotation.field.ChineseDescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@ -160,7 +160,7 @@ public class LoginUser implements Serializable {
*
*/
@ChineseDescription("当前用户语种的标识")
private String tranLanguageCode = RuleConstants.CHINES_TRAN_LANGUAGE_CODE;
private String tranLanguageCode = RuleConstants.CHINESE_TRAN_LANGUAGE_CODE;
/**
*

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-auth</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -126,6 +126,11 @@
<version>${roses.version}</version>
</dependency>
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>system-business-user</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -36,10 +36,12 @@ import cn.hutool.http.HttpResponse;
import cn.stylefeng.roses.kernel.auth.api.AuthServiceApi;
import cn.stylefeng.roses.kernel.auth.api.SessionManagerApi;
import cn.stylefeng.roses.kernel.auth.api.constants.AuthConstants;
import cn.stylefeng.roses.kernel.auth.api.constants.LoginCacheConstants;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.exception.AuthException;
import cn.stylefeng.roses.kernel.auth.api.exception.enums.AuthExceptionEnum;
import cn.stylefeng.roses.kernel.auth.api.expander.AuthConfigExpander;
import cn.stylefeng.roses.kernel.auth.api.expander.LoginConfigExpander;
import cn.stylefeng.roses.kernel.auth.api.password.PasswordStoredEncryptApi;
import cn.stylefeng.roses.kernel.auth.api.password.PasswordTransferEncryptApi;
import cn.stylefeng.roses.kernel.auth.api.pojo.SsoProperties;
@ -47,6 +49,7 @@ import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginWithTokenRequest;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
import cn.stylefeng.roses.kernel.demo.expander.DemoConfigExpander;
import cn.stylefeng.roses.kernel.jwt.JwtTokenOperator;
import cn.stylefeng.roses.kernel.jwt.api.context.JwtContext;
@ -66,6 +69,8 @@ import cn.stylefeng.roses.kernel.system.api.ResourceServiceApi;
import cn.stylefeng.roses.kernel.system.api.UserServiceApi;
import cn.stylefeng.roses.kernel.system.api.enums.UserStatusEnum;
import cn.stylefeng.roses.kernel.system.api.pojo.user.UserLoginInfoDTO;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import cn.stylefeng.roses.kernel.validator.api.exception.enums.ValidatorExceptionEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -119,6 +124,12 @@ public class AuthServiceImpl implements AuthServiceApi {
@Resource
private ResourceServiceApi resourceServiceApi;
@Resource
private SysUserService sysUserService;
@Resource
private CacheOperatorApi<String> loginCacheOperatorApi;
@Override
public LoginResponse login(LoginRequest loginRequest) {
return loginAction(loginRequest, true, null);
@ -254,6 +265,25 @@ public class AuthServiceImpl implements AuthServiceApi {
* @date 2020/10/21 16:59
*/
private LoginResponse loginAction(LoginRequest loginRequest, Boolean validatePassword, String caToken) {
SysUser userByAccount = sysUserService.getUserByAccount(loginRequest.getAccount());
// 判断登录错误检测是否开启
if (LoginConfigExpander.getAccountErrorDetectionFlag()) {
// 判断错误次数,超过最大放入缓存中
if (StrUtil.isBlank(loginCacheOperatorApi.get(userByAccount.getUserId().toString()))) {
if (userByAccount.getLoginCount() > LoginCacheConstants.MAX_LOGIN_COUNT) {
loginCacheOperatorApi.put(userByAccount.getUserId().toString(), "true", 1800L);
throw new AuthException(AuthExceptionEnum.EXCEED_MAX_LOGIN_COUNT);
}
} else {
throw new AuthException(AuthExceptionEnum.EXCEED_MAX_LOGIN_COUNT);
}
}
// 5. 获取用户密码的加密值和用户的状态
UserLoginInfoDTO userValidateInfo = userServiceApi.getUserLoginInfo(loginRequest.getAccount());
// 8. 获取LoginUser用于用户的缓存
LoginUser loginUser = userValidateInfo.getLoginUser();
// 1.参数为空校验
if (validatePassword) {
@ -275,6 +305,8 @@ public class AuthServiceImpl implements AuthServiceApi {
throw new AuthException(ValidatorExceptionEnum.CAPTCHA_EMPTY);
}
if (!captchaApi.validateCaptcha(verKey, verCode)) {
// 登录失败日志
loginLogServiceApi.loginFail(loginUser.getUserId(), "验证码错误");
throw new AuthException(ValidatorExceptionEnum.CAPTCHA_ERROR);
}
}
@ -288,6 +320,8 @@ public class AuthServiceImpl implements AuthServiceApi {
throw new AuthException(ValidatorExceptionEnum.CAPTCHA_EMPTY);
}
if (!dragCaptchaApi.validateCaptcha(verKey, Convert.toInt(verXLocationValue))) {
// 登录失败日志
loginLogServiceApi.loginFail(loginUser.getUserId(), "拖拽验证码错误");
throw new AuthException(ValidatorExceptionEnum.DRAG_CAPTCHA_ERROR);
}
}
@ -308,13 +342,15 @@ public class AuthServiceImpl implements AuthServiceApi {
return new LoginResponse(remoteLoginCode);
}
// 5. 获取用户密码的加密值和用户的状态
UserLoginInfoDTO userValidateInfo = userServiceApi.getUserLoginInfo(loginRequest.getAccount());
// 6. 校验用户密码是否正确
if (validatePassword) {
Boolean checkResult = passwordStoredEncryptApi.checkPassword(loginRequest.getPassword(), userValidateInfo.getUserPasswordHexed());
if (!checkResult) {
//更新登录次数
userByAccount.setLoginCount(userByAccount.getLoginCount() + 1);
sysUserService.updateById(userByAccount);
// 登录失败日志
loginLogServiceApi.loginFail(loginUser.getUserId(), "帐号或密码错误");
throw new AuthException(AuthExceptionEnum.USERNAME_PASSWORD_ERROR);
}
}
@ -324,9 +360,6 @@ public class AuthServiceImpl implements AuthServiceApi {
throw new AuthException(AuthExceptionEnum.USER_STATUS_ERROR, UserStatusEnum.getCodeMessage(userValidateInfo.getUserStatus()));
}
// 8. 获取LoginUser用于用户的缓存
LoginUser loginUser = userValidateInfo.getLoginUser();
// 9. 生成用户的token
DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), loginRequest.getRememberMe(), caToken);
String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload);
@ -355,6 +388,10 @@ public class AuthServiceImpl implements AuthServiceApi {
String ip = HttpServletUtil.getRequestClientIp(HttpServletUtil.getRequest());
userServiceApi.updateUserLoginInfo(loginUser.getUserId(), new Date(), ip);
//重置登录次数
userByAccount.setLoginCount(1);
sysUserService.updateById(userByAccount);
// 13.登录成功日志
loginLogServiceApi.loginSuccess(loginUser.getUserId());
}
@ -403,4 +440,13 @@ public class AuthServiceImpl implements AuthServiceApi {
return loginCode;
}
@Override
public void cancelFreeze(LoginRequest loginRequest) {
SysUser sysUser = sysUserService.getUserByAccount(loginRequest.getAccount());
sysUser.setLoginCount(1);
// 修改数据库中的登录次数
sysUserService.updateById(sysUser);
// 删除缓存中的数据
loginCacheOperatorApi.remove(sysUser.getUserId().toString());
}
}

View File

@ -24,7 +24,6 @@
*/
package cn.stylefeng.roses.kernel.auth.auth;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.auth.api.LoginUserApi;
import cn.stylefeng.roses.kernel.auth.api.SessionManagerApi;
import cn.stylefeng.roses.kernel.auth.api.context.LoginUserHolder;
@ -32,9 +31,6 @@ import cn.stylefeng.roses.kernel.auth.api.exception.AuthException;
import cn.stylefeng.roses.kernel.auth.api.exception.enums.AuthExceptionEnum;
import cn.stylefeng.roses.kernel.auth.api.loginuser.CommonLoginUserUtil;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.dsctn.api.constants.DatasourceContainerConstants;
import cn.stylefeng.roses.kernel.dsctn.api.context.CurrentDataSourceContext;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.system.api.UserServiceApi;
import org.springframework.stereotype.Service;
@ -80,19 +76,7 @@ public class LoginUserImpl implements LoginUserApi {
throw new AuthException(AuthExceptionEnum.AUTH_EXPIRED_ERROR);
}
// 获取当前上下文的数据源名称
String dataSourceName = CurrentDataSourceContext.getDataSourceName();
// 如果当前用户有租户编码,则需要切下数据源
if (ObjectUtil.isNotEmpty(session.getTenantCode()) && !session.getTenantCode().equals(DatasourceContainerConstants.MASTER_DATASOURCE_NAME)) {
CurrentDataSourceContext.setDataSourceName(RuleConstants.TENANT_DB_PREFIX + session.getTenantCode());
}
try {
// 从新组装一次loginUser保证loginUser中数据的时效性
return userServiceApi.getEffectiveLoginUser(session);
} finally {
CurrentDataSourceContext.setDataSourceName(dataSourceName);
}
return session;
}
@Override

View File

@ -0,0 +1,23 @@
package cn.stylefeng.roses.kernel.auth.cache;
import cn.hutool.cache.impl.TimedCache;
import cn.stylefeng.roses.kernel.auth.api.constants.LoginCacheConstants;
import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator;
/**
*
*
* @author xixiaowei
* @date 2022/1/22 17:33
*/
public class LoginMemoryCache extends AbstractMemoryCacheOperator<String> {
public LoginMemoryCache(TimedCache<String, String> timedCache) {
super(timedCache);
}
@Override
public String getCommonKeyPrefix() {
return LoginCacheConstants.LOGIN_CACHE_PREFIX;
}
}

View File

@ -0,0 +1,23 @@
package cn.stylefeng.roses.kernel.auth.cache;
import cn.stylefeng.roses.kernel.auth.api.constants.LoginCacheConstants;
import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator;
import org.springframework.data.redis.core.RedisTemplate;
/**
*
*
* @author xixiaowei
* @date 2022/1/23 23:34
*/
public class LoginRedisCache extends AbstractRedisCacheOperator<String> {
public LoginRedisCache(RedisTemplate<String, String> redisTemplate) {
super(redisTemplate);
}
@Override
public String getCommonKeyPrefix() {
return LoginCacheConstants.LOGIN_CACHE_PREFIX;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-auth</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,33 @@
package cn.stylefeng.roses.kernel.auth.starter;
import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import cn.stylefeng.roses.kernel.auth.api.constants.LoginCacheConstants;
import cn.stylefeng.roses.kernel.auth.cache.LoginMemoryCache;
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
*
*
* @author xixiaowei
* @date 2022/1/22 17:40
*/
@Configuration
public class GunsLoginCacheAutoConfiguration {
/**
*
*
* @author xixiaowei
* @date 2022/1/22 17:45
*/
@Bean
@ConditionalOnMissingBean(name = "loginCacheOperatorApi")
public CacheOperatorApi<String> loginCacheOperatorApi() {
TimedCache<String, String> loginTimeCache = CacheUtil.newTimedCache(LoginCacheConstants.LOGIN_CACHE_TIMEOUT_SECONDS * 1000);
return new LoginMemoryCache(loginTimeCache);
}
}

View File

@ -1,3 +1,4 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.stylefeng.roses.kernel.auth.starter.GunsAuthAutoConfiguration,\
cn.stylefeng.roses.kernel.auth.starter.GunsSsoAutoConfiguration
cn.stylefeng.roses.kernel.auth.starter.GunsSsoAutoConfiguration,\
cn.stylefeng.roses.kernel.auth.starter.GunsLoginCacheAutoConfiguration

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -1,5 +1,6 @@
package cn.stylefeng.roses.kernel.config.api.pojo;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -18,21 +19,25 @@ public class ConfigInitItem {
/**
*
*/
@ChineseDescription("配置中文名称")
private String configName;
/**
*
*/
@ChineseDescription("配置编码")
private String configCode;
/**
*
*/
@ChineseDescription("配置初始化值")
private String configValue;
/**
*
*/
@ChineseDescription("配置的描述")
private String configDescription;
}

View File

@ -1,5 +1,6 @@
package cn.stylefeng.roses.kernel.config.api.pojo;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
import java.util.Map;
@ -18,6 +19,7 @@ public class ConfigInitRequest {
* <p>
* keyvalue
*/
@ChineseDescription("系统配置集合")
private Map<String, String> sysConfigs;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -24,9 +24,12 @@
*/
package cn.stylefeng.roses.kernel.config.modular.controller;
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitItem;
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitRequest;
import cn.stylefeng.roses.kernel.config.modular.entity.SysConfig;
import cn.stylefeng.roses.kernel.config.modular.param.SysConfigParam;
import cn.stylefeng.roses.kernel.config.modular.service.SysConfigService;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
@ -37,7 +40,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
*
@ -59,9 +62,9 @@ public class SysConfigController {
* @date 2020/4/14 11:11
*/
@PostResource(name = "添加系统参数配置", path = "/sysConfig/add")
public ResponseData add(@RequestBody @Validated(SysConfigParam.add.class) SysConfigParam sysConfigParam) {
public ResponseData<?> add(@RequestBody @Validated(SysConfigParam.add.class) SysConfigParam sysConfigParam) {
sysConfigService.add(sysConfigParam);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -71,9 +74,9 @@ public class SysConfigController {
* @date 2020/4/14 11:11
*/
@PostResource(name = "删除系统参数配置", path = "/sysConfig/delete")
public ResponseData delete(@RequestBody @Validated(SysConfigParam.delete.class) SysConfigParam sysConfigParam) {
public ResponseData<?> delete(@RequestBody @Validated(SysConfigParam.delete.class) SysConfigParam sysConfigParam) {
sysConfigService.del(sysConfigParam);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -83,9 +86,9 @@ public class SysConfigController {
* @date 2020/4/14 11:11
*/
@PostResource(name = "编辑系统参数配置", path = "/sysConfig/edit")
public ResponseData edit(@RequestBody @Validated(SysConfigParam.edit.class) SysConfigParam sysConfigParam) {
public ResponseData<?> edit(@RequestBody @Validated(SysConfigParam.edit.class) SysConfigParam sysConfigParam) {
sysConfigService.edit(sysConfigParam);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -95,8 +98,8 @@ public class SysConfigController {
* @date 2020/4/14 11:12
*/
@GetResource(name = "查看系统参数配置", path = "/sysConfig/detail")
public ResponseData detail(@Validated(SysConfigParam.detail.class) SysConfigParam sysConfigParam) {
return new SuccessResponseData(sysConfigService.detail(sysConfigParam));
public ResponseData<SysConfig> detail(@Validated(SysConfigParam.detail.class) SysConfigParam sysConfigParam) {
return new SuccessResponseData<>(sysConfigService.detail(sysConfigParam));
}
@ -107,8 +110,8 @@ public class SysConfigController {
* @date 2020/4/14 11:10
*/
@GetResource(name = "分页查询配置列表", path = "/sysConfig/page")
public ResponseData page(SysConfigParam sysConfigParam) {
return new SuccessResponseData(sysConfigService.findPage(sysConfigParam));
public ResponseData<PageResult<SysConfig>> page(SysConfigParam sysConfigParam) {
return new SuccessResponseData<>(sysConfigService.findPage(sysConfigParam));
}
/**
@ -118,8 +121,8 @@ public class SysConfigController {
* @date 2020/4/14 11:10
*/
@GetResource(name = "系统参数配置列表", path = "/sysConfig/list")
public ResponseData list(SysConfigParam sysConfigParam) {
return new SuccessResponseData(sysConfigService.findList(sysConfigParam));
public ResponseData<List<SysConfig>> list(SysConfigParam sysConfigParam) {
return new SuccessResponseData<>(sysConfigService.findList(sysConfigParam));
}
/**
@ -129,8 +132,8 @@ public class SysConfigController {
* @date 2021/7/8 17:20
*/
@GetResource(name = "获取系统配置是否初始化的标志", path = "/sysConfig/getInitConfigFlag", requiredPermission = false)
public ResponseData getInitConfigFlag() {
return new SuccessResponseData(sysConfigService.getInitConfigFlag());
public ResponseData<Boolean> getInitConfigFlag() {
return new SuccessResponseData<>(sysConfigService.getInitConfigFlag());
}
/**
@ -140,9 +143,9 @@ public class SysConfigController {
* @date 2021/7/8 16:36
*/
@PostResource(name = "初始化系统配置参数,用在系统第一次登录时", path = "/sysConfig/initConfig", requiredPermission = false)
public ResponseData initConfig(@RequestBody ConfigInitRequest configInitRequest) {
public ResponseData<?> initConfig(@RequestBody ConfigInitRequest configInitRequest) {
sysConfigService.initConfig(configInitRequest);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -152,8 +155,8 @@ public class SysConfigController {
* @date 2021/7/8 16:36
*/
@GetResource(name = "获取需要初始化的配置列表", path = "/sysConfig/getInitConfigList")
public ResponseData getInitConfigList() {
return new SuccessResponseData(sysConfigService.getInitConfigs());
public ResponseData<List<ConfigInitItem>> getInitConfigList() {
return new SuccessResponseData<>(sysConfigService.getInitConfigs());
}
}

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.config.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -46,54 +47,63 @@ public class SysConfig extends BaseEntity {
*
*/
@TableId(value = "config_id", type = IdType.ASSIGN_ID)
@ChineseDescription("主键id")
private Long configId;
/**
*
*/
@TableField("config_name")
@ChineseDescription("名称")
private String configName;
/**
*
*/
@TableField("config_code")
@ChineseDescription("编码")
private String configCode;
/**
*
*/
@TableField("config_value")
@ChineseDescription("属性值")
private String configValue;
/**
* Y-N-
*/
@TableField("sys_flag")
@ChineseDescription("是否是系统参数Y-是N-否")
private String sysFlag;
/**
*
*/
@TableField("remark")
@ChineseDescription("备注")
private String remark;
/**
* 1-2
*/
@TableField("status_flag")
@ChineseDescription("状态1-正常2停用")
private Integer statusFlag;
/**
*
*/
@TableField("group_code")
@ChineseDescription("常量所属分类的编码")
private String groupCode;
/**
* Y-N-
*/
@TableField(value = "del_flag", fill = FieldFill.INSERT)
@ChineseDescription("是否删除Y-被删除N-未删除")
private String delFlag;
}

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.config.modular.param;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.validator.api.validators.flag.FlagValue;
import lombok.Data;
@ -46,24 +47,28 @@ public class SysConfigParam extends BaseRequest {
*
*/
@NotNull(message = "configId不能为空", groups = {edit.class, delete.class, detail.class})
@ChineseDescription("主键")
private Long configId;
/**
*
*/
@NotBlank(message = "名称不能为空", groups = {add.class, edit.class})
@ChineseDescription("名称")
private String configName;
/**
*
*/
@NotBlank(message = "编码不能为空", groups = {add.class, edit.class})
@ChineseDescription("编码")
private String configCode;
/**
*
*/
@NotBlank(message = "配置值不能为空", groups = {add.class, edit.class})
@ChineseDescription("配置值")
private String configValue;
/**
@ -71,22 +76,26 @@ public class SysConfigParam extends BaseRequest {
*/
@NotBlank(message = "是否是系统参数不能为空", groups = {add.class, edit.class})
@FlagValue(message = "是否是系统参数格式错误正确格式应该Y或者N", groups = {add.class, edit.class})
@ChineseDescription("是否系统参数")
private String sysFlag;
/**
*
*/
@ChineseDescription("备注")
private String remark;
/**
* 1-2
*/
@ChineseDescription("状态")
private Integer statusFlag;
/**
*
*/
@NotBlank(message = "量所属分类的编码不能为空", groups = {add.class, edit.class})
@ChineseDescription("常量所属分类的编码")
private String groupCode;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.db.api.pojo.page;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
import java.io.Serializable;
@ -43,26 +44,31 @@ public class PageResult<T> implements Serializable {
/**
*
*/
@ChineseDescription("第几页,从1开始")
private Integer pageNo = 1;
/**
*
*/
@ChineseDescription("每页条数")
private Integer pageSize = 20;
/**
*
*/
@ChineseDescription("总页数")
private Integer totalPage = 0;
/**
*
*/
@ChineseDescription("总记录数")
private Integer totalRows = 0;
/**
*
*/
@ChineseDescription("结果集")
private List<T> rows;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -66,26 +66,26 @@ public class CustomDatabaseIdProvider implements DatabaseIdProvider {
} catch (Exception e2) {
log.warn("CustomDatabaseIdProvider无法判断当前数据源类型默认选择Mysql类型");
return DbTypeEnum.MYSQL.getUrlWords();
return DbTypeEnum.MYSQL.getXmlDatabaseId();
}
}
// 达梦和oracle使用同一种
if (url.contains(DbTypeEnum.ORACLE.getUrlWords())) {
return DbTypeEnum.ORACLE.getUrlWords();
return DbTypeEnum.ORACLE.getXmlDatabaseId();
}
if (url.contains(DbTypeEnum.DM.getUrlWords())) {
return DbTypeEnum.ORACLE.getUrlWords();
return DbTypeEnum.ORACLE.getXmlDatabaseId();
}
if (url.contains(DbTypeEnum.MS_SQL.getUrlWords())) {
return DbTypeEnum.MS_SQL.getUrlWords();
return DbTypeEnum.MS_SQL.getXmlDatabaseId();
}
if (url.contains(DbTypeEnum.PG_SQL.getUrlWords())) {
return DbTypeEnum.PG_SQL.getUrlWords();
return DbTypeEnum.PG_SQL.getXmlDatabaseId();
}
return DbTypeEnum.MYSQL.getUrlWords();
return DbTypeEnum.MYSQL.getXmlDatabaseId();
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -37,7 +37,6 @@
<artifactId>db-sdk-flyway</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,59 @@
package cn.stylefeng.roses.kernel.db.starter;
import cn.stylefeng.roses.kernel.db.api.pojo.druid.DruidProperties;
import com.alibaba.druid.util.Utils;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.*;
import java.io.IOException;
@Configuration
@AutoConfigureBefore(DataSourceAutoConfiguration.class)
public class RemoveDruidAdConfig {
/**
* 广
*
* @author xixiaowei
* @date 2022/1/24 15:23
*/
@Bean
public FilterRegistrationBean removeDruidAdFilterRegistrationBean() {
// 提取common.js的配置路径
String pattern = "/druid/*";
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
final String filePath = "support/http/resources/js/common.js";
//创建filter进行过滤
Filter filter = new Filter() {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, response);
// 重置缓冲区,响应头不会被重置
response.resetBuffer();
// 获取common.js
String text = Utils.readFromResource(filePath);
// 正则替换banner, 除去底部的广告信息
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
text = text.replaceAll("powered.*?shrek.wang</a>", "");
response.getWriter().write(text);
}
@Override
public void destroy() {
}
};
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(filter);
registrationBean.addUrlPatterns(commonJsPattern);
return registrationBean;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.dsctn.api.pojo.request;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.validator.api.validators.unique.TableUniqueValue;
import lombok.Data;
@ -48,6 +49,7 @@ public class DatabaseInfoRequest extends BaseRequest {
* id
*/
@NotNull(message = "dbId不能为空", groups = {edit.class, delete.class, detail.class})
@ChineseDescription("主键id")
private Long dbId;
/**
@ -61,45 +63,53 @@ public class DatabaseInfoRequest extends BaseRequest {
columnName = "db_name",
idFieldName = "db_id",
excludeLogicDeleteItems = true)
@ChineseDescription("数据库名称(英文名称)")
private String dbName;
/**
* jdbc
*/
@NotBlank(message = "jdbc的驱动类型为空", groups = {add.class, edit.class})
@ChineseDescription("jdbc的驱动类型")
private String jdbcDriver;
/**
* jdbcurl
*/
@NotBlank(message = "jdbc的url", groups = {add.class, edit.class})
@ChineseDescription("jdbc的url")
private String jdbcUrl;
/**
*
*/
@NotBlank(message = "数据库连接的账号", groups = {add.class, edit.class})
@ChineseDescription("数据库连接的账号")
private String username;
/**
*
*/
@NotBlank(message = "数据库连接密码", groups = {add.class, edit.class})
@ChineseDescription("数据库连接密码")
private String password;
/**
* schemaNameschema
*/
@ChineseDescription("数据库schemaName")
private String schemaName;
/**
* 1-2-
*/
@ChineseDescription("状态标识1-正常2-无法连接")
private Integer statusFlag;
/**
*
*/
@ChineseDescription("备注")
private String remarks;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -28,6 +28,7 @@ import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.dsctn.api.pojo.request.DatabaseInfoRequest;
import cn.stylefeng.roses.kernel.dsctn.modular.entity.DatabaseInfo;
import cn.stylefeng.roses.kernel.dsctn.modular.service.DatabaseInfoService;
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
@ -62,9 +63,10 @@ public class DatabaseInfoController {
* @date 2020/11/1 22:16
*/
@PostResource(name = "新增数据源", path = "/databaseInfo/add")
public ResponseData add(@RequestBody @Validated(BaseRequest.add.class) DatabaseInfoRequest databaseInfoRequest) {
@BusinessLog
public ResponseData<?> add(@RequestBody @Validated(BaseRequest.add.class) DatabaseInfoRequest databaseInfoRequest) {
databaseInfoService.add(databaseInfoRequest);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -74,9 +76,10 @@ public class DatabaseInfoController {
* @date 2020/11/1 22:18
*/
@PostResource(name = "删除数据源", path = "/databaseInfo/delete")
public ResponseData del(@RequestBody @Validated(DatabaseInfoRequest.delete.class) DatabaseInfoRequest databaseInfoRequest) {
@BusinessLog
public ResponseData<?> del(@RequestBody @Validated(DatabaseInfoRequest.delete.class) DatabaseInfoRequest databaseInfoRequest) {
databaseInfoService.del(databaseInfoRequest);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -86,9 +89,10 @@ public class DatabaseInfoController {
* @date 2020/11/1 22:16
*/
@PostResource(name = "编辑数据源", path = "/databaseInfo/edit")
public ResponseData edit(@RequestBody @Validated(DatabaseInfoRequest.edit.class) DatabaseInfoRequest databaseInfoRequest) {
@BusinessLog
public ResponseData<?> edit(@RequestBody @Validated(DatabaseInfoRequest.edit.class) DatabaseInfoRequest databaseInfoRequest) {
databaseInfoService.edit(databaseInfoRequest);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -98,9 +102,9 @@ public class DatabaseInfoController {
* @date 2020/11/1 22:18
*/
@GetResource(name = "查询数据源列表(带分页)", path = "/databaseInfo/page")
public ResponseData findPage(DatabaseInfoRequest databaseInfoRequest) {
public ResponseData<PageResult<DatabaseInfo>> findPage(DatabaseInfoRequest databaseInfoRequest) {
PageResult<DatabaseInfo> pageResult = databaseInfoService.findPage(databaseInfoRequest);
return new SuccessResponseData(pageResult);
return new SuccessResponseData<>(pageResult);
}
/**
@ -110,9 +114,9 @@ public class DatabaseInfoController {
* @date 2020/11/1 22:18
*/
@GetResource(name = "查询所有数据源列表", path = "/databaseInfo/list")
public ResponseData findList(DatabaseInfoRequest databaseInfoRequest) {
public ResponseData<List<DatabaseInfo>> findList(DatabaseInfoRequest databaseInfoRequest) {
List<DatabaseInfo> databaseInfos = databaseInfoService.findList(databaseInfoRequest);
return new SuccessResponseData(databaseInfos);
return new SuccessResponseData<>(databaseInfos);
}
/**
@ -122,9 +126,9 @@ public class DatabaseInfoController {
* @date 2021/1/23 20:29
*/
@GetResource(name = "查询数据源详情", path = "/databaseInfo/detail")
public ResponseData detail(@Validated(BaseRequest.detail.class) DatabaseInfoRequest databaseInfoRequest) {
public ResponseData<DatabaseInfo> detail(@Validated(BaseRequest.detail.class) DatabaseInfoRequest databaseInfoRequest) {
DatabaseInfo databaseInfo = databaseInfoService.detail(databaseInfoRequest);
return new SuccessResponseData(databaseInfo);
return new SuccessResponseData<>(databaseInfo);
}
}

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.dsctn.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -46,60 +47,70 @@ public class DatabaseInfo extends BaseEntity {
* id
*/
@TableId(value = "db_id", type = IdType.ASSIGN_ID)
@ChineseDescription("主键id")
private Long dbId;
/**
*
*/
@TableField("db_name")
@ChineseDescription("数据库名称(英文名称)")
private String dbName;
/**
* jdbc
*/
@TableField("jdbc_driver")
@ChineseDescription("jdbc的驱动类型")
private String jdbcDriver;
/**
* jdbcurl
*/
@TableField("jdbc_url")
@ChineseDescription("jdbc的url")
private String jdbcUrl;
/**
*
*/
@TableField("username")
@ChineseDescription("数据库连接的账号")
private String username;
/**
*
*/
@TableField("password")
@ChineseDescription("数据库连接密码")
private String password;
/**
* schemaschema
*/
@TableField("schema_name")
@ChineseDescription("数据库的schema名称")
private String schemaName;
/**
* 1-2-
*/
@TableField("status_flag")
@ChineseDescription("状态标识1-正常2-无法连接")
private Integer statusFlag;
/**
*
*/
@TableField("error_description")
@ChineseDescription("无法连接原因")
private String errorDescription;
/**
*
*/
@TableField("remarks")
@ChineseDescription("备注")
private String remarks;
/**

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -65,4 +65,14 @@ public interface FileInfoApi {
*/
String getFileAuthUrl(Long fileId, String token);
/**
*
*
* @param fileId id
* @return 访url
* @author fengshuonan
* @date 2020/10/26 10:40
*/
String getFileUnAuthUrl(Long fileId);
}

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.file.api;
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
import java.io.InputStream;
@ -188,4 +189,12 @@ public interface FileOperatorApi {
*/
void deleteFile(String bucketName, String key);
/**
* api
*
* @author fengshuonan
* @date 2022/1/2 20:50
*/
FileLocationEnum getFileLocationEnum();
}

View File

@ -53,7 +53,12 @@ public enum FileLocationEnum {
/**
*
*/
LOCAL(4);
LOCAL(4),
/**
*
*/
DB(5);
private final Integer code;

View File

@ -106,14 +106,4 @@ public class FileConfigExpander {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOCAL_FILE_SAVE_PATH_WINDOWS", String.class, new LocalFileProperties().getLocalFileSavePathWin());
}
/**
* base64
*
* @author fengshuonan
* @date 2020/12/29 20:10
*/
public static String getDefaultAvatarBase64() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_DEFAULT_AVATAR_BASE64", String.class, FileConstants.DEFAULT_BASE_64_AVATAR);
}
}

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.file.api.pojo.request;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -48,6 +49,7 @@ public class SysFileInfoRequest extends BaseRequest {
* ID
*/
@NotNull(message = "fileId不能为空", groups = {versionBack.class, detail.class})
@ChineseDescription("文件id")
private Long fileId;
/**
@ -58,6 +60,7 @@ public class SysFileInfoRequest extends BaseRequest {
* codeid
*/
@NotNull(message = "fileCode不能为空", groups = {edit.class, delete.class,})
@ChineseDescription("文件编码")
private Long fileCode;
/**
@ -66,48 +69,57 @@ public class SysFileInfoRequest extends BaseRequest {
* 访
*/
@NotBlank(message = "是否是机密文件不能为空", groups = {add.class, edit.class})
@ChineseDescription("是否为机密文件Y-是机密N-不是机密")
private String secretFlag;
/**
* .txt
*/
@ChineseDescription("文件名称(上传时候的文件全名,例如:开发文档.txt")
private String fileOriginName;
/**
*
*/
@ChineseDescription("其他文件形式参数")
private String token;
/**
* 1-2-3-minio4-
*/
@ChineseDescription("文件存储位置1-阿里云2-腾讯云3-minio4-本地")
private Integer fileLocation;
/**
*
*/
@NotBlank(message = "fileBucket不能为空", groups = {previewByObjectName.class})
@ChineseDescription("文件仓库(文件夹)")
private String fileBucket;
/**
*
*/
@ChineseDescription("文件后缀")
private String fileSuffix;
/**
* kb
*/
@ChineseDescription("文件大小")
private Long fileSizeKb;
/**
* bucketid+.
*/
@NotBlank(message = "fileObjectName不能为空", groups = {previewByObjectName.class})
@ChineseDescription("存储到bucket中的名称主键id+.后缀")
private String fileObjectName;
/**
*
*/
@ChineseDescription("存储路径")
private String filePath;
/**

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.file.api.pojo.response;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
import java.io.Serializable;
@ -43,6 +44,7 @@ public class SysFileInfoListResponse implements Serializable {
/**
* id
*/
@ChineseDescription("主键id")
private Long fileId;
/**
@ -52,79 +54,99 @@ public class SysFileInfoListResponse implements Serializable {
* <p>
* codeid
*/
@ChineseDescription("文件编码")
private Long fileCode;
/**
*
*/
@ChineseDescription("文件仓库(文件夹)")
private String fileBucket;
/**
* bucketid+.
*/
@ChineseDescription("存储到bucket中的名称主键id+.后缀")
private String fileObjectName;
/**
*
*/
@ChineseDescription("是否为机密文件")
private String secretFlag;
/**
* Code
*/
@ChineseDescription("文件应用Code名称")
private String fileAppCodeName;
/**
*
*/
@ChineseDescription("文件名称(上传时候的文件名)")
private String fileOriginName;
/**
* 1-2-3-minio4-
*/
@ChineseDescription("存储位置1-阿里云2-腾讯云3-minio4-本地")
private Integer fileLocation;
/**
*
*/
@ChineseDescription("文件后缀")
private String fileSuffix;
/**
*
*/
@ChineseDescription("文件大小信息,计算后")
private String fileSizeInfo;
/**
*
*/
@ChineseDescription("文件版本")
private Integer fileVersion;
/**
*
*/
@ChineseDescription("创建人")
private Long createAccountId;
/**
* id
*/
@ChineseDescription("创建人部门id")
private Long createDeptId;
/**
*
*/
@ChineseDescription("创建人姓名")
private String createUserName;
/**
*
*/
@ChineseDescription("创建时间")
private Date createTime;
/**
*
*/
@ChineseDescription("创建人姓名")
private String realName;
/**
* 访url
*/
@ChineseDescription("文件访问的url")
private String fileUrl;
}

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.file.api.pojo.response;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
/**
@ -38,6 +39,7 @@ public class SysFileInfoResponse {
/**
* id
*/
@ChineseDescription("主键id")
private Long fileId;
/**
@ -47,71 +49,85 @@ public class SysFileInfoResponse {
* <p>
* codeid
*/
@ChineseDescription("文件编码")
private Long fileCode;
/**
*
*/
@ChineseDescription("文件版本")
private Integer fileVersion;
/**
* 0-,1-
*/
@ChineseDescription("文件状态")
private String fileStatus;
/**
* .txt
*/
@ChineseDescription("问价后缀")
private String fileSuffix;
/**
* kb
*/
@ChineseDescription("文件大小kb")
private Long fileSizeKb;
/**
*
*/
@ChineseDescription("文件大小信息,计算后")
private String fileSizeInfo;
/**
*
*/
@ChineseDescription("是否为机密文件")
private String secretFlag;
/**
*
*/
@ChineseDescription("文件的字节")
private byte[] fileBytes;
/**
* bucketid+.
*/
@ChineseDescription("存储到bucket中的名称主键id+.后缀")
private String fileObjectName;
/**
* 1-2-3-minio4-
*/
@ChineseDescription("文件存储位置1-阿里云2-腾讯云3-minio4-本地")
private Integer fileLocation;
/**
*
*/
@ChineseDescription("文件仓库")
private String fileBucket;
/**
*
*/
@ChineseDescription("文件名称(上传时候的文件名)")
private String fileOriginName;
/**
*
*/
@ChineseDescription("存储路径")
private String filePath;
/**
* 访url访url
*/
@ChineseDescription("文件访问路径")
private String fileUrl;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -24,10 +24,14 @@
*/
package cn.stylefeng.roses.kernel.file.modular.controller;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.pojo.request.SysFileInfoRequest;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoListResponse;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileInfo;
import cn.stylefeng.roses.kernel.file.modular.service.SysFileInfoService;
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
@ -72,14 +76,18 @@ public class SysFileInfoController {
/**
*
* <p>
* fileLocation5
* <p>
* fileLocation
*
* @author majianguo
* @date 2020/12/27 13:17
*/
@PostResource(name = "上传文件", path = "/sysFileInfo/upload", requiredPermission = false)
public ResponseData upload(@RequestPart("file") MultipartFile file, @Validated(SysFileInfoRequest.add.class) SysFileInfoRequest sysFileInfoRequest) {
public ResponseData<SysFileInfoResponse> upload(@RequestPart("file") MultipartFile file, @Validated(SysFileInfoRequest.add.class) SysFileInfoRequest sysFileInfoRequest) {
SysFileInfoResponse fileUploadInfoResult = this.sysFileInfoService.uploadFile(file, sysFileInfoRequest);
return new SuccessResponseData(fileUploadInfoResult);
return new SuccessResponseData<>(fileUploadInfoResult);
}
/**
@ -173,9 +181,9 @@ public class SysFileInfoController {
* @date 2020/12/16 15:34
*/
@PostResource(name = "替换文件", path = "/sysFileInfo/update", requiredPermission = false)
public ResponseData update(@RequestPart("file") MultipartFile file, @Validated(SysFileInfoRequest.edit.class) SysFileInfoRequest sysFileInfoRequest) {
public ResponseData<SysFileInfoResponse> update(@RequestPart("file") MultipartFile file, @Validated(SysFileInfoRequest.edit.class) SysFileInfoRequest sysFileInfoRequest) {
SysFileInfoResponse fileUploadInfoResult = this.sysFileInfoService.updateFile(file, sysFileInfoRequest);
return new SuccessResponseData(fileUploadInfoResult);
return new SuccessResponseData<>(fileUploadInfoResult);
}
/**
@ -184,10 +192,10 @@ public class SysFileInfoController {
* @author majianguo
* @date 2020/12/16 15:34
*/
@PostResource(name = "替换文件", path = "/sysFileInfo/versionBack", requiredPermission = false)
public ResponseData versionBack(@Validated(SysFileInfoRequest.versionBack.class) SysFileInfoRequest sysFileInfoRequest) {
@PostResource(name = "版本回退", path = "/sysFileInfo/versionBack", requiredPermission = false)
public ResponseData<SysFileInfoResponse> versionBack(@Validated(SysFileInfoRequest.versionBack.class) SysFileInfoRequest sysFileInfoRequest) {
SysFileInfoResponse fileUploadInfoResult = this.sysFileInfoService.versionBack(sysFileInfoRequest);
return new SuccessResponseData(fileUploadInfoResult);
return new SuccessResponseData<>(fileUploadInfoResult);
}
/**
@ -199,9 +207,9 @@ public class SysFileInfoController {
* @date 2020/12/27 13:17
*/
@GetResource(name = "根据附件IDS查询附件信息", path = "/sysFileInfo/getFileInfoListByFileIds", requiredPermission = false)
public ResponseData getFileInfoListByFileIds(@RequestParam(value = "fileIds") String fileIds) {
public ResponseData<List<SysFileInfoResponse>> getFileInfoListByFileIds(@RequestParam(value = "fileIds") String fileIds) {
List<SysFileInfoResponse> list = this.sysFileInfoService.getFileInfoListByFileIds(fileIds);
return new SuccessResponseData(list);
return new SuccessResponseData<>(list);
}
/**
@ -235,9 +243,10 @@ public class SysFileInfoController {
* @date 2020/11/29 11:19
*/
@PostResource(name = "删除文件信息(真删除文件信息)", path = "/sysFileInfo/deleteReally", requiredPermission = false)
public ResponseData deleteReally(@RequestBody @Validated(SysFileInfoRequest.delete.class) SysFileInfoRequest sysFileInfoRequest) {
@BusinessLog
public ResponseData<?> deleteReally(@RequestBody @Validated(SysFileInfoRequest.delete.class) SysFileInfoRequest sysFileInfoRequest) {
this.sysFileInfoService.deleteReally(sysFileInfoRequest);
return new SuccessResponseData();
return new SuccessResponseData<>();
}
/**
@ -247,8 +256,8 @@ public class SysFileInfoController {
* @date 2020/11/29 11:29
*/
@GetResource(name = "分页查询文件信息表", path = "/sysFileInfo/fileInfoListPage", requiredPermission = false)
public ResponseData fileInfoListPage(SysFileInfoRequest sysFileInfoRequest) {
return new SuccessResponseData(this.sysFileInfoService.fileInfoListPage(sysFileInfoRequest));
public ResponseData<PageResult<SysFileInfoListResponse>> fileInfoListPage(SysFileInfoRequest sysFileInfoRequest) {
return new SuccessResponseData<>(this.sysFileInfoService.fileInfoListPage(sysFileInfoRequest));
}
/**
@ -258,8 +267,8 @@ public class SysFileInfoController {
* @date 2020/11/29 11:29
*/
@GetResource(name = "查看详情文件信息表", path = "/sysFileInfo/detail", requiredPermission = false)
public ResponseData detail(@Validated(SysFileInfoRequest.detail.class) SysFileInfoRequest sysFileInfoRequest) {
return new SuccessResponseData(sysFileInfoService.detail(sysFileInfoRequest));
public ResponseData<SysFileInfo> detail(@Validated(SysFileInfoRequest.detail.class) SysFileInfoRequest sysFileInfoRequest) {
return new SuccessResponseData<>(sysFileInfoService.detail(sysFileInfoRequest));
}
}

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.file.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -46,6 +47,7 @@ public class SysFileInfo extends BaseEntity {
* id
*/
@TableId(value = "file_id", type = IdType.ASSIGN_ID)
@ChineseDescription("主键id")
private Long fileId;
/**
@ -54,78 +56,91 @@ public class SysFileInfo extends BaseEntity {
*
*/
@TableField("file_code")
@ChineseDescription("文件编码")
private Long fileCode;
/**
* 1
*/
@TableField("file_version")
@ChineseDescription("文件版本")
private Integer fileVersion;
/**
* 0-1-
*/
@TableField("file_status")
@ChineseDescription("当前状态0-历史版1-最新版")
private String fileStatus;
/**
* 1-2-3-minio4-
*/
@TableField("file_location")
@ChineseDescription("文件存储位置")
private Integer fileLocation;
/**
*
*/
@TableField("file_bucket")
@ChineseDescription("文件仓库(文件夹)")
private String fileBucket;
/**
*
*/
@TableField("file_origin_name")
@ChineseDescription("文件名称(上传时候的文件全名)")
private String fileOriginName;
/**
* .txt
*/
@TableField("file_suffix")
@ChineseDescription("文件后缀")
private String fileSuffix;
/**
* kb
*/
@TableField("file_size_kb")
@ChineseDescription("文件大小")
private Long fileSizeKb;
/**
*
*/
@TableField("file_size_info")
@ChineseDescription("文件大小信息,计算后的")
private String fileSizeInfo;
/**
* bucketid+.
*/
@TableField("file_object_name")
@ChineseDescription("存储到bucket中的名称主键id+.后缀")
private String fileObjectName;
/**
*
*/
@TableField("file_path")
@ChineseDescription("存储路径")
private String filePath;
/**
*
*/
@TableField("secret_flag")
@ChineseDescription("是否为机密文件")
private String secretFlag;
/**
* Y-N-
*/
@TableField(value = "del_flag", fill = FieldFill.INSERT)
@ChineseDescription("是否删除")
private String delFlag;
}

View File

@ -0,0 +1,32 @@
package cn.stylefeng.roses.kernel.file.modular.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
*
*
* @author fengshuonan
* @date 2022/01/08 15:53
*/
@TableName("sys_file_storage")
@Data
public class SysFileStorage {
/**
* idfile_info
*/
@TableId(value = "file_id", type = IdType.ASSIGN_ID)
private Long fileId;
/**
*
*/
@TableField("file_bytes")
private byte[] fileBytes;
}

View File

@ -38,6 +38,7 @@ import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
import cn.stylefeng.roses.kernel.file.api.pojo.request.SysFileInfoRequest;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileInfo;
import cn.stylefeng.roses.kernel.file.modular.service.SysFileStorageService;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.springframework.web.multipart.MultipartFile;
@ -63,6 +64,7 @@ public class FileInfoFactory {
public static SysFileInfo createSysFileInfo(MultipartFile file, SysFileInfoRequest sysFileInfoRequest) {
FileOperatorApi fileOperatorApi = SpringUtil.getBean(FileOperatorApi.class);
SysFileStorageService fileStorageService = SpringUtil.getBean(SysFileStorageService.class);
// 生成文件的唯一id
Long fileId = IdWorker.getId();
@ -89,7 +91,12 @@ public class FileInfoFactory {
if (StrUtil.isNotEmpty(sysFileInfoRequest.getFileBucket())) {
fileBucket = sysFileInfoRequest.getFileBucket();
}
fileOperatorApi.storageFile(fileBucket, finalFileName, bytes);
// 如果是存在数据库库里,单独处理一下
if (FileLocationEnum.DB.getCode().equals(sysFileInfoRequest.getFileLocation())) {
fileStorageService.saveFile(fileId, bytes);
} else {
fileOperatorApi.storageFile(fileBucket, finalFileName, bytes);
}
} catch (IOException e) {
throw new FileException(FileExceptionEnum.ERROR_FILE, e.getMessage());
}
@ -103,7 +110,12 @@ public class FileInfoFactory {
// 封装存储文件信息(上传替换公共信息)
SysFileInfo sysFileInfo = new SysFileInfo();
sysFileInfo.setFileId(fileId);
sysFileInfo.setFileLocation(FileLocationEnum.LOCAL.getCode());
// 如果是存在数据库库里,单独处理一下
if (FileLocationEnum.DB.getCode().equals(sysFileInfoRequest.getFileLocation())) {
sysFileInfo.setFileLocation(FileLocationEnum.DB.getCode());
} else {
sysFileInfo.setFileLocation(fileOperatorApi.getFileLocationEnum().getCode());
}
sysFileInfo.setFileBucket(fileBucket);
sysFileInfo.setFileObjectName(finalFileName);
sysFileInfo.setFileOriginName(originalFilename);

View File

@ -0,0 +1,14 @@
package cn.stylefeng.roses.kernel.file.modular.mapper;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileStorage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper
*
* @author fengshuonan
* @date 2022/01/08 15:53
*/
public interface SysFileStorageMapper extends BaseMapper<SysFileStorage> {
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.stylefeng.roses.kernel.system.modular.resource.mapper.ApiResourceFieldMapper">
<mapper namespace="cn.stylefeng.roses.kernel.file.modular.mapper.SysFileStorageMapper">
</mapper>

View File

@ -0,0 +1,40 @@
package cn.stylefeng.roses.kernel.file.modular.service;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileStorage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
*
* @author fengshuonan
* @date 2022/01/08 15:53
*/
public interface SysFileStorageService extends IService<SysFileStorage> {
/**
*
*
* @author fengshuonan
* @date 2022/1/8 16:08
*/
void saveFile(Long fileId, byte[] bytes);
/**
* 访url
*
* @param fileId id
* @author fengshuonan
* @date 2022/1/8 16:12
*/
String getFileAuthUrl(String fileId);
/**
* 访url
*
* @param fileId id
* @author fengshuonan
* @date 2022/1/8 16:12
*/
String getFileUnAuthUrl(String fileId);
}

View File

@ -25,7 +25,6 @@
package cn.stylefeng.roses.kernel.file.modular.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
@ -38,6 +37,7 @@ import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.file.api.FileInfoApi;
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
import cn.stylefeng.roses.kernel.file.api.enums.FileStatusEnum;
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
@ -49,11 +49,12 @@ import cn.stylefeng.roses.kernel.file.api.util.DownloadUtil;
import cn.stylefeng.roses.kernel.file.api.util.PdfFileTypeUtil;
import cn.stylefeng.roses.kernel.file.api.util.PicFileTypeUtil;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileInfo;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileStorage;
import cn.stylefeng.roses.kernel.file.modular.factory.FileInfoFactory;
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.SysFileStorageService;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -92,6 +93,9 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Resource
private FileOperatorApi fileOperatorApi;
@Resource
private SysFileStorageService sysFileStorageService;
@Override
public SysFileInfoResponse getFileInfoResult(Long fileId) {
@ -103,7 +107,13 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
// 获取文件字节码
byte[] fileBytes;
try {
fileBytes = fileOperatorApi.getFileBytes(FileConfigExpander.getDefaultBucket(), sysFileInfo.getFileObjectName());
// 如果是存储在数据库从数据库中获取其他的方式走FileOperatorApi
if (FileLocationEnum.DB.getCode().equals(sysFileInfo.getFileLocation())) {
SysFileStorage storage = sysFileStorageService.getById(fileId);
fileBytes = storage.getFileBytes();
} else {
fileBytes = fileOperatorApi.getFileBytes(FileConfigExpander.getDefaultBucket(), sysFileInfo.getFileObjectName());
}
} catch (Exception e) {
log.error("获取文件流异常,具体信息为:{}", e.getMessage());
throw new FileException(FileExceptionEnum.FILE_STREAM_ERROR, e.getMessage());
@ -188,8 +198,10 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
SysFileInfoResponse sysFileInfoResponse = this.getFileInfoResult(sysFileInfoRequest.getFileId());
// 如果文件加密等级不符合,文件不允许被访问
if (!sysFileInfoRequest.getSecretFlag().equals(sysFileInfoResponse.getSecretFlag())) {
throw new FileException(FileExceptionEnum.FILE_DENIED_ACCESS);
if (YesOrNotEnum.Y.getCode().equals(sysFileInfoResponse.getSecretFlag())) {
if (YesOrNotEnum.N.getCode().equals(sysFileInfoRequest.getSecretFlag())) {
throw new FileException(FileExceptionEnum.FILE_DENIED_ACCESS);
}
}
DownloadUtil.download(sysFileInfoResponse.getFileOriginName(), sysFileInfoResponse.getFileBytes(), response);
@ -201,7 +213,7 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
// 查询该Code的所有历史版本
LambdaQueryWrapper<SysFileInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(SysFileInfo::getFileCode, sysFileInfoRequest.getFileCode());
lqw.eq(SysFileInfo::getFileCode, sysFileInfoRequest.getFileCode()).or().eq(SysFileInfo::getFileId, sysFileInfoRequest.getFileId());
List<SysFileInfo> fileInfos = this.list(lqw);
// 批量删除
@ -209,7 +221,12 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
// 删除具体文件
for (SysFileInfo fileInfo : fileInfos) {
this.fileOperatorApi.deleteFile(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
//如果文件是在数据库存储,则特殊处理
if (fileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
this.sysFileStorageService.removeById(fileInfo.getFileId());
} else {
this.fileOperatorApi.deleteFile(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
}
}
}
@ -219,7 +236,15 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
List<SysFileInfoListResponse> list = this.baseMapper.fileInfoList(page, sysFileInfoRequest);
// 排除defaultAvatar.png这个图片,这个是默认头像
List<SysFileInfoListResponse> newList = list.stream().filter(i -> !i.getFileOriginName().equals("defaultAvatar.png")).collect(Collectors.toList());
List<SysFileInfoListResponse> newList = list.stream().filter(i -> !i.getFileOriginName().equals(FileConstants.DEFAULT_AVATAR_FILE_OBJ_NAME)).collect(Collectors.toList());
// 拼接图片url地址
for (SysFileInfoListResponse sysFileInfoListResponse : newList) {
// 判断是否是可以预览的文件
if (PicFileTypeUtil.getFileImgTypeFlag(sysFileInfoListResponse.getFileSuffix())) {
sysFileInfoListResponse.setFileUrl(this.getFileAuthUrl(sysFileInfoListResponse.getFileId()));
}
}
return PageResultFactory.createPageResult(page.setRecords(newList));
}
@ -285,18 +310,14 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Override
public void preview(SysFileInfoRequest sysFileInfoRequest, HttpServletResponse response) {
// 如果是默认头像
if (FileConstants.DEFAULT_AVATAR_FILE_ID.equals(sysFileInfoRequest.getFileId())) {
DownloadUtil.renderPreviewFile(response, Base64.decode(FileConfigExpander.getDefaultAvatarBase64()));
return;
}
// 根据文件id获取文件信息结果集
SysFileInfoResponse sysFileInfoResponse = this.getFileInfoResult(sysFileInfoRequest.getFileId());
// 如果文件加密等级不符合,文件不允许被访问
if (!sysFileInfoRequest.getSecretFlag().equals(sysFileInfoResponse.getSecretFlag())) {
throw new FileException(FileExceptionEnum.FILE_DENIED_ACCESS);
if (YesOrNotEnum.Y.getCode().equals(sysFileInfoResponse.getSecretFlag())) {
if (YesOrNotEnum.N.getCode().equals(sysFileInfoRequest.getSecretFlag())) {
throw new FileException(FileExceptionEnum.FILE_DENIED_ACCESS);
}
}
// 获取文件后缀
@ -345,12 +366,6 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Override
public void previewByBucketAndObjName(SysFileInfoRequest sysFileInfoRequest, HttpServletResponse response) {
// 如果是默认头像
if (FileConstants.DEFAULT_AVATAR_FILE_OBJ_NAME.equals(sysFileInfoRequest.getFileObjectName())) {
DownloadUtil.renderPreviewFile(response, Base64.decode(FileConfigExpander.getDefaultAvatarBase64()));
return;
}
// 判断文件是否需要鉴权需要鉴权的需要带token访问
LambdaQueryWrapper<SysFileInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysFileInfo::getFileObjectName, sysFileInfoRequest.getFileObjectName());
@ -415,23 +430,39 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Override
public String getFileAuthUrl(Long fileId) {
// 获取登录用户的token
String token = LoginContext.me().getToken();
// 获取context-path
String contextPath = HttpServletUtil.getRequest().getContextPath();
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileId=" + fileId + "&token=" + token;
return this.getFileAuthUrl(fileId, LoginContext.me().getToken());
}
@Override
public String getFileAuthUrl(Long fileId, String token) {
// 获取文件的基本信息
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
sysFileInfoRequest.setFileId(fileId);
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
// 获取context-path
String contextPath = HttpServletUtil.getRequest().getContextPath();
// 如果是数据库存储则返回previewUrl
if (sysFileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
return this.sysFileStorageService.getFileAuthUrl(String.valueOf(fileId));
} else {
// 返回第三方存储文件url
return fileOperatorApi.getFileAuthUrl(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName(), FileConfigExpander.getDefaultFileTimeoutSeconds());
}
}
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileId=" + fileId + "&token=" + token;
@Override
public String getFileUnAuthUrl(Long fileId) {
// 获取文件的基本信息
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
sysFileInfoRequest.setFileId(fileId);
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
// 如果是数据库存储则返回previewUrl
if (sysFileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
return this.sysFileStorageService.getFileUnAuthUrl(String.valueOf(fileId));
} else {
// 返回第三方存储文件url
return fileOperatorApi.getFileUnAuthUrl(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName());
}
}
/**

View File

@ -0,0 +1,46 @@
package cn.stylefeng.roses.kernel.file.modular.service.impl;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
import cn.stylefeng.roses.kernel.file.modular.entity.SysFileStorage;
import cn.stylefeng.roses.kernel.file.modular.mapper.SysFileStorageMapper;
import cn.stylefeng.roses.kernel.file.modular.service.SysFileStorageService;
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
*
*
* @author fengshuonan
* @date 2022/01/08 15:53
*/
@Service
public class SysFileStorageServiceImpl extends ServiceImpl<SysFileStorageMapper, SysFileStorage> implements SysFileStorageService {
@Override
public void saveFile(Long fileId, byte[] bytes) {
SysFileStorage sysFileStorage = new SysFileStorage();
sysFileStorage.setFileId(fileId);
sysFileStorage.setFileBytes(bytes);
this.save(sysFileStorage);
}
@Override
public String getFileAuthUrl(String fileId) {
// 获取登录用户的token
String token = LoginContext.me().getToken();
// 获取context-path
String contextPath = HttpServletUtil.getRequest().getContextPath();
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileId=" + fileId + "&token=" + token;
}
@Override
public String getFileUnAuthUrl(String fileId) {
// 获取context-path
String contextPath = HttpServletUtil.getRequest().getContextPath();
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PUBLIC_PREVIEW_URL + "?fileId=" + fileId;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -25,11 +25,12 @@
package cn.stylefeng.roses.kernel.file.aliyun;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
import cn.stylefeng.roses.kernel.file.api.pojo.props.AliyunOssProperties;
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
@ -200,8 +201,7 @@ public class AliyunFileOperator implements FileOperatorApi {
@Override
public String getFileUnAuthUrl(String bucketName, String key) {
String template = "https://{}.oss-cn-beijing.aliyuncs.com/{}";
return StrUtil.format(template,bucketName,key);
return this.getFileAuthUrl(bucketName, key, FileConfigExpander.getDefaultFileTimeoutSeconds() * 1000);
}
@Override
@ -209,4 +209,9 @@ public class AliyunFileOperator implements FileOperatorApi {
ossClient.deleteObject(bucketName, key);
}
@Override
public FileLocationEnum getFileLocationEnum() {
return FileLocationEnum.ALIYUN;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -31,6 +31,7 @@ import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
@ -199,4 +200,10 @@ public class LocalFileOperator implements FileOperatorApi {
FileUtil.del(file);
}
@Override
public FileLocationEnum getFileLocationEnum() {
return FileLocationEnum.LOCAL;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -31,6 +31,7 @@ import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
@ -233,6 +234,11 @@ public class MinIoFileOperator implements FileOperatorApi {
}
@Override
public FileLocationEnum getFileLocationEnum() {
return FileLocationEnum.MINIO;
}
/**
* contentType
*

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -28,6 +28,7 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.thread.ExecutorBuilder;
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
import cn.stylefeng.roses.kernel.file.api.enums.BucketAuthEnum;
import cn.stylefeng.roses.kernel.file.api.enums.FileLocationEnum;
import cn.stylefeng.roses.kernel.file.api.exception.FileException;
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
@ -261,4 +262,9 @@ public class TenFileOperator implements FileOperatorApi {
cosClient.deleteObject(bucketName, key);
}
@Override
public FileLocationEnum getFileLocationEnum() {
return FileLocationEnum.TENCENT;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-groovy</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-d-groovy</artifactId>
<version>7.1.5</version>
<version>7.2.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Some files were not shown because too many files have changed in this diff Show More