Explorar el Código

fs-admin 重复bean修复 不能使用bean名称重复后自动改名的方式让代码运行起来,不规范,增加后期维护的成本

xgb hace 2 semanas
padre
commit
4065dec89b

+ 1 - 10
fs-admin/src/main/java/com/fs/FSApplication.java

@@ -1,6 +1,5 @@
 package com.fs;
 package com.fs;
 
 
-import com.fs.config.OverridingBeanNameGenerator;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -11,20 +10,13 @@ import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
-/**
- * 启动程序
- */
 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, RedissonAutoConfiguration.class})
 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, RedissonAutoConfiguration.class})
 @ComponentScan(
 @ComponentScan(
     basePackages = "com.fs",
     basePackages = "com.fs",
-    nameGenerator = OverridingBeanNameGenerator.class,
     excludeFilters = {
     excludeFilters = {
         @ComponentScan.Filter(type = FilterType.REGEX, pattern = {
         @ComponentScan.Filter(type = FilterType.REGEX, pattern = {
             "com\\.fs\\.framework\\.service\\.PermissionService",
             "com\\.fs\\.framework\\.service\\.PermissionService",
-            "com\\.fs\\.framework\\.service\\.UserDetailsServiceImpl",
-            "com\\.fs\\.company\\.controller\\..*",
-            "com\\.fs\\.hisStore\\.controller\\..*",
-            "com\\.fs\\.his\\.controller\\.FsAiWorkflowController"
+            "com\\.fs\\.framework\\.service\\.UserDetailsServiceImpl"
         })
         })
     }
     }
 )
 )
