Browse Source

删除依赖冲突

king 4 năm trước cách đây
mục cha
commit
f4a84b5110

+ 0 - 15
boman-common/boman-common-core/pom.xml

@@ -16,16 +16,6 @@
     </description>
 
     <dependencies>
-        <dependency>
-            <groupId>com.boman</groupId>
-            <artifactId>boman-api-system</artifactId>
-        </dependency>
-        <!-- 华为云OBS-->
-        <dependency>
-            <groupId>com.huaweicloud</groupId>
-            <artifactId>esdk-obs-java</artifactId>
-            <version>[3.20.6.1,)</version>
-        </dependency>
     	<!-- SpringCloud Openfeign -->
         <dependency>
             <groupId>org.springframework.cloud</groupId>
@@ -43,11 +33,6 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
     	</dependency>
-        <!-- spring security 安全认证 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-        </dependency>
 
         <!-- Apache Commons Pool2 -->
         <dependency>

+ 0 - 64
boman-common/boman-common-core/src/main/java/com/boman/common/core/config/HuaWeiConfig.java

@@ -1,64 +0,0 @@
-package com.boman.common.core.config;
-
-import com.obs.services.ObsClient;
-import com.obs.services.model.PutObjectResult;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-
-/**
- * 读取项目相关配置
- *
- * @author danny
- */
-@Component
-@ConfigurationProperties(prefix = "huawei")
-public class HuaWeiConfig {
-    private static boolean enabled;
-    private static String endPoint;
-    private static String ak;
-    private static String sk;
-    private static String url;
-    private static String bucketName;
-
-    public static boolean isEnabled() {
-        return enabled;
-    }
-
-    public void setEnabled(boolean enabled) {
-        HuaWeiConfig.enabled = enabled;
-    }
-
-    public void setEndPoint(String endPoint) {
-        HuaWeiConfig.endPoint = endPoint;
-    }
-
-    public void setAk(String ak) {
-        HuaWeiConfig.ak = ak;
-    }
-
-    public void setSk(String sk) {
-        HuaWeiConfig.sk = sk;
-    }
-
-
-    public void setUrl(String url) {
-        HuaWeiConfig.url = url;
-    }
-
-
-    public void setBucketName(String bucketName) {
-        HuaWeiConfig.bucketName = bucketName;
-    }
-
-    private static ObsClient getObsClient() {
-        return new ObsClient(ak, sk, endPoint);
-    }
-    public static String saveHuaWeiOBS(String baseDir, String fileName, MultipartFile file) throws IOException {
-        ObsClient obsClient = getObsClient();
-        PutObjectResult putObjectResult = obsClient.putObject(bucketName, baseDir+"/"+fileName, file.getInputStream());
-        return url+"/"+putObjectResult.getObjectKey();
-    }
-}

+ 0 - 51
boman-common/boman-common-core/src/main/java/com/boman/common/core/config/NginxConfig.java

@@ -1,51 +0,0 @@
-package com.boman.common.core.config;
-
-import com.obs.services.ObsClient;
-import com.obs.services.model.PutObjectResult;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * 读取项目相关配置
- *
- * @author danny
- */
-@Component
-@ConfigurationProperties(prefix = "nginx")
-public class NginxConfig {
-    private static boolean enabled;
-    private static String path;
-    private static String url;
-
-    public static boolean isEnabled() {
-        return enabled;
-    }
-
-    public void setEnabled(boolean enabled) {
-        NginxConfig.enabled = enabled;
-    }
-
-
-
-    public void setPath(String path) {
-        NginxConfig.path = path;
-    }
-
-
-    public void setUrl(String url) {
-        NginxConfig.url = url;
-    }
-
-    public static String getPath() {
-        return path;
-    }
-
-    public static String getUrl() {
-        return url;
-    }
-}

+ 0 - 116
boman-common/boman-common-core/src/main/java/com/boman/common/core/config/RuoYiConfig.java