@@ -33,7 +25,6 @@ import org.springframework.transaction.annotation.Transactional;
 @EnableScheduling
 @EnableScheduling
 public class FSApplication {
 public class FSApplication {
     public static void main(String[] args) {
     public static void main(String[] args) {
-        // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(FSApplication.class, args);
         SpringApplication.run(FSApplication.class, args);
         System.out.println("admin启动成功");
         System.out.println("admin启动成功");
     }
     }

+ 0 - 43
fs-admin/src/main/java/com/fs/config/RedissonConfig.java

@@ -1,43 +0,0 @@
-package com.fs.config;
-
-import org.redisson.Redisson;
-import org.redisson.api.RedissonClient;
-import org.redisson.config.Config;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * 手动配置RedissonClient,仅用于分布式锁。
- * 排除RedissonAutoConfiguration后,避免Redisson接管RedisTemplate的连接工厂。
- */
-@Configuration
-public class RedissonConfig {
-
-    @Value("${spring.redis.host:localhost}")
-    private String host;
-
-    @Value("${spring.redis.port:6379}")
-    private int port;
-
-    @Value("${spring.redis.password:}")
-    private String password;
-
-    @Value("${spring.redis.database:0}")
-    private int database;
-
-    @Bean(destroyMethod = "shutdown")
-    public RedissonClient redissonClient() {
-        Config config = new Config();
-        String address = "redis://" + host + ":" + port;
-        config.useSingleServer()
-                .setAddress(address)
-                .setDatabase(database)
-                .setConnectionMinimumIdleSize(1)
-                .setConnectionPoolSize(4);
-        if (password != null && !password.isEmpty()) {
-            config.useSingleServer().setPassword(password);
-        }
-        return Redisson.create(config);
-    }
-}

+ 0 - 107
fs-service/src/main/java/com/fs/bean/AliPayBean.java

@@ -1,107 +0,0 @@
-package com.fs.bean;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.stereotype.Component;
-
-@Component
-@PropertySource("classpath:/pay/alipay.properties")
-@ConfigurationProperties(prefix = "alipay")
-public class AliPayBean {
-    private String appId;
-    private String privateKey;
-    private String publicKey;
-    private String appCertPath;
-    private String aliPayCertPath;
-    private String aliPayRootCertPath;
-    private String serverUrl;
-    private String domain;
-    private String returnDomain;
-
-    public String getReturnDomain() {
-        return returnDomain;
-    }
-
-    public void setReturnDomain(String returnDomain) {
-        this.returnDomain = returnDomain;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public void setAppId(String appId) {
-        this.appId = appId;
-    }
-
-    public String getPrivateKey() {
-        return privateKey;
-    }
-
-    public void setPrivateKey(String privateKey) {
-        this.privateKey = privateKey;
-    }
-
-    public String getPublicKey() {
-        return publicKey;
-    }
-
-    public void setPublicKey(String publicKey) {
-        this.publicKey = publicKey;
-    }
-
-    public String getAppCertPath() {
-        return appCertPath;
-    }
-
-    public void setAppCertPath(String appCertPath) {
-        this.appCertPath = appCertPath;
-    }
-
-    public String getAliPayCertPath() {
-        return aliPayCertPath;
-    }
-
-    public void setAliPayCertPath(String aliPayCertPath) {
-        this.aliPayCertPath = aliPayCertPath;
-    }
-
-    public String getAliPayRootCertPath() {
-        return aliPayRootCertPath;
-    }
-
-    public void setAliPayRootCertPath(String aliPayRootCertPath) {
-        this.aliPayRootCertPath = aliPayRootCertPath;
-    }
-
-    public String getServerUrl() {
-        return serverUrl;
-    }
-
-    public void setServerUrl(String serverUrl) {
-        this.serverUrl = serverUrl;
-    }
-
-
-    public String getDomain() {
-        return domain;
-    }
-
-    public void setDomain(String domain) {
-        this.domain = domain;
-    }
-
-    @Override
-    public String toString() {
-        return "AliPayBean{" +
-                "appId='" + appId + '\'' +
-                ", privateKey='" + privateKey + '\'' +
-                ", publicKey='" + publicKey + '\'' +
-                ", appCertPath='" + appCertPath + '\'' +
-                ", aliPayCertPath='" + aliPayCertPath + '\'' +
-                ", aliPayRootCertPath='" + aliPayRootCertPath + '\'' +
-                ", serverUrl='" + serverUrl + '\'' +
-                ", domain='" + domain + '\'' +
-                '}';
-    }
-}

+ 0 - 123
fs-service/src/main/java/com/fs/framework/config/DruidConfig.java

@@ -1,123 +0,0 @@
-package com.fs.framework.config;//package com.fs.framework.config;
-//
-//import com.alibaba.druid.pool.DruidDataSource;
-//import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
-//import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
-//import com.alibaba.druid.util.Utils;
-//import com.fs.framework.datasource.DynamicDataSource;
-//import com.fs.common.enums.DataSourceType;
-//import com.fs.common.utils.spring.SpringUtils;
-//import com.fs.framework.config.properties.DruidProperties;
-//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-//import org.springframework.boot.context.properties.ConfigurationProperties;
-//import org.springframework.boot.web.servlet.FilterRegistrationBean;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.context.annotation.Primary;
-//
-//import javax.servlet.*;
-//import javax.sql.DataSource;
-//import java.io.IOException;
-//import java.util.HashMap;
-//import java.util.Map;
-//
-///**
-// * druid 配置多数据源
-// *
-//
-// */
-//@Configuration
-//public class DruidConfig
-//{
-//    @Bean
-//    @ConfigurationProperties("spring.datasource.mysql.druid.master")
-//    public DataSource masterDataSource(DruidProperties druidProperties)
-//    {
-//        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
-//        return druidProperties.dataSource(dataSource);
-//    }
-//
-//    @Bean
-//    @ConfigurationProperties("spring.datasource.mysql.druid.slave")
-//    @ConditionalOnProperty(prefix = "spring.datasource.mysql.druid.slave", name = "enabled", havingValue = "true")
-//    public DataSource slaveDataSource(DruidProperties druidProperties)
-//    {
-//        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
-//        return druidProperties.dataSource(dataSource);
-//    }
-//
-//    @Bean(name = "dynamicDataSource")
-//    @Primary
-//    public DynamicDataSource dataSource(DataSource masterDataSource)
-//    {
-//        Map<Object, Object> targetDataSources = new HashMap<>();
-//        targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
-//        setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
-//        return new DynamicDataSource(masterDataSource, targetDataSources);
-//    }
-//
-//    /**
-//     * 设置数据源
-//     *
-//     * @param targetDataSources 备选数据源集合
-//     * @param sourceName 数据源名称
-//     * @param beanName bean名称
-//     */
-//    public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
-//    {
-//        try
-//        {
-//            DataSource dataSource = SpringUtils.getBean(beanName);
-//            targetDataSources.put(sourceName, dataSource);
-//        }
-//        catch (Exception e)
-//        {
-//        }
-//    }
-//
-//    /**
-//     * 去除监控页面底部的广告
-//     */
-//    @SuppressWarnings({ "rawtypes", "unchecked" })
-//    @Bean
-//    @ConditionalOnProperty(name = "spring.datasource.mysql.druid.statViewServlet.enabled", havingValue = "true")
-//    public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
-//    {
-//        // 获取web监控页面的参数
-//        DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
-//        // 提取common.js的配置路径
-//        String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/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(javax.servlet.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;
-//    }
-//}

+ 0 - 115
fs-service/src/main/java/com/fs/framework/exception/GlobalExceptionHandler.java

@@ -1,115 +0,0 @@
-package com.fs.framework.exception;
-
-import com.fs.common.constant.HttpStatus;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.exception.DemoModeException;
-import com.fs.common.exception.ServiceException;
-import com.fs.common.utils.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.validation.BindException;
-import org.springframework.web.HttpRequestMethodNotSupportedException;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * 全局异常处理器
- *
-
- */
-@RestControllerAdvice
-public class GlobalExceptionHandler
-{
-    private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
-
-    /**
-     * 权限校验异常
-     */
-    @ExceptionHandler(AccessDeniedException.class)
-    public AjaxResult handleAccessDeniedException(AccessDeniedException e, HttpServletRequest request)
-    {
-        String requestURI = request.getRequestURI();
-        log.error("请求地址'{}',权限校验失败'{}'", requestURI, e.getMessage());
-        return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
-    }
-
-    /**
-     * 请求方式不支持
-     */
-    @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
-    public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e,
-            HttpServletRequest request)
-    {
-        String requestURI = request.getRequestURI();
-        log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod());
-        return AjaxResult.error(e.getMessage());
-    }
-
-    /**
-     * 业务异常
-     */
-    @ExceptionHandler(ServiceException.class)
-    public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request)
-    {
-        log.error(e.getMessage(), e);
-        Integer code = e.getCode();
-        return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage());
-    }
-
-    /**
-     * 拦截未知的运行时异常
-     */
-    @ExceptionHandler(RuntimeException.class)
-    public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request)
-    {
-        String requestURI = request.getRequestURI();
-        log.error("请求地址'{}',发生未知异常.", requestURI, e);
-        return AjaxResult.error(e.getMessage());
-    }
-
-    /**
-     * 系统异常
-     */
-    @ExceptionHandler(Exception.class)
-    public AjaxResult handleException(Exception e, HttpServletRequest request)
-    {
-        String requestURI = request.getRequestURI();
-        log.error("请求地址'{}',发生系统异常.", requestURI, e);
-        return AjaxResult.error(e.getMessage());
-    }
-
-    /**
-     * 自定义验证异常
-     */
-    @ExceptionHandler(BindException.class)
-    public AjaxResult handleBindException(BindException e)
-    {
-        log.error(e.getMessage(), e);
-        String message = e.getAllErrors().get(0).getDefaultMessage();
-        return AjaxResult.error(message);
-    }
-
-    /**
-     * 自定义验证异常
-     */
-    @ExceptionHandler(MethodArgumentNotValidException.class)
-    public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e)
-    {
-        log.error(e.getMessage(), e);
-        String message = e.getBindingResult().getFieldError().getDefaultMessage();
-        return AjaxResult.error(message);
-    }
-
-    /**
-     * 演示模式异常
-     */
-    @ExceptionHandler(DemoModeException.class)
-    public AjaxResult handleDemoModeException(DemoModeException e)
-    {
-        return AjaxResult.error("演示模式,不允许操作");
-    }
-}