@@ -1,116 +0,0 @@
-package com.boman.common.core.config;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * 读取项目相关配置
- * 
- * @author ruoyi
- */
-@Component
-@ConfigurationProperties(prefix = "ruoyi")
-public class RuoYiConfig
-{
-    /** 项目名称 */
-    private String name;
-
-    /** 版本 */
-    private String version;
-
-    /** 版权年份 */
-    private String copyrightYear;
-
-    /** 实例演示开关 */
-    private boolean demoEnabled;
-
-    /** 上传路径 */
-    private static String profile;
-
-    /** 获取地址开关 */
-    private static boolean addressEnabled;
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion(String version)
-    {
-        this.version = version;
-    }
-
-    public String getCopyrightYear()
-    {
-        return copyrightYear;
-    }
-
-    public void setCopyrightYear(String copyrightYear)
-    {
-        this.copyrightYear = copyrightYear;
-    }
-
-    public boolean isDemoEnabled()
-    {
-        return demoEnabled;
-    }
-
-    public void setDemoEnabled(boolean demoEnabled)
-    {
-        this.demoEnabled = demoEnabled;
-    }
-
-    public static String getProfile()
-    {
-        return profile;
-    }
-
-    public void setProfile(String profile)
-    {
-        RuoYiConfig.profile = profile;
-    }
-
-    public static boolean isAddressEnabled()
-    {
-        return addressEnabled;
-    }
-
-    public void setAddressEnabled(boolean addressEnabled)
-    {
-        RuoYiConfig.addressEnabled = addressEnabled;
-    }
-
-    /**
-     * 获取头像上传路径
-     */
-    public static String getAvatarPath()
-    {
-        return getProfile() + "/avatar";
-    }
-
-    /**
-     * 获取下载路径
-     */
-    public static String getDownloadPath()
-    {
-        return getProfile() + "/download/";
-    }
-
-    /**
-     * 获取上传路径
-     */
-    public static String getUploadPath()
-    {
-        return getProfile() + "/upload";
-    }
-}

+ 0 - 211
boman-common/boman-common-core/src/main/java/com/boman/common/core/domain/LoginUser.java

@@ -1,211 +0,0 @@
-package com.boman.common.core.domain;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-import com.boman.system.api.domain.SysUser;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * 登录用户身份权限
- *
- * @author ruoyi
- */
-public class LoginUser implements UserDetails {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 用户唯一标识
-     */
-    private String token;
-
-    /**
-     * 登录时间
-     */
-    private Long loginTime;
-
-    /**
-     * 过期时间
-     */
-    private Long expireTime;
-
-    /**
-     * 登录IP地址
-     */
-    private String ipaddr;
-
-    /**
-     * 登录地点
-     */
-    private String loginLocation;
-
-    /**
-     * 浏览器类型
-     */
-    private String browser;
-
-    /**
-     * 操作系统
-     */
-    private String os;
-
-    /**
-     * 权限列表
-     */
-    private Set<String> permissions;
-
-    private List<SimpleGrantedAuthority> authorities;
-
-    /**
-     * 用户信息
-     */
-    private SysUser user;
-
-    public String getToken() {
-        return token;
-    }
-
-    public void setToken(String token) {
-        this.token = token;
-    }
-
-    public LoginUser() {
-    }
-
-    public LoginUser(SysUser user, Set<String> permissions, List<SimpleGrantedAuthority> authorities) {
-        this.user = user;
-        this.permissions = permissions;
-        this.authorities = authorities;
-    }
-
-    @JsonIgnore
-    @Override
-    public String getPassword() {
-        return user.getPassword();
-    }
-
-    @Override
-    public String getUsername() {
-        return user.getUserName();
-    }
-
-    /**
-     * 账户是否未过期,过期无法验证
-     */
-    @JsonIgnore
-    @Override
-    public boolean isAccountNonExpired() {
-        return true;
-    }
-
-    /**
-     * 指定用户是否解锁,锁定的用户无法进行身份验证
-     *
-     * @return
-     */
-    @JsonIgnore
-    @Override
-    public boolean isAccountNonLocked() {
-        return true;
-    }
-
-    /**
-     * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
-     *
-     * @return
-     */
-    @JsonIgnore
-    @Override
-    public boolean isCredentialsNonExpired() {
-        return true;
-    }
-
-    /**
-     * 是否可用 ,禁用的用户不能身份验证
-     *
-     * @return
-     */
-    @JsonIgnore
-    @Override
-    public boolean isEnabled() {
-        return true;
-    }
-
-    public Long getLoginTime() {
-        return loginTime;
-    }
-
-    public void setLoginTime(Long loginTime) {
-        this.loginTime = loginTime;
-    }
-
-    public String getIpaddr() {
-        return ipaddr;
-    }
-
-    public void setIpaddr(String ipaddr) {
-        this.ipaddr = ipaddr;
-    }
-
-    public String getLoginLocation() {
-        return loginLocation;
-    }
-
-    public void setLoginLocation(String loginLocation) {
-        this.loginLocation = loginLocation;
-    }
-
-    public String getBrowser() {
-        return browser;
-    }
-
-    public void setBrowser(String browser) {
-        this.browser = browser;
-    }
-
-    public String getOs() {
-        return os;
-    }
-
-    public void setOs(String os) {
-        this.os = os;
-    }
-
-    public Long getExpireTime() {
-        return expireTime;
-    }
-
-    public void setExpireTime(Long expireTime) {
-        this.expireTime = expireTime;
-    }
-
-    public Set<String> getPermissions() {
-        return permissions;
-    }
-
-    public void setPermissions(Set<String> permissions) {
-        this.permissions = permissions;
-    }
-
-    public SysUser getUser() {
-        return user;
-    }
-
-    public void setUser(SysUser user) {
-        this.user = user;
-    }
-
-    public void setAuthorities(List<SimpleGrantedAuthority> authorities) {
-        this.authorities = authorities;
-    }
-
-    @Override
-    public Collection<? extends GrantedAuthority> getAuthorities() {
-
-        return authorities;
-
-    }
-}