+ 0 - 240
fs-service/src/main/java/com/fs/framework/web/domain/Server.java

@@ -1,240 +0,0 @@
-package com.fs.framework.web.domain;
-
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import com.fs.common.utils.Arith;
-import com.fs.common.utils.ip.IpUtils;
-import com.fs.framework.web.domain.server.Cpu;
-import com.fs.framework.web.domain.server.Jvm;
-import com.fs.framework.web.domain.server.Mem;
-import com.fs.framework.web.domain.server.Sys;
-import com.fs.framework.web.domain.server.SysFile;
-import oshi.SystemInfo;
-import oshi.hardware.CentralProcessor;
-import oshi.hardware.CentralProcessor.TickType;
-import oshi.hardware.GlobalMemory;
-import oshi.hardware.HardwareAbstractionLayer;
-import oshi.software.os.FileSystem;
-import oshi.software.os.OSFileStore;
-import oshi.software.os.OperatingSystem;
-import oshi.util.Util;
-
-/**
- * 服务器相关信息
- * 
-
- */
-public class Server
-{
-    private static final int OSHI_WAIT_SECOND = 1000;
-    
-    /**
-     * CPU相关信息
-     */
-    private Cpu cpu = new Cpu();
-
-    /**
-     * 內存相关信息
-     */
-    private Mem mem = new Mem();
-
-    /**
-     * JVM相关信息
-     */
-    private Jvm jvm = new Jvm();
-
-    /**
-     * 服务器相关信息
-     */
-    private Sys sys = new Sys();
-
-    /**
-     * 磁盘相关信息
-     */
-    private List<SysFile> sysFiles = new LinkedList<SysFile>();
-
-    public Cpu getCpu()
-    {
-        return cpu;
-    }
-
-    public void setCpu(Cpu cpu)
-    {
-        this.cpu = cpu;
-    }
-
-    public Mem getMem()
-    {
-        return mem;
-    }
-
-    public void setMem(Mem mem)
-    {
-        this.mem = mem;
-    }
-
-    public Jvm getJvm()
-    {
-        return jvm;
-    }
-
-    public void setJvm(Jvm jvm)
-    {
-        this.jvm = jvm;
-    }
-
-    public Sys getSys()
-    {
-        return sys;
-    }
-
-    public void setSys(Sys sys)
-    {
-        this.sys = sys;
-    }
-
-    public List<SysFile> getSysFiles()
-    {
-        return sysFiles;
-    }
-
-    public void setSysFiles(List<SysFile> sysFiles)
-    {
-        this.sysFiles = sysFiles;
-    }
-
-    public void copyTo() throws Exception
-    {
-        SystemInfo si = new SystemInfo();
-        HardwareAbstractionLayer hal = si.getHardware();
-
-        setCpuInfo(hal.getProcessor());
-
-        setMemInfo(hal.getMemory());
-
-        setSysInfo();
-
-        setJvmInfo();
-
-        setSysFiles(si.getOperatingSystem());
-    }
-
-    /**
-     * 设置CPU信息
-     */
-    private void setCpuInfo(CentralProcessor processor)
-    {
-        // CPU信息
-        long[] prevTicks = processor.getSystemCpuLoadTicks();
-        Util.sleep(OSHI_WAIT_SECOND);
-        long[] ticks = processor.getSystemCpuLoadTicks();
-        long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()];
-        long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()];
-        long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()];
-        long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()];
-        long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()];
-        long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()];
-        long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()];
-        long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()];
-        long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal;
-        cpu.setCpuNum(processor.getLogicalProcessorCount());
-        cpu.setTotal(totalCpu);
-        cpu.setSys(cSys);
-        cpu.setUsed(user);
-        cpu.setWait(iowait);
-        cpu.setFree(idle);
-    }
-
-    /**
-     * 设置内存信息
-     */
-    private void setMemInfo(GlobalMemory memory)
-    {
-        mem.setTotal(memory.getTotal());
-        mem.setUsed(memory.getTotal() - memory.getAvailable());
-        mem.setFree(memory.getAvailable());
-    }
-
-    /**
-     * 设置服务器信息
-     */
-    private void setSysInfo()
-    {
-        Properties props = System.getProperties();
-        sys.setComputerName(IpUtils.getHostName());
-        sys.setComputerIp(IpUtils.getHostIp());
-        sys.setOsName(props.getProperty("os.name"));
-        sys.setOsArch(props.getProperty("os.arch"));
-        sys.setUserDir(props.getProperty("user.dir"));
-    }
-
-    /**
-     * 设置Java虚拟机
-     */
-    private void setJvmInfo() throws UnknownHostException
-    {
-        Properties props = System.getProperties();
-        jvm.setTotal(Runtime.getRuntime().totalMemory());
-        jvm.setMax(Runtime.getRuntime().maxMemory());
-        jvm.setFree(Runtime.getRuntime().freeMemory());
-        jvm.setVersion(props.getProperty("java.version"));
-        jvm.setHome(props.getProperty("java.home"));
-    }
-
-    /**
-     * 设置磁盘信息
-     */
-    private void setSysFiles(OperatingSystem os)
-    {
-        FileSystem fileSystem = os.getFileSystem();
-        List<OSFileStore> fsArray = fileSystem.getFileStores();
-        for (OSFileStore fs : fsArray)
-        {
-            long free = fs.getUsableSpace();
-            long total = fs.getTotalSpace();
-            long used = total - free;
-            SysFile sysFile = new SysFile();
-            sysFile.setDirName(fs.getMount());
-            sysFile.setSysTypeName(fs.getType());
-            sysFile.setTypeName(fs.getName());
-            sysFile.setTotal(convertFileSize(total));
-            sysFile.setFree(convertFileSize(free));
-            sysFile.setUsed(convertFileSize(used));
-            sysFile.setUsage(Arith.mul(Arith.div(used, total, 4), 100));
-            sysFiles.add(sysFile);
-        }
-    }
-
-    /**
-     * 字节转换
-     * 
-     * @param size 字节大小
-     * @return 转换后值
-     */
-    public String convertFileSize(long size)
-    {
-        long kb = 1024;
-        long mb = kb * 1024;
-        long gb = mb * 1024;
-        if (size >= gb)
-        {
-            return String.format("%.1f GB", (float) size / gb);
-        }
-        else if (size >= mb)
-        {
-            float f = (float) size / mb;
-            return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f);
-        }
-        else if (size >= kb)
-        {
-            float f = (float) size / kb;
-            return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f);
-        }
-        else
-        {
-            return String.format("%d B", size);
-        }
-    }
-}

+ 0 - 101
fs-service/src/main/java/com/fs/framework/web/domain/server/Cpu.java

@@ -1,101 +0,0 @@
-package com.fs.framework.web.domain.server;
-
-import com.fs.common.utils.Arith;
-
-/**
- * CPU相关信息
- * 
-
- */
-public class Cpu
-{
-    /**
-     * 核心数
-     */
-    private int cpuNum;
-
-    /**
-     * CPU总的使用率
-     */
-    private double total;
-
-    /**
-     * CPU系统使用率
-     */
-    private double sys;
-
-    /**
-     * CPU用户使用率
-     */
-    private double used;
-
-    /**
-     * CPU当前等待率
-     */
-    private double wait;
-
-    /**
-     * CPU当前空闲率
-     */
-    private double free;
-
-    public int getCpuNum()
-    {
-        return cpuNum;
-    }
-
-    public void setCpuNum(int cpuNum)
-    {
-        this.cpuNum = cpuNum;
-    }
-
-    public double getTotal()
-    {
-        return Arith.round(Arith.mul(total, 100), 2);
-    }
-
-    public void setTotal(double total)
-    {
-        this.total = total;
-    }
-
-    public double getSys()
-    {
-        return Arith.round(Arith.mul(sys / total, 100), 2);
-    }
-
-    public void setSys(double sys)
-    {
-        this.sys = sys;
-    }
-
-    public double getUsed()
-    {
-        return Arith.round(Arith.mul(used / total, 100), 2);
-    }
-
-    public void setUsed(double used)
-    {
-        this.used = used;
-    }
-
-    public double getWait()
-    {
-        return Arith.round(Arith.mul(wait / total, 100), 2);
-    }
-
-    public void setWait(double wait)
-    {
-        this.wait = wait;
-    }
-
-    public double getFree()
-    {
-        return Arith.round(Arith.mul(free / total, 100), 2);
-    }
-
-    public void setFree(double free)
-    {
-        this.free = free;
-    }
-}

+ 0 - 122
fs-service/src/main/java/com/fs/framework/web/domain/server/Jvm.java

@@ -1,122 +0,0 @@
-package com.fs.framework.web.domain.server;
-
-import java.lang.management.ManagementFactory;
-import com.fs.common.utils.Arith;
-import com.fs.common.utils.DateUtils;
-
-/**
- * JVM相关信息
- * 
-
- */
-public class Jvm
-{
-    /**
-     * 当前JVM占用的内存总数(M)
-     */
-    private double total;
-
-    /**
-     * JVM最大可用内存总数(M)
-     */
-    private double max;
-
-    /**
-     * JVM空闲内存(M)
-     */
-    private double free;
-
-    /**
-     * JDK版本
-     */
-    private String version;
-
-    /**
-     * JDK路径
-     */
-    private String home;
-
-    public double getTotal()
-    {
-        return Arith.div(total, (1024 * 1024), 2);
-    }
-
-    public void setTotal(double total)
-    {
-        this.total = total;
-    }
-
-    public double getMax()
-    {
-        return Arith.div(max, (1024 * 1024), 2);
-    }
-
-    public void setMax(double max)
-    {
-        this.max = max;
-    }
-
-    public double getFree()
-    {
-        return Arith.div(free, (1024 * 1024), 2);
-    }
-
-    public void setFree(double free)
-    {
-        this.free = free;
-    }
-
-    public double getUsed()
-    {
-        return Arith.div(total - free, (1024 * 1024), 2);
-    }
-
-    public double getUsage()
-    {
-        return Arith.mul(Arith.div(total - free, total, 4), 100);
-    }
-
-    /**
-     * 获取JDK名称
-     */
-    public String getName()
-    {
-        return ManagementFactory.getRuntimeMXBean().getVmName();
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion(String version)
-    {
-        this.version = version;
-    }
-
-    public String getHome()
-    {
-        return home;
-    }
-
-    public void setHome(String home)
-    {
-        this.home = home;
-    }
-
-    /**
-     * JDK启动时间
-     */
-    public String getStartTime()
-    {
-        return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate());
-    }
-
-    /**
-     * JDK运行时间
-     */
-    public String getRunTime()
-    {
-        return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate());
-    }
-}