+ 0 - 42
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/SecurityUtils.java

@@ -2,11 +2,6 @@ package com.boman.common.core.utils;
 
 import javax.servlet.http.HttpServletRequest;
 
-import com.boman.common.core.domain.LoginUser;
-import com.boman.common.core.exception.CustomException;
-import com.boman.common.core.utils.constant.HttpStatus;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import com.boman.common.core.constant.CacheConstants;
 import com.boman.common.core.text.Convert;
@@ -18,43 +13,6 @@ import com.boman.common.core.text.Convert;
  */
 public class SecurityUtils
 {
-
-    /**
-     * 获取用户账户
-     **/
-    public static String getNickName()
-    {
-        try
-        {
-            return getLoginUser().getUser().getNickName();
-        }
-        catch (Exception e)
-        {
-            throw new CustomException("获取用户账户异常", HttpStatus.UNAUTHORIZED);
-        }
-    }
-
-    /**
-     * 获取用户
-     **/
-    public static LoginUser getLoginUser()
-    {
-        try
-        {
-            return (LoginUser) getAuthentication().getPrincipal();
-        }
-        catch (Exception e)
-        {
-            throw new CustomException("获取用户信息异常", HttpStatus.UNAUTHORIZED);
-        }
-    }
-    /**
-     * 获取Authentication
-     */
-    public static Authentication getAuthentication()
-    {
-        return SecurityContextHolder.getContext().getAuthentication();
-    }
     /**
      * 获取用户
      */

+ 0 - 226
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/file/FileUploadUtils.java

@@ -1,226 +0,0 @@
-package com.boman.common.core.utils.file;
-
-import java.io.File;
-import java.io.IOException;
-
-import com.boman.common.core.config.HuaWeiConfig;
-import com.boman.common.core.config.NginxConfig;
-import com.boman.common.core.config.RuoYiConfig;
-import com.boman.common.core.constant.Constants;
-import com.boman.common.core.exception.file.FileNameLengthLimitExceededException;
-import com.boman.common.core.exception.file.FileSizeLimitExceededException;
-import com.boman.common.core.exception.file.InvalidExtensionException;
-import com.boman.common.core.utils.DateUtils;
-import com.boman.common.core.utils.IdUtils;
-import com.boman.common.core.utils.StringUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-
-/**
- * 文件上传工具类
- *
- * @author ruoyi
- */
-public class FileUploadUtils {
-    /**
-     * 默认大小 50M
-     */
-    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
-
-    /**
-     * 默认的文件名最大长度 100
-     */
-    public static final int DEFAULT_FILE_NAME_LENGTH = 100;
-
-    /**
-     * 默认上传的地址
-     */
-    private static String defaultBaseDir = RuoYiConfig.getProfile();
-
-    public static void setDefaultBaseDir(String defaultBaseDir) {
-        FileUploadUtils.defaultBaseDir = defaultBaseDir;
-    }
-
-    public static String getDefaultBaseDir() {
-        return defaultBaseDir;
-    }
-
-    /**
-     * 以默认配置进行文件上传
-     *
-     * @param file 上传的文件
-     * @return 文件名称
-     * @throws Exception
-     */
-    public static final String upload(MultipartFile file) throws IOException {
-        try {
-            return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
-        } catch (Exception e) {
-            throw new IOException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * 根据文件路径上传
-     *
-     * @param baseDir 相对应用的基目录
-     * @param file    上传的文件
-     * @return 文件名称
-     * @throws IOException
-     */
-    public static final String upload(String baseDir, MultipartFile file) throws IOException {
-        try {
-            return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
-        } catch (Exception e) {
-            throw new IOException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * 文件上传
-     *
-     * @param baseDir          相对应用的基目录
-     * @param file             上传的文件
-     * @param allowedExtension 上传文件类型
-     * @return 返回上传成功的文件名
-     * @throws FileSizeLimitExceededException       如果超出最大大小
-     * @throws FileNameLengthLimitExceededException 文件名太长
-     * @throws IOException                          比如读写文件出错时
-     * @throws InvalidExtensionException            文件校验异常
-     */
-    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
-            throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
-            InvalidExtensionException {
-        int fileNamelength = file.getOriginalFilename().length();
-        if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
-            throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
-        }
-
-        assertAllowed(file, allowedExtension);
-
-        String fileName = extractFilename(file);
-
-        String pathFileName = saveFile(baseDir, fileName, file);
-        return pathFileName;
-    }
-
-    public static String saveFile(String baseDir, String fileName, MultipartFile file) throws IOException {
-        String pathFileName = null;
-        if (HuaWeiConfig.isEnabled()) {
-            pathFileName = HuaWeiConfig.saveHuaWeiOBS(baseDir, fileName, file);
-        } else if (NginxConfig.isEnabled()) {
-            pathFileName = saveNginx(baseDir, fileName, file);
-        } else {
-            pathFileName = saveTheLocal(baseDir, fileName, file);
-        }
-        return pathFileName;
-    }
-
-
-    public static String saveTheLocal(String baseDir, String fileName, MultipartFile file) throws IOException {
-        File desc = getAbsoluteFile(baseDir, fileName);
-        file.transferTo(desc);
-        return getPathFileName(baseDir, fileName);
-    }
-
-    public static String saveNginx(String baseDir, String fileName, MultipartFile file) throws IOException {
-        File desc = getAbsoluteFile(NginxConfig.getPath() + baseDir, fileName);
-        file.transferTo(desc);
-        return NginxConfig.getUrl() + getPathFileName(NginxConfig.getPath() + baseDir, fileName);
-    }
-
-
-    /**
-     * 编码文件名
-     */
-    public static final String extractFilename(MultipartFile file) {
-        String fileName = file.getOriginalFilename();
-        String extension = getExtension(file);
-        fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
-        return fileName;
-    }
-
-    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
-        File desc = new File(uploadDir + File.separator + fileName);
-
-        if (!desc.getParentFile().exists()) {
-            desc.getParentFile().mkdirs();
-        }
-        if (!desc.exists()) {
-            desc.createNewFile();
-        }
-        return desc;
-    }
-
-    private static final String getPathFileName(String uploadDir, String fileName) throws IOException {
-        int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
-        String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
-        String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
-        return pathFileName;
-    }
-
-    /**
-     * 文件大小校验
-     *
-     * @param file 上传的文件
-     * @return
-     * @throws FileSizeLimitExceededException 如果超出最大大小
-     * @throws InvalidExtensionException
-     */
-    public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
-            throws FileSizeLimitExceededException, InvalidExtensionException {
-        long size = file.getSize();
-        if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) {
-            throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
-        }
-
-        String fileName = file.getOriginalFilename();
-        String extension = getExtension(file);
-        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
-            if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
-                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
-                        fileName);
-            } else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
-                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
-                        fileName);
-            } else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
-                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
-                        fileName);
-            } else {
-                throw new InvalidExtensionException(allowedExtension, extension, fileName);
-            }
-        }
-
-    }
-
-    /**
-     * 判断MIME类型是否是允许的MIME类型
-     *
-     * @param extension
-     * @param allowedExtension
-     * @return
-     */
-    public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
-        for (String str : allowedExtension) {
-            if (str.equalsIgnoreCase(extension)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 获取文件名的后缀
-     *
-     * @param file 表单文件
-     * @return 后缀名
-     */
-    public static final String getExtension(MultipartFile file) {
-        String extension = FilenameUtils.getExtension(file.getOriginalFilename());
-        if (StringUtils.isEmpty(extension)) {
-            extension = MimeTypeUtils.getExtension(file.getContentType());
-        }
-        return extension;
-    }
-}