+ 0 - 61
fs-service/src/main/java/com/fs/framework/web/domain/server/Mem.java

@@ -1,61 +0,0 @@
-package com.fs.framework.web.domain.server;
-
-import com.fs.common.utils.Arith;
-
-/**
- * 內存相关信息
- * 
-
- */
-public class Mem
-{
-    /**
-     * 内存总量
-     */
-    private double total;
-
-    /**
-     * 已用内存
-     */
-    private double used;
-
-    /**
-     * 剩余内存
-     */
-    private double free;
-
-    public double getTotal()
-    {
-        return Arith.div(total, (1024 * 1024 * 1024), 2);
-    }
-
-    public void setTotal(long total)
-    {
-        this.total = total;
-    }
-
-    public double getUsed()
-    {
-        return Arith.div(used, (1024 * 1024 * 1024), 2);
-    }
-
-    public void setUsed(long used)
-    {
-        this.used = used;
-    }
-
-    public double getFree()
-    {
-        return Arith.div(free, (1024 * 1024 * 1024), 2);
-    }
-
-    public void setFree(long free)
-    {
-        this.free = free;
-    }
-
-    public double getUsage()
-    {
-        return Arith.mul(Arith.div(used, total, 4), 100);
-    }
-}

+ 0 - 84
fs-service/src/main/java/com/fs/framework/web/domain/server/Sys.java

@@ -1,84 +0,0 @@
-package com.fs.framework.web.domain.server;
-
-/**
- * 系统相关信息
- * 
-
- */
-public class Sys
-{
-    /**
-     * 服务器名称
-     */
-    private String computerName;
-
-    /**
-     * 服务器Ip
-     */
-    private String computerIp;
-
-    /**
-     * 项目路径
-     */
-    private String userDir;
-
-    /**
-     * 操作系统
-     */
-    private String osName;
-
-    /**
-     * 系统架构
-     */
-    private String osArch;
-
-    public String getComputerName()
-    {
-        return computerName;
-    }
-
-    public void setComputerName(String computerName)
-    {
-        this.computerName = computerName;
-    }
-
-    public String getComputerIp()
-    {
-        return computerIp;
-    }
-
-    public void setComputerIp(String computerIp)
-    {
-        this.computerIp = computerIp;
-    }
-
-    public String getUserDir()
-    {
-        return userDir;
-    }
-
-    public void setUserDir(String userDir)
-    {
-        this.userDir = userDir;
-    }
-
-    public String getOsName()
-    {
-        return osName;
-    }
-
-    public void setOsName(String osName)
-    {
-        this.osName = osName;
-    }
-
-    public String getOsArch()
-    {
-        return osArch;
-    }
-
-    public void setOsArch(String osArch)
-    {
-        this.osArch = osArch;
-    }
-}

+ 0 - 114
fs-service/src/main/java/com/fs/framework/web/domain/server/SysFile.java

@@ -1,114 +0,0 @@
-package com.fs.framework.web.domain.server;
-
-/**
- * 系统文件相关信息
- * 
-
- */
-public class SysFile
-{
-    /**
-     * 盘符路径
-     */
-    private String dirName;
-
-    /**
-     * 盘符类型
-     */
-    private String sysTypeName;
-
-    /**
-     * 文件类型
-     */
-    private String typeName;
-
-    /**
-     * 总大小
-     */
-    private String total;
-
-    /**
-     * 剩余大小
-     */
-    private String free;
-
-    /**
-     * 已经使用量
-     */
-    private String used;
-
-    /**
-     * 资源的使用率
-     */
-    private double usage;
-
-    public String getDirName()
-    {
-        return dirName;
-    }
-
-    public void setDirName(String dirName)
-    {
-        this.dirName = dirName;
-    }
-
-    public String getSysTypeName()
-    {
-        return sysTypeName;
-    }
-
-    public void setSysTypeName(String sysTypeName)
-    {
-        this.sysTypeName = sysTypeName;
-    }
-
-    public String getTypeName()
-    {
-        return typeName;
-    }
-
-    public void setTypeName(String typeName)
-    {
-        this.typeName = typeName;
-    }
-
-    public String getTotal()
-    {
-        return total;
-    }
-
-    public void setTotal(String total)
-    {
-        this.total = total;
-    }
-
-    public String getFree()
-    {
-        return free;
-    }
-
-    public void setFree(String free)
-    {
-        this.free = free;
-    }
-
-    public String getUsed()
-    {
-        return used;
-    }
-
-    public void setUsed(String used)
-    {
-        this.used = used;
-    }
-
-    public double getUsage()
-    {
-        return usage;
-    }
-
-    public void setUsage(double usage)
-    {
-        this.usage = usage;
-    }
-}

+ 0 - 417
fs-service/src/main/java/com/fs/framework/web/service/SysLoginService.java

@@ -1,417 +0,0 @@
-package com.fs.framework.web.service;
-
-import com.fs.framework.service.TokenService;
-import javax.annotation.Resource;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.fs.common.enums.DataSourceType;
-import com.fs.common.service.WechatLoginService;
-import com.fs.common.utils.StringUtils;
-import com.fs.framework.datasource.DynamicDataSource;
-import com.fs.framework.datasource.DynamicDataSourceContextHolder;
-import com.fs.framework.datasource.TenantDataSourceManager;
-import com.fs.tenant.domain.TenantInfo;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Component;
-import com.fs.common.constant.Constants;
-import com.fs.common.core.domain.entity.SysUser;
-import com.fs.common.core.domain.model.LoginUser;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.exception.ServiceException;
-import com.fs.common.exception.user.CaptchaException;
-import com.fs.common.exception.user.CaptchaExpireException;
-import com.fs.common.exception.user.UserPasswordNotMatchException;
-import com.fs.common.utils.DateUtils;
-import com.fs.common.utils.MessageUtils;
-import com.fs.common.utils.ServletUtils;
-import com.fs.common.utils.ip.IpUtils;
-import com.fs.framework.manager.AsyncManager;
-import com.fs.framework.manager.factory.AsyncFactory;
-import com.fs.system.service.ISysConfigService;
-import com.fs.system.service.ISysUserService;
-
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 登录校验方法
- * 
-
- */
-@Component
-public class SysLoginService
-{
-    @Autowired
-    private TokenService tokenService;
-
-    @Resource
-    private AuthenticationManager authenticationManager;
-
-    @Autowired
-    private RedisCache redisCache;
-    
-    @Autowired
-    private ISysUserService userService;
-
-    @Autowired
-    private ISysConfigService configService;
-    @Autowired
-    private WechatLoginService wechatLoginService;
-
-    @Value("${wechat.admin.appid:#{null}}")
-    private String appId;
-    @Value("${wechat.admin.secret:#{null}}")
-    private String secret;
-    @Value("${wechat.admin.redirectUri:#{null}}")
-    private String redirectUri;
-    @Value("${wechat.isNeedScan:false}")
-    private Boolean isNeedScan;
-
-    /**
-     * 登录验证
-     * 
-     * @param username 用户名
-     * @param password 密码
-     * @param code 验证码
-     * @param uuid 唯一标识
-     * @return 结果
-     */
-    public String login(String username, String password, String code, String uuid, String tenantCode)
-    {
-        boolean captchaOnOff = configService.selectCaptchaOnOff();
-        // 验证码开关
-        if (captchaOnOff)
-        {
-            validateCaptcha(username, code, uuid);
-        }
-
-        TenantInfo tenantInfo = null;
-
-        // 默认使用主库
-        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
-
-        // ===== 只有传了 tenantCode 才查询租户并切库 =====
-        if (StringUtils.isNotBlank(tenantCode))
-        {
-            // 查询租户(主库)
-            tenantInfo = userService.getTenantInfo(tenantCode);
-            if (BeanUtil.isEmpty(tenantInfo)) {
-                throw new ServiceException("企业不存在");
-            }
-
-            if (!tenantInfo.getStatus().equals(1)) {
-                throw new ServiceException("企业已禁用");
-            }
-
-            // 切租户库
-            tenantDataSourceManager.switchTenant(tenantInfo);
-        }
-
-        try {
-            // 用户验证
-            Authentication authentication = null;
-            try {
-                // 该方法会去调用 UserDetailsServiceImpl.loadUserByUsername
-                authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
-            } catch (Exception e) {
-                if (e instanceof BadCredentialsException) {
-                    AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
-                    throw new UserPasswordNotMatchException();
-                } else {
-                    AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, e.getMessage()));
-                    throw new ServiceException(e.getMessage());
-                }
-            }
-
-            AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
-
-            LoginUser loginUser = (LoginUser) authentication.getPrincipal();
-
-            // 只有多租户登录才设置 tenantId
-            if (tenantInfo != null) {
-                loginUser.setTenantId(tenantInfo.getId());
-            }
-
-            recordLoginInfo(loginUser.getUser());
-
-            // 生成 token
-            return tokenService.createToken(loginUser);
-        } finally {
-            // 防止线程串库(必须)
-            tenantDataSourceManager.clear();
-            DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
-        }
-    }
-
-
-    /**
-     * 校验验证码
-     * 
-     * @param username 用户名
-     * @param code 验证码
-     * @param uuid 唯一标识
-     * @return 结果
-     */
-    public void validateCaptcha(String username, String code, String uuid)
-    {
-        String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
-        String captcha = redisCache.getCacheObject(verifyKey);
-        redisCache.deleteObject(verifyKey);
-        if (captcha == null)
-        {
-            AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
-            throw new CaptchaExpireException();
-        }
-        if (!code.equalsIgnoreCase(captcha))
-        {
-            AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
-            throw new CaptchaException();
-        }
-    }
-
-    /**
-     * 记录登录信息
-     */
-    public void recordLoginInfo(SysUser user)
-    {
-        String ipAddr = IpUtils.getIpAddr(ServletUtils.getRequest());
-        String loginIp = user.getLoginIp();
-        if (com.fs.common.utils.StringUtils.isEmpty(loginIp)) {
-            user.setLoginIp(ipAddr);
-        } else {
-            List<String> ipList = new ArrayList<>(Arrays.asList(loginIp.split(",")));
-            if (!ipList.contains(ipAddr)) {
-                ipList.add(ipAddr);
-                user.setLoginIp(String.join(",", ipList));
-            }
-        }
-        user.setLoginDate(DateUtils.getNowDate());
-        userService.updateUserProfile(user);
-    }
-
-    @Resource
-    private TenantDataSourceManager tenantDataSourceManager;
-
-    public boolean checkIsNeedCheck(String username, String password, String code, String uuid, String tenantCode)
-    {
-        // 验证码开关
-        boolean captchaOnOff = configService.selectCaptchaOnOff();
-        if (captchaOnOff)
-        {
-            String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
-            String captcha = redisCache.getCacheObject(verifyKey);
-            redisCache.deleteObject(verifyKey);
-
-            if (captcha == null)
-            {
-                AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
-                throw new CaptchaExpireException();
-            }
-
-            if (!code.equalsIgnoreCase(captcha))
-            {
-                AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
-                throw new CaptchaException();
-            }
-        }
-
-        TenantInfo tenantInfo = null;
-
-        // 默认使用主库
-        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
-
-        // ===== 只有传了 tenantCode 才走租户逻辑 =====
-        if (StringUtils.isNotBlank(tenantCode))
-        {
-            // 查询租户(主库)
-            tenantInfo = userService.getTenantInfo(tenantCode);
-            if (BeanUtil.isEmpty(tenantInfo))
-            {
-                throw new ServiceException("企业不存在");
-            }
-            if (!tenantInfo.getStatus().equals(1))
-            {
-                throw new ServiceException("企业已禁用");
-            }
-
-            // 切到租户库
-            tenantDataSourceManager.switchTenant(tenantInfo);
-        }
-
-        try
-        {
-            // 用户验证
-            Authentication authentication = null;
-            try {
-                authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
-            } catch (Exception e)
-            {
-                if (e instanceof BadCredentialsException) {
-                    AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
-                    throw new UserPasswordNotMatchException();
-                } else {
-                    AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.LOGIN_FAIL, e.getMessage()));
-                    throw new ServiceException(e.getMessage());
-                }
-            }
-
-            LoginUser loginUser = (LoginUser) authentication.getPrincipal();
-
-            // 查询当前登录用户信息(在当前数据源下)
-            SysUser sysUser = userService.selectUserById(loginUser.getUserId());
-
-            Long[] userIds = new Long[]{236L, 246L, 247L, 253L, 119L};
-            for (Long userId : userIds)
-            {
-                if (userId.equals(sysUser.getUserId()))
-                {
-                    return false;
-                }
-            }
-
-            // 判断是否开启了扫码配置
-            if (ObjectUtil.isEmpty(isNeedScan) || !isNeedScan)
-            {
-                return false;
-            }
-
-            // true → 需要短信验证码
-            // false → 直接登录
-            return needCheck(sysUser);
-        }
-        finally
-        {
-            // 防止线程串库
-            tenantDataSourceManager.clear();
-            DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
-        }
-    }
-
-    public boolean needCheck(SysUser sysUser) {
-
-
-        // 1. 校验 IP
-        if (!checkIp(sysUser)) {
-            // IP 不一致
-            return true;
-        }
-
-        // 2. 校验是否首次登录
-        if (checkIsFirstLogin(sysUser)) {
-            return true;
-        }
-
-        // 3. 校验上次登录时间是否在五天前
-        if (checkIsLoginTime(sysUser)) {
-            return true;
-        }
-
-        // 4. 检查是否在设置的某一天
-//        if (checkIsSpecialDay(new Date())) {
-//            return true;
-//        }
-        if (haveUnionId(sysUser)){
-            return true;
-        }
-
-        return false;
-    }
-    public boolean haveUnionId( SysUser sysUser){
-        if (StringUtils.isEmpty(sysUser.getUnionId())){
-            return true;
-        }
-        return false;
-    }
-    public boolean checkIp(SysUser sysUser){
-        // 获取当前 IP
-        String ipAddr = IpUtils.getIpAddr(ServletUtils.getRequest());
-        // 获取已记录的登录 IP
-        String lastLoginIp = sysUser.getLoginIp();
-
-        if (StringUtils.isNotEmpty(lastLoginIp)) {
-            List<String> ipList = Arrays.asList(lastLoginIp.split(","));
-            return ipList.contains(ipAddr);
-        }
-        return false;
-    }
-    //检查是否第一次登录
-    public boolean checkIsFirstLogin(SysUser sysUser){
-        // 获取上次登录 IP
-        String lastLoginIp = sysUser.getLoginIp();
-        if (StringUtils.isEmpty(lastLoginIp)||sysUser.getLoginDate()==null){
-            return true;
-        }
-        return false;
-    }
-    public boolean checkIsLoginTime(SysUser sysUser) {
-        // 获取上次登录时间
-        Date loginDate = sysUser.getLoginDate();
-        if (loginDate == null) {
-            // 没有登录记录,直接返回 true(需要处理)
-            return true;
-        }
-
-        // 当前时间
-        Date now = new Date();
-
-        // 计算两个时间的毫秒差
-        long diff = now.getTime() - loginDate.getTime();
-
-        // 5天 = 5 * 24 * 60 * 60 * 1000 毫秒
-        long fiveDays = 5L * 24 * 60 * 60 * 1000;
-
-        return diff >= fiveDays;
-    }
-
-    /**
-     * 获取微信登录二维码参数
-     * @param account 当前登录用户名
-     * @return 二维码参数
-     */
-    public Map<String, String> getWechatQrCode(String account) throws Exception {
-        // 生成 loginTicket
-        String ticket = UUID.randomUUID().toString();
-        redisCache.setCacheObject("login:ticket:" + ticket, account, 60, TimeUnit.SECONDS);
-
-        return wechatLoginService.getQrCode(ticket,appId,secret,redirectUri); // 返回二维码参数
-    }
-
-    /**
-     * 微信扫码回调
-     */
-    public void handleCallback(String code, String ticket) {
-        String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appId
-                + "&secret=" + secret
-                + "&code=" + code
-                + "&grant_type=authorization_code";
-
-        JSONObject json = JSON.parseObject(cn.hutool.http.HttpUtil.get(url));
-        String unionid = json.getString("unionid");
-        if (unionid == null) throw new ServiceException("微信授权失败");
-
-        String username = redisCache.getCacheObject("login:ticket:" + ticket);
-        if (username == null) throw new ServiceException("ticket无效或过期");
-        SysUser sysUser = userService.selectUserByUserName(username);
-        if (sysUser == null) throw new ServiceException("用户不存在");
-        if (sysUser.getUnionId() == null || sysUser.getUnionId().isEmpty()) {
-            // 如果用户没有绑定 unionid,则绑定当前扫码用户的 unionid
-            sysUser.setUnionId(unionid);
-            userService.updateUserProfile(sysUser);
-        } else if (!sysUser.getUnionId().equals(unionid)) {
-            // 如果用户已绑定 unionid,但与扫码用户不一致,则拒绝登录
-            redisCache.setCacheObject("wechat:scan:" + ticket, "error:账号与绑定用户不匹配", 30, TimeUnit.SECONDS);
-            return;
-        }
-
-        redisCache.setCacheObject("wechat:scan:" + ticket, "ok", 30, TimeUnit.SECONDS);
-    }
-}

+ 0 - 66
fs-service/src/main/java/com/fs/framework/web/service/SysPermissionService.java

@@ -1,66 +0,0 @@
-package com.fs.framework.web.service;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import com.fs.common.core.domain.entity.SysUser;
-import com.fs.system.service.ISysMenuService;
-import com.fs.system.service.ISysRoleService;
-
-/**
- * 用户权限处理
- * 
-
- */
-@Component
-public class SysPermissionService
-{
-    @Autowired
-    private ISysRoleService roleService;
-
-    @Autowired
-    private ISysMenuService menuService;
-
-    /**
-     * 获取角色数据权限
-     * 
-     * @param user 用户信息
-     * @return 角色权限信息
-     */
-    public Set<String> getRolePermission(SysUser user)
-    {
-        Set<String> roles = new HashSet<String>();
-        // 管理员拥有所有权限
-        if (user.isAdmin())
-        {
-            roles.add("admin");
-        }
-        else
-        {
-            roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
-        }
-        return roles;
-    }
-
-    /**
-     * 获取菜单数据权限
-     * 
-     * @param user 用户信息
-     * @return 菜单权限信息
-     */
-    public Set<String> getMenuPermission(SysUser user)
-    {
-        Set<String> perms = new HashSet<String>();
-        // 管理员拥有所有权限
-        if (user.isAdmin())
-        {
-            perms.add("*:*:*");
-        }
-        else
-        {
-            perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
-        }
-        return perms;
-    }
-}

+ 0 - 115
fs-service/src/main/java/com/fs/framework/web/service/SysRegisterService.java

@@ -1,115 +0,0 @@
-package com.fs.framework.web.service;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-import com.fs.common.constant.Constants;
-import com.fs.common.constant.UserConstants;
-import com.fs.common.core.domain.entity.SysUser;
-import com.fs.common.core.domain.model.RegisterBody;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.exception.user.CaptchaException;
-import com.fs.common.exception.user.CaptchaExpireException;
-import com.fs.common.utils.MessageUtils;
-import com.fs.common.utils.SecurityUtils;
-import com.fs.framework.manager.AsyncManager;
-import com.fs.framework.manager.factory.AsyncFactory;
-import com.fs.system.service.ISysConfigService;
-import com.fs.system.service.ISysUserService;
-
-/**
- * 注册校验方法
- * 
-
- */
-@Component
-public class SysRegisterService
-{
-    @Autowired
-    private ISysUserService userService;
-
-    @Autowired
-    private ISysConfigService configService;
-
-    @Autowired
-    private RedisCache redisCache;
-
-    /**
-     * 注册
-     */
-    public String register(RegisterBody registerBody)
-    {
-        String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword();
-
-        boolean captchaOnOff = configService.selectCaptchaOnOff();
-        // 验证码开关
-        if (captchaOnOff)
-        {
-            validateCaptcha(username, registerBody.getCode(), registerBody.getUuid());
-        }
-
-        if (StringUtils.isEmpty(username))
-        {
-            msg = "用户名不能为空";
-        }
-        else if (StringUtils.isEmpty(password))
-        {
-            msg = "用户密码不能为空";
-        }
-        else if (username.length() < UserConstants.USERNAME_MIN_LENGTH
-                || username.length() > UserConstants.USERNAME_MAX_LENGTH)
-        {
-            msg = "账户长度必须在2到20个字符之间";
-        }
-        else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
-                || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
-        {
-            msg = "密码长度必须在5到20个字符之间";
-        }
-        else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(username)))
-        {
-            msg = "保存用户'" + username + "'失败,注册账号已存在";
-        }
-        else
-        {
-            SysUser sysUser = new SysUser();
-            sysUser.setUserName(username);
-            sysUser.setNickName(username);
-            sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword()));
-            boolean regFlag = userService.registerUser(sysUser);
-            if (!regFlag)
-            {
-                msg = "注册失败,请联系系统管理人员";
-            }
-            else
-            {
-                AsyncManager.me().execute(AsyncFactory.recordLogininfor(0L, username, Constants.REGISTER,
-                        MessageUtils.message("user.register.success")));
-            }
-        }
-        return msg;
-    }
-
-    /**
-     * 校验验证码
-     * 
-     * @param username 用户名
-     * @param code 验证码
-     * @param uuid 唯一标识
-     * @return 结果
-     */
-    public void validateCaptcha(String username, String code, String uuid)
-    {
-        String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
-        String captcha = redisCache.getCacheObject(verifyKey);
-        redisCache.deleteObject(verifyKey);
-        if (captcha == null)
-        {
-            throw new CaptchaExpireException();
-        }
-        if (!code.equalsIgnoreCase(captcha))
-        {
-            throw new CaptchaException();
-        }
-    }
-}