Bladeren bron

新增安防集成平台项目

duanmin 2 jaren geleden
commit
3cc59486c4
100 gewijzigde bestanden met toevoegingen van 10259 en 0 verwijderingen
  1. 33 0
      .gitignore
  2. 124 0
      consumer/pom.xml
  3. 17 0
      consumer/src/main/java/com/sunwin/swismp/ConsumerApplication.java
  4. 22 0
      consumer/src/main/java/com/sunwin/swismp/config/log/LogInterfaceConfig.java
  5. 34 0
      consumer/src/main/java/com/sunwin/swismp/config/log/LogIpConfig.java
  6. 16 0
      consumer/src/main/java/com/sunwin/swismp/config/log/LogLineConfig.java
  7. 28 0
      consumer/src/main/java/com/sunwin/swismp/config/log/LogMesConfig.java
  8. 19 0
      consumer/src/main/java/com/sunwin/swismp/config/log/LogMethodsConfig.java
  9. 34 0
      consumer/src/main/java/com/sunwin/swismp/config/log/LogUserOrgIdConfig.java
  10. 26 0
      consumer/src/main/java/com/sunwin/swismp/config/log/ResponseTimeConfig.java
  11. 27 0
      consumer/src/main/java/com/sunwin/swismp/config/threadlocal/DateContextHolder.java
  12. 20 0
      consumer/src/main/java/com/sunwin/swismp/config/threadlocal/StartTimeContextHolder.java
  13. 28 0
      consumer/src/main/java/com/sunwin/swismp/config/threadlocal/UserOrgContextHolder.java
  14. 56 0
      consumer/src/main/java/com/sunwin/swismp/constant/AggregateDateEnum.java
  15. 32 0
      consumer/src/main/java/com/sunwin/swismp/constant/DateParam.java
  16. 83 0
      consumer/src/main/java/com/sunwin/swismp/constant/HttpResultParam.java
  17. 22 0
      consumer/src/main/java/com/sunwin/swismp/constant/MethodDescription.java
  18. 166 0
      consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/LoginController.java
  19. 56 0
      consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysLogController.java
  20. 143 0
      consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysMenuController.java
  21. 168 0
      consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysOrgController.java
  22. 212 0
      consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysRoleController.java
  23. 416 0
      consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysUserController.java
  24. 115 0
      consumer/src/main/java/com/sunwin/swismp/exception/CustomExceptionResolver.java
  25. 53 0
      consumer/src/main/java/com/sunwin/swismp/exception/JsonResult.java
  26. 62 0
      consumer/src/main/java/com/sunwin/swismp/exception/JsonResultData.java
  27. 46 0
      consumer/src/main/java/com/sunwin/swismp/util/LoggerMessageUtil.java
  28. 42 0
      consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/CheckSumBuilder.java
  29. 144 0
      consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/MobileMessageSendUtil.java
  30. 38 0
      consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/NeteaseImResponse.java
  31. 48 0
      consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/ReadPropertiesUtil.java
  32. 12 0
      consumer/src/main/resources/application.properties
  33. 27 0
      consumer/src/main/resources/dubbo-consumer.xml
  34. 48 0
      consumer/src/main/resources/logback.xml
  35. 39 0
      consumer/src/main/resources/mobile.properties
  36. 43 0
      pom.xml
  37. 147 0
      provider/pom.xml
  38. 21 0
      provider/src/main/java/com/sunwin/ProviderApplication.java
  39. 19 0
      provider/src/main/java/com/sunwin/swismp/config/annotation/DS.java
  40. 63 0
      provider/src/main/java/com/sunwin/swismp/config/datasource/DataSourceConfig.java
  41. 9 0
      provider/src/main/java/com/sunwin/swismp/config/datasource/DataSourceType.java
  42. 20 0
      provider/src/main/java/com/sunwin/swismp/config/datasource/DynamicDataSource.java
  43. 70 0
      provider/src/main/java/com/sunwin/swismp/config/datasource/DynamicDataSourceAspect.java
  44. 31 0
      provider/src/main/java/com/sunwin/swismp/config/threadlocal/DataSourceContextHolder.java
  45. 93 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysMenuMapper.java
  46. 30 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysOperationLogMapper.java
  47. 47 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysOrgMapper.java
  48. 109 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysRoleMapper.java
  49. 29 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysRoleMenuMapper.java
  50. 27 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysRoleMenuPermissionsMapper.java
  51. 199 0
      provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysUserMapper.java
  52. 259 0
      provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysMenuServiceImpl.java
  53. 53 0
      provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysOperationLogServiceImpl.java
  54. 153 0
      provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysOrgServiceImpl.java
  55. 163 0
      provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysRoleMenuPermissionsServiceImpl.java
  56. 218 0
      provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysRoleServiceImpl.java
  57. 593 0
      provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysUserServiceImpl.java
  58. 37 0
      provider/src/main/resources/application-dev.properties
  59. 1 0
      provider/src/main/resources/application.properties
  60. 41 0
      provider/src/main/resources/dubbo-provider.xml
  61. 231 0
      provider/src/main/resources/mapping/sysfunction/SysMenuMapper.xml
  62. 78 0
      provider/src/main/resources/mapping/sysfunction/SysOperationLogMapper.xml
  63. 265 0
      provider/src/main/resources/mapping/sysfunction/SysOrgMapper.xml
  64. 174 0
      provider/src/main/resources/mapping/sysfunction/SysRoleMapper.xml
  65. 33 0
      provider/src/main/resources/mapping/sysfunction/SysRoleMenuMapper.xml
  66. 70 0
      provider/src/main/resources/mapping/sysfunction/SysRoleMenuPermissionsMapper.xml
  67. 613 0
      provider/src/main/resources/mapping/sysfunction/SysUserMapper.xml
  68. 81 0
      swismp-api/pom.xml
  69. 136 0
      swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysMenu.java
  70. 97 0
      swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysOperationLog.java
  71. 117 0
      swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysOrg.java
  72. 103 0
      swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysRole.java
  73. 76 0
      swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysRoleMenu.java
  74. 179 0
      swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysUser.java
  75. 39 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/Link.java
  76. 35 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/LoginResult.java
  77. 29 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/Node.java
  78. 51 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysMenuDTO.java
  79. 103 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysMenuResult.java
  80. 30 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysOperationLogDTO.java
  81. 58 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysOrgDTO.java
  82. 22 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysRoleDTO.java
  83. 133 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysRoleMenuPermissions.java
  84. 39 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysUserDTO.java
  85. 62 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysUserManage.java
  86. 50 0
      swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysUserOrg.java
  87. 23 0
      swismp-api/src/main/java/com/sunwin/swismp/exception/SwismpBizException.java
  88. 68 0
      swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysMenuService.java
  89. 18 0
      swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysOperationLogService.java
  90. 37 0
      swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysOrgService.java
  91. 22 0
      swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysRoleMenuPermissionsService.java
  92. 55 0
      swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysRoleService.java
  93. 175 0
      swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysUserService.java
  94. 727 0
      swismp-api/src/main/java/com/sunwin/swismp/util/ChartUtil.java
  95. 266 0
      swismp-api/src/main/java/com/sunwin/swismp/util/CronUtil.java
  96. 50 0
      swismp-api/src/main/java/com/sunwin/swismp/util/FileUtils.java
  97. 109 0
      swismp-api/src/main/java/com/sunwin/swismp/util/HolidayUtil.java
  98. 218 0
      swismp-api/src/main/java/com/sunwin/swismp/util/HttpUtil.java
  99. 78 0
      swismp-api/src/main/java/com/sunwin/swismp/util/Md5Util.java
  100. 578 0
      swismp-api/src/main/java/com/sunwin/swismp/util/NumberUtils.java

+ 33 - 0
.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

+ 124 - 0
consumer/pom.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.sunwin</groupId>
+        <artifactId>swismp</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <groupId>com.sunwin.swismp</groupId>
+    <artifactId>consumer</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>consumer</name>
+    <description>consumer</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.sunwin.swismp</groupId>
+            <artifactId>swismp-api</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-mail</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+
+
+        <!-- https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-spring-boot-starter -->
+        <dependency>
+            <groupId>com.alibaba.spring.boot</groupId>
+            <artifactId>dubbo-spring-boot-starter</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.zookeeper</groupId>
+            <artifactId>zookeeper</artifactId>
+            <version>3.5.5</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>slf4j-log4j12</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>log4j</artifactId>
+                    <groupId>log4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-framework -->
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+            <version>2.13.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-recipes -->
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+            <version>2.13.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-client -->
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-client</artifactId>
+            <version>2.13.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.101tec</groupId>
+            <artifactId>zkclient</artifactId>
+            <version>0.10</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--json-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.47</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.8.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.openjdk.jol</groupId>
+            <artifactId>jol-core</artifactId>
+            <version>0.16</version>
+        </dependency>
+    </dependencies>
+
+
+</project>

+ 17 - 0
consumer/src/main/java/com/sunwin/swismp/ConsumerApplication.java

@@ -0,0 +1,17 @@
+package com.sunwin.swismp;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@ImportResource("classpath:dubbo-consumer.xml")
+@EnableScheduling
+public class ConsumerApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ConsumerApplication.class, args);
+    }
+
+}

+ 22 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/LogInterfaceConfig.java

@@ -0,0 +1,22 @@
+package com.sunwin.swismp.config.log;
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.sunwin.swismp.constant.InterfaceEnum;
+
+
+public class LogInterfaceConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+        StackTraceElement[] callerData = event.getCallerData();
+        String className=callerData[1].getClassName();//获取类全名
+        if(className.equals("com.sunwin.swismp.exception.CustomExceptionResolver")){
+            className = event.getLoggerName();
+        }
+        InterfaceEnum interfaceEnum= InterfaceEnum.testInterfaceEnum(className);
+        if (interfaceEnum!=null){
+            return interfaceEnum.getInterfaceName();//返回该接口所属模块名称
+        }
+        return null;
+    }
+}

+ 34 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/LogIpConfig.java

@@ -0,0 +1,34 @@
+package com.sunwin.swismp.config.log;
+
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.alibaba.dubbo.rpc.RpcContext;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * @author fengyong
+ * @date 2020/1/21
+ * @description
+ */
+public class LogIpConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+        String webIP=null;
+        try {
+            RpcContext context=RpcContext.getContext();
+            webIP = RpcContext.getContext().getRemoteAddressString();
+            if (webIP==null || webIP.equals("null") || webIP.equals("null:0")){
+                webIP = InetAddress.getLocalHost().getHostAddress();
+            }else {
+                webIP=webIP.split(":")[0];
+            }
+
+        } catch (UnknownHostException e) {
+            System.out.println("获取日志Ip异常");
+        }
+        return webIP;
+    }
+}

+ 16 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/LogLineConfig.java

@@ -0,0 +1,16 @@
+package com.sunwin.swismp.config.log;
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
+/**
+ * @author fengyong
+ * @description
+ */
+public class LogLineConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+         StackTraceElement[] callerData = event.getCallerData();
+         return String.valueOf(callerData[1].getLineNumber());
+    }
+}

+ 28 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/LogMesConfig.java

@@ -0,0 +1,28 @@
+package com.sunwin.swismp.config.log;
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * yangdong
+ * 将日志信息里的换行去除
+ */
+public class LogMesConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+        String message=event.getMessage();
+        message=removeLineBreak(message);
+        return message;
+    }
+    public static String removeLineBreak(String message){
+        Pattern pattern = Pattern.compile("\\s|\t|\r|\n",Pattern.DOTALL);
+        Matcher matcher = pattern.matcher(message);
+        String str = matcher.replaceAll(" ");
+
+        return str;
+    }
+
+}

+ 19 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/LogMethodsConfig.java

@@ -0,0 +1,19 @@
+package com.sunwin.swismp.config.log;
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
+public class LogMethodsConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+        StackTraceElement[] callerData = event.getCallerData();
+        String methodName = callerData[1].getMethodName();
+        if(methodName.equals("resolveException")){
+            return "";
+        }
+        return "|"+methodName;
+//    }
+//        StackTraceElement[] callerData = event.getCallerData();
+//        return callerData[1].getMethodName();
+    }
+}

+ 34 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/LogUserOrgIdConfig.java

@@ -0,0 +1,34 @@
+package com.sunwin.swismp.config.log;
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.sunwin.swismp.config.threadlocal.UserOrgContextHolder;
+import com.sunwin.swismp.dto.sysfunction.SysUserOrg;
+
+/**
+ * @author yangdong
+ * @date 2020/1/21
+ * @description
+ */
+public class LogUserOrgIdConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+        String uidOid=null;
+        try {
+            SysUserOrg userOrg= UserOrgContextHolder.getUserOrg();
+            //获取用户和部门的id 如果获取不到 就用-1 来表示
+            if (userOrg!=null){
+                if (userOrg.getUserId()!=null && userOrg.getOrgId()!=null){
+                    uidOid=userOrg.getUserId()+"|"+userOrg.getOrgId();
+                }else{
+                    uidOid="-1|-1";
+                }
+            }else{
+                uidOid="-1|-1";
+            }
+        } catch (Exception e) {
+            System.out.println("获取日志用户部门id异常");
+        }
+        return uidOid;
+    }
+}

+ 26 - 0
consumer/src/main/java/com/sunwin/swismp/config/log/ResponseTimeConfig.java

@@ -0,0 +1,26 @@
+package com.sunwin.swismp.config.log;
+
+import ch.qos.logback.classic.pattern.ClassicConverter;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.sunwin.swismp.config.threadlocal.StartTimeContextHolder;
+
+import java.util.Date;
+
+public class ResponseTimeConfig extends ClassicConverter {
+    @Override
+    public String convert(ILoggingEvent event) {
+        Long reponseTime=0L;
+        Long startTime=new Date().getTime();
+        try {
+            Long endTime=new Date().getTime();
+            if (StartTimeContextHolder.getStartTime()!=null){
+                startTime=StartTimeContextHolder.getStartTime();
+            }
+            reponseTime=(endTime-startTime);
+        }catch (Exception e){
+            System.out.println("响应时间获取失败");
+            e.printStackTrace();
+        }
+        return String.valueOf(reponseTime);
+    }
+}

+ 27 - 0
consumer/src/main/java/com/sunwin/swismp/config/threadlocal/DateContextHolder.java

@@ -0,0 +1,27 @@
+package com.sunwin.swismp.config.threadlocal;
+
+
+import com.sunwin.swismp.constant.DateParam;
+
+public class DateContextHolder {
+
+    private static final ThreadLocal<DateParam> contextHolder = new ThreadLocal<>();
+
+    public static final DateParam dateParam = new DateParam(); //默认时间参数
+
+    static {
+        contextHolder.set(dateParam);
+    }
+
+    public static void setDateParam(DateParam dateParam) {
+        contextHolder.set(dateParam);
+    }
+
+    public static DateParam getDateParam() {
+        return contextHolder.get();
+    }
+
+    public static void clearDateParam() {
+        contextHolder.remove();
+    }
+}

+ 20 - 0
consumer/src/main/java/com/sunwin/swismp/config/threadlocal/StartTimeContextHolder.java

@@ -0,0 +1,20 @@
+package com.sunwin.swismp.config.threadlocal;
+
+/**
+ * 保存一个起始时间
+ */
+
+public class StartTimeContextHolder {
+    private static final ThreadLocal<Long> contextHolder = new ThreadLocal<>();
+    public static void setStartTime(Long startTime) {
+        contextHolder.set(startTime);
+    }
+
+    public static Long getStartTime() {
+        return contextHolder.get();
+    }
+
+    public static void clearStartTime() {
+        contextHolder.remove();
+    }
+}

+ 28 - 0
consumer/src/main/java/com/sunwin/swismp/config/threadlocal/UserOrgContextHolder.java

@@ -0,0 +1,28 @@
+package com.sunwin.swismp.config.threadlocal;
+
+
+import com.sunwin.swismp.dto.sysfunction.SysUserOrg;
+
+/**
+ * 保存一个map里面存储的是用户部门信息
+ */
+public class UserOrgContextHolder {
+    private static final ThreadLocal<SysUserOrg> contextHolder = new ThreadLocal<>();
+
+    public static final SysUserOrg map = new SysUserOrg(); //默认用户部门信息
+
+    static {
+        contextHolder.set(map);
+    }
+    public static void setUserOrg(SysUserOrg map) {
+        contextHolder.set(map);
+    }
+
+    public static SysUserOrg getUserOrg() {
+        return contextHolder.get();
+    }
+
+    public static void clearUserOrg() {
+        contextHolder.remove();
+    }
+}

+ 56 - 0
consumer/src/main/java/com/sunwin/swismp/constant/AggregateDateEnum.java

@@ -0,0 +1,56 @@
+package com.sunwin.swismp.constant;
+//时间聚合类型
+public enum AggregateDateEnum {
+    //月聚合类型
+    AGG_MONTH(
+                "^[0-9]{4}-[0-9]{1,2}$",//日期聚合后的形式 2019-10
+                61,// 匹配条件,日期数量61~365*2+1
+                365*2+1,
+                (String str)->{ //日期表达式转换后的聚合值 如2019-11-03  转换后 2019-11
+                    return str.substring(0,7);
+                },
+                "^\\d{4}-\\d{1,2}-\\d{1,2}$"//要匹配的原始日期表达式 2019-10-21
+    ),
+    //年聚合类型
+    AGG_YEAR(
+                "^[0-9]{4}$",//日期聚合后的形式 2019
+                365*2+1,// 匹配条件,日期数量大于365*2+1
+                Integer.MAX_VALUE,
+                (String str)->{//日期表达式转换后的聚合值 如2019-11-03  转换后 2019
+                    return str.substring(0,4);
+                },
+                "^\\d{4}-\\d{1,2}-\\d{1,2}$"//要匹配的原始日期表达式 2019-10-21
+    );
+    AggregateDateEnum(String strRegx, Integer floor, Integer ceil, AggregateExp aggregateExp, String expectRegx){
+        this.strRegx = strRegx;
+        this.floor = floor;
+        this.ceil = ceil;
+        this.exp = aggregateExp;
+        this.expectRegx=expectRegx;
+    }
+    private String expectRegx; //要匹配的日期表达式
+    private String strRegx;//聚合后转换成的形式
+    private Integer floor;//下界
+    private Integer ceil;//上界但不包括
+    private AggregateExp exp;//将原始日期表达式转换为聚合值的接口
+    interface AggregateExp{
+       String parseType(String str);//原始日期表达式转换后的聚合值
+    }
+    public String getStrRegx() {
+        return strRegx;
+    }
+    public Integer getFloor() {
+        return floor;
+    }
+    public Integer getCeil() {
+        return ceil;
+    }
+
+    public String getExp(String str) {
+        return exp.parseType(str);
+    }
+
+    public String getExpectRegx() {
+        return expectRegx;
+    }
+}

+ 32 - 0
consumer/src/main/java/com/sunwin/swismp/constant/DateParam.java

@@ -0,0 +1,32 @@
+package com.sunwin.swismp.constant;
+
+//获取请求时间的参数
+public class DateParam {
+    private String beginDate;
+    private String endDate;
+    private String date;
+
+    public String getBeginDate() {
+        return beginDate;
+    }
+
+    public void setBeginDate(String beginDate) {
+        this.beginDate = beginDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+}

+ 83 - 0
consumer/src/main/java/com/sunwin/swismp/constant/HttpResultParam.java

@@ -0,0 +1,83 @@
+package com.sunwin.swismp.constant;
+
+/**
+* @Description: restfule接口返回值httpCode
+* @Author: zc
+* @CreateDate: 2019/2/25 16:43
+* @Remark:
+* @Version: 1.0
+*/
+public class HttpResultParam {
+
+    public static final int FAIL_CODE = 0;//请求失败
+
+    public static final int SUCCESS_CODE = 1; //请求成功
+
+    public static final int NO_DATA_CODE = 2;//查询无数据
+
+    public static final int LOGIN_PASSWORD_CODE = 3; //密码错误
+
+    public static final int ACCOUNT_ISENABLE_CODE = 4; //用户不可用
+
+    public static final int TELEPHONE_EXISTED_CODE = 5;//手机号已经存在
+
+    public static final int LOGIN_OTHER_PLACE_CODE = 6;//其他地点登录
+
+    public static final int ACCOUNT_IS_OUTOFDATE_CODE = 7;//账号过期
+
+    public static final int VERIFICATION_CODE_ERROR_CODE = 8;//验证码错误
+
+    public static final int ACCOUNT_NOT_EXISTED_CODE = 9;//账户不存在
+
+    public static final int VERIFICATION_CODE_NOT_EXISTED = 10; //验证码不存在
+
+    public static final int TELEPHONE_ERROR = 11; //电话号码输入错误
+
+    public static final int USER_NAME_ERROR = 12;//用户名错误
+
+    public static final int USER_NAME_EXISTED = 13;//用户名已存在
+
+
+    public static final String SUCCESS_SUBMIT_MSG = "配置成功";
+
+    public static final String FAIL_SUBMIT_MSG = "配置失败";
+
+    public static final String FAIL_REMOVE_MSG = "移除失败";
+    public static final String SUCCESS_MSG = "请求成功";
+
+    public static final String FAIL_MSG = "请求失败";
+
+    public static final String NO_DATA_MSG = "查无数据";
+
+    public static final String LOGIN_PASSWORD_MSG = "登录密码错误";
+
+    public static final String ACCOUNT_ISENABLE_MSG = "该账户不可用";
+
+    public static final String TELEPHONE_EXISTED_MSG = "该电话号码已存在";
+
+    public static final String LOGIN_OTHER_PLACE_MSG = "该账户已在其他地点登录";
+
+    public static final String ACCOUNT_IS_OUTOFDATE_MSG = "该账户已过期";
+
+    public static final String VERIFICATION_CODE_ERROR_MSG = "验证码错误";
+
+    public static final String VERIFICATION_CODE_NOT_EXISTED_MSG = "验证码已过期";
+
+    public static final String ACCOUNT_NOT_EXISTED_MSG = "用户不存在";
+
+    public static final String TELEPHONE_ERROR_MSG = "手机号码错误";
+
+    public static final String USER_NAME_ERROR_MSG = "用户名错误";
+
+    public static final String USER_NAME_EXISTED_MSG = "用户名已存在";
+
+    public static final String REGISTER_SUCCESS_MSG = "注册成功,请登录";
+
+    public static final String REGISTER_FAIL_MSG = "注册失败";
+
+    public static final Integer LOGIN_TIMEOUT = 3600; //登录会话持有时间,s
+
+    public static final Integer VERIFICATION_CODE_TIMEOUT = 10;// 验证码过期时间,分钟
+
+
+}

+ 22 - 0
consumer/src/main/java/com/sunwin/swismp/constant/MethodDescription.java

@@ -0,0 +1,22 @@
+package com.sunwin.swismp.constant;
+
+import java.lang.annotation.*;
+
+/**
+ * Copyright (c) 2/25/2020 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swbd.config
+ * FileName: MethodDescription
+ *
+ * @author duanmin
+ * @description 注解用于对方法的描述
+ * @created 2/25/2020-12:27 PM
+ * @last Modified
+ * @history
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface MethodDescription {
+    String description() default "默认描述";
+}

+ 166 - 0
consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/LoginController.java

@@ -0,0 +1,166 @@
+package com.sunwin.swismp.controller.sysfunction;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.sunwin.swismp.bean.sysfunction.SysOperationLog;
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+import com.sunwin.swismp.config.threadlocal.UserOrgContextHolder;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.HttpResultParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.sysfunction.LoginResult;
+import com.sunwin.swismp.dto.sysfunction.SysUserOrg;
+import com.sunwin.swismp.service.sysfunction.SysOperationLogService;
+import com.sunwin.swismp.service.sysfunction.SysUserService;
+import com.sunwin.swismp.util.HttpUtil;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import com.sunwin.swismp.util.mobileMessage.NeteaseImResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.util.Map;
+
+@RestController
+@RequestMapping(value = "/login")
+public class LoginController {
+
+    @Autowired
+    private SysUserService sysUserService;
+
+    @Autowired
+    private SysOperationLogService sysOperationLogService;
+    @Autowired
+    private RedisTemplate<String,String> redisTemplate;
+
+    private Logger logger = LoggerFactory.getLogger(LoginController.class);
+
+    /**
+     * @Description : 登录接口
+     * @param params 封装的用户信息  包括 动态密码  以及 用户名
+     * @param request 请求体
+     * @param response 回应体
+     * @Return : 会话id 以及 封装在cookie里的 会话是否过期标识 用户id 部门id
+     * @Author : yangdong
+     * @Date : 2020/2/28 11:47
+    */
+    @RequestMapping(method = RequestMethod.POST)
+    @MethodDescription(description = "登录")
+    public HttpResult login(@RequestBody String params, HttpServletRequest request, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        JSONObject object = JSON.parseObject(params);
+        String userName = object.get("userName").toString();
+        //查询ip 是否 锁定 如果锁定 则直接不让登录
+        Boolean locked = sysUserService.lock(userName);
+        if(locked){
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE,HttpResponseParam.LLOGIN_LOCK);
+        } else {
+            String ip = HttpUtil.getIpAddr(request);
+            Map map=sysUserService.login(object.get("userName").toString(),object.get("feature").toString(),object.get("vCode").toString());
+            httpResult = (HttpResult) map.get("result");
+            if (httpResult.getHttpCode() == HttpResponseParam.SUCCESS_CODE) { //登录成功,插入操作日志
+                /*
+                如果登录成功  则非法登录计数清零
+                 */
+                sysUserService.unlock(userName);
+                SysOperationLog log = new SysOperationLog("登录", null, object.get("userName").toString(),ip);
+                sysOperationLogService.insertOperationLog(log);
+                HttpSession session = request.getSession();
+                session.setAttribute("userId", ((LoginResult)httpResult.getData()).getUserId());
+                session.setAttribute(session.getId(),object.get("userName").toString());
+                session.setAttribute("userName",object.get("userName").toString());
+                session.setAttribute("roleCode", String.valueOf(map.get("role_feature")));
+                //session.setMaxInactiveInterval(1800);
+                session.setMaxInactiveInterval(18000);//5小时
+                //session.setMaxInactiveInterval(60*60*24);//一天
+                Cookie cookiePresent=new Cookie("sessionIsPresent","true");
+                cookiePresent.setPath("/");//cookie设置会话是否过期标识
+                cookiePresent.setHttpOnly(false);
+                Cookie cookieUserId=new Cookie("u_feature",String.valueOf(map.get("u_feature")));
+                cookieUserId.setPath("/");//cookie设置userid
+                Cookie cookieOrgId=new Cookie("org_feature",String.valueOf(map.get("org_feature")));
+                Cookie cookieRoleCode = new Cookie("role_feature",String.valueOf(map.get("role_feature")));
+                Cookie cookieRoleName = new Cookie("role_name",String.valueOf(map.get("role_name")));
+                cookieRoleCode.setPath("/");//cookie设置role_feature
+                cookieRoleName.setPath("/");//cookie设置role_name
+                cookieOrgId.setPath("/");//cookie设置orgid
+                response.addCookie(cookiePresent);
+                response.addCookie(cookieUserId);
+                response.addCookie(cookieOrgId);
+                response.addCookie(cookieRoleCode);
+                response.addCookie(cookieRoleName);
+                SysUserOrg userOrg=new SysUserOrg(Integer.parseInt(String.valueOf(map.get("u_feature"))),Integer.parseInt(String.valueOf(map.get("org_feature"))),String.valueOf(map.get("role_feature")));
+                UserOrgContextHolder.setUserOrg(userOrg);//将用户部门信息放入线程全局变量中
+            } else {
+                /*
+                记录该ip的登录次数  如果达到5次 则直接提示  并更改redis状态 否则 只是记录
+                 */
+                Map<String,String> lockedStart = sysUserService.updateFailCount(userName);
+                if(lockedStart.get("locakedStart").equals("true")){
+                    httpResult = new HttpResult(HttpResponseParam.FAIL_CODE,HttpResponseParam.LLOGIN_LOCK);
+                } else {
+                    String countRemain = "当前您还剩余"+lockedStart.get("countRemain")+"次连续的登录机会";
+                    String des = httpResult.getMsg();
+                    if(des == null || des.trim().equals("")){
+                        httpResult.setMsg(countRemain);
+                    } else {
+                        httpResult.setMsg(httpResult.getMsg()+","+countRemain);
+                    }
+                }
+            }
+        }
+        LoggerMessageUtil.successfulMsg(logger,"登录");
+        return httpResult;
+    }
+
+
+    /**
+     * 给手机号码发送验证码
+     * @param userName
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/captcha")
+    @MethodDescription(description = "发送登录验证码")
+    public HttpResult getSmsCaptcha(@RequestParam String userName) throws Exception{
+        HttpResult httpResult = null;
+        NeteaseImResponse response = null;
+        SysUser sysUser = sysUserService.queryUserByName(userName);
+        //TODO 验证码暂时不处理, 默认 111111 ,启用替换下段注释的代码
+        if (sysUser != null && sysUser.getMobilePhone() !=null && sysUser.getMobilePhone() != "" ){
+            sysUserService.setCodeRedis("swismp_login_telephone_"+sysUser.getMobilePhone(), String.valueOf(111111), HttpResultParam.VERIFICATION_CODE_TIMEOUT);
+            //redisTemplate.opsForValue().set( "swurt_login_telephone_:"+telephone, String.valueOf(response.getObj()), HttpResultParam.VERIFICATION_CODE_TIMEOUT,TimeUnit.MINUTES);
+            httpResult = new HttpResult(HttpResultParam.SUCCESS_CODE, "发送成功,测试阶段,默认为 111111");
+        }else {
+            httpResult = new HttpResult(HttpResultParam.FAIL_CODE, "账号或账号手机号不存在");
+        }
+        /*
+        if (sysUser != null && sysUser.getMobilePhone() !=null && sysUser.getMobilePhone() != "" ){
+            response = MobileMessageSendUtil.sendMsg(sysUser.getMobilePhone(), "swbd_login_templateid");
+        }else {
+            httpResult = new HttpResult(HttpResultParam.FAIL_CODE, "账号或账号手机号不存在");
+        }
+
+        if (response != null && response.getCode() == 200) {
+            sysUserService.setCodeRedis("login_telephone_"+sysUser.getMobilePhone(), String.valueOf(response.getObj()), HttpResultParam.VERIFICATION_CODE_TIMEOUT);
+            //redisTemplate.opsForValue().set( "login_telephone:"+telephone, String.valueOf(response.getObj()), HttpResultParam.VERIFICATION_CODE_TIMEOUT,TimeUnit.MINUTES);
+            httpResult = new HttpResult(HttpResultParam.SUCCESS_CODE, "发送成功");
+        } else if (response != null && response.getCode() == 416){
+            httpResult = new HttpResult(HttpResultParam.FAIL_CODE, "今日该账号手机验证码获取次数已达上限");
+        }else {
+            if (httpResult == null) {
+                httpResult = new HttpResult(HttpResultParam.FAIL_CODE, "发送失败");
+            }
+        }
+        */
+        LoggerMessageUtil.successfulMsg(logger,"发送登录验证码");
+        return httpResult;
+    }
+}

+ 56 - 0
consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysLogController.java

@@ -0,0 +1,56 @@
+package com.sunwin.swismp.controller.sysfunction;
+
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.service.sysfunction.SysOperationLogService;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swismp.controller.sysfunction
+ * FileName: SysLogController
+ *
+ * @author duanmin
+ * @description
+ * @created 2022/2/25 - 13:44
+ * @last Modified
+ * @history
+ */
+@RestController
+@RequestMapping(value = "/log")
+public class SysLogController {
+    @Autowired
+    private SysOperationLogService sysOperationLogService;
+    private Logger logger = LoggerFactory.getLogger(SysLogController.class);
+
+    /**
+     * @Description : 查询日志-分页
+     * @Return :
+     */
+    @GetMapping(value = "/querySysLogPage")
+    @MethodDescription(description = "查询日志-分页")
+    public HttpResult querySysLogPage(@RequestParam(value = "moduleName", required = false) String moduleName,
+                                      @RequestParam(value = "operationName", required = false) String operationName,
+                                      @RequestParam(value = "roleId", required = false) String roleId,
+                                      @RequestParam(value = "beginOperateTime", required = false) String beginOperateTime,
+                                      @RequestParam(value = "endOperateTime", required = false) String endOperateTime,
+                                      @RequestParam(value = "pageNum") Integer pageNum,
+                                      @RequestParam(value = "pageSize") Integer pageSize) {
+        HttpResult httpResult = null;
+        PageResult pageResult = sysOperationLogService.querySysLogPage(moduleName, operationName, roleId, beginOperateTime,
+                endOperateTime, pageNum, pageSize);
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, pageResult);
+        LoggerMessageUtil.successfulMsg(logger, "查询日志-分页");
+        return httpResult;
+    }
+}

+ 143 - 0
consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysMenuController.java

@@ -0,0 +1,143 @@
+package com.sunwin.swismp.controller.sysfunction;
+
+import com.sunwin.swismp.bean.TreeNode;
+import com.sunwin.swismp.bean.sysfunction.SysMenu;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysMenuDTO;
+import com.sunwin.swismp.service.sysfunction.SysMenuService;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @Description: 系统菜单管理接口
+ * @Author: fengyong
+ * @CreateDate: 2022/2/15 09:16
+ * @Remark:
+ * @Version: 1.0
+ */
+@RestController
+@RequestMapping(value = "/menu")
+public class SysMenuController {
+    private Logger logger = LoggerFactory.getLogger(SysMenuController.class);
+    @Autowired
+    private SysMenuService sysMenuService;
+
+    /**
+     * 查询指定菜单明细
+     * @param menuId
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/queryMenu")
+    public HttpResult queryMenuDetail(@RequestParam("menuId") Integer menuId) {
+        HttpResult httpResult = null;
+        try {
+            SysMenuDTO sysMenu = sysMenuService.selectMenuById(menuId);
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE,HttpResponseParam.SUCCESS_MSG,sysMenu);
+            LoggerMessageUtil.successfulMsg(logger,"查询指定菜单明细");
+        }catch (Exception e) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE,HttpResponseParam.FAIL_MSG);
+            LoggerMessageUtil.errorMsg(logger,"查询指定菜单明细",e);
+        }
+        return httpResult;
+    }
+    /**
+     * 查询次级菜单列表
+     * @param menuId
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/queryMenu/secondary")
+    public HttpResult queryMenuSecondary(@RequestParam("menuId") Integer menuId,
+                                         @RequestParam(value = "resourceType",required = false) Integer resourceType,
+                                         @RequestParam(name = "isEnable", required = false) Integer isEnable,
+                                         @RequestParam(value = "keywords",required = false) String keywords,
+                                         @RequestParam(name = "pageNum") Integer pageNum,
+                                         @RequestParam(name = "pageSize") Integer pageSize) {
+        HttpResult httpResult = null;
+        try {
+            PageResult pageResult = sysMenuService.queryMenuSecondary(menuId, resourceType, isEnable, keywords, pageNum, pageSize);
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE,HttpResponseParam.SUCCESS_MSG,pageResult);
+            LoggerMessageUtil.successfulMsg(logger,"查询次级菜单列表");
+        }catch (Exception e) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE,HttpResponseParam.FAIL_MSG);
+            LoggerMessageUtil.errorMsg(logger,"查询次级菜单列表",e);
+        }
+        return httpResult;
+    }
+
+    /**
+     * @Description : 添加、修改资源(菜单)
+     * @param sysMenu 封装的菜单信息
+     * @Return : 提交是否成功
+     * @Author : fengyong
+     * @Date : 2022/2/15 13:37
+     */
+    @RequestMapping(method = RequestMethod.POST, value = "/save")
+    @MethodDescription(description = "保存系统资源信息")
+    public HttpResult menuSave(@RequestBody SysMenu sysMenu, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        httpResult = sysMenuService.menuSave(sysMenu);
+        LoggerMessageUtil.successfulMsg(logger,"保存系统资源信息");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 修改启用状态
+     * @Return :
+     */
+    @RequestMapping(method = RequestMethod.POST, value = "/update/enabled")
+    @MethodDescription(description = "修改启用状态")
+    public HttpResult updateEnabled(@RequestBody SysMenu sysMenu) {
+        HttpResult httpResult = null;
+        Integer index = sysMenuService.updateEnabled(sysMenu);
+        if (index > 0) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "修改启用状态");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 删除资源
+     * @Return :
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/delete")
+    @MethodDescription(description = "删除资源")
+    public HttpResult deleteMenu(@RequestParam(value = "menuId") Integer menuId) {
+        HttpResult httpResult = null;
+        Integer index = sysMenuService.deleteMenu(menuId);
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_DELETE_MSG);
+        } else if (index == 2) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_DELETE_EXIST_CHILDREN_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_DELETE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "删除资源");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 系统资源菜单树
+     * @Return :
+     */
+    @GetMapping(value = "/sysMenuTree")
+    @MethodDescription(description = "系统资源菜单树")
+    public HttpResult sysMenuTree() {
+        HttpResult httpResult = null;
+        List<TreeNode> root = sysMenuService.sysMenuTree();
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, root);
+        LoggerMessageUtil.successfulMsg(logger, "系统资源菜单树");
+        return httpResult;
+    }
+}

+ 168 - 0
consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysOrgController.java

@@ -0,0 +1,168 @@
+package com.sunwin.swismp.controller.sysfunction;
+
+import com.sunwin.swismp.bean.TreeNode;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysOrgDTO;
+import com.sunwin.swismp.service.sysfunction.SysOrgService;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swismp.controller.sysfunction
+ * FileName: SysOrgController
+ *
+ * @author duanmin
+ * @description
+ * @created 2/11/2022 - 5:29 PM
+ * @last Modified
+ * @history
+ */
+@RestController
+@RequestMapping(value = "/org")
+public class SysOrgController {
+    private Logger logger = LoggerFactory.getLogger(SysOrgController.class);
+
+    @Autowired
+    private SysOrgService sysOrgService;
+
+    /**
+     * @Description : 新增组织
+     * @Return :
+     */
+    @PostMapping(value = "/addSysOrg", produces = {"application/json;charset=UTF-8"})
+    @MethodDescription(description = "新增组织")
+    public HttpResult addSysOrg(@RequestBody SysOrgDTO sysOrgDTO) {
+        HttpResult httpResult = null;
+        Integer index = sysOrgService.addSysOrg(sysOrgDTO);
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_INSERT_MSG);
+        } else if (index == 2) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_ADD_DUPLICATTED_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_INSERT_MSG);
+        }
+
+        LoggerMessageUtil.successfulMsg(logger, "新增组织");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 删除组织
+     * @Return :
+     */
+    @GetMapping(value = "/delSysOrg")
+    @MethodDescription(description = "删除组织")
+    public HttpResult delSysOrg(@RequestParam(value = "sysOrgId") Integer sysOrgId) {
+        HttpResult httpResult = null;
+        Integer index = sysOrgService.delSysOrg(sysOrgId);
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_DELETE_MSG);
+        } else if (index == 2) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_DELETE_EXIST_CHILDREN_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_DELETE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "删除组织");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 修改组织
+     * @Return :
+     */
+    @PostMapping(value = "/editSysOrg", produces = {"application/json;charset=UTF-8"})
+    @MethodDescription(description = "修改组织")
+    public HttpResult editSysOrg(@RequestBody SysOrgDTO SysOrgDTO) {
+        HttpResult httpResult = null;
+        Integer index = sysOrgService.editSysOrg(SysOrgDTO);
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else if (index == 2) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_DUPLICATTED_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+
+        LoggerMessageUtil.successfulMsg(logger, "修改组织");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 查看组织
+     * @Return :
+     */
+    @GetMapping(value = "/viewSysOrg")
+    @MethodDescription(description = "查看组织")
+    public HttpResult viewSysOrg(@RequestParam(value = "sysOrgId") String sysOrgId) {
+        HttpResult httpResult = null;
+        SysOrgDTO sysOrgDTO = sysOrgService.viewSysOrg(sysOrgId);
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, sysOrgDTO);
+        LoggerMessageUtil.successfulMsg(logger, "查看组织");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 修改启用状态
+     * @Return :
+     */
+    @GetMapping(value = "/enableSysOrg")
+    @MethodDescription(description = "修改启用状态")
+    public HttpResult enableSysOrg(@RequestParam(value = "sysOrgId") Integer sysOrgId,
+                                   @RequestParam(value = "enabled") Integer enabled) {
+        HttpResult httpResult = null;
+        Integer index = sysOrgService.enableSysOrg(sysOrgId, enabled);
+        if (index > 0) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "修改启用状态");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 查询组织-分页
+     * @Return :
+     */
+    @GetMapping(value = "/querySysOrgPage")
+    @MethodDescription(description = "查询组织-分页")
+    public HttpResult querySysOrgPage(@RequestParam(value = "parentOrgId", required = false) String parentOrgId,
+                                      @RequestParam(value = "orgUserNum", required = false) String orgUserNum,
+                                      @RequestParam(value = "isEnabled", required = false) String isEnabled,
+                                      @RequestParam(value = "keywords") String keywords,
+                                      @RequestParam(value = "beginUpdateTime") String beginUpdateTime,
+                                      @RequestParam(value = "endUpdateTime") String endUpdateTime,
+                                      @RequestParam(value = "pageNum") Integer pageNum,
+                                      @RequestParam(value = "pageSize") Integer pageSize) {
+        HttpResult httpResult = null;
+        PageResult pageResult = sysOrgService.querySysOrgPage(parentOrgId, orgUserNum, isEnabled, keywords,
+                beginUpdateTime, endUpdateTime, pageNum, pageSize);
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, pageResult);
+        LoggerMessageUtil.successfulMsg(logger, "查询组织-分页");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 组织树
+     * @Return :
+     */
+    @GetMapping(value = "/sysOrgTree")
+    @MethodDescription(description = "组织树")
+    public HttpResult sysOrgTree() {
+        HttpResult httpResult = null;
+        List<TreeNode> root = sysOrgService.sysOrgTree();
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, root);
+        LoggerMessageUtil.successfulMsg(logger, "组织树");
+        return httpResult;
+    }
+}

+ 212 - 0
consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysRoleController.java

@@ -0,0 +1,212 @@
+package com.sunwin.swismp.controller.sysfunction;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.sunwin.swismp.bean.sysfunction.SysRole;
+import com.sunwin.swismp.config.threadlocal.UserOrgContextHolder;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysRoleDTO;
+import com.sunwin.swismp.dto.sysfunction.SysUserOrg;
+import com.sunwin.swismp.service.sysfunction.SysRoleMenuPermissionsService;
+import com.sunwin.swismp.service.sysfunction.SysRoleService;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+* @Description: 系统角色接口
+* @Author: zc
+* @CreateDate: 2018/11/16 17:16
+* @Remark:
+* @Version: 1.0
+*/
+@RestController
+@RequestMapping(value = "/role")
+public class SysRoleController {
+
+    @Autowired
+    private SysRoleService sysRoleService;
+    @Autowired
+    private SysRoleMenuPermissionsService sysRoleMenuPermissionsService;
+
+    private Logger logger = LoggerFactory.getLogger(SysRoleController.class);
+
+
+    /**
+     * @Description : 角色下拉框参数
+     * @Return : 角色信息列表
+     * @Author : yangdong
+     * @Date : 2020/2/28 13:36
+    */
+    @RequestMapping(method = RequestMethod.GET,value = "/box")
+    @MethodDescription(description = "角色下拉框参数")
+    public HttpResult queryRoleBox() {
+        HttpResult httpResult = null;
+        //获取当前用户的roleid
+        SysUserOrg userOrg = UserOrgContextHolder.getUserOrg();
+        String roleCode = null;
+        if(userOrg != null){
+            roleCode = userOrg.getRoleCode();
+        }
+        /*
+        判断是否是管理员  或是 普通管理员
+         */
+        //TODO:没提需求,暂不加权限,若加权限,注释此行
+        roleCode = "10001";
+        if(roleCode == null){
+            httpResult = new HttpResult(HttpResponseParam.NO_DATA_CODE, HttpResponseParam.NO_DATA_MSG);
+        } else {
+            List<SysRole> roles = sysRoleService.selectAllByRoleCode(roleCode);
+            List<Map> list = new ArrayList<>();
+            for (SysRole sysRole:roles){
+                    Map map = new HashMap<>();
+                    map.put("value",sysRole.getRoleId());
+                    map.put("label",sysRole.getRoleName());
+                    list.add(map);
+            }
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG,list);
+        }
+        return httpResult;
+    }
+
+    /**
+     * @Description : 删除角色
+     * @param SysRole 角色id
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 13:37
+    */
+    @RequestMapping(method = RequestMethod.DELETE,value = "/delete")
+    @MethodDescription(description = "删除角色")
+    public HttpResult deleteRole(@RequestBody SysRole sysRole) {
+        HttpResult httpResult = null;
+        int index = sysRoleService.deleteRoleByRoleId(sysRole.getRoleId());
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_DELETE_MSG);
+        } else if(index == 2){
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_DELETE_EXIST_USER_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_DELETE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger,"删除角色");
+        return httpResult;
+    }
+
+
+    /**
+     *  角色-分页条件查询
+     * @param roleName
+     * @param roleCode
+     * @param isEnable
+     * @param page
+     * @param size
+     * @param response
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/list")
+    @MethodDescription(description = "查询角色信息列表")
+    public HttpResult rolesInfo(@RequestParam(name = "roleName", required = false) String roleName,
+                                @RequestParam(name = "roleCode", required = false) String roleCode,
+                                @RequestParam(name = "isEnable", required = false) Integer isEnable,
+                                @RequestParam(value = "keywords",required = false) String keywords,
+                                @RequestParam(name = "pageNum") Integer page,
+                                @RequestParam(name = "pageSize") Integer size,
+                                HttpServletResponse response) {
+        HttpResult httpResult = null;
+        PageResult pageResult = new PageResult();
+        List<SysRoleDTO> list = sysRoleService.selectPage(roleName,roleCode,isEnable, keywords,page,size);
+        pageResult.setData(list);
+        Integer count = sysRoleService.selectPageCount(roleName, roleCode, isEnable, keywords);
+        pageResult.setCount(Long.valueOf(count));
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG,pageResult);
+        LoggerMessageUtil.successfulMsg(logger,"查询角色信息列表");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 添加、修改角色
+     * @param sysRole 封装的角色信息
+     * @Return : 提交是否成功
+     * @Author : yangdong
+     * @Date : 2020/2/28 13:37
+     */
+    @RequestMapping(method = RequestMethod.POST, value = "/save")
+    @MethodDescription(description = "保存角色信息")
+    public HttpResult rolesSave(@RequestBody SysRole sysRole, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        httpResult = sysRoleService.roleSave(sysRole);
+        LoggerMessageUtil.successfulMsg(logger,"保存角色信息");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 查询角色权限
+     * @param roleId
+     * @param response
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 13:45
+    */
+    @RequestMapping(method = RequestMethod.GET, value = "/queryMenus")
+    @MethodDescription(description = "查询角色权限")
+    public HttpResult queryRoleMenu(@RequestParam("roleId") Integer roleId, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        Map map = sysRoleMenuPermissionsService.selectByRoleId(roleId,"all");//type : all 查询全部 ; self 查询已有的
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG,map);
+        LoggerMessageUtil.successfulMsg(logger,"查询角色权限");
+        return httpResult;
+    }
+
+    /**
+     * 查询角色权限(查询已分配的)
+     * @param roleId
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/queryMenusHave")
+    public HttpResult queryRoleMenuSelf(@RequestParam("roleId") Integer roleId, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        try {
+            Map map = sysRoleMenuPermissionsService.selectByRoleId(roleId,"self");//type : all 查询全部 ; self 查询已有的
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE,HttpResponseParam.SUCCESS_MSG,map);
+            LoggerMessageUtil.successfulMsg(logger,"查询已分配角色权限");
+        }catch (Exception e) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE,HttpResponseParam.FAIL_MSG);
+            LoggerMessageUtil.errorMsg(logger,"查询已分配角色权限",e);
+        }
+        return httpResult;
+    }
+    /**
+     * @Description : 修改角色权限
+     * @param object 角色信息
+     * @param response
+     * @Return : 是否成功
+     * @Author : yangdong
+     * @Date : 2020/2/28 13:45
+    */
+    @RequestMapping(method = RequestMethod.PUT, value = "/menus")
+    @MethodDescription(description = "修改已分配角色权限")
+    public HttpResult updateRoleMenu(@RequestBody JSONObject object, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        Integer roleId = object.getInteger("roleId");
+        List<Integer> menuIds = object.getJSONArray("menuIds").toJavaList(Integer.class);
+        boolean success = sysRoleService.updateRoleMenu(roleId, menuIds);
+        if (success) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger,"修改已分配角色权限");
+        return httpResult;
+    }
+}

+ 416 - 0
consumer/src/main/java/com/sunwin/swismp/controller/sysfunction/SysUserController.java

@@ -0,0 +1,416 @@
+package com.sunwin.swismp.controller.sysfunction;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+import com.sunwin.swismp.config.threadlocal.UserOrgContextHolder;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysUserDTO;
+import com.sunwin.swismp.dto.sysfunction.SysUserManage;
+import com.sunwin.swismp.dto.sysfunction.SysUserOrg;
+import com.sunwin.swismp.service.sysfunction.SysUserService;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import com.sunwin.swismp.util.Md5Util;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping(value = "/user")
+public class SysUserController {
+
+    @Autowired
+    private SysUserService sysUserService;
+    /*@Autowired
+    private SysRoleService sysRoleService;*/
+
+    private Logger logger = LoggerFactory.getLogger(SysUserController.class);
+
+    /**
+     * @Description : 查看用户信息
+     * @Return : 封装的用户信息
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/info")
+    @MethodDescription(description = "查询用户信息")
+    public HttpResult queryUserInfo(@RequestParam(value = "userId") Integer userId) {
+        HttpResult httpResult = null;
+        SysUserManage sysUserManage = sysUserService.selectUserManageById(userId);
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, "成功", sysUserManage);
+        LoggerMessageUtil.successfulMsg(logger, "查询用户信息");
+        return httpResult;
+    }
+
+    /**
+     * 用户修改密码
+     *
+     * @param json
+     * @param session
+     * @param response
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.PUT, value = "/info/pwd")
+    @MethodDescription(description = "修改用户密码")
+    public HttpResult updateUserPwd(@RequestBody JSONObject json, HttpSession session, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        Integer userId = (Integer) session.getAttribute("userId");
+        SysUser sysUser = sysUserService.queryUserById(userId);
+        String oldPwd = json.getString("oldPassword");
+        String newPwd = json.getString("newPassword");
+        if (sysUser.getUserPwd().equals(oldPwd)) { //验证原密码
+            if (!sysUser.getUserPwd().equals(newPwd)) {
+                int flag = sysUserService.updatePwd(userId, newPwd, oldPwd);
+                if (flag > 0) {
+                    httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG, flag);
+                } else {
+                    httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+                }
+            } else {
+                httpResult = new HttpResult(HttpResponseParam.LOGIN_PASSWORD_CODE, "修改的新密码不能与原密码一致");
+            }
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.LOGIN_PASSWORD_CODE, "原密码错误");
+        }
+        LoggerMessageUtil.successfulMsg(logger, "修改用户密码");
+        return httpResult;
+    }
+
+    /**
+     * 用户修改手机号码
+     *
+     * @param json
+     * @param session
+     * @param response
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.PUT, value = "/info/telephone")
+    @MethodDescription(description = "修改用户手机号")
+    public HttpResult updateUserTelephone(@RequestBody JSONObject json, HttpSession session, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        Integer userId = (Integer) session.getAttribute("userId");
+        //比对原号码的验证码
+        //TODO: 暂时不用验证码
+        //boolean success = sysUserService.updateTelephone(userId, json.getString("newTelephone"), json.getString("newCode"));
+        boolean success = sysUserService.updateTelephone(userId, json.getString("newTelephone"));
+        if (success) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "修改用户手机号");
+        return httpResult;
+    }
+
+    /**
+     * 用户修改邮箱
+     *
+     * @param json     用户邮箱信息
+     * @param session  用户信息
+     * @param response 响应内容
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.PUT, value = "/info/email")
+    @MethodDescription(description = "修改用户邮箱")
+    public HttpResult updateUserEmail(@RequestBody JSONObject json, HttpSession session, HttpServletResponse response) {
+        HttpResult httpResult = null;
+        Integer userId = (Integer) session.getAttribute("userId");
+        boolean success = sysUserService.updateEmail(userId, json.getString("email"));
+        if (success) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "修改用户邮箱");
+        return httpResult;
+    }
+
+
+    /**
+     * 添加用户
+     *
+     * @param user
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.POST)
+    @MethodDescription(description = "添加用户")
+    public HttpResult register(@RequestBody SysUser user) {  //注册
+        HttpResult httpResult = null;
+        if (user.getIsEnable() == null) {
+            user.setIsEnable(1);//默认可用
+        }
+        user.setCreateTime(new Date());//创建时间
+        httpResult = sysUserService.addUser(user);
+        LoggerMessageUtil.successfulMsg(logger, "添加用户邮箱");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 新增用户
+     * @Return :
+     */
+    @PostMapping(value = "/addSysUser", produces = {"application/json;charset=UTF-8"})
+    @MethodDescription(description = "新增用户")
+    public HttpResult addSysUser(@RequestBody SysUserDTO sysUserDTO) {
+        HttpResult httpResult = null;
+        Integer index = sysUserService.addSysUser(sysUserDTO);
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_INSERT_MSG);
+        } else if (index == 2) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_ADD_DUPLICATTED_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_INSERT_MSG);
+        }
+
+        LoggerMessageUtil.successfulMsg(logger, "新增用户");
+        return httpResult;
+    }
+
+
+    /**
+     * 更新用户信息
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping(value = "/updateUser", produces = {"application/json;charset=UTF-8"})
+    @MethodDescription(description = "更新用户信息")
+    public HttpResult updateUser(@RequestBody SysUser user) { //更新
+        HttpResult httpResult = null;
+        Integer index = sysUserService.editUser(user);
+        if (index == 1) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+        } else if (index == 2) {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_DUPLICATTED_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "更新用户信息");
+        return httpResult;
+    }
+
+    /**
+     * @Description : 查询用户-分页
+     * @Return :
+     */
+    @GetMapping(value = "/querySysUserPage")
+    @MethodDescription(description = "查询用户-分页")
+    public HttpResult querySysOrgPage(@RequestParam(value = "orgId", required = false) Integer orgId,
+                                      @RequestParam(value = "orgType", required = false) String orgType,
+                                      @RequestParam(value = "roleId", required = false) String roleId,
+                                      @RequestParam(value = "realName", required = false) String realName,
+                                      @RequestParam(value = "isEnabled", required = false) String isEnabled,
+                                      @RequestParam(value = "userName", required = false) String userName,
+                                      @RequestParam(value = "beginUpdateTime", required = false) String beginUpdateTime,
+                                      @RequestParam(value = "endUpdateTime", required = false) String endUpdateTime,
+                                      @RequestParam(value = "pageNum") Integer pageNum,
+                                      @RequestParam(value = "pageSize") Integer pageSize) {
+        HttpResult httpResult = null;
+        PageResult pageResult = sysUserService.querySysUserPage(orgId, orgType, roleId, realName, isEnabled, userName,
+                beginUpdateTime, endUpdateTime, pageNum, pageSize);
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, pageResult);
+        LoggerMessageUtil.successfulMsg(logger, "查询用户-分页");
+        return httpResult;
+    }
+
+    /**
+     * 用户信息详情
+     *
+     * @param userId
+     * @return
+     */
+    @GetMapping(value = "/userView", produces = {"application/json;charset=UTF-8"})
+    @MethodDescription(description = "用户信息详情")
+    public HttpResult userView(@RequestParam(value = "userId", required = false) Integer userId) {
+        HttpResult httpResult = null;
+        SysUserDTO sysUserDTO = sysUserService.userView(userId);
+        httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, sysUserDTO);
+        LoggerMessageUtil.successfulMsg(logger, "用户信息详情");
+        return httpResult;
+    }
+
+    /**
+     * 查看 部门 用户 权限 桑吉图
+     *
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/view/relation")
+    @MethodDescription(description = "查看部门用户权限桑吉图")
+    public HttpResult updateUserOrgRoleRelationView() { //更新
+        HttpResult httpResult = null;
+        Map result = sysUserService.queryUserOrgRoleView();
+        if (result != null && result.size() > 0) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, result);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.NO_DATA_CODE, HttpResponseParam.NO_DATA_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "查看部门用户权限桑吉图");
+        return httpResult;
+    }
+
+    /**
+     * 删除,暂停,启用
+     *
+     * @param userId
+     * @param type
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET, value = "/operation")
+    @MethodDescription(description = "删除、暂停、启用用户")
+    public HttpResult operateUser(@RequestParam("userId") Integer userId,
+                                  @RequestParam(value = "type", required = false) Integer type,
+                                  @RequestParam(value = "enabled", required = false) Integer enabled) {
+        HttpResult httpResult = null;
+        int result = 0;
+        if (type == 0) { //启用
+            result = sysUserService.enableUser(userId, enabled);
+        } else if (type == 1) { //暂停,注销
+            result = sysUserService.logoff(userId);
+        } else if (type == 2) { //物理删除
+            result = sysUserService.deleteUser(userId);
+        }
+        if (result > 0) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_CHANGE_MSG);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_CHANGE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "删除、暂停、启用用户");
+        return httpResult;
+    }
+
+    /**
+     * @param queryType  查找方式  1 用户名  2 电话号码  3 email
+     * @param queryValue 查找值
+     * @param pageNo     第几页
+     * @param pageSize   显示条数
+     * @Description : 查询所有用户信息
+     * @Return : 用户信息列表
+     * @Author : yangdong
+     * @Date : 2020/2/28 13:29
+     */
+    @RequestMapping(method = RequestMethod.GET)
+    @MethodDescription(description = "查询系统用户管理信息")
+    public HttpResult querySysUserManage(@RequestParam(value = "queryType") Integer queryType, @RequestParam(value = "queryValue", required = false) String queryValue, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
+        HttpResult httpResult = null;
+        //获取当前用户的orgId
+        SysUserOrg userOrg = UserOrgContextHolder.getUserOrg();
+        Integer orgId = null;
+        String roleCode = null;
+        if (userOrg != null) {
+            orgId = userOrg.getOrgId();
+            roleCode = userOrg.getRoleCode();
+        }
+        List<SysUserManage> list = null;
+        String userName = null;
+        String phone = null;
+        String email = null;
+        if (queryType == 1) { //通过用户名查询
+            userName = queryValue;
+        } else if (queryType == 2) { //通过电话号码查询
+            phone = queryValue;
+        } else if (queryType == 3) { //通过email查询
+            email = queryValue;
+        }
+        pageNo = (pageNo - 1) * pageSize;
+        Integer count = 0;
+        Map map = new HashMap();
+        if (orgId == null || roleCode == null) {
+            httpResult = new HttpResult(HttpResponseParam.NO_DATA_CODE, HttpResponseParam.NO_DATA_MSG, map);
+        } else {
+            if (queryType == 0) { //查询全部
+                if (!roleCode.equals("10001")) {
+                    list = sysUserService.selectAllUserManage(queryValue, pageNo, pageSize, orgId);
+                    count = sysUserService.selectAllUserManageCount(queryValue, orgId);
+                } else {
+                    list = sysUserService.selectAllUserManage(queryValue, pageNo, pageSize, -10001);
+                    count = sysUserService.selectAllUserManageCount(queryValue, -10001);
+                }
+
+            } else {
+                if (!roleCode.equals("10001")) {
+                    list = sysUserService.selectUserManageByParams(userName, phone, email, pageNo, pageSize, orgId);
+                    count = sysUserService.selectUserManageByParamsCount(userName, phone, email, orgId);
+                } else {
+                    list = sysUserService.selectUserManageByParams(userName, phone, email, pageNo, pageSize, -10001);
+                    count = sysUserService.selectUserManageByParamsCount(userName, phone, email, -10001);
+                }
+
+            }
+            map.put("count", count);
+            map.put("list", list);
+            if (list != null && !list.isEmpty()) {
+                httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_MSG, JSON.toJSONStringWithDateFormat(map, "yyyy-MM-dd HH:mm:ss"));
+            } else {
+                httpResult = new HttpResult(HttpResponseParam.NO_DATA_CODE, HttpResponseParam.NO_DATA_MSG, map);
+            }
+        }
+        LoggerMessageUtil.successfulMsg(logger, "查询系统用户管理信息");
+        return httpResult;
+    }
+
+    /**
+     * 修改密码
+     *
+     * @param userPwdInfo
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.PUT, value = "/reset")
+    @MethodDescription(description = "修改密码")
+    public HttpResult reSetUserPwd(@RequestBody String userPwdInfo) {
+        HttpResult httpResult = null;
+        JSONObject object = JSON.parseObject(userPwdInfo);
+        Integer userId = Integer.valueOf(object.get("userId").toString());
+        String oldPwd = object.get("feature").toString();
+        String newPwd = object.get("newPwd").toString();
+        SysUser sysUser = sysUserService.queryUserById(userId);
+        if (sysUser != null && Md5Util.processUserId(oldPwd, sysUser, Md5Util.TimeMd5Type.DATE)) { //验证原密码
+            if (!sysUser.getUserPwd().equals(newPwd)) {
+                int flag = sysUserService.updatePwd(userId, newPwd, oldPwd);
+                if (flag > 0) {
+                    httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG, flag);
+                } else {
+                    httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+                }
+            } else {
+                httpResult = new HttpResult(HttpResponseParam.LOGIN_PASSWORD_CODE, "修改的新密码不能与原密码一致");
+            }
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.LOGIN_PASSWORD_CODE, "原密码错误");
+        }
+        LoggerMessageUtil.successfulMsg(logger, "修改密码");
+        return httpResult;
+    }
+
+
+    /**
+     * 初始化密码为123456
+     *
+     * @param sysUser
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.POST, value = "/intial")
+    @MethodDescription(description = "重置密码")
+    public HttpResult intialUserPwd(@RequestBody SysUser sysUser) {
+        HttpResult httpResult = null;
+        int flag = sysUserService.resetPwd(sysUser.getUserId(), "123456");
+        if (flag > 0) {
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG, flag);
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_UPDATE_MSG);
+        }
+        LoggerMessageUtil.successfulMsg(logger, "重置密码");
+        return httpResult;
+    }
+
+
+}

+ 115 - 0
consumer/src/main/java/com/sunwin/swismp/exception/CustomExceptionResolver.java

@@ -0,0 +1,115 @@
+package com.sunwin.swismp.exception;
+
+import com.alibaba.fastjson.JSON;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.constant.MethodDescription;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.util.LoggerMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.servlet.HandlerExceptionResolver;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <br>
+ * Copyright (c) 1/21/2020 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swbd.exception <br>
+ * FileName: CustomExceptionResolver <br>
+ * <br>
+ * 自定义异常统一处理
+ *
+ * @author duanmin
+ * @created 1/21/2020-10:29 AM
+ * @last Modified
+ * @history
+ */
+@Configuration
+public class CustomExceptionResolver implements HandlerExceptionResolver {
+    private static Logger logger = LoggerFactory.getLogger(CustomExceptionResolver.class);
+
+    @Override
+    public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
+                                         Object handler, Exception ex) {
+
+
+        httpServletResponse.setCharacterEncoding("UTF-8");
+        httpServletResponse.setStatus(HttpStatus.OK.value());
+        Map<String, String> body = this.getBody(ex);
+        try {
+            HttpResult httpResult = new HttpResult(HttpResponseParam.FAIL_MSG);
+            String handlerStr = handler.toString();
+            int len = handlerStr.split(" ")[2].split("\\(")[0].split("\\.").length - 1;
+            String methodName = handlerStr.split(" ")[2].split("\\(")[0].split("\\.")[len];
+            String clazzName = handlerStr.split(" ")[2].split("\\(")[0].split("\\." + methodName)[0];
+            Class clazz = Class.forName(clazzName);
+            Method[] methods = clazz.getMethods();
+            for (Method method : methods) {
+                if (method.getName().equals(methodName)) {
+                    MethodDescription methodDescription = method.getAnnotation(MethodDescription.class);
+                    if (methodDescription != null) {
+                        httpResult.setDescription(methodDescription.description());
+                    } else {
+                        httpResult.setDescription(body.get("message"));
+                    }
+                    Logger logger1 = LoggerFactory.getLogger(clazzName);
+                    LoggerMessageUtil.errorMsg(logger1, methodName, httpResult.getDescription(), ex);
+                    httpServletResponse.getWriter().write(JSON.toJSONString(httpResult));
+                }
+            }
+
+        } catch (Exception e) {
+            LoggerMessageUtil.errorMsg(logger, HttpResponseParam.FAIL_MSG, e);
+        }
+        return new ModelAndView();
+    }
+
+    /**
+     * 获取错误编码
+     *
+     * @param request
+     * @return
+     */
+    private HttpStatus getStatus(HttpServletRequest request) {
+        Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
+        if (statusCode == null) {
+            return HttpStatus.INTERNAL_SERVER_ERROR;
+        }
+        try {
+            return HttpStatus.valueOf(statusCode);
+        } catch (Exception ex) {
+            return HttpStatus.INTERNAL_SERVER_ERROR;
+        }
+    }
+
+    /**
+     * <p>
+     * <code>getBody</code>根据exception获取返回信息
+     * </p>
+     *
+     * @param ex
+     * @return
+     */
+    private Map<String, String> getBody(Exception ex) {
+        Map<String, String> body = new HashMap();
+        if (ex instanceof SwismpBizException) {
+            body.put("message", ex.getMessage());
+            body.put("msg", HttpResponseParam.FAIL_MSG);
+        } else if (ex instanceof IllegalArgumentException) {
+            body.put("message", ex.getMessage());
+            body.put("msg", HttpResponseParam.FAIL_MSG);
+        } else {
+            body.put("message", "系统出现未知异常,请联系管理员!");
+            body.put("msg", HttpResponseParam.FAIL_MSG);
+        }
+        return body;
+    }
+}

+ 53 - 0
consumer/src/main/java/com/sunwin/swismp/exception/JsonResult.java

@@ -0,0 +1,53 @@
+package com.sunwin.swismp.exception;
+
+/**
+ * <br>
+ * Copyright (c) 12/27/2019 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swbd.exception <br>
+ * FileName: JsonResult <br>
+ * <br>
+ * 用于封装json 返回结果数据
+ *
+ * @author duanmin
+ * @created 12/27/2019-10:15 AM
+ * @last Modified
+ * @history
+ */
+public class JsonResult {
+    protected int httpCode;
+    protected String msg;
+
+    public int getHttpCode() {
+        return httpCode;
+    }
+
+    public void setHttpCode(int httpCode) {
+        this.httpCode = httpCode;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    /**
+     * 构造一个成功的结果返回
+     */
+    public JsonResult() {
+        this.setHttpCode(0);
+    }
+
+    /**
+     * 构造一个有异常信息的结果返回
+     *
+     * @param msg
+     */
+    public JsonResult(String msg) {
+        this.setHttpCode(-1);
+        this.setMsg(msg);
+    }
+}

+ 62 - 0
consumer/src/main/java/com/sunwin/swismp/exception/JsonResultData.java

@@ -0,0 +1,62 @@
+package com.sunwin.swismp.exception;
+
+/**
+ * <br>
+ * Copyright (c) 12/27/2019 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swbd.exception <br>
+ * FileName: JsonResultData <br>
+ * <br>
+ * 用于封装带data的json 返回结果数据
+ *
+ * @author duanmin
+ * @created 12/27/2019-2:30 PM
+ * @last Modified
+ * @history
+ */
+public class JsonResultData {
+    protected int resultCode;
+    protected String resultInfo;
+    private Object data;
+
+    public int getResultCode() {
+        return resultCode;
+    }
+
+    public void setResultCode(int resultCode) {
+        this.resultCode = resultCode;
+    }
+
+    public String getResultInfo() {
+        return resultInfo;
+    }
+
+    public void setResultInfo(String resultInfo) {
+        this.resultInfo = resultInfo;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+    /**
+     * 构造一个成功的结果返回
+     */
+    public JsonResultData() {
+        this.setResultCode(0);
+    }
+
+    /**
+     * 构造一个有异常信息的结果返回
+     *
+     * @param resultInfo
+     */
+    public JsonResultData(String resultInfo) {
+        this.setResultCode(-1);
+        this.setResultInfo(resultInfo);
+    }
+}

+ 46 - 0
consumer/src/main/java/com/sunwin/swismp/util/LoggerMessageUtil.java

@@ -0,0 +1,46 @@
+package com.sunwin.swismp.util;
+
+import org.slf4j.Logger;
+
+/**
+ * <br>
+ * Copyright (c) 1/8/2020 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swbd.utils <br>
+ * FileName: LoggerMessageUtil <br>
+ * <br>
+ * 日志消息处理工具类
+ *
+ * @author duanmin
+ * @created 2020/1/21-10:29 AM
+ * @last Modified
+ * @history
+ */
+public class LoggerMessageUtil {
+
+
+    /**
+     * 请求成功,日志打印
+     *
+     * @param logger
+     * @param msg
+     */
+    public static void successfulMsg(Logger logger, String msg) {
+        logger.info("成功|" + msg);
+    }
+
+    /**
+     * 请求失败,日志打印
+     *
+     * @param logger
+     * @param msg
+     * @param e
+     */
+    public static void errorMsg(Logger logger, String msg, Exception e) {
+        logger.error("失败|" + msg + " " + e.getMessage());
+    }
+
+    public static void errorMsg(Logger logger, String methodName, String msg, Exception e) {
+        logger.error(methodName+"|"+"失败|" + msg + e.getMessage());
+    }
+}

+ 42 - 0
consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/CheckSumBuilder.java

@@ -0,0 +1,42 @@
+package com.sunwin.swismp.util.mobileMessage;
+
+import java.security.MessageDigest;
+
+public class CheckSumBuilder {
+
+
+    // 计算并获取CheckSum sha1 不是 shal 1 l
+    public static String getCheckSum(String appSecret, String nonce, String curTime) {
+        return encode("sha1", appSecret + nonce + curTime);
+    }
+
+    // 计算并获取md5值
+    public static String getMD5(String requestBody) {
+        return encode("md5", requestBody);
+    }
+
+    private static String encode(String algorithm, String value) {
+        if (value == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest
+                    = MessageDigest.getInstance(algorithm);
+            messageDigest.update(value.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        for (int j = 0; j < len; j++) {
+            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+        }
+        return buf.toString();
+    }
+    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
+            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+}

+ 144 - 0
consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/MobileMessageSendUtil.java

@@ -0,0 +1,144 @@
+package com.sunwin.swismp.util.mobileMessage;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+* @Description: 短信发送工具
+* @Author: zc
+* @CreateDate: 2019/2/28 11:33
+* @Remark:
+* @Version: 1.0
+*/
+public class MobileMessageSendUtil {
+
+    //发送验证码的请求路径URL
+    private static final String SERVER_URL= ReadPropertiesUtil.GetValueByKey("netease_im_sendcode");
+    //发送带有参数的url
+    private static final String SEND_MSG_SERVER_URL = ReadPropertiesUtil.GetValueByKey("netease_im_sendtemplate");
+    //网易云信分配的账号,请替换你在管理后台应用下申请的Appkey
+    private static final String APP_KEY = ReadPropertiesUtil.GetValueByKey("swbd_appKey");
+    //网易云信分配的密钥,请替换你在管理后台应用下申请的appSecret
+    private static final String APP_SECRET=ReadPropertiesUtil.GetValueByKey("swbd_appSecret");
+    //随机数
+    private static final String NONCE= String.valueOf(System.currentTimeMillis());
+
+    //验证码长度,范围4~10,默认为4
+    private static final String CODELEN="6";
+
+    /**
+     * 验证码接口
+     * @param phone
+     * @param templateid
+     * @return
+     * @throws IOException
+     */
+    public static NeteaseImResponse sendMsg(String phone, String templateid) throws IOException {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost post = new HttpPost(SERVER_URL);
+
+//      CheckSum的计算
+        String curTime= String.valueOf((new Date().getTime()/1000L));
+        String checkSum= CheckSumBuilder.getCheckSum(APP_SECRET,NONCE,curTime);
+
+        //设置请求的header
+        post.addHeader("AppKey",APP_KEY);
+        post.addHeader("Nonce",NONCE);
+        post.addHeader("CurTime",curTime);
+        post.addHeader("CheckSum",checkSum);
+        post.addHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
+
+        //设置请求参数
+        List<NameValuePair> nameValuePairs =new ArrayList<>();
+        nameValuePairs.add(new BasicNameValuePair("mobile",phone));
+        nameValuePairs.add(new BasicNameValuePair("templateid", ReadPropertiesUtil.GetValueByKey(templateid)));
+        nameValuePairs.add(new BasicNameValuePair("codeLen", CODELEN));
+
+        post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
+
+        //执行请求
+        HttpResponse response=httpclient.execute(post);
+        String responseEntity= EntityUtils.toString(response.getEntity(),"utf-8");
+
+        //获取发送状态码
+        JSONObject jsonObject = JSON.parseObject(responseEntity);
+        Integer code = jsonObject.getInteger("code");
+        NeteaseImResponse neteaseImResponse = new NeteaseImResponse();
+        if (code == 200){
+            neteaseImResponse = JSON.parseObject(responseEntity, NeteaseImResponse.class);
+        }else {
+            neteaseImResponse.setCode(jsonObject.getInteger("code"));
+            neteaseImResponse.setMsg(jsonObject.getString("msg"));
+        }
+        return neteaseImResponse;
+    }
+
+    /**
+     * 带有参数的短信,可以批量发送多个对象
+     * @param phones "['13888888888','13555555555']"
+     * @param params 例如:"['xxxx','xxxx']
+     * @param templateid
+     * @return
+     * @throws IOException
+     */
+    public static NeteaseImResponse sendMsg(String phones, String params, String templateid) throws IOException {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost post = new HttpPost(SEND_MSG_SERVER_URL);
+
+//      CheckSum的计算
+        String curTime= String.valueOf((new Date().getTime()/1000L));
+        String checkSum= CheckSumBuilder.getCheckSum(APP_SECRET,NONCE,curTime);
+
+        //设置请求的header
+        post.addHeader("AppKey",APP_KEY);
+        post.addHeader("Nonce",NONCE);
+        post.addHeader("CurTime",curTime);
+        post.addHeader("CheckSum",checkSum);
+        post.addHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
+
+        //设置请求参数
+        List<NameValuePair> nameValuePairs =new ArrayList<>();
+        nameValuePairs.add(new BasicNameValuePair("mobiles",phones));
+        nameValuePairs.add(new BasicNameValuePair("templateid", ReadPropertiesUtil.GetValueByKey(templateid)));
+        nameValuePairs.add(new BasicNameValuePair("codeLen", CODELEN));
+        nameValuePairs.add(new BasicNameValuePair("params", params));
+
+        post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
+
+        //执行请求
+        HttpResponse response=httpclient.execute(post);
+        String responseEntity= EntityUtils.toString(response.getEntity(),"utf-8");
+
+        //获取发送状态码
+        return JSON.parseObject(responseEntity, NeteaseImResponse.class);
+    }
+
+
+    public static void main(String[] args) throws IOException {
+        String[] params = new String[]{"8", "https://axhub.im/pro/02fc03a400783200/"};
+        System.out.println(JSON.toJSONString(params));
+        List<String> phones = new ArrayList<>();
+        phones.add("17730212170");
+//        phones.add("15656002738");
+        System.out.println(JSON.toJSONString(phones));
+        String params2 = "['8','https://axhub.im/pro']";
+        NeteaseImResponse response = sendMsg(JSON.toJSONString(phones), params2,"bdiap_send_templateid");
+        System.out.println(JSON.toJSONString(response));
+    }
+
+
+
+}

+ 38 - 0
consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/NeteaseImResponse.java

@@ -0,0 +1,38 @@
+package com.sunwin.swismp.util.mobileMessage;
+
+public class NeteaseImResponse {
+
+
+    /**
+     * msg : sendid
+     * code : 200
+     * obj : 123
+     */
+    private String msg;
+    private int code;
+    private int obj;
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public void setObj(int obj) {
+        this.obj = obj;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public int getObj() {
+        return obj;
+    }
+}

+ 48 - 0
consumer/src/main/java/com/sunwin/swismp/util/mobileMessage/ReadPropertiesUtil.java

@@ -0,0 +1,48 @@
+package com.sunwin.swismp.util.mobileMessage;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+* @Description: 获取properties配置文件
+* @Author: zc
+* @CreateDate: 2019/2/28 11:34
+* @Remark:
+* @Version: 1.0
+*/
+public class ReadPropertiesUtil {
+
+    private static final String PROPS_FILE = "mobile.properties";
+
+    private static final Properties PROPS;
+
+    static {
+        PROPS = loadProps(PROPS_FILE);
+    }
+
+    public static Properties loadProps(String file)  {
+        InputStream is = ReadPropertiesUtil.class.getClassLoader().getResourceAsStream(PROPS_FILE);
+        Properties properties = new Properties();
+        try {
+            properties.load(is);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (is != null) {
+                    is.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return properties;
+    }
+
+
+    public static String GetValueByKey(String key) {
+        return PROPS.getProperty(key);
+    }
+
+}

+ 12 - 0
consumer/src/main/resources/application.properties

@@ -0,0 +1,12 @@
+#20\u73AF\u5883
+server.port=8088
+logging.path=/home/swismp/log
+
+#logging.level.root=debug
+
+#??session????
+server.servlet.session.timeout=-1
+
+# \u4E0A\u4F20\u6587\u4EF6\u9650\u5236
+spring.servlet.multipart.max-file-size=200MB
+spring.servlet.multipart.max-request-size=200MB

+ 27 - 0
consumer/src/main/resources/dubbo-consumer.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+    http://www.springframework.org/schema/beans/spring-beans.xsd
+    http://code.alibabatech.com/schema/dubbo
+    http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
+    <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
+    <dubbo:application name="swismp-consumer"/>
+    <!--<dubbo:monitor protocol="registry"/>-->
+    <!-- zookeeper作为注册中心 -->
+    <!--20开发环境-->
+    <dubbo:registry protocol="zookeeper"
+                    address="zookeeper://192.168.20.65:2181?backup=192.168.20.66:2181,192.168.20.67:2181" group="swismp"/>
+
+    <!-- 消费端,访问超时时间为3秒 -->
+    <dubbo:consumer filter="monitor" group="dubbo" timeout="20000"/>
+
+    <!-- 系统功能模块 -->
+    <dubbo:reference interface="com.sunwin.swismp.service.sysfunction.SysUserService" id="sysUserService"/>
+    <dubbo:reference interface="com.sunwin.swismp.service.sysfunction.SysMenuService" id="sysMenuService"/>
+    <dubbo:reference interface="com.sunwin.swismp.service.sysfunction.SysOperationLogService" id="sysOperationLogService"/>
+    <dubbo:reference interface="com.sunwin.swismp.service.sysfunction.SysOrgService" id="sysOrgService"/>
+    <dubbo:reference interface="com.sunwin.swismp.service.sysfunction.SysRoleService" id="sysRoleService"/>
+    <dubbo:reference interface="com.sunwin.swismp.service.sysfunction.SysRoleMenuPermissionsService" id="sysRoleMenuPermissionsService"/>
+</beans>

+ 48 - 0
consumer/src/main/resources/logback.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false">
+    <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
+    <property name="LOG_HOME" value="/home/swismp/log" />
+    <conversionRule conversionWord="ip" converterClass="com.sunwin.swismp.config.log.LogIpConfig" />
+    <conversionRule conversionWord="logMethods" converterClass="com.sunwin.swismp.config.log.LogMethodsConfig" />
+    <conversionRule conversionWord="uidOid" converterClass="com.sunwin.swismp.config.log.LogUserOrgIdConfig" />
+    <conversionRule conversionWord="interface" converterClass="com.sunwin.swismp.config.log.LogInterfaceConfig" />
+    <conversionRule conversionWord="mess" converterClass="com.sunwin.swismp.config.log.LogMesConfig" />
+    <conversionRule conversionWord="response" converterClass="com.sunwin.swismp.config.log.ResponseTimeConfig" />
+    <conversionRule conversionWord="logLine" converterClass="com.sunwin.swismp.config.log.LogLineConfig" />
+    <!-- 控制台输出 -->
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
+            <!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
+            <!--<pattern>%d{yyyy-MM-dd HH:mm:ss}|%ip|%p|%interface|%c|%logMethods|%t|%reponse|%L|%mess|%uidOid%n</pattern>-->
+            <pattern>%d{yyyy-MM-dd HH:mm:ss}|%ip|%p|%interface|%c%logMethods|%mess|%t|%response|%logLine|%uidOid%n</pattern>
+        </encoder>
+    </appender>
+    <!-- 按照每天生成日志文件  -->
+    <appender name="FILE"  class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名-->
+            <FileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>30</MaxHistory>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
+            <!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
+            <!--%d日期,%p输出优先级,%c所在类的全名,%M方法名,-->
+            <!--<pattern>%d{yyyy-MM-dd HH:mm:ss}|%ip|%p|%interface|%c|%logMethods|%t|%reponse|%L|%mess|%uidOid%n</pattern>-->
+            <pattern>%d{yyyy-MM-dd HH:mm:ss}|%ip|%p|%interface|%c%logMethods|%mess|%t|%response|%logLine|%uidOid%n</pattern>
+        </encoder>
+        <!--日志文件最大的大小 与日期滚动策略不能同时存在???-->
+        <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
+        <!--<MaxFileSize>10MB</MaxFileSize>-->
+        <!--</triggeringPolicy>-->
+    </appender>
+    <!-- 日志输出级别 -->
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+        <appender-ref ref="FILE" />
+        <!--<appender-ref ref="infoAppender" />-->
+        <!--<appender-ref ref="errorAppender" />-->
+    </root>
+</configuration>

+ 39 - 0
consumer/src/main/resources/mobile.properties

@@ -0,0 +1,39 @@
+###if task=1 then start job else ignore;default 0 ignore;
+task=0
+netease_im_sendcode=https://api.netease.im/sms/sendcode.action
+netease_im_verifycode=https://api.netease.im/sms/verifycode.action
+netease_im_sendtemplate = https://api.netease.im/sms/sendtemplate.action
+
+
+## \u8206\u60C5\u6D1E\u5BDF\u7CFB\u7EDF
+bdiap_appKey=8f5b88d1bdde765e93253076cc3afdf0
+bdiap_appSecret=a242307ca655
+
+## \u667A\u6167\u65C5\u6E38 \u6D4B\u8BD5\u7528
+#netease_im_appKey=ce4916e6fe3e5b7d010cd31319ef2279
+#netease_im_appSecret=9f5e9e5022c9
+netease_im_register_templateid=4033352
+netease_im_resetpwd_templateid=3933133
+netease_im_codelogin_templateid=4033350
+
+## \u8206\u60C5\u6D1E\u5BDF\u7CFB\u7EDF
+bdiap_register_templateid=9674206
+bdiap_update_templateid=9714313
+bdiap_send_templateid=9684551
+bdiap_monitor_task_templateid=14886435
+bdiap_error_words_templateid=14878474
+##\u4E03\u725B
+url=http://static.smartjishou.com/
+ak=J8lMo2eKzAD2-RJUUc663YGKfjiBC-PQ_iVYmCVN
+sk=jwzsriKAEx5Fy3i5zVCS4V066B-VpTat09DeSCd9
+bucketName=jishou
+
+## \u652F\u6491\u5E73\u53F0
+swbd_appKey=2dc6f165fcc0701a38ad6dd102f515bc
+swbd_appSecret=0bc4cfbc75ab
+swbd_register_templateid=14831597
+swbd_update_templateid=14846636
+swbd_send_templateid=9684551
+swbd_login_templateid=14878480
+
+

+ 43 - 0
pom.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>pom</packaging>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.0.3.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.sunwin</groupId>
+    <artifactId>swismp</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <name>swismp</name>
+    <description>swismp</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <modules>
+        <module>swismp-base</module>
+        <module>swismp-api</module>
+        <module>provider</module>
+        <module>consumer</module>
+    </modules>
+
+</project>

+ 147 - 0
provider/pom.xml

@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>com.sunwin</groupId>
+        <artifactId>swismp</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.sunwin.swismp</groupId>
+    <artifactId>provider</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>provider</name>
+    <description>provider</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.sunwin.swismp</groupId>
+            <artifactId>swismp-api</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <!--工具类-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>log4j-to-slf4j</artifactId>
+                    <groupId>org.apache.logging.log4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba.spring.boot</groupId>
+            <artifactId>dubbo-spring-boot-starter</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+
+        <!-- postgresql-->
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <!--阿里数据库连接池-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.2.11</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.11</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.zookeeper</groupId>
+            <artifactId>zookeeper</artifactId>
+            <version>3.5.5</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>slf4j-log4j12</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+                <exclusion>
+                    <groupId>io.netty</groupId>
+                    <artifactId>netty</artifactId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>log4j</artifactId>
+                    <groupId>log4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-framework -->
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+            <version>2.13.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-recipes -->
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+            <version>2.13.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.curator/curator-client -->
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-client</artifactId>
+            <version>2.13.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>com.101tec</groupId>
+            <artifactId>zkclient</artifactId>
+            <version>0.10</version>
+        </dependency>
+        <!--mybatis-->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis-typehandlers-jsr310</artifactId>
+            <version>1.0.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jvnet.hudson</groupId>
+            <artifactId>ganymed-ssh2</artifactId>
+            <version>build210-hudson-1</version>
+        </dependency>
+
+    </dependencies>
+
+
+</project>

+ 21 - 0
provider/src/main/java/com/sunwin/ProviderApplication.java

@@ -0,0 +1,21 @@
+package com.sunwin;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+@ImportResource("classpath:dubbo-provider.xml")
+@EnableTransactionManagement
+@EnableScheduling
+@EnableAsync
+public class ProviderApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ProviderApplication.class, args);
+    }
+
+}

+ 19 - 0
provider/src/main/java/com/sunwin/swismp/config/annotation/DS.java

@@ -0,0 +1,19 @@
+package com.sunwin.swismp.config.annotation;
+
+
+import com.sunwin.swismp.config.datasource.DataSourceType;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 自定义注解
+ */
+@Retention(RetentionPolicy.RUNTIME) //生命周期 运行时
+@Target({ElementType.METHOD}) //作用范围 方法
+public @interface DS {
+	DataSourceType value() default DataSourceType.postgreDS;
+}

+ 63 - 0
provider/src/main/java/com/sunwin/swismp/config/datasource/DataSourceConfig.java

@@ -0,0 +1,63 @@
+package com.sunwin.swismp.config.datasource;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.env.Environment;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.PlatformTransactionManager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 数据源配置
+ * es 是自动加载
+ */
+@Configuration
+public class DataSourceConfig {
+
+	@Autowired
+	private Environment env;
+
+	//
+	@Bean(name = "dataSource3")
+	public DruidDataSource dataSource3(){
+		DruidDataSource dataSource = new DruidDataSource();
+		dataSource.setUrl(env.getProperty("spring.datasource.postgresql.url"));
+		dataSource.setUsername(env.getProperty("spring.datasource.postgresql.username"));
+		dataSource.setPassword(env.getProperty("spring.datasource.postgresql.password"));
+		dataSource.setDriverClassName(env.getProperty("spring.datasource.postgresql.driver-class-name"));
+		return dataSource;
+	}
+
+	/**
+	 * 动态数据源,通过AOP实现切换
+	 * @return
+	 */
+	@Bean(name = "dynamicDataSource")
+	@Primary
+	public DynamicDataSource dynamicDataSource() {
+		DynamicDataSource dynamicDataSource = new DynamicDataSource();
+        //默认数据源,mysql
+        dynamicDataSource.setDefaultTargetDataSource(dataSource3());
+		//配置多数据源
+		Map<Object, Object> map = new HashMap<>();
+		//TODO:添加新的jdbc数据源类型
+		map.put(DataSourceType.postgreDS,dataSource3());
+//		map.put(DataSourceType.azkabanDS,dataSource4());
+		dynamicDataSource.setTargetDataSources(map);
+		return dynamicDataSource;
+	}
+
+	/**
+	 * 配置事务管理器
+	 * @return
+	 */
+	@Bean
+	public PlatformTransactionManager transactionManager() {
+		return new DataSourceTransactionManager(dynamicDataSource());
+	}
+}

+ 9 - 0
provider/src/main/java/com/sunwin/swismp/config/datasource/DataSourceType.java

@@ -0,0 +1,9 @@
+package com.sunwin.swismp.config.datasource;
+
+/**
+ * jdbc数据源类型
+ */
+public enum DataSourceType {
+	 postgreDS
+	//,azkabanDS, impalaDS TODO:添加新的jdbc数据源类型
+}

+ 20 - 0
provider/src/main/java/com/sunwin/swismp/config/datasource/DynamicDataSource.java

@@ -0,0 +1,20 @@
+package com.sunwin.swismp.config.datasource;
+
+import com.sunwin.swismp.config.threadlocal.DataSourceContextHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
+
+/**
+ * 动态数据源
+ */
+public class DynamicDataSource extends AbstractRoutingDataSource {
+
+	private Logger logger = LoggerFactory.getLogger(DynamicDataSource.class);
+
+	@Override
+	protected Object determineCurrentLookupKey() {
+//		logger.info("dataSource={}",DataSourceContextHolder.getDB());
+		return DataSourceContextHolder.getDB();
+	}
+}

+ 70 - 0
provider/src/main/java/com/sunwin/swismp/config/datasource/DynamicDataSourceAspect.java

@@ -0,0 +1,70 @@
+package com.sunwin.swismp.config.datasource;
+
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.config.threadlocal.DataSourceContextHolder;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+
+/**
+ * 自定义注解 + AOP的方式实现数据源动态切换
+ */
+@Aspect
+@Component
+public class DynamicDataSourceAspect {
+
+	@Before("@annotation(com.sunwin.swismp.config.annotation.DS)")
+	public void beforeSwitchDS(JoinPoint point) {
+		//获得当前访问的class
+		Class className = point.getTarget().getClass();
+		//获得访问的方法名
+		String methodName = point.getSignature().getName();
+		//得到方法的参数类型
+		Class[] params = ((MethodSignature)point.getSignature()).getParameterTypes();
+
+		DataSourceType dataSource = DataSourceContextHolder.DEFAULT_DS;
+		try {
+			//得到访问的方法对象
+			Method method = className.getMethod(methodName, params);
+			//判断是否存在@DS注解
+			if (method.isAnnotationPresent(DS.class)) {
+				DS annotation = method.getAnnotation(DS.class);
+				//取出注解中的数据源名
+				dataSource = annotation.value();
+			}
+		} catch (NoSuchMethodException e) {
+			e.printStackTrace();
+		}
+		//切换数据源
+		DataSourceContextHolder.setDB(dataSource);
+	}
+
+	@After("@annotation(com.sunwin.swismp.config.annotation.DS)")
+	public void afterSwitchDS(JoinPoint point) {
+		DataSourceContextHolder.clearDB();
+	}
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 31 - 0
provider/src/main/java/com/sunwin/swismp/config/threadlocal/DataSourceContextHolder.java

@@ -0,0 +1,31 @@
+package com.sunwin.swismp.config.threadlocal;
+
+
+import com.sunwin.swismp.config.datasource.DataSourceType;
+
+/**
+ * 保存一个线程安全的数据源容器
+ */
+public class DataSourceContextHolder {
+
+	private static final ThreadLocal<DataSourceType> contextHolder = new ThreadLocal<>();
+
+	//TODO:添加新的jdbc数据源类型
+	public static final DataSourceType DEFAULT_DS = DataSourceType.postgreDS; //默认数据源
+
+	static {
+		contextHolder.set(DEFAULT_DS);
+	}
+
+	public static void setDB(DataSourceType dataBaseType) {
+		contextHolder.set(dataBaseType);
+	}
+
+	public static DataSourceType getDB() {
+		return contextHolder.get();
+	}
+
+	public static void clearDB() {
+		contextHolder.remove();
+	}
+}

+ 93 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysMenuMapper.java

@@ -0,0 +1,93 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.bean.sysfunction.SysMenu;
+import com.sunwin.swismp.dto.sysfunction.SysMenuDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface SysMenuMapper {
+    /**
+     * 查询角色能看到的菜单
+     * @param roleId
+     * @return
+     */
+    List<SysMenu> selectByRoleId(@Param("roleId") Integer roleId);
+    /**
+     * 用户id对应的菜单
+     * @param userId
+     * @return
+     */
+    List<SysMenu> selectByUserId(@Param("userId") Integer userId);
+
+    /**
+     * 菜单明细
+     * @param menuId
+     * @return
+     */
+    SysMenuDTO selectMenuById(@Param("menuId") Integer menuId);
+    /**
+     * 查询次级菜单列表
+     * @param menuId
+     * @return
+     */
+    List<SysMenuDTO> queryMenuSecondary(@Param("menuId")Integer menuId,
+                                        @Param(value = "resourceType") Integer resourceType,
+                                        @Param(value = "isEnable") Integer isEnable,
+                                        @Param(value = "keywords") String keywords,
+                                        @Param(value = "offset") Integer offset,
+                                        @Param(value = "size") Integer size);
+    Long queryMenuSecondaryCount(@Param("menuId")Integer menuId,
+                                 @Param(value = "resourceType") Integer resourceType,
+                                 @Param(value = "isEnable") Integer isEnable,
+                                 @Param(value = "keywords") String keywords);
+
+    Long queryMenuCount(@Param("menuId")Integer menuId,
+                        @Param(value = "menuName") String menuName,
+                        @Param(value = "resourceType") Integer resourceType,
+                        @Param(value = "isEnable") Integer isEnable,
+                        @Param(value = "keywords") String keywords);
+
+    Long queryMenuOutSelfCount(@Param("menuId")Integer menuId,
+                               @Param(value = "menuName") String menuName);
+
+    /**
+     * @Description : 插入新增资源信息
+     * @param record
+     * @Return :
+     * @Author : fengyong
+     * @Date : 2022/2/16 9:36
+     */
+    int menuInsert(SysMenu record);
+
+
+    /**
+     * @Description : 根据主键修改资源内容
+     * @param record
+     * @Return :
+     * @Author : fengyong
+     * @Date : 2022/2/16 9:36
+     */
+    int menuUpdateByPrimaryKey(SysMenu record);
+
+    /**
+     * @Description : 根据主键修改资源启用状态
+     * @param record
+     * @Return :
+     * @Author : fengyong
+     * @Date : 2022/2/16 9:36
+     */
+    int menuUpdateIsEnableByPrimaryKey(SysMenu record);
+
+    /**
+     * @Description : 删除资源
+     * @Return :
+     */
+    Integer deleteMenu(Integer menuId);
+
+    List<SysMenuDTO> querySysMenuTree();
+
+
+}

+ 30 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysOperationLogMapper.java

@@ -0,0 +1,30 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.bean.sysfunction.SysOperationLog;
+import com.sunwin.swismp.dto.sysfunction.SysOperationLogDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface SysOperationLogMapper {
+    /**
+     * 插入操作日志
+     * @param record
+     * @return
+     */
+    int insert(SysOperationLog record);
+
+    List<SysOperationLogDTO> querySysLogPage(@Param("operationModule") String moduleName,
+                                             @Param("operationName") String operationName, @Param("roleId") String roleId,
+                                             @Param("beginOperateTime") String beginOperateTime,
+                                             @Param("endOperateTime") String endOperateTime,
+                                             @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
+
+    Long querySysLogPageCount(@Param("operationModule") String moduleName,
+                              @Param("operationName") String operationName, @Param("roleId") String roleId,
+                              @Param("beginOperateTime") String beginOperateTime,
+                              @Param("endOperateTime") String endOperateTime);
+
+}

+ 47 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysOrgMapper.java

@@ -0,0 +1,47 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.dto.sysfunction.SysOrgDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swismp.dao.sysfunction.mapper
+ * FileName: SysOrgMapper
+ *
+ * @author duanmin
+ * @description
+ * @created 2/11/2022 - 5:26 PM
+ * @last Modified
+ * @history
+ */
+@Mapper
+public interface SysOrgMapper {
+    Integer enableSysOrg(@Param("sysOrgId") Integer sysOrgId, @Param("enabled") Integer enabled);
+
+    Integer addSysOrg(SysOrgDTO sysOrgDTO);
+
+    Integer delSysOrg(@Param("sysOrgId") Integer sysOrgId);
+
+    Integer editSysOrg(SysOrgDTO sysOrgDTO);
+
+    List<SysOrgDTO> querySysOrgPage(@Param("parentOrgId") String parentOrgId, @Param("orgUserNum") String orgUserNum,
+                                    @Param("enabled") String enabled, @Param("keywords") String keywords,
+                                    @Param("beginUpdateTime") String beginUpdateTime,
+                                    @Param("endUpdateTime") String endUpdateTime, @Param("pageNum") Integer pageNum,
+                                    @Param("pageSize") Integer pageSize);
+
+    Long querySysOrgPageCount(@Param("parentOrgId") String parentOrgId, @Param("orgUserNum") String orgUserNum,
+                              @Param("enabled") String enabled, @Param("keywords") String keywords,
+                              @Param("beginUpdateTime") String beginUpdateTime,
+                              @Param("endUpdateTime") String endUpdateTime);
+
+    List<SysOrgDTO> querySysOrgTree();
+
+    SysOrgDTO viewSysOrg(@Param("sysOrgId") String sysOrgId);
+
+    List<SysOrgDTO> querySysOrgByParentAndName(@Param("parentOrgId") Integer parentOrgId, @Param("orgName") String orgName);
+}

+ 109 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysRoleMapper.java

@@ -0,0 +1,109 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.bean.sysfunction.SysRole;
+import com.sunwin.swismp.dto.sysfunction.SysRoleDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface SysRoleMapper {
+    /**
+     * 删除
+     * @param roleId
+     * @return
+     */
+    int deleteByPrimaryKey(Integer roleId);
+    /**
+     * @Description : 插入新增角色信息
+     * @param record
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:36
+    */
+    int insert(SysRole record);
+
+    /**
+     * @Description : 根据主键修改角色内容
+     * @param record
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:37
+    */
+    int updateByPrimaryKey(SysRole record);
+    /**
+     * @Description : 根据名称查询
+     * @param roleName
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:35
+    */
+    SysRole selectByRoleName(@Param(value = "roleName") String roleName);
+    /**
+     * @Description : 根据编号查询
+     * @param roleCode
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:35
+    */
+    SysRole selectByRoleCode(@Param(value = "roleCode") String roleCode);
+    /**
+     * @Description : 根据角色名称查询 是否已有角色存在
+     * @param roleName
+     * @param roleId
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:38
+    */
+    SysRole selectByRoleNameOutSelf(@Param(value = "roleName") String roleName, @Param(value = "roleId") Integer roleId);
+    /**
+     * @Description : 根据编号查询是否已有角色存在
+     * @param roleCode
+     * @param roleId
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:43
+    */
+    SysRole selectByRoleCodeOutSelf(@Param(value = "roleCode") String roleCode, @Param(value = "roleId") Integer roleId);
+
+    List<SysRole> selectAll();
+    /**
+     *  分页-条件查询
+     * @param roleName 名称
+     * @param roleCode 编号
+     * @param isEnable 是否可用
+     * @param offset 位移
+     * @param size 数目
+     * @return
+     */
+    List<SysRoleDTO> selectPage(@Param(value = "roleName") String roleName,
+                                @Param(value = "roleCode") String roleCode,
+                                @Param(value = "isEnable") Integer isEnable,
+                                @Param(value = "keywords") String keywords,
+                                @Param(value = "offset") Integer offset,
+                                @Param(value = "size") Integer size);
+    Integer selectPageCount(@Param(value = "roleName") String roleName,
+                            @Param(value = "roleCode") String roleCode,
+                            @Param(value = "isEnable") Integer isEnable,
+                            @Param(value = "keywords") String keywords);
+    /**
+     * @Description : 检查角色名 是否 与 已有 角色名 部门 人名冲突
+     * @param roleName
+     * @param roleId
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/5/28 15:36
+    */
+    List<Map> checkRoleName(@Param("roleName") String roleName, @Param("roleId") Integer roleId);
+
+    List<SysRole> selectExcludeRoleCode(@Param(value = "roleCode") String excludeRoleCode);
+
+    /**
+     * 查询角色用户数
+     * @param roleId
+     * @return
+     */
+    Integer selectRoleUserNum(@Param(value = "roleId") Integer roleId);
+}

+ 29 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysRoleMenuMapper.java

@@ -0,0 +1,29 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.bean.sysfunction.SysRoleMenu;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface SysRoleMenuMapper {
+    /**
+     * 根据角色id查询所有信息
+     * @param roleId
+     * @return
+     */
+    List<SysRoleMenu> selectByRoleIdMenuId(@Param("roleId") Integer roleId);
+    /**
+     * 批量插入
+     * @param sysRoleMenus
+     * @return
+     */
+    int batchInsert(List<SysRoleMenu> sysRoleMenus);
+    /**
+     * 通过角色id 删除
+     * @param roleId
+     * @return
+     */
+    int deleteByRoleId(Integer roleId);
+}

+ 27 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysRoleMenuPermissionsMapper.java

@@ -0,0 +1,27 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.dto.sysfunction.SysRoleMenuPermissions;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface SysRoleMenuPermissionsMapper {
+    /**
+     * @Description : 查询全部的权限信息
+     * @param roleId 根据id
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:12
+     */
+    List<SysRoleMenuPermissions> selectByRoleId(@Param(value = "roleId") Integer roleId);
+    /**
+     * @Description : 查询已有的权限信息
+     * @param roleId 根据id
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:12
+     */
+    List<SysRoleMenuPermissions> selectByRoleIdSelf(@Param(value = "roleId") Integer roleId);
+}

+ 199 - 0
provider/src/main/java/com/sunwin/swismp/dao/sysfunction/mapper/SysUserMapper.java

@@ -0,0 +1,199 @@
+package com.sunwin.swismp.dao.sysfunction.mapper;
+
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+import com.sunwin.swismp.dto.sysfunction.SysUserDTO;
+import com.sunwin.swismp.dto.sysfunction.SysUserManage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface SysUserMapper {
+
+    /**
+     * 添加用户
+     * @param record
+     * @return
+     */
+    int insert(SysUser record);
+    /**
+     * @Description : 根据id查询用户内容
+     * @param userId
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:46
+     */
+    SysUser selectByPrimaryKey(Integer userId);
+    /**
+     * @Description : 更新用户信息
+     * @param record
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:53
+    */
+    int updateByPrimaryKey(SysUser record);
+    /**
+     * @Description : 根据电话查询用户内容
+     * @param telephone
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:47
+     */
+    SysUser selectByTelephone(@Param("telephone") String telephone);
+    /**
+     * @Description : 更新电话号码
+     * @param userId
+     * @param telephone
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:54
+    */
+    int updateTelephoneByUserId(@Param("userId") Integer userId, @Param("telephone") String telephone);
+    /**
+     * @Description : 更新用户邮箱
+     * @param userId
+     * @param email
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:55
+    */
+    int updateEmailByUserId(@Param("userId") Integer userId, @Param("email") String email);
+    /**
+     * @Description : 验证用户是否存在
+     * @param userName
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:51
+     * @return
+    */
+    List<SysUserDTO> selectByUserName(@Param("userName") String userName);
+
+    SysUser selectByUserNameWithRoleCode(@Param("userName") String userName);
+
+    /**
+     * @Description : 查找重合的部门 权限 用户名称
+     * @param userName
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/5/22 9:33
+    */
+    List<SysUser> selectUserRoleOrgByUserName(@Param("userName") String userName);
+    /**
+     * @Description : 更新用户密码
+     * @param userId
+     * @param userPwd
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:53
+    */
+    int updatePwd(@Param("userId") Integer userId, @Param("userPwd") String userPwd);
+    /**
+     * 注销,暂停用户
+     * @param userId
+     * @return
+     */
+    int logoff(@Param("userId") Integer userId);
+    /**
+     * 启用用户
+     * @param userId
+     * @param enabled
+     * @return
+     */
+    int enableUser(@Param("userId") Integer userId, @Param("enabled") Integer enabled);
+    /**
+     * @Description : 删除用户内容 根据主键
+     * @param userId
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:55
+    */
+    int deleteByPrimaryKey(@Param("userId") Integer userId);
+
+    /**
+     * 模糊匹配userName, phone, email三个字段
+     * @return
+     */
+    List<SysUserManage> selectAllUserManage(@Param("param") String param, @Param("pageNo") Integer pageNo,
+                                            @Param("pageSize") Integer pageSize, @Param("orgId") Integer orgId);
+    /**
+     * 查询所有系统用户管理信息
+     * @return
+     */
+    SysUserManage selectUserManageById(@Param("userId") Integer userId);
+
+
+    /**
+     * 多参数模糊查询
+     * @param userName
+     * @param phone
+     * @param email
+     * @return
+     */
+    List<SysUserManage> selectUserManageByParams(@Param("userName") String userName, @Param("phone") String phone,
+                                                 @Param("email") String email, @Param("pageNo") Integer pageNo,
+                                                 @Param("pageSize") Integer pageSize, @Param("orgId") Integer orgId);
+    /**
+     * @Description : 根据用户姓名 手机号  邮箱 返回用户编号
+     * @param userName
+     * @param phone
+     * @param email
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:16
+     */
+    Integer selectUserManageByParamsCount(@Param("userName") String userName, @Param("phone") String phone,
+                                          @Param("email") String email, @Param("orgId") Integer orgId);
+    /**
+     * @Description : 查询用户所有信息
+     * @param param
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:17
+     */
+    Integer selectAllUserManageCount(@Param("param") String param, @Param("orgId") Integer orgId);
+
+    /**
+     * 查询所有的用户id 信息
+     * @return
+     */
+    List<SysUserManage> queryAllUserIdName();
+    List<SysUserManage> queryOrgUserRelation();
+    List<SysUserManage> queryUserRoleRelation();
+
+    List<SysUser> selectRoleOrgByUserName(@Param("userName") String userName, @Param("userId") Integer userId);
+    /**
+     * @Description : 查找用户权限
+     * @param userName
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/6/18 8:32
+    */
+    Map queryUserEnabled(@Param("userName") String userName);
+
+    /**
+     * 查询系统所有用户
+     * @return
+     */
+    List<SysUserManage> queryUserManger();
+
+    List<SysUserDTO> querySysUserPage(@Param("orgType") String orgType, @Param("orgId") Integer orgId,
+                                      @Param("roleId") String roleId, @Param("realName") String realName,
+                                      @Param("isEnabled") String isEnabled, @Param("userName") String userName,
+                                      @Param("beginUpdateTime") String beginUpdateTime,
+                                      @Param("endUpdateTime") String endUpdateTime, @Param("pageNum") Integer pageNum,
+                                      @Param("pageSize") Integer pageSize);
+
+    Long querySysUserPageCount(@Param("orgType") String orgType, @Param("orgId") Integer orgId,
+                               @Param("roleId") String roleId, @Param("realName") String realName,
+                               @Param("isEnabled") String isEnabled, @Param("userName") String userName,
+                               @Param("beginUpdateTime") String beginUpdateTime,
+                               @Param("endUpdateTime") String endUpdateTime);
+
+    SysUserDTO queryUserById(@Param("userId") Integer userId);
+
+    List<SysUserDTO> querySysUserByName(@Param("userName") String userName);
+
+    String queryLastLoginTimeByUserName(@Param("userName") String userName);
+}

+ 259 - 0
provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysMenuServiceImpl.java

@@ -0,0 +1,259 @@
+package com.sunwin.swismp.service.sysfunction.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.sunwin.swismp.bean.TreeNode;
+import com.sunwin.swismp.bean.sysfunction.SysMenu;
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysMenuMapper;
+import com.sunwin.swismp.config.datasource.DataSourceType;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysMenuDTO;
+import com.sunwin.swismp.dto.sysfunction.SysMenuResult;
+import com.sunwin.swismp.service.sysfunction.SysMenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 菜单信息服务
+ */
+@Service
+public class SysMenuServiceImpl implements SysMenuService {
+
+    @Autowired
+    private SysMenuMapper sysMenuMapper;
+
+    /**
+     * 查询角色能看到的菜单
+     * @param roleId
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public List<SysMenuResult> selectByRoleId(Integer roleId) {
+        return constructMenus(sysMenuMapper.selectByRoleId(roleId));
+    }
+
+    /**
+     * 用户id对应的菜单
+     * @param userId
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public List<SysMenuResult> selectByUserId(Integer userId) {
+        List<SysMenu> menus = sysMenuMapper.selectByUserId(userId);
+        return constructMenus(menus);
+    }
+
+
+    /**
+     * 构造多级菜单
+     * @param menus
+     * @return
+     */
+    public List<SysMenuResult> constructMenus(List<SysMenu> menus) {
+        List<SysMenuResult> sysMenuResults = new ArrayList<>();
+        for (SysMenu sysMenu : menus) {
+            sysMenuResults.add(new SysMenuResult(sysMenu));
+        }
+
+        for (SysMenuResult sysMenuResult1 : sysMenuResults) {
+            for (SysMenuResult sysMenuResult2 : sysMenuResults) {
+                if (sysMenuResult1.getMenuId().equals(sysMenuResult2.getParentMenuId())) {
+                    sysMenuResult1.addChildMenu(sysMenuResult2);
+                }
+            }
+        }
+
+        List<SysMenuResult> results = new ArrayList<>();
+        for (SysMenuResult sysMenuResult : sysMenuResults) {
+            if (sysMenuResult.getParentMenuId() == null) {
+                results.add(sysMenuResult);
+            }
+        }
+        return results;
+    }
+
+    /**
+     * 菜单明细
+     * @param menuId
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysMenuDTO selectMenuById(Integer menuId){
+        SysMenuDTO sysMenu = sysMenuMapper.selectMenuById(menuId);
+        return sysMenu==null?new SysMenuDTO():sysMenu;
+    }
+
+    /**
+     * 查询次级菜单列表
+     * @param menuId
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public PageResult queryMenuSecondary(Integer menuId,
+                                         Integer resourceType, Integer isEnable, String keywords,
+                                         Integer pageNum, Integer pageSize){
+        Integer offset = (pageNum - 1) * pageSize;
+        List<SysMenuDTO> sysMenuDTOS = sysMenuMapper.queryMenuSecondary(menuId,
+                resourceType, isEnable, keywords,
+                offset, pageSize);
+        Long count = sysMenuMapper.queryMenuSecondaryCount(menuId,
+                resourceType, isEnable, keywords);
+        PageResult pageResult = new PageResult();
+        pageResult.setData(sysMenuDTOS);
+        pageResult.setCount(count);
+        return pageResult;
+    }
+
+    /**
+     * 保存系统资源信息(新增、修改)
+     * @param sysMenu
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public HttpResult menuSave(SysMenu sysMenu){
+        HttpResult httpResult = null;
+        int i;
+        Integer menuId = sysMenu.getMenuId();
+        //为空判断
+        if(sysMenu.getMenuName()==null || "".equals(sysMenu.getMenuName())){
+            httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,"资源名称不可为空","资源名称不可为空");
+            return httpResult;
+        }
+        if(sysMenu.getResourceType()==null){
+            httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,"资源类型不可为空","资源类型不可为空");
+            return httpResult;
+        }
+        String  msg =null;
+        Integer msgCode = 1;
+        Long count =0L;
+        //判断 新增 或 修改
+        if (menuId == null){
+            count = sysMenuMapper.queryMenuCount(null, sysMenu.getMenuName(),null, null, null);
+            if (count>0) {
+                i = 0;
+                msg = HttpResponseParam.FAIL_ADD_DUPLICATTED_MSG;
+                msgCode = HttpResponseParam.RECORD_THE_EXISTING_CODE;
+            }else {
+                i = sysMenuMapper.menuInsert(sysMenu);
+                msg = HttpResponseParam.SUCCESS_INSERT_MSG;
+                msgCode = HttpResponseParam.SUCCESS_CODE;
+            }
+
+        } else {
+            count = sysMenuMapper.queryMenuOutSelfCount(menuId, sysMenu.getMenuName());
+            if (count>0) {
+                i = 0;
+                msg = HttpResponseParam.FAIL_UPDATE_DUPLICATTED_MSG;
+                msgCode = HttpResponseParam.RECORD_THE_EXISTING_CODE;
+            }else {
+                i = sysMenuMapper.menuUpdateByPrimaryKey(sysMenu);
+                msg = HttpResponseParam.SUCCESS_UPDATE_MSG;
+                msgCode = HttpResponseParam.SUCCESS_CODE;
+            }
+        }
+        if (i == 1){
+            httpResult = new HttpResult(msgCode,msg,"保存成功");
+        }else{
+            httpResult = new HttpResult(msgCode,msg,"保存失败");
+        }
+        return httpResult;
+    }
+
+    /**
+     * 修改启用状态
+     * @param sysMenu
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer updateEnabled(SysMenu sysMenu){
+        return sysMenuMapper.menuUpdateIsEnableByPrimaryKey(sysMenu);
+    }
+
+    /**
+     * @Description : 删除资源
+     * @Return :
+     */
+    @Override
+    public Integer deleteMenu(Integer menuId){
+        Long count = sysMenuMapper.queryMenuSecondaryCount(menuId, null, null, null);
+        if (count>0L){
+            return 2;
+        }
+        return sysMenuMapper.deleteMenu(menuId);
+    }
+
+    /**
+     * @Description : 系统资源菜单树
+     * @Return :
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public List<TreeNode> sysMenuTree(){
+        List<SysMenuDTO> sysMenuDTOS = sysMenuMapper.querySysMenuTree();
+        JSONArray jsonResult = treeRecursionDataList(sysMenuDTOS, 0);
+        List<SysMenuDTO> sysOrgTreeList = jsonResult.toJavaList(SysMenuDTO.class);
+        List<TreeNode> rootTree = new ArrayList<>();
+        TreeNode root = new TreeNode(0, null, "智慧城轨大数据管理平台", true, false,
+                false, true, 1);
+        rootTree.add(root);
+        if (CollectionUtils.isEmpty(sysMenuDTOS)) {
+            return rootTree;
+        }
+        root.setChildren(treeNodes(sysOrgTreeList));
+        return rootTree;
+    }
+
+    /**
+     * @param sysMenuTreeList
+     * @return
+     */
+    private List<TreeNode> treeNodes(List<SysMenuDTO> sysMenuTreeList) {
+        List<TreeNode> treeNodes = new ArrayList<>();
+        for (SysMenuDTO sysMenuDTO : sysMenuTreeList) {
+            TreeNode treeNode = new TreeNode(sysMenuDTO.getMenuId(), sysMenuDTO.getMenuId(), sysMenuDTO.getMenuName(),
+                    true, false, false, true, sysMenuDTO.getMenuLevel());
+            if (!CollectionUtils.isEmpty(sysMenuDTO.getChildList())) {
+                treeNode.setChildren(treeNodes(sysMenuDTO.getChildList()));
+            }
+            treeNodes.add(treeNode);
+        }
+
+        return treeNodes;
+    }
+
+
+    /**
+     * @param treeList
+     * @param parentId
+     * @return
+     */
+    public static JSONArray treeRecursionDataList(List<SysMenuDTO> treeList, int parentId) {
+        JSONArray childMenu = new JSONArray();
+        for (Object object : treeList) {
+            JSONObject jsonMenu = JSONObject.parseObject(JSON.toJSONString(object));
+            int menuId = jsonMenu.getIntValue("menuId");
+            int pid = jsonMenu.getIntValue("parentMenuId");
+            if (parentId == pid) {
+                JSONArray c_node = treeRecursionDataList(treeList, menuId);
+                jsonMenu.put("childList", c_node);
+                childMenu.add(jsonMenu);
+            }
+        }
+        return childMenu;
+    }
+
+}

+ 53 - 0
provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysOperationLogServiceImpl.java

@@ -0,0 +1,53 @@
+package com.sunwin.swismp.service.sysfunction.impl;
+
+import com.sunwin.swismp.bean.sysfunction.SysOperationLog;
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysOperationLogMapper;
+import com.sunwin.swismp.config.datasource.DataSourceType;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysOperationLogDTO;
+import com.sunwin.swismp.service.sysfunction.SysOperationLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class SysOperationLogServiceImpl implements SysOperationLogService {
+
+    @Autowired
+    private SysOperationLogMapper sysOperationLogMapper;
+
+    /**
+     * 插入操作日志
+     * @param log
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public int insertOperationLog(SysOperationLog log) {
+        return sysOperationLogMapper.insert(log);
+    }
+
+    /**
+     * 日志查询-分页
+     * @param moduleName
+     * @param operationName
+     * @param roleId
+     * @param beginOperateTime
+     * @param endOperateTime
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public PageResult querySysLogPage(String moduleName, String operationName, String roleId, String beginOperateTime,
+                                      String endOperateTime, Integer pageNum, Integer pageSize) {
+        List<SysOperationLogDTO> sysOperationLogDTOList = sysOperationLogMapper.querySysLogPage(moduleName, operationName,
+                roleId, beginOperateTime, endOperateTime, (pageNum - 1) * pageSize, pageSize);
+        Long count = sysOperationLogMapper.querySysLogPageCount(moduleName, operationName, roleId, beginOperateTime,
+                endOperateTime);
+        return new PageResult(count, sysOperationLogDTOList);
+    }
+}

+ 153 - 0
provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysOrgServiceImpl.java

@@ -0,0 +1,153 @@
+package com.sunwin.swismp.service.sysfunction.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.sunwin.swismp.bean.TreeNode;
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.config.datasource.DataSourceType;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysOrgMapper;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysOrgDTO;
+import com.sunwin.swismp.service.sysfunction.SysOrgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swismp.service.sysfunction.impl
+ * FileName: SysOrgServiceImpl
+ *
+ * @author duanmin
+ * @description
+ * @created 2/11/2022 - 5:26 PM
+ * @last Modified
+ * @history
+ */
+@Service
+public class SysOrgServiceImpl implements SysOrgService {
+    @Autowired
+    private SysOrgMapper sysOrgMapper;
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer addSysOrg(SysOrgDTO sysOrgDTO) {
+        List<SysOrgDTO> sysOrgDTOList = sysOrgMapper.querySysOrgByParentAndName(sysOrgDTO.getParentOrgId(),
+                sysOrgDTO.getOrgName());
+        if (!CollectionUtils.isEmpty(sysOrgDTOList)) {
+            return 2;
+        }
+        return sysOrgMapper.addSysOrg(sysOrgDTO);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer delSysOrg(Integer sysOrgId) {
+        List<SysOrgDTO> sysOrgDTOList = sysOrgMapper.querySysOrgByParentAndName(sysOrgId, null);
+        if (!CollectionUtils.isEmpty(sysOrgDTOList)) {
+            return 2;
+        }
+        return sysOrgMapper.delSysOrg(sysOrgId);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer editSysOrg(SysOrgDTO sysOrgDTO) {
+        List<SysOrgDTO> sysOrgDTOList = sysOrgMapper.querySysOrgByParentAndName(sysOrgDTO.getParentOrgId(),
+                sysOrgDTO.getOrgName());
+        SysOrgDTO sysOrgDTO1 = sysOrgMapper.viewSysOrg(sysOrgDTO.getOrgId().toString());
+        if (!CollectionUtils.isEmpty(sysOrgDTOList) && !sysOrgDTO.getOrgName().equals(sysOrgDTO1.getOrgName())) {
+            return 2;
+        }
+        return sysOrgMapper.editSysOrg(sysOrgDTO);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer enableSysOrg(Integer sysOrgId, Integer enabled) {
+        return sysOrgMapper.enableSysOrg(sysOrgId, enabled);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public PageResult querySysOrgPage(String parentOrgId, String orgUserNum, String isEnabled, String keywords,
+                                      String beginUpdateTime, String endUpdateTime, Integer pageNum, Integer pageSize) {
+        List<SysOrgDTO> sysOrgDTOList = sysOrgMapper.querySysOrgPage(parentOrgId, orgUserNum, isEnabled, keywords,
+                beginUpdateTime, endUpdateTime, (pageNum - 1) * pageSize, pageSize);
+        Long count = sysOrgMapper.querySysOrgPageCount(parentOrgId, orgUserNum, isEnabled, keywords, beginUpdateTime,
+                endUpdateTime);
+        return new PageResult(count, sysOrgDTOList);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public List<TreeNode> sysOrgTree() {
+        List<SysOrgDTO> sysOrgDTOS = sysOrgMapper.querySysOrgTree();
+        JSONArray jsonResult = treeRecursionDataList(sysOrgDTOS, 0);
+        List<SysOrgDTO> sysOrgTreeList = jsonResult.toJavaList(SysOrgDTO.class);
+        List<TreeNode> rootTree = new ArrayList<>();
+        TreeNode root = new TreeNode(0, null, "合肥轨道交通", true, false,
+                false, true, 1);
+        rootTree.add(root);
+        if (CollectionUtils.isEmpty(sysOrgDTOS)) {
+            return rootTree;
+        }
+        root.setChildren(treeNodes(sysOrgTreeList));
+        return rootTree;
+    }
+
+    /**
+     * @param sysOrgTreeList
+     * @return
+     */
+    private List<TreeNode> treeNodes(List<SysOrgDTO> sysOrgTreeList) {
+        List<TreeNode> treeNodes = new ArrayList<>();
+        for (SysOrgDTO sysOrgDTO : sysOrgTreeList) {
+            TreeNode treeNode = new TreeNode(sysOrgDTO.getOrgId(), sysOrgDTO.getOrgId(), sysOrgDTO.getOrgName(),
+                    true, false, false, true, sysOrgDTO.getOrgLevel());
+            if (!CollectionUtils.isEmpty(sysOrgDTO.getChildList())) {
+                treeNode.setChildren(treeNodes(sysOrgDTO.getChildList()));
+            }
+            treeNodes.add(treeNode);
+        }
+
+        return treeNodes;
+    }
+
+
+    /**
+     * @param treeList
+     * @param parentId
+     * @return
+     */
+    public static JSONArray treeRecursionDataList(List<SysOrgDTO> treeList, int parentId) {
+        JSONArray childMenu = new JSONArray();
+        for (Object object : treeList) {
+            JSONObject jsonMenu = JSONObject.parseObject(JSON.toJSONString(object));
+            int orgId = jsonMenu.getIntValue("orgId");
+            int pid = jsonMenu.getIntValue("parentOrgId");
+            if (parentId == pid) {
+                JSONArray c_node = treeRecursionDataList(treeList, orgId);
+                jsonMenu.put("childList", c_node);
+                childMenu.add(jsonMenu);
+            }
+        }
+        return childMenu;
+    }
+
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysOrgDTO viewSysOrg(String sysOrgId) {
+        List<SysOrgDTO> sysOrgDTOList = sysOrgMapper.querySysOrgByParentAndName(Integer.valueOf(sysOrgId), null);
+        SysOrgDTO sysOrgDTO = sysOrgMapper.viewSysOrg(sysOrgId);
+        sysOrgDTO.setChildOrgCount(sysOrgDTOList.size());
+        return sysOrgDTO;
+    }
+
+}

+ 163 - 0
provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysRoleMenuPermissionsServiceImpl.java

@@ -0,0 +1,163 @@
+package com.sunwin.swismp.service.sysfunction.impl;
+
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.config.datasource.DataSourceType;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysRoleMenuPermissionsMapper;
+import com.sunwin.swismp.dto.sysfunction.SysRoleMenuPermissions;
+import com.sunwin.swismp.service.sysfunction.SysRoleMenuPermissionsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 系统角色菜单权限接口实现类
+ * @Author: fengyong
+ * @CreateDate: 2019/7/12
+ * @Remark:
+ * @Version: 1.0
+ */
+@Service
+public class SysRoleMenuPermissionsServiceImpl implements SysRoleMenuPermissionsService {
+    @Autowired
+    SysRoleMenuPermissionsMapper sysRoleMenuPermissionsMapper;
+    /**
+     * @Description : 查询权限信息
+     * @param roleId
+     * @param type
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:12
+    */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public Map selectByRoleId(Integer roleId,String type) { //type : all查询全部 ; self 查询已有的
+        List<SysRoleMenuPermissions> sysRoleMenuPermissionsList=null;
+        if("all".equals(type)){
+            sysRoleMenuPermissionsList = sysRoleMenuPermissionsMapper.selectByRoleId(roleId);
+        }else if("self".equals(type)){
+            sysRoleMenuPermissionsList = sysRoleMenuPermissionsMapper.selectByRoleIdSelf(roleId);
+        }else {
+            sysRoleMenuPermissionsList = new ArrayList<>();
+        }
+        List<Integer> chooseMenue = new ArrayList();
+        List<Map> roleMenuList = new ArrayList<>();//返回结果集
+
+        //List<Object> twoMenuList = new ArrayList<>();
+        for (SysRoleMenuPermissions sysRoleMenuPermissions:sysRoleMenuPermissionsList){
+            //数据投入容器标志
+            boolean check =false;
+            /**
+             * 遍历容器
+             */
+            for (Map onelistMap:roleMenuList ){
+               //找到所在一级菜单
+                Integer oneId = (Integer) onelistMap.get("id");
+                if (oneId==sysRoleMenuPermissions.getOneMenuId()){
+                    if (sysRoleMenuPermissions.getTwoMenuId()!=null){
+                        //找到二级菜单
+                        List<Map> twoMenuList = (List<Map>) onelistMap.get("children");
+                        if (twoMenuList==null) twoMenuList = new ArrayList<>();
+                        for (Map twolistMap:twoMenuList){
+                            Integer twoId = (Integer) twolistMap.get("id");
+                            if (twoId==sysRoleMenuPermissions.getTwoMenuId()){
+                                if (sysRoleMenuPermissions.getThreeMenuId()!=null){
+                                    //找到三级菜单
+                                    List<Map> threeMenuList = (List<Map>) twolistMap.get("children");
+                                    //投入数据
+                                    if (threeMenuList==null) threeMenuList = new ArrayList<>();
+                                    Map map3 = new HashMap();
+                                    map3.put("id",sysRoleMenuPermissions.getThreeMenuId());
+                                    map3.put("title",sysRoleMenuPermissions.getThreeMenuName());
+                                    map3.put("checked", sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1);
+                                    map3.put("expand", sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1);
+                                    if (sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1)
+                                        chooseMenue.add(sysRoleMenuPermissions.getThreeMenuId());
+                                    threeMenuList.add(map3);
+                                    twolistMap.put("checked",(boolean)twolistMap.get("checked")?map3.get("checked"):twolistMap.get("checked"));//父节点半勾选处理
+                                    check = true;
+                                }
+                                onelistMap.put("checked",(boolean)onelistMap.get("checked")?twolistMap.get("checked"):onelistMap.get("checked"));//父节点半勾选处理
+                            }
+                        }
+                        if (!check){
+                            //未找到二级菜单列表投入数据
+                            Map map2 = new HashMap();
+                            map2.put("id",sysRoleMenuPermissions.getTwoMenuId());
+                            map2.put("title",sysRoleMenuPermissions.getTwoMenuName());
+                            map2.put("checked", sysRoleMenuPermissions.getTwoIsShown() != null && sysRoleMenuPermissions.getTwoIsShown() == 1);
+                            map2.put("expand", sysRoleMenuPermissions.getTwoIsShown() != null && sysRoleMenuPermissions.getTwoIsShown() == 1);
+                            if (sysRoleMenuPermissions.getTwoIsShown() != null && sysRoleMenuPermissions.getTwoIsShown() == 1)
+                                chooseMenue.add(sysRoleMenuPermissions.getTwoMenuId());
+                            List<Map> threelist = new ArrayList<>();
+                            if (sysRoleMenuPermissions.getThreeMenuId()!=null){
+                                Map map3 = new HashMap();
+                                map3.put("id",sysRoleMenuPermissions.getThreeMenuId());
+                                map3.put("title",sysRoleMenuPermissions.getThreeMenuName());
+                                map3.put("checked", sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1);
+                                map3.put("expand", sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1);
+                                if (sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1)
+                                    chooseMenue.add(sysRoleMenuPermissions.getThreeMenuId());
+                                map2.put("checked",(boolean)map2.get("checked")?map3.get("checked"):map2.get("checked"));//父节点半勾选处理
+                                threelist.add(map3);
+                            }
+                            map2.put("children",threelist);
+                            twoMenuList.add(map2);
+                            onelistMap.put("checked",(boolean)onelistMap.get("checked")?map2.get("checked"):onelistMap.get("checked"));//父节点半勾选处理
+                            onelistMap.put("children",twoMenuList);
+                            check = true;
+                        }
+
+                    }
+                }
+            }
+            if (!check){
+              //初次投入数据
+                Map map1 = new HashMap();
+                map1.put("id",sysRoleMenuPermissions.getOneMenuId());
+                map1.put("title",sysRoleMenuPermissions.getOneMenuName());
+                map1.put("checked", sysRoleMenuPermissions.getOneIsShown() != null && sysRoleMenuPermissions.getOneIsShown() == 1);
+                map1.put("expand", sysRoleMenuPermissions.getOneIsShown() != null && sysRoleMenuPermissions.getOneIsShown() == 1);
+                if (sysRoleMenuPermissions.getOneIsShown() != null && sysRoleMenuPermissions.getOneIsShown()==1)
+                    chooseMenue.add(sysRoleMenuPermissions.getOneMenuId());
+                List<Map> twolist = new ArrayList<>();
+                boolean checkTemp = false;
+                Map map2 = new HashMap();
+                if (sysRoleMenuPermissions.getTwoMenuId()!=null){
+                    map2.put("id",sysRoleMenuPermissions.getTwoMenuId());
+                    map2.put("title",sysRoleMenuPermissions.getTwoMenuName());
+                    map2.put("checked", sysRoleMenuPermissions.getTwoIsShown() != null && sysRoleMenuPermissions.getTwoIsShown() == 1);
+                    map2.put("expand", sysRoleMenuPermissions.getTwoIsShown() != null && sysRoleMenuPermissions.getTwoIsShown() == 1);
+                    if (sysRoleMenuPermissions.getTwoIsShown() != null && sysRoleMenuPermissions.getTwoIsShown() == 1)
+                        chooseMenue.add(sysRoleMenuPermissions.getTwoMenuId());
+                    List<Map> threelist = new ArrayList<>();
+                    if (sysRoleMenuPermissions.getThreeMenuId()!=null){
+                        Map map3 = new HashMap();
+                        map3.put("id",sysRoleMenuPermissions.getThreeMenuId());
+                        map3.put("title",sysRoleMenuPermissions.getThreeMenuName());
+                        map3.put("checked", sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1);
+                        map3.put("expand", sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1);
+                        if (sysRoleMenuPermissions.getThreeIsShown() != null && sysRoleMenuPermissions.getThreeIsShown() == 1)
+                            chooseMenue.add(sysRoleMenuPermissions.getThreeMenuId());
+                        threelist.add(map3);
+                        map2.put("checked",(boolean)map2.get("checked")?map3.get("checked"):map2.get("checked"));//父节点半勾选处理
+                    }
+                    map1.put("checked",(boolean)map1.get("checked")?map2.get("checked"):map1.get("checked"));//父节点半勾选处理
+                    map2.put("children",threelist);
+                    twolist.add(map2);
+                }
+                map1.put("children",twolist);
+                roleMenuList.add(map1);
+                check = true;
+            }
+
+        }
+        Map map = new HashMap();
+        map.put("chooseMenu",chooseMenue);
+        map.put("menuList",roleMenuList);
+        return map;
+    }
+}

+ 218 - 0
provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysRoleServiceImpl.java

@@ -0,0 +1,218 @@
+package com.sunwin.swismp.service.sysfunction.impl;
+
+import com.sunwin.swismp.bean.sysfunction.SysRole;
+import com.sunwin.swismp.bean.sysfunction.SysRoleMenu;
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.config.datasource.DataSourceType;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysRoleMapper;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysRoleMenuMapper;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.sysfunction.SysRoleDTO;
+import com.sunwin.swismp.service.sysfunction.SysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 角色信息服务
+ */
+@Service
+public class SysRoleServiceImpl implements SysRoleService {
+
+    @Autowired
+    private SysRoleMapper sysRoleMapper;
+
+    @Autowired
+    private SysRoleMenuMapper sysRoleMenuMapper;
+
+    /**
+     * 删除
+     * @param roleId
+     * @return
+     */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public int deleteRoleByRoleId(Integer roleId) {
+        Integer i = sysRoleMapper.selectRoleUserNum(roleId);
+        if (i>0) return 2;
+        return sysRoleMapper.deleteByPrimaryKey(roleId);
+    }
+
+    /**
+     * 查询所有角色
+     * @return
+     */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public List<SysRole> selectAll() {
+        return sysRoleMapper.selectAll();
+    }
+
+
+    /**
+     *  分页-条件查询
+     * @param roleName
+     * @param roleCode
+     * @param isEnable
+     * @param page
+     * @param size
+     * @return
+     */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public List<SysRoleDTO> selectPage(String roleName, String roleCode, Integer isEnable, String keywords, Integer page, Integer size) {
+        Integer offset = (page - 1) * size;
+        return sysRoleMapper.selectPage(roleName,roleCode,isEnable,keywords,offset,size);
+    }
+    /**
+     * @Description : 通过roleCode 来判断 是否 需要查询所有的role列表
+     * @param roleCode
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/9/25 11:08
+    */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public List<SysRole> selectAllByRoleCode(String excludeRoleCode) {
+        if(excludeRoleCode.equals("10001")){
+            return sysRoleMapper.selectAll();
+        } else {
+            return sysRoleMapper.selectExcludeRoleCode(excludeRoleCode);
+        }
+    }
+
+    /**
+     * @Description : 查询分页角色信息
+     * @param roleName
+     * @param roleCode
+     * @param isEnable
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:15
+    */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public Integer selectPageCount(String roleName,String roleCode,Integer isEnable,String keywords) {
+        return sysRoleMapper.selectPageCount(roleName,roleCode,isEnable,keywords);
+    }
+
+    /**
+     * 保存角色信息(新增、修改)
+     * @param sysRole
+     * @return
+     */
+    @Override
+    @DS(DataSourceType.postgreDS)
+    public HttpResult roleSave(SysRole sysRole){
+        HttpResult httpResult = null;
+        int i;
+        Integer roleId = sysRole.getRoleId();
+        //为空判断
+        if(sysRole.getRoleName()==null || "".equals(sysRole.getRoleName())){
+            httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,"角色名不可为空","角色名不可为空");
+            return httpResult;
+        }
+       String  msg =null;
+        //判断 新增 或 修改
+        if (roleId == null){
+            List<Map> nameMap = sysRoleMapper.checkRoleName(sysRole.getRoleName(),null);
+            SysRole sysRole2 = sysRoleMapper.selectByRoleCode(sysRole.getRoleCode());
+            if (nameMap != null && nameMap.size()>0){
+                Map nameExisted = nameMap.get(0);
+                switch (String.valueOf(nameExisted.get("type_existed"))){
+                    case "role":
+                        httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.ROLE_NAME_ERROR_MSG);
+                        break;
+                    case "user":
+                        httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.USER_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                    case "org":
+                        httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.ORG_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+              }
+                return httpResult;
+            }
+            if(sysRole2!=null){
+                httpResult = new HttpResult(HttpResponseParam.ROLE_CODE_ERROR_CODE,HttpResponseParam.ROLE_CODE_ERROR_MSG,HttpResponseParam.ROLE_CODE_ERROR_MSG);
+                return httpResult;
+            }
+            sysRole.setIsEnable(0);
+            sysRole.setCreateTime(new Date());
+            sysRole.setUpdateTime(new Date());
+            i = sysRoleMapper.insert(sysRole);
+            //自动设置角色代码
+            SysRole sysRoleNew = sysRoleMapper.selectByRoleName(sysRole.getRoleName());
+            sysRoleNew.setRoleCode(String.format("%04d", sysRoleNew.getRoleId()));
+            sysRoleMapper.updateByPrimaryKey(sysRoleNew);
+            msg = HttpResponseParam.SUCCESS_INSERT_MSG;
+        }else{
+            SysRole sysRole3 = sysRoleMapper.selectByRoleNameOutSelf(sysRole.getRoleName(),roleId);
+            SysRole sysRole4 = sysRoleMapper.selectByRoleCodeOutSelf(sysRole.getRoleCode(), roleId);
+            if (sysRole3!=null){
+                httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.ROLE_NAME_ERROR_MSG,HttpResponseParam.ROLE_NAME_ERROR_MSG);
+                return httpResult;
+            }
+            if(sysRole4!=null){
+                httpResult = new HttpResult(HttpResponseParam.ROLE_CODE_ERROR_CODE,HttpResponseParam.ROLE_CODE_ERROR_MSG,HttpResponseParam.ROLE_CODE_ERROR_MSG);
+                return httpResult;
+            }
+            List<Map> nameMap = sysRoleMapper.checkRoleName(sysRole.getRoleName(),roleId);
+            if (nameMap != null && nameMap.size()>0){
+                Map nameExisted = nameMap.get(0);
+                switch (String.valueOf(nameExisted.get("type_existed"))){
+                    case "role":
+                        httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.ROLE_NAME_ERROR_MSG);
+                        break;
+                    case "user":
+                        httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.USER_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                    case "org":
+                        httpResult = new HttpResult(HttpResponseParam.ROLE_NAME_ERROR_CODE,HttpResponseParam.ORG_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                }
+                return httpResult;
+            }
+            sysRole.setUpdateTime(new Date());
+            i = sysRoleMapper.updateByPrimaryKey(sysRole);
+            msg = HttpResponseParam.SUCCESS_UPDATE_MSG;
+        }
+        if (i == 1){
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE,msg,"保存成功");
+        }else{
+            httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE,HttpResponseParam.SUCCESS_MSG,"保存失败");
+        }
+        return httpResult;
+    }
+
+    /**
+     * 修改角色菜单对应关系
+     * @param roleId
+     * @param menuIds
+     * @return
+     */
+    @Override
+    //@Transactional
+    @DS(DataSourceType.postgreDS)
+    public boolean updateRoleMenu(Integer roleId,List<Integer> menuIds) {
+        if (menuIds != null) {
+            List<SysRoleMenu> sysRoleMenus = new ArrayList<>();
+            for (Integer menuId : menuIds) {
+                sysRoleMenus.add(new SysRoleMenu(roleId, menuId));
+            }
+            //先删除该角色对应的菜单
+            sysRoleMenuMapper.deleteByRoleId(roleId);
+            if (sysRoleMenus.size()>0){
+                //插入新的对应关系
+                sysRoleMenuMapper.batchInsert(sysRoleMenus);
+            }
+            return true;
+        }
+        return false;
+    }
+
+}

+ 593 - 0
provider/src/main/java/com/sunwin/swismp/service/sysfunction/impl/SysUserServiceImpl.java

@@ -0,0 +1,593 @@
+package com.sunwin.swismp.service.sysfunction.impl;
+
+import com.alibaba.dubbo.config.annotation.Service;
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+import com.sunwin.swismp.config.annotation.DS;
+import com.sunwin.swismp.config.datasource.DataSourceType;
+import com.sunwin.swismp.constant.HttpResponseParam;
+import com.sunwin.swismp.dao.sysfunction.mapper.SysUserMapper;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.*;
+import com.sunwin.swismp.service.sysfunction.SysMenuService;
+import com.sunwin.swismp.service.sysfunction.SysUserService;
+import com.sunwin.swismp.util.Md5Util;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.regex.Pattern;
+
+/**
+ * 用户信息服务
+ */
+@Service
+public class SysUserServiceImpl implements SysUserService {
+
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
+    @Autowired
+    private SysMenuService sysMenuService;
+    @Autowired
+    public RedisTemplate<String, String> redisTemplate;
+
+
+    private DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+    private ReentrantLock lock = new ReentrantLock();
+    private String checkIpFailCount = "swismp_failCount-";
+    private String checkIpExpireTime = "swismp_failExpireTime-";
+
+
+    /**
+     * 验证码存储到redis
+     *
+     * @param key
+     * @param value
+     * @param codeTimeOut 验证码过期时间,分钟
+     */
+    @Override
+    public void setCodeRedis(String key, String value, Integer codeTimeOut) {
+        redisTemplate.opsForValue().set(key, value, codeTimeOut, TimeUnit.MINUTES);
+    }
+
+    /**
+     * 根据用户名查询用户内容
+     *
+     * @param userName add by fengyong
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysUser queryUserByName(String userName) {
+        if (userName != null && !userName.equals("")) {
+            return sysUserMapper.selectByUserName(userName).get(0);
+        }
+        return null;
+    }
+
+    /**
+     * @param userId
+     * @Description : 根据id查询用户内容
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:46
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysUser queryUserById(Integer userId) {
+        return sysUserMapper.selectByPrimaryKey(userId);
+    }
+
+    /**
+     * @param telephone
+     * @Description : 根据电话查询用户内容
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/10 9:47
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysUser queryUserByTelephone(String telephone) {
+        String pattern = "1[0-9]{10}"; //1开头,11位手机号
+        if (telephone != null && !telephone.equals("") && Pattern.matches(pattern, telephone)) {
+            return sysUserMapper.selectByTelephone(telephone);
+        }
+        return null;
+    }
+
+    /**
+     * 添加用户
+     *
+     * @param user
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public HttpResult addUser(SysUser user) {
+        HttpResult httpResult = null;
+        String userName = user.getUserName();
+        String passwd = user.getUserPwd();
+        if (userName != null && !userName.trim().equals("") && passwd != null && !passwd.trim().equals("")) {
+            //判断更新的用户名是否存在 或者是否与 部门 权限名重名
+            List<SysUser> users = sysUserMapper.selectUserRoleOrgByUserName(userName);
+            if (users != null && users.size() > 0) {
+                SysUser userExisted = users.get(0);
+                switch (userExisted.getRealName()) {
+                    case "user":
+                        httpResult = new HttpResult(HttpResponseParam.NAME_EXISTED_CODE, HttpResponseParam.NAME_EXISTED_MSG);
+                        break;
+                    case "role":
+                        httpResult = new HttpResult(HttpResponseParam.NAME_EXISTED_CODE, HttpResponseParam.ROLE_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                    case "org":
+                        httpResult = new HttpResult(HttpResponseParam.NAME_EXISTED_CODE, HttpResponseParam.ORG_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                }
+            } else {
+                //插入数据
+                sysUserMapper.insert(user);
+                httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_INSERT_MSG);
+            }
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.NAME_PASSWD_ERROR_CODE, HttpResponseParam.NAME_PASSWD_ERROR_MSG);
+        }
+        return httpResult;
+    }
+
+    /**
+     * @Description : 返回部门 用户  角色 桑吉图
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/5/21 17:23
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Map queryUserOrgRoleView() {
+        List<SysUserManage> orgUserRelations = sysUserMapper.queryOrgUserRelation();
+        List<SysUserManage> userRoleRelations = sysUserMapper.queryUserRoleRelation();
+        LinkedHashMap<String, Integer> users = new LinkedHashMap();
+        LinkedHashMap<String, Integer> orgs = new LinkedHashMap();
+        LinkedHashMap<String, Integer> roles = new LinkedHashMap();
+        List<Link> links = new ArrayList<>();
+        List<Node> nodes = new ArrayList<>();
+        /**
+         * 创建 部门节点 以及 部门和用户关系
+         */
+        if (orgUserRelations != null && orgUserRelations.size() > 0) {
+            for (SysUserManage orgUserMem : orgUserRelations) {
+                orgs.put(orgUserMem.getOrgName(), orgs.getOrDefault(orgUserMem.getOrgName(), 0) + 1);
+                Link link = new Link(orgUserMem.getOrgName(), orgUserMem.getUserName(), 1);
+                links.add(link);
+            }
+            for (Map.Entry<String, Integer> entry : orgs.entrySet()) {
+                nodes.add(new Node(entry.getKey(), entry.getValue()));
+            }
+        }
+        /**
+         * 创建 用户节点  权限节点  以及用户与权限的关系
+         */
+        if (userRoleRelations != null && userRoleRelations.size() > 0) {
+            for (SysUserManage userRoleMem : userRoleRelations) {
+                users.put(userRoleMem.getUserName(), users.getOrDefault(userRoleMem.getUserName(), 0) + 1);
+                roles.put(userRoleMem.getRoleName(), roles.getOrDefault(userRoleMem.getRoleName(), 0) + 1);
+                Link link = new Link(userRoleMem.getUserName(), userRoleMem.getRoleName(), 1);
+                links.add(link);
+            }
+            for (Map.Entry<String, Integer> entry : users.entrySet()) {
+                nodes.add(new Node(entry.getKey(), entry.getValue()));
+            }
+            for (Map.Entry<String, Integer> entry : roles.entrySet()) {
+                nodes.add(new Node(entry.getKey(), entry.getValue()));
+            }
+        }
+        Map map = new LinkedHashMap();
+        if (nodes != null && nodes.size() > 0 && links != null && links.size() > 0) {
+            map.put("nodes", nodes);
+            map.put("links", links);
+        }
+        return map;
+    }
+
+    /**
+     * 登陆
+     *
+     * @param userName
+     * @param userPwd
+     * @param vCode    手机验证码
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Map login(String userName, String userPwd, String vCode) {
+        HttpResult httpResult = null;
+        Map map = new HashMap();
+        if (userName != null && !userName.trim().equals("") && userPwd != null && !userPwd.trim().equals("")) {
+            SysUser sysUser = sysUserMapper.selectByUserNameWithRoleCode(userName);
+            Map userEnabled = sysUserMapper.queryUserEnabled(userName);
+            //部门是否有权限 注释掉在这些会有空指针的异常
+            //Object orgEnabled = userEnabled.get("orgEnabled");
+            //角色是否有权限
+            //Object roleEnabled = userEnabled.get("roleEnabled");
+            if (sysUser == null) { //用户不存在
+                httpResult = new HttpResult(HttpResponseParam.LOGIN_USERNAME_CODE, HttpResponseParam.LOGIN_USERNAME_MSG);
+
+            } else if (!Md5Util.processUser(userPwd, sysUser, Md5Util.TimeMd5Type.DATE)) { //密码是否一致
+                httpResult = new HttpResult(HttpResponseParam.LOGIN_PASSWORD_CODE, HttpResponseParam.LOGIN_PASSWORD_MSG);
+
+            } else if (sysUser.getIsEnable() == null || sysUser.getIsEnable() != 1) { //账户是否注销
+                httpResult = new HttpResult(HttpResponseParam.LOGIN_ISENABLE_CODE, HttpResponseParam.LOGIN_ISENABLE_MSG);
+            } else if (userEnabled == null || userEnabled.get("orgenabled") == null || Integer.valueOf(String.valueOf(userEnabled.get("orgenabled"))) != 1) {//部门是否有权限
+                httpResult = new HttpResult(HttpResponseParam.ORG_ISENABLE_CODE, HttpResponseParam.ORG_ISENABLE_MSG);
+            } else if (userEnabled == null || userEnabled.get("roleenabled") == null || Integer.valueOf(String.valueOf(userEnabled.get("roleenabled"))) != 1) {//角色是否有权限
+                httpResult = new HttpResult(HttpResponseParam.ROLE_ISENABLE_CODE, HttpResponseParam.ROLE_ISENABLE_MSG);
+                //TODO 验证码暂时不处理,暂时注释
+//            } else if(!redisTemplate.hasKey("swurt_login_telephone_"+sysUser.getMobilePhone())){
+//                //是否获取验证码 是否正确 add by fengyong
+//                httpResult = new HttpResult(HttpResponseParam.VERIFICATION_CODE_GET_CODE,HttpResponseParam.VERIFICATION_CODE_GET_MSG);
+//            } else if(vCode == null ||
+//                    !redisTemplate.hasKey("swurt_login_telephone_"+sysUser.getMobilePhone()) ||
+//                    !(redisTemplate.opsForValue().get("swurt_login_telephone_"+sysUser.getMobilePhone())).equals(vCode)){
+//                //手机验证码 是否正确 add by fengyong
+//                httpResult = new HttpResult(HttpResponseParam.VERIFICATION_CODE_ISENABLE_CODE,HttpResponseParam.VERIFICATION_CODE_ISENABLE_MSG);
+            } else {
+                List<SysMenuResult> list = sysMenuService.selectByUserId(sysUser.getUserId());
+                LoginResult loginResult = new LoginResult(sysUser.getUserId(), list);
+                httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_LOG_MSG, loginResult); //登录成功,返回菜单列表
+                map.put("u_feature", sysUser.getUserId());
+                map.put("org_feature", sysUser.getOrgId());
+                map.put("role_feature", sysUser.getRoleCode());
+                map.put("role_name", sysUser.getRoleName());
+            }
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.FAIL_CODE, HttpResponseParam.FAIL_FAIL_MSG);
+        }
+        map.put("result", httpResult);
+        return map;
+    }
+
+    /**
+     * @param username
+     * @return
+     * @Description : 记录用户连续非法登录次数
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/9/27 8:34
+     */
+    @Override
+    public Map<String, String> updateFailCount(String username) {
+        Map<String, String> countRemain = new HashMap<String, String>();
+        Boolean countUsed = false;
+        try {
+            lock.lock();
+            if (lock(username)) {
+                countUsed = true;
+            } else {
+                Long size = redisTemplate.opsForList().size(checkIpFailCount + username);
+                if (size >= 4) {
+                    redisTemplate.opsForValue().set(checkIpExpireTime + username, String.valueOf(System.currentTimeMillis()), 30, TimeUnit.MINUTES);
+                    redisTemplate.delete(checkIpFailCount + username);
+                    countUsed = true;
+                } else {
+                    redisTemplate.opsForList().rightPush(checkIpFailCount + username, "1");
+                    //连续登录检测只设置一段分钟
+                    if (size == 0) {
+                        redisTemplate.expire(checkIpFailCount + username, 30, TimeUnit.MINUTES);
+                    }
+                    countRemain.put("countRemain", String.valueOf(4 - size));
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            lock.unlock();
+        }
+        countRemain.put("locakedStart", countUsed.toString());
+        return countRemain;
+    }
+
+    /**
+     * @param username
+     * @Description : 检查用户名 是否是锁定状态
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/9/27 8:33
+     */
+    @Override
+    public Boolean lock(String username) {
+        Boolean countUsed = false;
+        String expire = redisTemplate.opsForValue().get(checkIpExpireTime + username);
+        if (expire != null) {
+            countUsed = true;
+        }
+        return countUsed;
+    }
+
+    /**
+     * @param userName
+     * @Description : 对用户锁定状态解锁
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/9/27 8:33
+     */
+    @Override
+    public void unlock(String userName) {
+        redisTemplate.delete(checkIpFailCount + userName);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer addSysUser(SysUserDTO sysUserDTO) {
+        List<SysUserDTO> sysUserDTOList = sysUserMapper.querySysUserByName(sysUserDTO.getUserName());
+        String loginTimeByUserName = sysUserMapper.queryLastLoginTimeByUserName(sysUserDTO.getUserName());
+        if (!CollectionUtils.isEmpty(sysUserDTOList) || !StringUtils.isEmpty(loginTimeByUserName)) {
+            return 2;
+        }
+        return sysUserMapper.insert(sysUserDTO);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public PageResult querySysUserPage(Integer orgId, String orgType, String roleId, String realName, String isEnabled,
+                                       String userName, String beginUpdateTime, String endUpdateTime, Integer pageNum,
+                                       Integer pageSize) {
+        List<SysUserDTO> sysUserDTOList = sysUserMapper.querySysUserPage(orgType, orgId, roleId, realName, isEnabled,
+                userName, beginUpdateTime, endUpdateTime, (pageNum - 1) * pageSize, pageSize);
+        Long count = sysUserMapper.querySysUserPageCount(orgType, orgId, roleId, realName, isEnabled, userName,
+                beginUpdateTime, endUpdateTime);
+        return new PageResult(count, sysUserDTOList);
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysUserDTO userView(Integer userId) {
+        SysUserDTO sysUserDTO = sysUserMapper.queryUserById(userId);
+        String lastLoginTime = sysUserMapper.queryLastLoginTimeByUserName(sysUserDTO.getUserName());
+        sysUserDTO.setLastLoginTime(lastLoginTime);
+        return sysUserDTO;
+    }
+
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer editUser(SysUser user) {
+        SysUserDTO sysUserDTO = sysUserMapper.queryUserById(user.getUserId());
+        List<SysUserDTO> sysUserDTOList = sysUserMapper.querySysUserByName(user.getUserName());
+        String loginTimeByUserName = sysUserMapper.queryLastLoginTimeByUserName(user.getUserName());
+        //第一种情况是啥都没改,点击编辑按钮
+
+        //第二种情况是改的用户id被之前删除过,有过操作日志,这种不可以修改
+        if (!user.getUserName().equals(sysUserDTO.getUserName())
+                && (!CollectionUtils.isEmpty(sysUserDTOList) || !StringUtils.isEmpty(loginTimeByUserName))) {
+            return 2;
+        }
+        return sysUserMapper.updateByPrimaryKey(user);
+    }
+
+    /**
+     * 更新用户信息
+     *
+     * @param user
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public HttpResult updateUser(SysUser user) {
+        HttpResult httpResult = null;
+        String userName = user.getUserName();
+        Integer userId = user.getUserId();
+        if (userName != null && !userName.equals("") && userId != null && userId > -1) {
+            //判断更新的用户名 是否与 部门 权限名重名
+            List<SysUser> users = sysUserMapper.selectRoleOrgByUserName(userName, userId);
+            if (users != null && users.size() > 0) {
+                SysUser userExisted = users.get(0);
+                switch (userExisted.getRealName()) {
+                    case "role":
+                        httpResult = new HttpResult(HttpResponseParam.NAME_EXISTED_CODE, HttpResponseParam.ROLE_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                    case "org":
+                        httpResult = new HttpResult(HttpResponseParam.NAME_EXISTED_CODE, HttpResponseParam.ORG_NAME_CONFLICT_WITH_NAME_MSG);
+                        break;
+                }
+            } else {
+                SysUser exitUser = sysUserMapper.selectByPrimaryKey(user.getUserId());
+                if (exitUser != null) {
+                    exitUser.setUserName(user.getUserName());
+                    exitUser.setMobilePhone(user.getMobilePhone());
+                    exitUser.setUserMail(user.getUserMail());
+                    exitUser.setOrgId(user.getOrgId());
+                    exitUser.setRoleId(user.getRoleId());
+                    exitUser.setUpdateTime(new Date());
+                    sysUserMapper.updateByPrimaryKey(exitUser);
+                    httpResult = new HttpResult(HttpResponseParam.SUCCESS_CODE, HttpResponseParam.SUCCESS_UPDATE_MSG);
+                } else {
+                    httpResult = new HttpResult(HttpResponseParam.LOGIN_USERNAME_CODE, HttpResponseParam.LOGIN_USERNAME_MSG);
+                }
+            }
+        } else {
+            httpResult = new HttpResult(HttpResponseParam.NAME_PASSWD_ERROR_CODE, HttpResponseParam.NAME_PASSWD_ERROR_MSG);
+        }
+        return httpResult;
+    }
+
+    /**
+     * 更新用户密码
+     *
+     * @param userId
+     * @param newPwd
+     * @param oldPwd
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public int updatePwd(Integer userId, String newPwd, String oldPwd) {
+        SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId);
+        if (sysUser != null && Md5Util.processUserId(oldPwd, sysUser, Md5Util.TimeMd5Type.DATE)) { //如果原密码一致执行更新
+            return sysUserMapper.updatePwd(userId, newPwd);
+        }
+        return 0;
+    }
+
+    /**
+     * 重置用户密码
+     *
+     * @param userId
+     * @param newPwd
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public int resetPwd(Integer userId, String newPwd) {
+        SysUser sysUser = sysUserMapper.selectByPrimaryKey(userId);
+        if (sysUser != null) { //如果原密码一致执行更新
+            return sysUserMapper.updatePwd(userId, newPwd);
+        }
+        return 0;
+    }
+
+    /**
+     * 用户修改电话号码
+     *
+     * @param newTelephone
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public boolean updateTelephone(Integer userId, String newTelephone) {
+        //TODO: 暂时不用验证码
+//     public boolean updateTelephone(Integer userId, String newTelephone, String newCode) {
+//        String code2 = redisTemplate.opsForValue().get("telephone:" + newTelephone);
+//        if (!code2.equals(newCode)) {
+//            return false;
+//        }
+        SysUser sysUser = sysUserMapper.selectByTelephone(newTelephone); //验证新号码是否已有其他用户注册
+        if (sysUser != null && sysUser.getUserId() != userId) {
+            return false;
+        }
+        int i = sysUserMapper.updateTelephoneByUserId(userId, newTelephone);
+        return i > 0;
+    }
+
+    /**
+     * 用户修改邮箱
+     *
+     * @param userId
+     * @param email
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public boolean updateEmail(Integer userId, String email) {
+        int i = sysUserMapper.updateEmailByUserId(userId, email);
+        return i == 1;
+    }
+
+    /**
+     * 删除用户
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public int deleteUser(Integer userId) {
+        return sysUserMapper.deleteByPrimaryKey(userId);
+    }
+
+    /**
+     * 注销,暂停用户
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public int logoff(Integer userId) {
+        return sysUserMapper.logoff(userId);
+    }
+
+    /**
+     * 启用用户
+     *
+     * @param userId
+     * @param enabled
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public int enableUser(Integer userId, Integer enabled) {
+        return sysUserMapper.enableUser(userId, enabled);
+    }
+
+    /**
+     * 查询所有系统用户管理信息
+     *
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public List<SysUserManage> selectAllUserManage(String param, Integer pageNo, Integer pageSize, Integer orgId) {
+        return sysUserMapper.selectAllUserManage(param, pageNo, pageSize, orgId);
+    }
+
+    /**
+     * 查询指定用户管理信息
+     *
+     * @return
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public SysUserManage selectUserManageById(Integer userId) {
+        return sysUserMapper.selectUserManageById(userId);
+    }
+
+    /**
+     * @param userName 名字
+     * @param phone    电话
+     * @param email    邮箱
+     * @param pageNo   第几页
+     * @param pageSize 每页条数
+     * @Description : 多条件查询用户信息
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/9 17:14
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public List<SysUserManage> selectUserManageByParams(String userName, String phone, String email, Integer pageNo, Integer pageSize, Integer orgId) {
+        return sysUserMapper.selectUserManageByParams(userName, phone, email, pageNo, pageSize, orgId);
+    }
+
+    /**
+     * @param userName
+     * @param phone
+     * @param email
+     * @Description : 根据用户姓名 手机号  邮箱 返回用户编号
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:16
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer selectUserManageByParamsCount(String userName, String phone, String email, Integer orgId) {
+        return sysUserMapper.selectUserManageByParamsCount(userName, phone, email, orgId);
+    }
+
+    /**
+     * @param param
+     * @Description : 查询用户所有信息
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:17
+     */
+    @Override
+    @DS(value = DataSourceType.postgreDS)
+    public Integer selectAllUserManageCount(String param, Integer orgId) {
+        return sysUserMapper.selectAllUserManageCount(param, orgId);
+    }
+}

+ 37 - 0
provider/src/main/resources/application-dev.properties

@@ -0,0 +1,37 @@
+server.port=8084
+server.tomcat.uri-encoding=utf-8
+
+#logging.level.root=debug
+
+#redis
+spring.redis.host=192.168.20.58
+spring.redis.port=6379
+spring.redis.password=root
+spring.redis.jedis.pool.max-idle=8
+spring.redis.jedis.pool.min-idle=0
+spring.redis.jedis.pool.max-active=8
+spring.redis.jedis.pool.max-wait=-1ms
+
+
+#mybatis\u914D\u7F6E
+mybatis.mapper-locations=classpath:mapping/*.xml,classpath:mapping/*/*.xml
+mybatis.type-aliases-package=com.sunwin.swismp.bean,com.sunwin.swismp.dto
+mybatis.configuration.map-underscore-to-camel-case=true
+mybatis.configuration.default-statement-timeout=30
+
+#\u5B9A\u65F6\u4EFB\u52A1\u7EBF\u7A0B\u6C60\u914D\u7F6E
+scheduleThreadPoll.corePoolSize=10
+
+
+#zookeeper\u5E73\u53F0\u7EF4\u62A4\u914D\u7F6E\u53C2\u6570
+zk.maintain.path=/dubbo/application/swismp
+zk.maintain.properties.new.file=application_new.properties
+zk.maintain.properties.from.jar=application-dev.properties
+zk.maintain.servers=192.168.20.65:2181,192.168.20.66:2181,192.168.20.67:2181
+
+
+#postgresql \u76F8\u5173\u914D\u7F6E
+spring.datasource.postgresql.url=jdbc:postgresql://192.168.20.72:5432/ismpdb
+spring.datasource.postgresql.username=postgres
+spring.datasource.postgresql.password=sw12345
+spring.datasource.postgresql.driver-class-name=org.postgresql.Driver

+ 1 - 0
provider/src/main/resources/application.properties

@@ -0,0 +1 @@
+spring.profiles.active=dev

+ 41 - 0
provider/src/main/resources/dubbo-provider.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+    http://www.springframework.org/schema/beans/spring-beans.xsd
+    http://code.alibabatech.com/schema/dubbo
+    http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
+    <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
+    <dubbo:application name="swismp-provider"/>
+
+    <!-- zookeeper作为注册中心 -->
+    <!--20开发环境-->
+    <dubbo:registry protocol="zookeeper"
+                    address="zookeeper://192.168.20.65:2181?backup=192.168.20.66:2181,192.168.20.67:2181" group="swismp"/>
+
+    <!-- 用dubbo协议在20880端口暴露服务 -->
+    <!--payload : 1M=1048576-->
+    <dubbo:protocol name="dubbo" port="20884" />
+    <dubbo:monitor protocol="registry"/>
+    <dubbo:provider filter="monitor" group="dubbo"/>
+
+    <!-- 生成远程服务代理 -->
+    <!-- 系统功能模块 -->
+    <dubbo:service ref="sysOperationLogService" interface="com.sunwin.swismp.service.sysfunction.SysOperationLogService"/>
+    <dubbo:service ref="sysUserService" interface="com.sunwin.swismp.service.sysfunction.SysUserService"/>
+    <dubbo:service ref="sysMenuService" interface="com.sunwin.swismp.service.sysfunction.SysMenuService"/>
+    <dubbo:service ref="sysOrgService" interface="com.sunwin.swismp.service.sysfunction.SysOrgService"/>
+    <dubbo:service ref="sysRoleService" interface="com.sunwin.swismp.service.sysfunction.SysRoleService"/>
+    <dubbo:service ref="sysRoleMenuPermissionsService" interface="com.sunwin.swismp.service.sysfunction.SysRoleMenuPermissionsService"/>
+
+
+    <!-- bean -->
+    <!-- 系统功能模块 -->
+    <bean class="com.sunwin.swismp.service.sysfunction.impl.SysOperationLogServiceImpl" id="sysOperationLogService"/>
+    <bean class="com.sunwin.swismp.service.sysfunction.impl.SysUserServiceImpl" id="sysUserService"/>
+    <bean class="com.sunwin.swismp.service.sysfunction.impl.SysMenuServiceImpl" id="sysMenuService"/>
+    <bean class="com.sunwin.swismp.service.sysfunction.impl.SysOrgServiceImpl" id="sysOrgService"/>
+    <bean class="com.sunwin.swismp.service.sysfunction.impl.SysRoleServiceImpl" id="sysRoleService"/>
+    <bean class="com.sunwin.swismp.service.sysfunction.impl.SysRoleMenuPermissionsServiceImpl" id="sysRoleMenuPermissionsService"/>
+</beans>

+ 231 - 0
provider/src/main/resources/mapping/sysfunction/SysMenuMapper.xml

@@ -0,0 +1,231 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysMenuMapper" >
+  <resultMap id="BaseResultMap" type="com.sunwin.swismp.dto.sysfunction.SysMenuDTO" >
+     <id column="menu_id" property="menuId" jdbcType="INTEGER" />
+     <result column="menu_name" property="menuName" jdbcType="VARCHAR" />
+      <result column="display_order" property="displayOrder" jdbcType="INTEGER" />
+     <result column="parent_menu_id" property="parentMenuId" jdbcType="INTEGER" />
+     <result column="link_url" property="linkUrl" jdbcType="VARCHAR" />
+     <result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
+     <result column="bz" property="bz" jdbcType="VARCHAR" />
+      <result column="is_enable" property="isEnable" jdbcType="INTEGER" />
+      <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+      <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
+     <result column="resource_type" property="resourceType" jdbcType="INTEGER" />
+      <result column="resource_type_name" property="resourceTypeName" jdbcType="VARCHAR" />
+      <result column="child_menu_count" property="childMenuCount" jdbcType="INTEGER" />
+      <result column="parent_menu_name" property="parentMenuName" jdbcType="VARCHAR" />
+      <result column="menu_level" property="menuLevel" jdbcType="INTEGER" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    menu_id, menu_name, display_order,parent_menu_id, link_url, image_url, bz,is_enable,create_time,update_time,resource_type,menu_level
+  </sql>
+    <select id="querySysMenuTree" resultMap="BaseResultMap">
+        select
+             t.menu_id, t.menu_name, t.display_order,t.parent_menu_id, t.link_url, t.image_url,
+             t.bz,t.is_enable,t.create_time,t.update_time,t.resource_type,t.menu_level,
+            case when t.resource_type =1 then '菜单'
+            when t.resource_type =2 then '页面'
+            when t.resource_type =3 then '按钮'
+            end as resource_type_name,
+            (select t1.menu_name from t_menu t1 where t.parent_menu_id = t1.menu_id) as parent_menu_name,
+				(select count(1) from t_menu t2 where t.menu_id = t2.parent_menu_id ) as child_menu_count
+        from t_menu t
+		ORDER BY t.menu_id,t.display_order
+    </select>
+  <select id="selectByRoleId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+      SELECT
+      a.menu_id,
+      a.menu_name,
+      a.parent_menu_id,
+      a.link_url,
+      a.image_url,
+      a.bz
+      FROM t_menu a,t_rolemenu b
+      WHERE a.menu_id = b.menu_id
+      AND b.role_id = #{roleId}
+      ORDER BY a.menu_id
+  </select>
+  <select id="selectByUserId"  resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        select tb.menu_id,
+                    tb.menu_name,
+                    tb.parent_menu_id,
+                    tb.link_url,
+                    tb.image_url,
+                    tb.bz from
+         ((select
+                    t.menu_id,
+                    t.menu_name,
+                    t.parent_menu_id,
+                    t.link_url,
+                    t.image_url,
+                    t.bz,
+                    t.display_order
+              from t_menu t
+              where EXISTS (select 1
+                     from t_menu a,t_rolemenu b,t_user c
+                               where c.role_id=b.role_id
+                              and b.menu_id=a.menu_id
+                              and a.parent_menu_id = t.menu_id
+                              and c.user_id=#{userId})
+                and t.is_enable=1)
+              UNION
+              (select
+              a.menu_id,
+              a.menu_name,
+              a.parent_menu_id,
+              a.link_url,
+              a.image_url,
+              a.bz,
+              a.display_order
+              from t_menu a,t_rolemenu b,t_user c
+              where c.role_id=b.role_id
+              and b.menu_id=a.menu_id
+              and c.user_id=#{userId}
+              and a.is_enable=1)) tb order by tb.display_order
+  </select>
+    <select id="selectMenuById"  resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        select
+            <include refid="Base_Column_List" />,
+            case when t.resource_type =1 then '菜单'
+            when t.resource_type =2 then '页面'
+            when t.resource_type =3 then '按钮'
+            end as resource_type_name,
+        (select t1.menu_name from t_menu t1 where t.parent_menu_id = t1.menu_id) as parent_menu_name
+        from t_menu t
+        where t.menu_id = #{menuId}
+    </select>
+    <select id="queryMenuSecondary"  resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        select
+        t.menu_id, t.menu_name, t.display_order,t.parent_menu_id, t.link_url, t.image_url,
+        t.bz,t.is_enable,t.create_time,t.update_time,t.resource_type,t.menu_level,
+        case when t.resource_type =1 then '菜单'
+        when t.resource_type =2 then '页面'
+        when t.resource_type =3 then '按钮'
+        end as resource_type_name,
+        (select t1.menu_name from t_menu t1 where t.parent_menu_id = t1.menu_id) as parent_menu_name
+        from t_menu t
+        where t.parent_menu_id =  #{menuId}
+        <if test="resourceType != null">
+            AND t.resource_type = #{resourceType, jdbcType=INTEGER}
+        </if>
+        <if test="isEnable != null">
+            AND t.is_enable = #{isEnable, jdbcType=INTEGER}
+        </if>
+        <if test="keywords != null and keywords !=''">
+            and (t.menu_name like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+            or t.link_url like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+            or t.image_url like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%') )
+        </if>
+        order by t.display_order
+        limit #{size,jdbcType=INTEGER} offset #{offset,jdbcType=INTEGER};
+    </select>
+    <select id="queryMenuSecondaryCount" resultType="java.lang.Long">
+        select
+         count(1)
+        from t_menu t
+        where t.parent_menu_id =  #{menuId}
+        <if test="resourceType != null">
+            AND t.resource_type = #{resourceType, jdbcType=INTEGER}
+        </if>
+        <if test="isEnable != null">
+            AND t.is_enable = #{isEnable, jdbcType=INTEGER}
+        </if>
+        <if test="keywords != null and keywords !=''">
+            and (t.menu_name like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+            or t.link_url like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+            or t.image_url like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%') )
+        </if>
+    </select>
+
+
+    <insert id="menuInsert" parameterType="com.sunwin.swismp.bean.sysfunction.SysMenu">
+        insert into t_menu(menu_name,display_order,parent_menu_id,
+        link_url,image_url,
+        create_time,update_time,
+        is_enable,resource_type,menu_level)
+        VALUES(#{menuName,jdbcType=VARCHAR},#{displayOrder,jdbcType=INTEGER},#{parentMenuId,jdbcType=INTEGER},
+        #{linkUrl,jdbcType=VARCHAR},#{imageUrl,jdbcType=VARCHAR},
+        now(),now(),
+        #{isEnable,jdbcType=INTEGER},#{resourceType,jdbcType=INTEGER},#{menuLevel,jdbcType=INTEGER})
+  </insert>
+
+    <select id="queryMenuCount" resultType="java.lang.Long">
+        select
+        count(1)
+        from t_menu t
+        <where>
+            1=1
+            <if test="menuId != null">
+                AND t.menu_id = #{menuId, jdbcType=INTEGER}
+            </if>
+            <if test="resourceType != null">
+                AND t.resource_type = #{resourceType, jdbcType=INTEGER}
+            </if>
+            <if test="isEnable != null">
+                AND t.is_enable = #{isEnable, jdbcType=INTEGER}
+            </if>
+            <if test="keywords != null and keywords !=''">
+                and (t.menu_name like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+                or t.link_url like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+                or t.image_url like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%') )
+            </if>
+            <if test="menuName != null and menuName !=''">
+                AND t.menu_name = #{menuName, jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
+    <select id="queryMenuOutSelfCount" resultType="java.lang.Long">
+        select
+        count(1)
+        from t_menu t
+        where t.menu_id <![CDATA[ <> ]]> #{menuId, jdbcType=INTEGER}
+         AND t.menu_name = #{menuName, jdbcType=VARCHAR}
+    </select>
+
+    <update id="menuUpdateByPrimaryKey" parameterType="com.sunwin.swismp.bean.sysfunction.SysMenu">
+        update t_menu
+        <set >
+            <if test="menuName != null and menuName !=''" >
+                menu_name = #{menuName,jdbcType=VARCHAR},
+            </if>
+            <if test="displayOrder != null" >
+                display_order = #{displayOrder,jdbcType=INTEGER},
+            </if>
+            <if test="parentMenuId != null" >
+                parent_menu_id = #{parentMenuId,jdbcType=INTEGER},
+            </if>
+            <if test="linkUrl != null and linkUrl !=''" >
+                link_url = #{linkUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="imageUrl != null and imageUrl !=''" >
+                image_url = #{imageUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="isEnable != null" >
+                is_enable = #{isEnable,jdbcType=INTEGER},
+            </if>
+            <if test="resourceType != null" >
+                resource_type = #{resourceType,jdbcType=INTEGER},
+            </if>
+            <if test="menuLevel != null" >
+                menu_level = #{menuLevel,jdbcType=INTEGER},
+            </if>
+            update_time = now()
+        </set>
+        where menu_id = #{menuId,jdbcType=INTEGER}
+    </update>
+    <update id="menuUpdateIsEnableByPrimaryKey" parameterType="com.sunwin.swismp.bean.sysfunction.SysMenu">
+        update t_menu
+        <set >
+            <if test="isEnable != null" >
+                is_enable = #{isEnable,jdbcType=INTEGER},
+            </if>
+            update_time = now()
+        </set>
+        where menu_id = #{menuId,jdbcType=INTEGER}
+    </update>
+    <delete id="deleteMenu" parameterType="java.lang.Integer">
+        delete from t_menu where menu_id = #{menuId,jdbcType=INTEGER}
+    </delete>
+</mapper>

+ 78 - 0
provider/src/main/resources/mapping/sysfunction/SysOperationLogMapper.xml

@@ -0,0 +1,78 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysOperationLogMapper">
+    <resultMap id="BaseResultMap" type="com.sunwin.swismp.dto.sysfunction.SysOperationLogDTO">
+        <id column="operation_id" jdbcType="INTEGER" property="operationId"/>
+        <result column="operation_name" jdbcType="VARCHAR" property="operationName"/>
+        <result column="operation_module" jdbcType="VARCHAR" property="operationModule"/>
+        <result column="operation_content" jdbcType="VARCHAR" property="operationContent"/>
+        <result column="operation_time" jdbcType="VARCHAR" property="operationTime"/>
+        <result column="operation_user" jdbcType="VARCHAR" property="operationUser"/>
+        <result column="operator" jdbcType="INTEGER" property="operator"/>
+        <result column="role_name" jdbcType="VARCHAR" property="roleName"/>
+    </resultMap>
+
+    <insert id="insert" parameterType="com.sunwin.swismp.bean.sysfunction.SysOperationLog">
+        insert into t_operation_log (operation_name, operation_content, operation_module,
+                                     operation_time, operation_user, operator)
+        values (#{operationName,jdbcType=VARCHAR}, #{operationContent,jdbcType=VARCHAR}, #{operationModule},
+               now(), #{operationUser,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR})
+    </insert>
+
+    <select id="querySysLogPage" resultMap="BaseResultMap">
+        select distinct l.*, tr.role_name
+        from t_operation_log l
+        left join t_user u on u.user_name = l.operation_user
+        left join t_role tr on u.role_id = tr.role_id
+        <where>
+            1=1
+            <if test="operationModule != null and operationModule != ''">
+                and l.operation_module like '%${operationModule}%'
+            </if>
+            <if test="operationName != null and operationName != ''">
+                and l.operation_name like '%${operationName}%'
+            </if>
+            <if test="beginOperateTime != null and beginOperateTime != ''">
+                and cast(l.operation_time AS VARCHAR) >= #{beginOperateTime}
+            </if>
+            <if test="endOperateTime != null and endOperateTime != ''">
+                and cast(l.operation_time AS VARCHAR) <![CDATA[ <= ]]> #{endOperateTime}
+            </if>
+            <if test="roleId != null and roleId != ''">
+                and tr.role_id :: text  = #{roleId}
+            </if>
+        </where>
+        order by l.operation_time desc
+        limit #{pageSize} offset #{pageNum}
+    </select>
+
+    <select id="querySysLogPageCount" resultType="java.lang.Long">
+        select count(*)
+        from (
+        select distinct l.*, tr.role_name
+        from t_operation_log l
+        left join t_user u on u.user_name = l.operation_user
+        left join t_role tr on u.role_id = tr.role_id
+        <where>
+            1=1
+            <if test="operationModule != null and operationModule != ''">
+                and l.operation_module like '%${operationModule}%'
+            </if>
+            <if test="operationName != null and operationName != ''">
+                and l.operation_name like '%${operationName}%'
+            </if>
+            <if test="beginOperateTime != null and beginOperateTime != ''">
+                and cast(l.operation_time AS VARCHAR) >= #{beginOperateTime}
+            </if>
+            <if test="endOperateTime != null and endOperateTime != ''">
+                and cast(l.operation_time AS VARCHAR) <![CDATA[ <= ]]> #{endOperateTime}
+            </if>
+            <if test="roleId != null and roleId != ''">
+                and tr.role_id :: text  = #{roleId}
+            </if>
+        </where>
+        order by l.operation_time desc
+        ) t
+    </select>
+
+</mapper>

+ 265 - 0
provider/src/main/resources/mapping/sysfunction/SysOrgMapper.xml

@@ -0,0 +1,265 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysOrgMapper">
+    <resultMap id="BaseResultMap" type="com.sunwin.swismp.dto.sysfunction.SysOrgDTO" >
+        <id column="org_id" property="orgId" jdbcType="INTEGER" />
+        <result column="org_name" property="orgName" jdbcType="VARCHAR" />
+        <result column="parent_org_id" property="parentOrgId" jdbcType="INTEGER" />
+        <result column="org_leader" property="orgLeader" jdbcType="VARCHAR" />
+        <result column="org_leader_phone" property="orgLeaderPhone" jdbcType="VARCHAR" />
+        <result column="org_address" property="orgAddress" jdbcType="VARCHAR" />
+        <result column="is_enabled" property="isEnabled" jdbcType="INTEGER" />
+        <result column="org_order" property="orgOrder" jdbcType="INTEGER" />
+        <result column="org_level" property="orgLevel" jdbcType="INTEGER" />
+        <result column="cur_org_user_count" property="curOrgUserCount" jdbcType="INTEGER" />
+        <result column="child_org_count" property="childOrgCount" jdbcType="INTEGER" />
+        <result column="parent_org_name" property="parentOrgName" jdbcType="VARCHAR" />
+        <result column="create_time" property="createTime" jdbcType="VARCHAR" />
+        <result column="update_time" property="updateTime" jdbcType="VARCHAR" />
+    </resultMap>
+
+    <insert id="addSysOrg" parameterType="com.sunwin.swismp.bean.sysfunction.SysOrg">
+        insert into t_org (org_id, org_name, org_order, org_level, parent_org_id, org_leader, org_leader_phone, org_address, is_enabled,
+                                 create_time, update_time)
+        values (nextval('t_org_org_id_seq'), #{orgName}, #{orgOrder}, #{orgLevel}, #{parentOrgId}, #{orgLeader}, #{orgLeaderPhone}, #{orgAddress},
+                0, now(), now())
+    </insert>
+
+    <update id="editSysOrg" parameterType="com.sunwin.swismp.bean.sysfunction.SysOrg">
+        update t_org set org_name = #{orgName}, org_order = #{orgOrder}, org_level = #{orgLevel}, parent_org_id = #{parentOrgId}, org_leader = #{orgLeader},
+                         org_leader_phone = #{orgLeaderPhone}, org_address = #{orgAddress}, is_enabled = #{isEnabled},
+                         update_time = now()
+        where org_id = #{orgId}
+    </update>
+
+    <delete id="delSysOrg" parameterType="java.lang.Integer">
+        delete from t_org where org_id = #{sysOrgId}
+    </delete>
+
+    <update id="enableSysOrg" parameterType="com.sunwin.swismp.bean.sysfunction.SysOrg">
+        update t_org set is_enabled = #{enabled} where org_id = #{sysOrgId}
+    </update>
+
+    <select id="querySysOrgPage" resultMap="BaseResultMap">
+        select o.*,t.parent_org_name, t.cur_org_user_count, COALESCE(t2.child_org_count,0) as child_org_count
+        from t_org o
+        left join (
+        select org_id,
+        org_name,
+        parent_org_id,
+        org_leader,
+        org_order,
+        org_leader_phone,
+        org_address,
+        is_enabled,
+        org_level,
+        create_time,
+        update_time,
+        parent_org_name,
+        sum(t.cur_org_user_count) as cur_org_user_count
+        from (
+        select o1.org_id,
+        o1.org_name,
+        o1.parent_org_id,
+        o1.org_leader,
+        o1.org_order,
+        o1.org_leader_phone,
+        o1.org_address,
+        o1.is_enabled,
+        o1.org_level,
+        o1.create_time,
+        o1.update_time,
+        o2.org_name                                    as parent_org_name,
+        case when tu.user_id is null then 0 else 1 end as cur_org_user_count
+        from t_org o1
+        left join t_org o2 on o1.parent_org_id = o2.org_id
+        left join t_user tu on o1.org_id = tu.org_id
+        ) t
+        group by org_id, org_name, parent_org_id, org_leader, org_order, org_leader_phone, org_address,
+        is_enabled, org_level,
+        create_time, update_time, parent_org_name
+        ) t
+        on o.org_id = t.org_id
+        left join (
+        select o.parent_org_id, count(*) as child_org_count
+        from t_org o
+        left join t_org o2 on o.parent_org_id = o2.org_id
+        group by o.parent_org_id
+        ) t2 on o.org_id = t2.parent_org_id
+        <where>
+            1=1
+            <if test="enabled != null and enabled != ''">
+                and o.is_enabled::varchar = #{enabled}
+            </if>
+            <if test="parentOrgId != null and parentOrgId != ''">
+                and o.parent_org_id = ${parentOrgId}
+            </if>
+            <if test="keywords != null and keywords != ''">
+                and o.org_leader like '%${keywords}%'
+            </if>
+            <if test="beginUpdateTime != null and beginUpdateTime != ''">
+                and cast(o.update_time AS VARCHAR) >= #{beginUpdateTime}
+            </if>
+            <if test="endUpdateTime != null and endUpdateTime != ''">
+                and cast(o.update_time AS VARCHAR) <![CDATA[ <= ]]> #{endUpdateTime}
+            </if>
+            <if test="orgUserNum != null and orgUserNum != '' and orgUserNum == 0">
+                and t.cur_org_user_count = 0
+            </if>
+            <if test="orgUserNum != null and orgUserNum != '' and orgUserNum == 1">
+                and t.cur_org_user_count > 0
+            </if>
+        </where>
+        order by o.org_order::int,o.update_time desc
+        limit #{pageSize} offset #{pageNum}
+    </select>
+
+    <select id="querySysOrgPageCount" resultType="java.lang.Long">
+        select count(*)
+        from (
+        select o.*,t.parent_org_name, t.cur_org_user_count, COALESCE(t2.child_org_count,0) as child_org_count
+        from t_org o
+        left join (
+        select org_id,
+        org_name,
+        parent_org_id,
+        org_leader,
+        org_order,
+        org_leader_phone,
+        org_address,
+        is_enabled,
+        org_level,
+        create_time,
+        update_time,
+        parent_org_name,
+        sum(t.cur_org_user_count) as cur_org_user_count
+        from (
+        select o1.org_id,
+        o1.org_name,
+        o1.parent_org_id,
+        o1.org_leader,
+        o1.org_order,
+        o1.org_leader_phone,
+        o1.org_address,
+        o1.is_enabled,
+        o1.org_level,
+        o1.create_time,
+        o1.update_time,
+        o2.org_name                                    as parent_org_name,
+        case when tu.user_id is null then 0 else 1 end as cur_org_user_count
+        from t_org o1
+        left join t_org o2 on o1.parent_org_id = o2.org_id
+        left join t_user tu on o1.org_id = tu.org_id
+        ) t
+        group by org_id, org_name, parent_org_id, org_leader, org_order, org_leader_phone, org_address,
+        is_enabled, org_level,
+        create_time, update_time, parent_org_name
+        ) t
+        on o.org_id = t.org_id
+        left join (
+        select o.parent_org_id, count(*) as child_org_count
+        from t_org o
+        left join t_org o2 on o.parent_org_id = o2.org_id
+        group by o.parent_org_id
+        ) t2 on o.org_id = t2.parent_org_id
+        <where>
+            1=1
+            <if test="enabled != null and enabled != ''">
+                and o.is_enabled::varchar = #{enabled}
+            </if>
+            <if test="parentOrgId != null and parentOrgId != ''">
+                and o.parent_org_id = ${parentOrgId}
+            </if>
+            <if test="keywords != null and keywords != ''">
+                and o.org_name like '%${keywords}%'
+            </if>
+            <if test="beginUpdateTime != null and beginUpdateTime != ''">
+                and cast(o.update_time AS VARCHAR) >= #{beginUpdateTime}
+            </if>
+            <if test="endUpdateTime != null and endUpdateTime != ''">
+                and cast(o.update_time AS VARCHAR) <![CDATA[ <= ]]> #{endUpdateTime}
+            </if>
+            <if test="orgUserNum != null and orgUserNum != '' and orgUserNum == 0">
+                and t.cur_org_user_count = 0
+            </if>
+            <if test="orgUserNum != null and orgUserNum != '' and orgUserNum == 1">
+                and t.cur_org_user_count > 0
+            </if>
+        </where>
+        order by o.org_order::int,o.update_time desc
+                 ) t
+    </select>
+
+    <select id="querySysOrgTree" resultMap="BaseResultMap">
+        select org_id,
+               org_name,
+               parent_org_id,
+               org_order,
+               org_leader,
+               org_leader_phone,
+               org_address,
+               is_enabled,
+               org_level,
+               create_time,
+               update_time
+        from t_org
+        order by org_id::int, org_order::int
+    </select>
+
+    <select id="querySysOrgByParentAndName" resultMap="BaseResultMap">
+        select *
+        from t_org
+        <where>
+            1=1
+            <if test="parentOrgId != null and parentOrgId != ''">
+                and parent_org_id = #{parentOrgId}
+            </if>
+            <if test="orgName != null and orgName != ''">
+                and org_name = #{orgName}
+            </if>
+        </where>
+    </select>
+
+    <select id="viewSysOrg" resultType="com.sunwin.swismp.dto.sysfunction.SysOrgDTO">
+        select org_id,
+        org_name,
+        parent_org_id,
+        org_leader,
+        org_order,
+        org_leader_phone,
+        org_address,
+        is_enabled,
+        org_level,
+        create_time,
+        update_time,
+        parent_org_name,
+        sum(t.cur_org_user_count) as cur_org_user_count
+        from (
+        select o1.org_id,
+        o1.org_name,
+        o1.parent_org_id,
+        o1.org_leader,
+        o1.org_order,
+        o1.org_leader_phone,
+        o1.org_address,
+        o1.is_enabled,
+        o1.org_level,
+        o1.create_time,
+        o1.update_time,
+        o2.org_name                                    as parent_org_name,
+        case when tu.user_id is null then 0 else 1 end as cur_org_user_count
+        from t_org o1
+        left join t_org o2 on o1.parent_org_id = o2.org_id
+        left join t_user tu on o1.org_id = tu.org_id
+        <where>
+            1=1
+            <if test="sysOrgId != null and sysOrgId != ''">
+                and o1.org_id = ${sysOrgId}
+            </if>
+        </where>
+        ) t
+        group by org_id, org_name, parent_org_id, org_leader, org_order, org_leader_phone, org_address, is_enabled, org_level,
+        create_time, update_time, parent_org_name
+    </select>
+
+</mapper>

+ 174 - 0
provider/src/main/resources/mapping/sysfunction/SysRoleMapper.xml

@@ -0,0 +1,174 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysRoleMapper">
+  <resultMap id="BaseResultMap" type="com.sunwin.swismp.dto.sysfunction.SysRoleDTO">
+    <id column="role_id" property="roleId" jdbcType="INTEGER" />
+    <result column="role_code" property="roleCode" jdbcType="VARCHAR" />
+    <result column="role_name" property="roleName" jdbcType="VARCHAR" />
+    <result column="role_describe" property="roleDescribe" jdbcType="VARCHAR" />
+    <result column="is_enable" property="isEnable" jdbcType="INTEGER" />
+    <result column="bz" jdbcType="VARCHAR" property="bz" />
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="user_num" property="userNum" jdbcType="INTEGER" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    role_id,role_code, role_name, role_describe, is_enable, bz,create_time, update_time
+  </sql>
+
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_role
+    where role_id = #{roleId,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.sunwin.swismp.bean.sysfunction.SysRole">
+     insert into t_role (role_code,role_name,role_describe,is_enable,
+      bz, create_time, update_time
+      )
+    values (#{roleCode,jdbcType=VARCHAR}, #{roleName,jdbcType=VARCHAR},
+      #{roleDescribe,jdbcType=VARCHAR},#{isEnable,jdbcType=INTEGER},
+      #{bz,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+
+  <update id="updateByPrimaryKey" parameterType="com.sunwin.swismp.bean.sysfunction.SysRole">
+    update t_role
+    <set >
+      <if test="roleCode != null and roleCode !=''" >
+        role_code = #{roleCode,jdbcType=VARCHAR},
+      </if>
+      <if test="roleName != null and roleName !=''" >
+        role_name = #{roleName,jdbcType=VARCHAR},
+      </if>
+      <if test="isEnable != null" >
+        is_enable = #{isEnable,jdbcType=INTEGER},
+      </if>
+      <if test="roleDescribe != null and roleDescribe !=''" >
+        role_describe = #{roleDescribe,jdbcType=VARCHAR},
+      </if>
+      <if test="bz != null and bz !=''">
+        bz = #{bz,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null" >
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null" >
+        update_time = #{updateTime,jdbcType=TIMESTAMP}
+      </if>
+    </set>
+    where role_id = #{roleId,jdbcType=INTEGER}
+  </update>
+  <select id="selectByRoleName" parameterType="java.lang.String" resultType="com.sunwin.swismp.bean.sysfunction.SysRole">
+      SELECT
+      <include refid="Base_Column_List"/>
+      FROM t_role
+      WHERE role_name = #{roleName, jdbcType=VARCHAR}
+  </select>
+
+  <select id="checkRoleName" resultType="hashmap">
+     Select
+      role_name as name_existed, 'role' as type_existed
+      from t_role
+      where role_name = #{roleName,jdbcType=VARCHAR}
+      <if test="roleId != null">
+        AND role_id != #{roleId,jdbcType=INTEGER}
+      </if>
+      union all
+     SELECT
+      user_name as name_existed ,'user' as type_existed
+      from t_user
+      where  user_name = #{roleName,jdbcType = VARCHAR}
+      union all
+      select
+      org_name as name_existed ,'org' as type_existed
+      from
+      t_org
+      where  org_name = #{roleName,jdbcType=VARCHAR}
+  </select>
+  <select id="selectByRoleCode" parameterType="java.lang.String" resultType="com.sunwin.swismp.bean.sysfunction.SysRole">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM t_role
+    WHERE role_code = #{roleCode, jdbcType=VARCHAR}
+  </select>
+  <select id="selectByRoleNameOutSelf" resultType="com.sunwin.swismp.bean.sysfunction.SysRole">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM t_role
+    WHERE role_name = #{roleName, jdbcType=VARCHAR}
+    and role_id !=#{roleId,jdbcType=INTEGER}
+  </select>
+  <select id="selectByRoleCodeOutSelf" resultType="com.sunwin.swismp.bean.sysfunction.SysRole">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM t_role
+    WHERE role_code = #{roleCode, jdbcType=VARCHAR}
+    and role_id !=#{roleId,jdbcType=INTEGER}
+  </select>
+
+  <select id="selectAll"  resultMap="BaseResultMap">
+      select
+      <include refid="Base_Column_List"/>
+      from t_role
+      order by create_time desc
+  </select>
+    <select id="selectExcludeRoleCode"  resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from t_role
+        where is_enable = 1 and  role_code != '10001'
+        and role_name NOT LIKE '%管理员%'
+        order by create_time desc
+    </select>
+  <select id="selectPage" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    ,(select count(1) from t_user t1 where t.role_id = t1.role_id) as user_num
+    from t_role t
+    <where>
+      1 = 1
+      <if test="roleName != null and roleName !=''">
+        AND role_name like CONCAT('%',#{roleName, jdbcType=VARCHAR},'%')
+      </if>
+      <if test="roleCode != null and roleCode !=''">
+        AND role_code = #{roleCode, jdbcType=VARCHAR}
+      </if>
+      <if test="isEnable != null">
+        AND is_enable = #{isEnable, jdbcType=INTEGER}
+      </if>
+      <if test="keywords != null and keywords !=''">
+        and (role_name like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+            or role_code like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+            or role_describe like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%') )
+      </if>
+    </where>
+    order by create_time desc
+      limit #{size,jdbcType=INTEGER} offset #{offset,jdbcType=INTEGER};
+  </select>
+  <select id="selectPageCount" resultType="java.lang.Integer">
+    select
+    count(1)
+    from t_role
+    <where>
+      1 = 1
+      <if test="roleName != null and roleName !=''">
+        AND role_name like CONCAT('%',#{roleName, jdbcType=VARCHAR},'%')
+      </if>
+      <if test="roleCode != null and roleCode !=''">
+        AND role_code = #{roleCode, jdbcType=VARCHAR}
+      </if>
+      <if test="isEnable != null">
+        AND is_enable = #{isEnable, jdbcType=INTEGER}
+      </if>
+      <if test="keywords != null and keywords !=''">
+        and (role_name like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+        or role_code like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%')
+        or role_describe like CONCAT('%',#{keywords, jdbcType=VARCHAR},'%') )
+      </if>
+    </where>
+  </select>
+    <select id="selectRoleUserNum" resultType="java.lang.Integer">
+         select count(1) from t_user t1 where t1.role_id = #{roleId,jdbcType=INTEGER}
+    </select>
+
+</mapper>

+ 33 - 0
provider/src/main/resources/mapping/sysfunction/SysRoleMenuMapper.xml

@@ -0,0 +1,33 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysRoleMenuMapper" >
+  <resultMap id="BaseResultMap" type="com.sunwin.swismp.bean.sysfunction.SysRoleMenu" >
+    <id column="rolemenu_id" property="rolemenuId" jdbcType="INTEGER" />
+    <result column="menu_id" property="menuId" jdbcType="INTEGER" />
+    <result column="role_id" property="roleId" jdbcType="INTEGER" />
+    <result column="isenable" property="isenable" jdbcType="INTEGER" />
+    <result column="bz" property="bz" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    rolemenu_id, menu_id, role_id, isenable, bz
+  </sql>
+  <select id="selectByRoleId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+      SELECT
+      <include refid="Base_Column_List"/>
+      FROM t_rolemenu
+      WHERE role_id = #{roleId,jdbcType=INTEGER}
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+      INSERT INTO t_rolemenu ( menu_id, role_id,
+      isenable, bz)
+      VALUES
+      <foreach collection="list" separator="," item="item" >
+          (#{item.menuId,jdbcType=INTEGER},#{item.roleId,jdbcType=INTEGER},
+          #{item.isenable,jdbcType=INTEGER},#{item.bz,jdbcType=VARCHAR})
+      </foreach>
+  </insert>
+  <delete id="deleteByRoleId" parameterType="java.lang.Integer">
+    delete from t_rolemenu
+    where role_id = #{roleId,jdbcType=INTEGER}
+  </delete>
+</mapper>

+ 70 - 0
provider/src/main/resources/mapping/sysfunction/SysRoleMenuPermissionsMapper.xml

@@ -0,0 +1,70 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysRoleMenuPermissionsMapper" >
+    <resultMap id="BaseResultMap" type="com.sunwin.swismp.dto.sysfunction.SysRoleMenuPermissions" >
+        <result column="role_id" property="roleId" jdbcType="INTEGER" />
+        <result column="one_menu_id" property="oneMenuId" jdbcType="INTEGER" />
+        <result column="one_menu_name" property="oneMenuName" jdbcType="VARCHAR" />
+        <result column="one_display_order" property="oneDisplayOrder" jdbcType="INTEGER" />
+        <result column="one_is_shown" property="oneIsShown" jdbcType="INTEGER" />
+
+        <result column="two_menu_id" property="twoMenuId" jdbcType="INTEGER" />
+        <result column="two_menu_name" property="twoMenuName" jdbcType="VARCHAR" />
+        <result column="two_display_order" property="twoDisplayOrder" jdbcType="INTEGER" />
+        <result column="two_is_shown" property="twoIsShown" jdbcType="INTEGER" />
+
+        <result column="three_menu_id" property="threeMenuId" jdbcType="INTEGER" />
+        <result column="three_menu_name" property="threeMenuName" jdbcType="VARCHAR" />
+        <result column="three_display_order" property="threeDisplayOrder" jdbcType="INTEGER" />
+        <result column="three_is_shown" property="threeIsShown" jdbcType="INTEGER" />
+    </resultMap>
+
+    <select id="selectByRoleId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+        select role_id,onep.menu_id one_menu_id,onep.menu_name one_menu_name,
+               onep.display_order one_display_order ,r.isenable one_is_shown,
+
+        twopm.menu_id two_menu_id,twopm.menu_name two_menu_name,
+               twopm.display_order two_display_order ,twopm.isenable two_is_shown,
+
+        threepm.menu_id three_menu_id,threepm.menu_name three_menu_name,
+               threepm.display_order three_display_order ,threepm.isenable three_is_shown
+        from t_menu onep
+        LEFT JOIN t_rolemenu r ON onep.menu_id= r.menu_id and r.role_id = #{roleId,jdbcType=INTEGER}
+        LEFT JOIN (select twop.*,r2.isenable from t_menu twop
+                   LEFT JOIN t_rolemenu r2 ON twop.menu_id= r2.menu_id and r2.role_id = #{roleId,jdbcType=INTEGER}
+                   where twop.parent_menu_id is not null
+                   and twop.is_enable=1) twopm ON twopm.parent_menu_id = onep.menu_id
+        LEFT JOIN (select threep.*,r3.isenable from t_menu threep
+                   LEFT JOIN t_rolemenu r3 ON threep.menu_id= r3.menu_id and r3.role_id = #{roleId,jdbcType=INTEGER}
+                   where threep.parent_menu_id is not null
+                   and threep.is_enable=1) threepm ON threepm.parent_menu_id = twopm.menu_id
+        where onep.parent_menu_id is null
+        and onep.is_enable=1
+        order by onep.display_order,twopm.display_order,threepm.display_order
+    </select>
+
+    <select id="selectByRoleIdSelf" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+        select role_id,onep.menu_id one_menu_id,onep.menu_name one_menu_name,
+               onep.display_order one_display_order ,r.isenable one_is_shown,
+
+        twopm.menu_id two_menu_id,twopm.menu_name two_menu_name,
+               twopm.display_order two_display_order ,twopm.isenable two_is_shown,
+
+        threepm.menu_id three_menu_id,threepm.menu_name three_menu_name,
+               threepm.display_order three_display_order ,threepm.isenable three_is_shown
+        from t_menu onep
+        LEFT JOIN t_rolemenu r ON onep.menu_id= r.menu_id and r.role_id = #{roleId,jdbcType=INTEGER}
+        LEFT JOIN (select twop.*,r2.isenable from t_menu twop
+                   LEFT JOIN t_rolemenu r2 ON twop.menu_id= r2.menu_id and r2.role_id = #{roleId,jdbcType=INTEGER}
+                   where twop.parent_menu_id is not null
+                   and twop.is_enable=1) twopm ON twopm.parent_menu_id = onep.menu_id
+        LEFT JOIN (select threep.*,r3.isenable from t_menu threep
+                   LEFT JOIN t_rolemenu r3 ON threep.menu_id= r3.menu_id and r3.role_id = #{roleId,jdbcType=INTEGER}
+                   where threep.parent_menu_id is not null
+                   and threep.is_enable=1) threepm ON threepm.parent_menu_id = twopm.menu_id
+        where onep.parent_menu_id is null
+        and r.isenable =1
+        and onep.is_enable=1
+        order by onep.display_order,twopm.display_order,threepm.display_order
+    </select>
+</mapper>

+ 613 - 0
provider/src/main/resources/mapping/sysfunction/SysUserMapper.xml

@@ -0,0 +1,613 @@
+<?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="com.sunwin.swismp.dao.sysfunction.mapper.SysUserMapper">
+    <resultMap id="BaseResultMap" type="com.sunwin.swismp.dto.sysfunction.SysUserDTO">
+        <id column="user_id" jdbcType="INTEGER" property="userId"/>
+        <result column="org_id" jdbcType="INTEGER" property="orgId"/>
+        <result column="org_name" jdbcType="VARCHAR" property="orgName"/>
+        <result column="user_code" jdbcType="VARCHAR" property="userCode"/>
+        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
+        <result column="role_id" jdbcType="INTEGER" property="roleId"/>
+        <result column="role_name" jdbcType="VARCHAR" property="roleName"/>
+        <result column="real_name" jdbcType="VARCHAR" property="realName"/>
+        <result column="police_no" jdbcType="VARCHAR" property="policeNo"/>
+        <result column="user_pwd" jdbcType="VARCHAR" property="userPwd"/>
+        <result column="user_phone" jdbcType="VARCHAR" property="userPhone"/>
+        <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone"/>
+        <result column="user_mail" jdbcType="VARCHAR" property="userMail"/>
+        <result column="is_enable" jdbcType="INTEGER" property="isEnable"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
+        <result column="last_login_time" jdbcType="VARCHAR" property="updateBy"/>
+    </resultMap>
+    <resultMap id="BaseResultMap2" type="com.sunwin.swismp.bean.sysfunction.SysUser">
+        <id column="user_id" jdbcType="INTEGER" property="userId"/>
+        <result column="org_id" jdbcType="INTEGER" property="orgId"/>
+        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
+        <result column="role_id" jdbcType="INTEGER" property="roleId"/>
+        <result column="real_name" jdbcType="VARCHAR" property="realName"/>
+        <result column="police_no" jdbcType="VARCHAR" property="policeNo"/>
+        <result column="user_pwd" jdbcType="VARCHAR" property="userPwd"/>
+        <result column="user_phone" jdbcType="VARCHAR" property="userPhone"/>
+        <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone"/>
+        <result column="user_mail" jdbcType="VARCHAR" property="userMail"/>
+        <result column="is_enable" jdbcType="INTEGER" property="isEnable"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
+        <result column="role_code" jdbcType="VARCHAR" property="roleCode"/>
+        <result column="role_name" jdbcType="VARCHAR" property="roleName"/>
+    </resultMap>
+
+    <resultMap id="SysUserManage" type="com.sunwin.swismp.dto.sysfunction.SysUserManage">
+        <id column="user_id" jdbcType="INTEGER" property="userId"/>
+        <result column="org_id" jdbcType="INTEGER" property="orgId"/>
+        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
+        <result column="role_id" jdbcType="INTEGER" property="roleId"/>
+        <result column="real_name" jdbcType="VARCHAR" property="realName"/>
+        <result column="police_no" jdbcType="VARCHAR" property="policeNo"/>
+        <result column="user_pwd" jdbcType="VARCHAR" property="userPwd"/>
+        <result column="user_phone" jdbcType="VARCHAR" property="userPhone"/>
+        <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone"/>
+        <result column="user_mail" jdbcType="VARCHAR" property="userMail"/>
+        <result column="is_enable" jdbcType="INTEGER" property="isEnable"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
+        <result column="org_name" jdbcType="VARCHAR" property="orgName"/>
+        <result column="role_name" jdbcType="VARCHAR" property="roleName"/>
+        <result column="last_logintime" jdbcType="VARCHAR" property="lastLoginTime"/>
+        <result column="is_enablestr" jdbcType="VARCHAR" property="isEnableStr"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        user_id
+        , org_id, user_name, role_id, real_name, police_no, user_pwd, user_phone,
+        mobile_phone, user_mail, is_enable, create_time, create_by, update_time, update_by
+    </sql>
+
+    <sql id="Role_Code_Column_List">
+        user_id
+        , org_id, user_name, role_id, real_name, police_no, user_pwd, user_phone,
+        mobile_phone, user_mail, is_enable, create_time, create_by, update_time, update_by,role_code
+    </sql>
+
+    <sql id="Result_Column_List">
+        user_id
+        , org_id, user_name, role_id, real_name, police_no, user_pwd, user_phone,
+        mobile_phone, user_mail, is_enable, create_time, create_by, update_time, update_by,
+        org_name, role_name, last_logintime, is_enablestr
+    </sql>
+
+    <select id="queryAllUserIdName" resultType="SysUserManage">
+        select user_id, user_name
+        from t_user
+    </select>
+    <select id="queryOrgUserRelation" resultType="SysUserManage">
+        SELECT user_id, u.org_id, org_name, user_name
+        FROM t_user u
+                 LEFT JOIN t_org o ON u.org_id = o.org_id
+    </select>
+    <select id="queryUserRoleRelation" resultType="SysUserManage">
+        SELECT user_id, u.role_id, user_name, role_name
+        FROM t_user u
+                 LEFT JOIN t_role r ON u.role_id = r.role_id
+    </select>
+
+    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from t_user
+        where user_id = #{userId,jdbcType=INTEGER}
+    </select>
+
+    <select id="queryUserById" parameterType="java.lang.Integer"
+            resultType="com.sunwin.swismp.dto.sysfunction.SysUserDTO">
+        select u.user_id,
+               u.user_name,
+               u.org_id,
+               u.mobile_phone,
+               t.org_name,
+               u.role_id,
+               u.real_name,
+               u.user_mail,
+               tr.role_name,
+               u.update_time,
+               u.is_enable
+        from t_user u
+                 left join t_org t on u.org_id = t.org_id
+                 left join t_role tr on u.role_id = tr.role_id
+        where user_id = #{userId}
+    </select>
+
+    <select id="selectByTelephone" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from t_user
+        where mobile_phone = #{telephone}
+    </select>
+    <update id="updateTelephoneByUserId">
+        update t_user
+        set mobile_phone = #{telephone, jdbcType=VARCHAR}
+        where user_id = #{userId,jdbcType=INTEGER}
+    </update>
+    <update id="updateEmailByUserId">
+        update t_user
+        set user_mail = #{email, jdbcType=VARCHAR}
+        where user_id = #{userId,jdbcType=INTEGER}
+    </update>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete
+        from t_user
+        where user_id = #{userId,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insert" parameterType="com.sunwin.swismp.bean.sysfunction.SysUser">
+        insert into t_user (user_id, org_id, user_name, real_name, role_id, user_pwd,
+                            mobile_phone, user_mail, is_enable, create_time, create_by, update_time, update_by)
+        values (nextval('t_user_user_id_seq'), #{orgId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{realName},
+                #{roleId,jdbcType=INTEGER}, '123456', #{mobilePhone,jdbcType=BIGINT}, #{userMail,jdbcType=VARCHAR},
+                #{isEnable,jdbcType=INTEGER}, now(), #{createBy,jdbcType=VARCHAR}, now(), #{updateBy,jdbcType=VARCHAR})
+    </insert>
+
+    <update id="updateByPrimaryKey" parameterType="com.sunwin.swismp.bean.sysfunction.SysUser">
+        update t_user
+        set org_id       = #{orgId,jdbcType=INTEGER},
+            user_name    = #{userName,jdbcType=VARCHAR},
+            real_name    = #{realName,jdbcType=VARCHAR},
+            role_id      = #{roleId,jdbcType=INTEGER},
+            mobile_phone = #{mobilePhone,jdbcType=BIGINT},
+            user_mail    = #{userMail,jdbcType=VARCHAR},
+            update_time=NOW()
+        where user_id = #{userId,jdbcType=INTEGER}
+    </update>
+
+    <select id="selectUserRoleOrgByUserName" parameterType="java.lang.String" resultMap="BaseResultMap">
+        SELECT user_name,
+               "user" as real_name
+        FROM t_user
+        WHERE user_name = #{userName}
+        union all
+        Select role_name,
+               "role" as real_name
+        from t_role
+        where role_name = #{userName}
+        union all
+        select org_name,
+               "org" as real_name
+        from t_org
+        where org_name = #{userName}
+    </select>
+
+    <select id="selectRoleOrgByUserName" resultMap="BaseResultMap">
+        SELECT user_name,
+               "user" as real_name
+        from t_user
+        where user_id != #{userId,jdbcType = INTEGER}
+          and user_name = #{userName,jdbcType = VARCHAR}
+        union all
+        Select role_name,
+               "role" as real_name
+        from t_role
+        where role_name = #{userName,jdbcType=VARCHAR}
+        union all
+        select org_name,
+               "org" as real_name
+        from t_org
+        where org_name = #{userName,jdbcType=VARCHAR}
+    </select>
+    <select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_user
+        WHERE user_name = #{userName}
+    </select>
+    <select id="selectByUserNameWithRoleCode" parameterType="java.lang.String" resultMap="BaseResultMap2">
+        SELECT user_id,
+               org_id,
+               user_name,
+               a.role_id,
+               real_name,
+               police_no,
+               user_pwd,
+               user_phone,
+               mobile_phone,
+               user_mail,
+               a.is_enable,
+               a.create_time,
+               create_by,
+               a.update_time,
+               update_by,
+               role_code,
+               role_name
+        FROM t_user a
+                 LEFT JOIN t_role b
+                           ON a.role_id = b.role_id
+        WHERE user_name = #{userName}
+    </select>
+    <update id="updatePwd">
+        update t_user
+        set user_pwd   = #{userPwd,jdbcType=VARCHAR},
+            update_time=NOW()
+        where user_id = #{userId,jdbcType=INTEGER}
+    </update>
+
+    <update id="logoff" parameterType="java.lang.Integer">
+        UPDATE t_user
+        set is_enable=0,
+            update_time=NOW()
+        WHERE user_id = #{userId}
+    </update>
+
+    <update id="enableUser" parameterType="java.lang.Integer">
+        UPDATE t_user
+        set is_enable= #{enabled},
+            update_time=NOW()
+        WHERE user_id = #{userId}
+    </update>
+
+    <select id="selectUserManageById" resultMap="SysUserManage" parameterType="java.lang.Integer">
+        SELECT a.*, b.last_logintime
+        FROM (
+                 SELECT a.user_id,
+                        a.org_id,
+                        a.user_name,
+                        a.role_id,
+                        a.mobile_phone,
+                        a.user_mail,
+                        a.is_enable,
+                        a.create_time,
+                        b.org_name,
+                        c.role_name,
+                        case when a.is_enable = 1 then '启用' else '暂停' end as is_enablestr
+                 from t_user a
+                          LEFT JOIN t_org b on a.org_id = b.org_id
+                          INNER JOIN t_role c ON a.role_id = c.role_id
+             ) a
+                 LEFT JOIN (select operation_user, max(operation_time) as last_logintime
+                            from t_operation_log
+                            GROUP BY operation_user) b
+                           on a.user_name = b.operation_user
+        where 1 = 1
+          and a.user_id = #{userId}
+    </select>
+
+    <select id="selectAllUserManage" resultMap="SysUserManage">
+        SELECT a.*,b.last_logintime
+        FROM
+        (
+        SELECT a.user_id,a.org_id,a.user_name,a.role_id,a.mobile_phone,a.user_mail,a.is_enable,a.create_time,
+        b.org_name,c.role_name,c.role_code,
+        case when a.is_enable=1 then '启用' else '暂停' end as is_enablestr
+        from t_user a
+        LEFT JOIN t_org b on a.org_id=b.org_id
+        INNER JOIN t_role c ON a.role_id=c.role_id
+        ) a
+        LEFT JOIN (select operation_user,max(operation_time) as last_logintime from t_operation_log GROUP BY
+        operation_user) b
+        on a.user_name=b.operation_user
+        <trim prefixOverrides="and" prefix="where">
+            <if test="orgId != -10001">
+                and a.org_id=#{orgId,jdbcType=INTEGER}
+                and a.role_code != '10001'
+                and a.role_name not like '%管理员%'
+            </if>
+            <if test="param != null">
+                AND (
+                a.user_name LIKE concat(concat('%',#{param,jdbcType=VARCHAR}),'%')
+                OR
+                a.mobile_phone LIKE concat(concat('%',#{param,jdbcType=VARCHAR}),'%')
+                OR
+                a.user_mail LIKE concat(concat('%',#{param,jdbcType=VARCHAR}),'%')
+                )
+            </if>
+        </trim>
+        order by a.create_time desc
+        limit #{pageNo,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER};
+    </select>
+
+    <select id="selectAllUserManageCount" resultType="int">
+        SELECT count(a.user_id)
+        FROM
+        (
+        SELECT a.user_id,a.org_id,a.user_name,a.role_id,a.mobile_phone,a.user_mail,a.is_enable,a.create_time,
+        b.org_name,c.role_name,c.role_code,if(a.is_enable=1,"启用","暂停") as is_enablestr
+        from t_user a
+        LEFT JOIN t_org b on a.org_id=b.org_id
+        INNER JOIN t_role c ON a.role_id=c.role_id
+        ) a
+        LEFT JOIN (select operation_user,max(operation_time) as last_logintime from t_operation_log GROUP BY
+        operation_user) b
+        on a.user_name=b.operation_user
+        <trim prefixOverrides="and" prefix="where">
+            <if test="orgId != -10001">
+                and a.org_id=#{orgId,jdbcType=INTEGER}
+                and a.role_code != '10001'
+                and a.role_name not like '%管理员%'
+            </if>
+            <if test="param != null">
+                AND (
+                a.user_name LIKE concat(concat('%',#{param,jdbcType=VARCHAR}),'%')
+                OR
+                a.mobile_phone LIKE concat(concat('%',#{param,jdbcType=VARCHAR}),'%')
+                OR
+                a.user_mail LIKE concat(concat('%',#{param,jdbcType=VARCHAR}),'%')
+                )
+            </if>
+        </trim>
+        ;
+    </select>
+
+    <select id="selectUserManageByParams" resultMap="SysUserManage">
+        SELECT a.*,b.last_logintime
+        FROM
+        (
+        SELECT a.user_id,a.org_id,a.user_name,a.role_id,a.mobile_phone,a.user_mail,a.is_enable,a.create_time,
+        b.org_name,c.role_name,c.role_code,if(a.is_enable=1,"启用","暂停") as is_enablestr
+        from t_user a
+        LEFT JOIN t_org b on a.org_id=b.org_id
+        INNER JOIN t_role c ON a.role_id=c.role_id
+        ) a
+        LEFT JOIN (select operation_user,max(operation_time) as last_logintime from t_operation_log GROUP BY
+        operation_user) b
+        on a.user_name=b.operation_user
+        <trim prefix="where" prefixOverrides="and">
+            <if test="orgId != -10001">
+                and a.org_id=#{orgId,jdbcType=INTEGER}
+                and a.role_code != '10001'
+                and a.role_name not like '%管理员%'
+            </if>
+            <if test="email != null">
+                and a.user_mail LIKE concat(concat('%',#{email,jdbcType=VARCHAR}),'%')
+            </if>
+            <if test="userName != null">
+                and a.user_name LIKE concat(concat('%',#{userName,jdbcType=VARCHAR}),'%')
+            </if>
+            <if test="phone != null">
+                and a.mobile_phone LIKE concat(concat('%',#{phone,jdbcType=VARCHAR}),'%')
+            </if>
+        </trim>
+        order by a.create_time desc
+        limit #{pageNo,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER};
+    </select>
+
+    <select id="selectUserManageByParamsCount" resultType="int">
+        SELECT count(a.user_id)
+        FROM
+        (
+        SELECT a.user_id,a.org_id,a.user_name,a.role_id,a.mobile_phone,a.user_mail,a.is_enable,a.create_time,
+        b.org_name,c.role_name,c.role_code,if(a.is_enable=1,"启用","暂停") as is_enablestr
+        from t_user a
+        LEFT JOIN t_org b on a.org_id=b.org_id
+        INNER JOIN t_role c ON a.role_id=c.role_id
+        ) a
+        LEFT JOIN (select operation_user,max(operation_time) as last_logintime from t_operation_log GROUP BY
+        operation_user) b
+        on a.user_name=b.operation_user
+        <trim prefix="where" prefixOverrides="and">
+            <if test="orgId != -10001">
+                and a.org_id=#{orgId,jdbcType=INTEGER}
+                and a.role_code != '10001'
+                and a.role_name not like '%管理员%'
+            </if>
+            <if test="email != null">
+                and a.user_mail LIKE concat(concat('%',#{email,jdbcType=VARCHAR}),'%')
+            </if>
+            <if test="userName != null">
+                and a.user_name LIKE concat(concat('%',#{userName,jdbcType=VARCHAR}),'%')
+            </if>
+            <if test="phone != null">
+                and a.mobile_phone LIKE concat(concat('%',#{phone,jdbcType=VARCHAR}),'%')
+            </if>
+        </trim>
+        ;
+    </select>
+    <select id="queryUserEnabled" resultType="Map">
+        SELECT u.user_id,
+               u.is_enable  AS userEnabled,
+               o.is_enabled AS orgEnabled,
+               r.is_enable  AS roleEnabled
+        FROM t_user u
+                 LEFT JOIN t_org o ON u.org_id = o.org_id
+                 LEFT JOIN t_role r ON u.role_id = r.role_id
+        where user_name = #{userName,jdbcType=VARCHAR}
+    </select>
+
+    <select id="queryUserManger" resultMap="SysUserManage">
+        SELECT a.user_id,
+               a.org_id,
+               a.user_name,
+               a.role_id,
+               a.mobile_phone,
+               a.user_mail,
+               a.is_enable,
+               a.create_time,
+               b.org_name,
+               c.role_name,
+               c.role_code,
+               case when a.is_enable = 1 then '启用' else '暂停' end as is_enablestr
+        from t_user a
+                 LEFT JOIN t_org b on a.org_id = b.org_id
+                 INNER JOIN t_role c ON a.role_id = c.role_id
+        order by a.create_time desc;
+
+    </select>
+
+    <select id="querySysUserPage" resultMap="BaseResultMap">
+        select u.user_id,
+        u.user_name,
+        u.real_name,
+        u.org_id,
+        u.mobile_phone,
+        t.org_name,
+        u.role_id,
+        tr.role_name,
+        u.user_mail,
+        u.mobile_phone,
+        u.update_time,
+        u.is_enable
+        from t_user u
+        left join t_role tr on u.role_id = tr.role_id
+        left join t_org t on u.org_id = t.org_id
+        <where>
+            <if test="orgType == 'cur' or orgType == null or orgType == ''">
+                1=1
+                <if test="isEnabled != null and isEnabled != ''">
+                    and u.is_enable::varchar = #{isEnabled}
+                </if>
+                <if test="orgId != null and orgId != ''">
+                    and u.org_id = ${orgId}
+                </if>
+                <if test="userName != null and userName != ''">
+                    and u.user_name like '%${userName}%'
+                </if>
+                <if test="realName != null and realName != ''">
+                    and u.real_name like '%${realName}%'
+                </if>
+                <if test="roleId != null and roleId != ''">
+                    and u.role_id = ${roleId}
+                </if>
+                <if test="beginUpdateTime != null and beginUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) >= #{beginUpdateTime}
+                </if>
+                <if test="endUpdateTime != null and endUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) <![CDATA[ <= ]]> #{endUpdateTime}
+                </if>
+            </if>
+            <if test="orgType == 'all'">
+                u.org_id in (WITH RECURSIVE subordinates AS (
+                SELECT org_id
+                FROM t_org
+                <where>
+                    <if test="orgId != null and orgId != ''">
+                        and org_id = ${orgId}
+                    </if>
+                </where>
+                UNION
+                SELECT e.org_id
+                FROM t_org e
+                INNER JOIN subordinates s ON s.org_id = e.parent_org_id
+                )
+                SELECT *
+                FROM subordinates)
+                <if test="isEnabled != null and isEnabled != ''">
+                    and u.is_enable::varchar = #{isEnabled}
+                </if>
+                <if test="userName != null and userName != ''">
+                    and u.user_name like '%${userName}%'
+                </if>
+                <if test="realName != null and realName != ''">
+                    and u.real_name like '%${realName}%'
+                </if>
+                <if test="roleId != null and roleId != ''">
+                    and u.role_id = ${roleId}
+                </if>
+                <if test="beginUpdateTime != null and beginUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) >= #{beginUpdateTime}
+                </if>
+                <if test="endUpdateTime != null and endUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) <![CDATA[ <= ]]> #{endUpdateTime}
+                </if>
+            </if>
+        </where>
+        order by u.update_time desc
+        limit #{pageSize} offset #{pageNum}
+    </select>
+
+    <select id="querySysUserPageCount" resultType="java.lang.Long">
+        select count(*) from (
+        select u.user_id,
+        u.user_name,
+        u.org_id,
+        u.mobile_phone,
+        t.org_name,
+        u.role_id,
+        tr.role_name,
+        u.update_time,
+        u.is_enable
+        from t_user u
+        left join t_role tr on u.role_id = tr.role_id
+        left join t_org t on u.org_id = t.org_id
+        <where>
+            <if test="orgType == 'cur' or orgType == null or orgType == ''">
+                1=1
+                <if test="isEnabled != null and isEnabled != ''">
+                    and u.is_enable::varchar = #{isEnabled}
+                </if>
+                <if test="orgId != null and orgId != ''">
+                    and u.org_id = ${orgId}
+                </if>
+                <if test="userName != null and userName != ''">
+                    and u.user_name like '%${userName}%'
+                </if>
+                <if test="realName != null and realName != ''">
+                    and u.real_name like '%${realName}%'
+                </if>
+                <if test="roleId != null and roleId != ''">
+                    and u.role_id = ${roleId}
+                </if>
+                <if test="beginUpdateTime != null and beginUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) >= #{beginUpdateTime}
+                </if>
+                <if test="endUpdateTime != null and endUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) <![CDATA[ <= ]]> #{endUpdateTime}
+                </if>
+            </if>
+            <if test="orgType == 'all'">
+                u.org_id in (WITH RECURSIVE subordinates AS (
+                SELECT org_id
+                FROM t_org
+                <where>
+                    <if test="orgId != null and orgId != ''">
+                        and org_id = ${orgId}
+                    </if>
+                </where>
+                UNION
+                SELECT e.org_id
+                FROM t_org e
+                INNER JOIN subordinates s ON s.org_id = e.parent_org_id
+                )
+                SELECT *
+                FROM subordinates)
+                <if test="isEnabled != null and isEnabled != ''">
+                    and u.is_enable::varchar = #{isEnabled}
+                </if>
+                <if test="userName != null and userName != ''">
+                    and u.user_name like '%${userName}%'
+                </if>
+                <if test="realName != null and realName != ''">
+                    and u.real_name like '%${realName}%'
+                </if>
+                <if test="roleId != null and roleId != ''">
+                    and u.role_id = ${roleId}
+                </if>
+                <if test="beginUpdateTime != null and beginUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) >= #{beginUpdateTime}
+                </if>
+                <if test="endUpdateTime != null and endUpdateTime != ''">
+                    and cast(u.update_time AS VARCHAR) <![CDATA[ <= ]]> #{endUpdateTime}
+                </if>
+            </if>
+        </where>
+        ) t
+
+    </select>
+
+    <select id="querySysUserByName" resultMap="BaseResultMap">
+        SELECT *
+        from t_user a
+        where user_name = #{userName}
+    </select>
+
+    <select id="queryLastLoginTimeByUserName" resultType="java.lang.String">
+        select operation_time
+        from t_operation_log
+        where operation_user = #{userName}
+        order by operation_time desc limit 1
+    </select>
+</mapper>

+ 81 - 0
swismp-api/pom.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.sunwin</groupId>
+        <artifactId>swismp</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <groupId>com.sunwin.swismp</groupId>
+    <artifactId>swismp-api</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>swismp-api</name>
+    <description>swismp-api</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.sunwin.swismp</groupId>
+            <artifactId>swismp-base</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!--json-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.47</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>2.2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.webjars.npm/md5 -->
+        <dependency>
+            <groupId>org.webjars.npm</groupId>
+            <artifactId>md5</artifactId>
+            <version>2.2.1</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>2.12.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5.6</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.9</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 136 - 0
swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysMenu.java

@@ -0,0 +1,136 @@
+package com.sunwin.swismp.bean.sysfunction;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class SysMenu implements Serializable {
+    private Integer menuId;
+
+    private String menuName;
+
+    private Integer displayOrder;
+
+    private Integer parentMenuId;
+
+    private String linkUrl;
+
+    private String imageUrl;
+
+    private String bz;
+    /** 资源类型 : 资源类型:1:菜单  2:页面  3:按钮 */
+    private Integer resourceType;
+    /** 层级*/
+    private Integer menuLevel;
+
+    /** 是否可用*/
+    private Integer isEnable;
+
+    /** 创建时间*/
+    private Date createTime;
+
+    /** 更新时间*/
+    private Date updateTime;
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public String getMenuName() {
+        return menuName;
+    }
+
+    public void setMenuName(String menuName) {
+        this.menuName = menuName == null ? null : menuName.trim();
+    }
+
+    public Integer getDisplayOrder() {
+        return displayOrder;
+    }
+
+    public void setDisplayOrder(Integer displayOrder) {
+        this.displayOrder = displayOrder;
+    }
+
+    public Integer getParentMenuId() {
+        return parentMenuId;
+    }
+
+    public void setParentMenuId(Integer parentMenuId) {
+        this.parentMenuId = parentMenuId;
+    }
+
+    public String getLinkUrl() {
+        return linkUrl;
+    }
+
+    public void setLinkUrl(String linkUrl) {
+        this.linkUrl = linkUrl == null ? null : linkUrl.trim();
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl == null ? null : imageUrl.trim();
+    }
+
+    public Integer getResourceType() {
+        return resourceType;
+    }
+
+    public void setResourceType(Integer resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    public String getBz() {
+        return bz;
+    }
+
+    public void setBz(String bz) {
+        this.bz = bz == null ? null : bz.trim();
+    }
+
+    public Integer getIsEnable() {
+        return isEnable;
+    }
+
+    public void setIsEnable(Integer isEnable) {
+        this.isEnable = isEnable;
+    }
+
+    public Integer getMenuLevel() {
+        return menuLevel;
+    }
+
+    public void setMenuLevel(Integer menuLevel) {
+        this.menuLevel = menuLevel;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public SysMenu() {
+    }
+}

+ 97 - 0
swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysOperationLog.java

@@ -0,0 +1,97 @@
+package com.sunwin.swismp.bean.sysfunction;
+
+import java.io.Serializable;
+
+public class SysOperationLog implements Serializable {
+
+    private Integer operationId;
+
+    private String operationName;
+
+    private String operationContent;
+
+    private String operationTime;
+
+    private String operationUser;
+
+    private String operator;
+
+    private String operationModule;
+
+    public SysOperationLog() {
+    }
+
+    public SysOperationLog(String operationUser, String operator) {
+        this.operationUser = operationUser;
+        this.operator = operator;
+    }
+
+    public SysOperationLog(String operationName, String operationTime, String operationUser, String operator) {
+        this.operationName = operationName;
+        this.operationTime = operationTime;
+        this.operationUser = operationUser;
+        this.operator = operator;
+    }
+
+    public SysOperationLog(String operationName, String operationTime, String operationUser) {
+        this.operationName = operationName;
+        this.operationTime = operationTime;
+        this.operationUser = operationUser;
+    }
+
+    public String getOperationModule() {
+        return operationModule;
+    }
+
+    public void setOperationModule(String operationModule) {
+        this.operationModule = operationModule;
+    }
+
+    public Integer getOperationId() {
+        return operationId;
+    }
+
+    public void setOperationId(Integer operationId) {
+        this.operationId = operationId;
+    }
+
+    public String getOperationName() {
+        return operationName;
+    }
+
+    public void setOperationName(String operationName) {
+        this.operationName = operationName == null ? null : operationName.trim();
+    }
+
+    public String getOperationContent() {
+        return operationContent;
+    }
+
+    public void setOperationContent(String operationContent) {
+        this.operationContent = operationContent == null ? null : operationContent.trim();
+    }
+
+    public String getOperationTime() {
+        return operationTime;
+    }
+
+    public void setOperationTime(String operationTime) {
+        this.operationTime = operationTime;
+    }
+
+    public String getOperationUser() {
+        return operationUser;
+    }
+
+    public void setOperationUser(String operationUser) {
+        this.operationUser = operationUser == null ? null : operationUser.trim();
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator == null ? null : operator.trim();
+    }
+}

+ 117 - 0
swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysOrg.java

@@ -0,0 +1,117 @@
+package com.sunwin.swismp.bean.sysfunction;
+
+import java.io.Serializable;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swismp.bean.sysfunction
+ * FileName: SysOrg
+ *
+ * @author duanmin
+ * @description
+ * @created 2/11/2022 - 5:17 PM
+ * @last Modified
+ * @history
+ */
+public class SysOrg implements Serializable {
+    private Integer orgId;
+    private String orgName;
+    private Integer parentOrgId;
+    private Integer orgOrder;
+    private String orgLeader;
+    private String orgLeaderPhone;
+    private String orgAddress;
+    private Integer isEnabled;
+    private Integer orgLevel;
+    private String createTime;
+    private String updateTime;
+
+    public Integer getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Integer orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public Integer getParentOrgId() {
+        return parentOrgId;
+    }
+
+    public Integer getOrgOrder() {
+        return orgOrder;
+    }
+
+    public void setOrgOrder(Integer orgOrder) {
+        this.orgOrder = orgOrder;
+    }
+
+    public Integer getOrgLevel() {
+        return orgLevel;
+    }
+
+    public void setOrgLevel(Integer orgLevel) {
+        this.orgLevel = orgLevel;
+    }
+
+    public void setParentOrgId(Integer parentOrgId) {
+        this.parentOrgId = parentOrgId;
+    }
+
+    public String getOrgLeader() {
+        return orgLeader;
+    }
+
+    public void setOrgLeader(String orgLeader) {
+        this.orgLeader = orgLeader;
+    }
+
+    public String getOrgLeaderPhone() {
+        return orgLeaderPhone;
+    }
+
+    public void setOrgLeaderPhone(String orgLeaderPhone) {
+        this.orgLeaderPhone = orgLeaderPhone;
+    }
+
+    public String getOrgAddress() {
+        return orgAddress;
+    }
+
+    public void setOrgAddress(String orgAddress) {
+        this.orgAddress = orgAddress;
+    }
+
+    public Integer getIsEnabled() {
+        return isEnabled;
+    }
+
+    public void setIsEnabled(Integer isEnabled) {
+        this.isEnabled = isEnabled;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 103 - 0
swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysRole.java

@@ -0,0 +1,103 @@
+package com.sunwin.swismp.bean.sysfunction;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description : 角色自身内容
+ * @Author : yangdong
+ * @Date : 2020/3/10 9:27
+*/
+public class SysRole implements Serializable {
+
+    /** 角色id*/
+    private Integer roleId;
+
+    /** 角色代码*/
+    private String roleCode;
+
+    /** 角色名称*/
+    private String roleName;
+
+    /** 角色描述*/
+    private String roleDescribe;
+
+    /** 是否可用*/
+    private Integer isEnable;
+
+    /** 创建时间*/
+    private Date createTime;
+
+    /** 更新时间*/
+    private Date updateTime;
+
+    private String bz;
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName == null ? null : roleName.trim();
+    }
+
+    public String getBz() {
+        return bz;
+    }
+
+    public void setBz(String bz) {
+        this.bz = bz == null ? null : bz.trim();
+    }
+
+    public String getRoleCode() {
+        return roleCode;
+    }
+
+    public void setRoleCode(String roleCode) {
+        this.roleCode = roleCode;
+    }
+
+    public String getRoleDescribe() {
+        return roleDescribe;
+    }
+
+    public void setRoleDescribe(String roleDescribe) {
+        this.roleDescribe = roleDescribe;
+    }
+
+    public Integer getIsEnable() {
+        return isEnable;
+    }
+
+    public void setIsEnable(Integer isEnable) {
+        this.isEnable = isEnable;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 76 - 0
swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysRoleMenu.java

@@ -0,0 +1,76 @@
+package com.sunwin.swismp.bean.sysfunction;
+
+import java.io.Serializable;
+
+/**
+ * @Description : 系统权限内容
+ * @Author : yangdong
+ * @Date : 2020/3/10 9:22
+*/
+public class SysRoleMenu implements Serializable {
+    //权限模块id
+    private Integer rolemenuId;
+    //模块id
+    private Integer menuId;
+    //权限id
+    private Integer roleId;
+    //是否可用
+    private Integer isenable;
+    //备注
+    private String bz;
+
+    public SysRoleMenu() {
+    }
+
+    public SysRoleMenu(Integer roleId, Integer menuId) {
+        this.roleId = roleId;
+        this.menuId = menuId;
+        this.isenable = this.isenable == null? 1:this.isenable;
+    }
+
+    public SysRoleMenu(Integer rolemenuId, Integer roleId, Integer menuId) {
+        this.rolemenuId = rolemenuId;
+        this.roleId = roleId;
+        this.menuId = menuId;
+    }
+
+    public Integer getRolemenuId() {
+        return rolemenuId;
+    }
+
+    public void setRolemenuId(Integer rolemenuId) {
+        this.rolemenuId = rolemenuId;
+    }
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    public Integer getIsenable() {
+        return isenable;
+    }
+
+    public void setIsenable(Integer isenable) {
+        this.isenable = isenable;
+    }
+
+    public String getBz() {
+        return bz;
+    }
+
+    public void setBz(String bz) {
+        this.bz = bz;
+    }
+}

+ 179 - 0
swismp-api/src/main/java/com/sunwin/swismp/bean/sysfunction/SysUser.java

@@ -0,0 +1,179 @@
+package com.sunwin.swismp.bean.sysfunction;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class SysUser implements Serializable {
+    private Integer userId;
+
+    private Integer orgId;
+
+    private String userName;
+
+    private Integer roleId;
+    private String roleName;
+
+    private String realName;
+
+    private String policeNo;
+
+    private String userPwd;
+
+    private String userPhone;
+
+    private String mobilePhone;
+
+    private String userMail;
+
+    private Integer isEnable;
+
+    private Date createTime;
+
+    private String createBy;
+
+    private Date updateTime;
+
+    private String updateBy;
+
+    private String roleCode;
+
+    public String getRoleCode() {
+        return roleCode;
+    }
+
+    public void setRoleCode(String roleCode) {
+        this.roleCode = roleCode;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Integer orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName == null ? null : userName.trim();
+    }
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName == null ? null : realName.trim();
+    }
+
+    public String getPoliceNo() {
+        return policeNo;
+    }
+
+    public void setPoliceNo(String policeNo) {
+        this.policeNo = policeNo == null ? null : policeNo.trim();
+    }
+
+    public String getUserPwd() {
+        return userPwd;
+    }
+
+    public void setUserPwd(String userPwd) {
+        this.userPwd = userPwd == null ? null : userPwd.trim();
+    }
+
+    public String getUserPhone() {
+        return userPhone;
+    }
+
+    public void setUserPhone(String userPhone) {
+        this.userPhone = userPhone == null ? null : userPhone.trim();
+    }
+
+    public String getMobilePhone() {
+        return mobilePhone;
+    }
+
+    public void setMobilePhone(String mobilePhone) {
+        this.mobilePhone = mobilePhone;
+    }
+
+    public String getUserMail() {
+        return userMail;
+    }
+
+    public void setUserMail(String userMail) {
+        this.userMail = userMail == null ? null : userMail.trim();
+    }
+
+    public Integer getIsEnable() {
+        return isEnable;
+    }
+
+    public void setIsEnable(Integer isEnable) {
+        this.isEnable = isEnable;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy == null ? null : createBy.trim();
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy == null ? null : updateBy.trim();
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+}

+ 39 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/Link.java

@@ -0,0 +1,39 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+import java.io.Serializable;
+
+public class Link implements Serializable {
+    private String source ;
+    private String target ;
+    private Integer value ;
+
+    public Link(String source, String target, Integer value) {
+        this.source = source;
+        this.target = target;
+        this.value = value;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public String getTarget() {
+        return target;
+    }
+
+    public void setTarget(String target) {
+        this.target = target;
+    }
+
+    public Integer getValue() {
+        return value;
+    }
+
+    public void setValue(Integer value) {
+        this.value = value;
+    }
+}

+ 35 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/LoginResult.java

@@ -0,0 +1,35 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class LoginResult implements Serializable {
+
+    private Integer userId;
+
+    private List<SysMenuResult> menus;
+
+    public LoginResult() {
+    }
+
+    public LoginResult(Integer userId, List<SysMenuResult> menus) {
+        this.userId = userId;
+        this.menus = menus;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public List<SysMenuResult> getMenus() {
+        return menus;
+    }
+
+    public void setMenus(List<SysMenuResult> menus) {
+        this.menus = menus;
+    }
+}

+ 29 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/Node.java

@@ -0,0 +1,29 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+import java.io.Serializable;
+
+public class Node implements Serializable {
+    private String name ;
+    private Integer value;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getValue() {
+        return value;
+    }
+
+    public void setValue(Integer value) {
+        this.value = value;
+    }
+
+    public Node(String name, Integer value) {
+        this.name = name;
+        this.value = value;
+    }
+}

+ 51 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysMenuDTO.java

@@ -0,0 +1,51 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysMenu;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description : 菜单数据集
+ * @Author : fengyong
+ * @Date : 2022/2/10 9:27
+ */
+public class SysMenuDTO extends SysMenu implements Serializable {
+    private String resourceTypeName;//资源类型 :菜单、页面 、按钮
+    private Integer childMenuCount;
+    private String parentMenuName;
+    private List<SysMenuDTO> childList;
+
+    public String getResourceTypeName() {
+        return resourceTypeName;
+    }
+
+    public void setResourceTypeName(String resourceTypeName) {
+        this.resourceTypeName = resourceTypeName;
+    }
+
+    public Integer getChildMenuCount() {
+        return childMenuCount;
+    }
+
+    public void setChildMenuCount(Integer childMenuCount) {
+        this.childMenuCount = childMenuCount;
+    }
+
+    public String getParentMenuName() {
+        return parentMenuName;
+    }
+
+    public void setParentMenuName(String parentMenuName) {
+        this.parentMenuName = parentMenuName;
+    }
+
+    public List<SysMenuDTO> getChildList() {
+        return childList;
+    }
+
+    public void setChildList(List<SysMenuDTO> childList) {
+        this.childList = childList;
+    }
+}

+ 103 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysMenuResult.java

@@ -0,0 +1,103 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysMenu;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class SysMenuResult implements Serializable {
+
+    private Integer menuId;
+
+    private String menuName;
+
+    private Integer parentMenuId;
+
+    private String linkUrl;
+
+    private String imageUrl;
+
+    private String bz;
+
+    private List<SysMenuResult> childMenus;
+
+    public SysMenuResult() {
+    }
+
+    public SysMenuResult(SysMenu sysMenu) {
+        this.menuId = sysMenu.getMenuId();
+        this.menuName = sysMenu.getMenuName();
+        this.parentMenuId = sysMenu.getParentMenuId();
+        this.linkUrl = sysMenu.getLinkUrl();
+        this.imageUrl = sysMenu.getImageUrl();
+        this.bz = sysMenu.getBz();
+    }
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public String getMenuName() {
+        return menuName;
+    }
+
+    public void setMenuName(String menuName) {
+        this.menuName = menuName;
+    }
+
+    public Integer getParentMenuId() {
+        return parentMenuId;
+    }
+
+    public void setParentMenuId(Integer parentMenuId) {
+        this.parentMenuId = parentMenuId;
+    }
+
+    public String getLinkUrl() {
+        return linkUrl;
+    }
+
+    public void setLinkUrl(String linkUrl) {
+        this.linkUrl = linkUrl;
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getBz() {
+        return bz;
+    }
+
+    public void setBz(String bz) {
+        this.bz = bz;
+    }
+
+    public List<SysMenuResult> getChildMenus() {
+        return childMenus;
+    }
+
+    public void setChildMenus(List<SysMenuResult> childMenus) {
+        this.childMenus = childMenus;
+    }
+
+    public SysMenuResult addChildMenu(SysMenuResult menu) {
+        if (this.childMenus == null) {
+            this.childMenus = new ArrayList<>();
+        }
+        if (menu != null) {
+            this.childMenus.add(menu);
+        }
+        return this;
+    }
+}

+ 30 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysOperationLogDTO.java

@@ -0,0 +1,30 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysOperationLog;
+
+import java.io.Serializable;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swurtmp.dto.sysfunction
+ * FileName: SysOperationLogDTO
+ *
+ * @author duanmin
+ * @description
+ * @created 2022/2/25 - 13:59
+ * @last Modified
+ * @history
+ */
+public class SysOperationLogDTO extends SysOperationLog implements Serializable {
+    private String roleName;
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+}

+ 58 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysOrgDTO.java

@@ -0,0 +1,58 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysOrg;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swurtmp.dto.sysfunction
+ * FileName: SysOrgDTO
+ *
+ * @author duanmin
+ * @description
+ * @created 2/11/2022 - 5:24 PM
+ * @last Modified
+ * @history
+ */
+public class SysOrgDTO extends SysOrg implements Serializable {
+    private Integer curOrgUserCount;
+    private Integer childOrgCount;
+    private String parentOrgName;
+    private List<SysOrgDTO> childList;
+
+    public Integer getCurOrgUserCount() {
+        return curOrgUserCount;
+    }
+
+    public void setCurOrgUserCount(Integer curOrgUserCount) {
+        this.curOrgUserCount = curOrgUserCount;
+    }
+
+    public Integer getChildOrgCount() {
+        return childOrgCount;
+    }
+
+    public void setChildOrgCount(Integer childOrgCount) {
+        this.childOrgCount = childOrgCount;
+    }
+
+    public String getParentOrgName() {
+        return parentOrgName;
+    }
+
+    public void setParentOrgName(String parentOrgName) {
+        this.parentOrgName = parentOrgName;
+    }
+
+    public List<SysOrgDTO> getChildList() {
+        return childList;
+    }
+
+    public void setChildList(List<SysOrgDTO> childList) {
+        this.childList = childList;
+    }
+}

+ 22 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysRoleDTO.java

@@ -0,0 +1,22 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysRole;
+
+import java.io.Serializable;
+/**
+ * @Description : 角色数据集
+ * @Author : fengyong
+ * @Date : 2022/2/10 9:27
+ */
+public class SysRoleDTO extends SysRole implements Serializable {
+    private Integer userNum;//角色用户数据量
+
+    public Integer getUserNum() {
+        return userNum;
+    }
+
+    public void setUserNum(Integer userNum) {
+        this.userNum = userNum;
+    }
+}

+ 133 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysRoleMenuPermissions.java

@@ -0,0 +1,133 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 系统角色菜单权限结果集
+ * @Author: fengyong
+ * @CreateDate: 2019/7/12
+ * @Remark:
+ * @Version: 1.0
+ */
+public class SysRoleMenuPermissions implements Serializable {
+    private Integer roleId;
+    //一级菜单
+    private Integer oneMenuId;
+    private String oneMenuName;
+    private Integer oneDisplayOrder;
+    private Integer oneIsShown;
+    //二级菜单
+    private Integer twoMenuId;
+    private String twoMenuName;
+    private Integer twoDisplayOrder;
+    private Integer twoIsShown;
+    //三级菜单
+    private Integer threeMenuId;
+    private String threeMenuName;
+    private Integer threeDisplayOrder;
+    private Integer threeIsShown;
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    public Integer getOneMenuId() {
+        return oneMenuId;
+    }
+
+    public void setOneMenuId(Integer oneMenuId) {
+        this.oneMenuId = oneMenuId;
+    }
+
+    public String getOneMenuName() {
+        return oneMenuName;
+    }
+
+    public void setOneMenuName(String oneMenuName) {
+        this.oneMenuName = oneMenuName;
+    }
+
+    public Integer getOneDisplayOrder() {
+        return oneDisplayOrder;
+    }
+
+    public void setOneDisplayOrder(Integer oneDisplayOrder) {
+        this.oneDisplayOrder = oneDisplayOrder;
+    }
+
+    public Integer getOneIsShown() {
+        return oneIsShown;
+    }
+
+    public void setOneIsShown(Integer oneIsShown) {
+        this.oneIsShown = oneIsShown;
+    }
+
+    public Integer getTwoMenuId() {
+        return twoMenuId;
+    }
+
+    public void setTwoMenuId(Integer twoMenuId) {
+        this.twoMenuId = twoMenuId;
+    }
+
+    public String getTwoMenuName() {
+        return twoMenuName;
+    }
+
+    public void setTwoMenuName(String twoMenuName) {
+        this.twoMenuName = twoMenuName;
+    }
+
+    public Integer getTwoDisplayOrder() {
+        return twoDisplayOrder;
+    }
+
+    public void setTwoDisplayOrder(Integer twoDisplayOrder) {
+        this.twoDisplayOrder = twoDisplayOrder;
+    }
+
+    public Integer getTwoIsShown() {
+        return twoIsShown;
+    }
+
+    public void setTwoIsShown(Integer twoIsShown) {
+        this.twoIsShown = twoIsShown;
+    }
+
+    public Integer getThreeMenuId() {
+        return threeMenuId;
+    }
+
+    public void setThreeMenuId(Integer threeMenuId) {
+        this.threeMenuId = threeMenuId;
+    }
+
+    public String getThreeMenuName() {
+        return threeMenuName;
+    }
+
+    public void setThreeMenuName(String threeMenuName) {
+        this.threeMenuName = threeMenuName;
+    }
+
+    public Integer getThreeDisplayOrder() {
+        return threeDisplayOrder;
+    }
+
+    public void setThreeDisplayOrder(Integer threeDisplayOrder) {
+        this.threeDisplayOrder = threeDisplayOrder;
+    }
+
+    public Integer getThreeIsShown() {
+        return threeIsShown;
+    }
+
+    public void setThreeIsShown(Integer threeIsShown) {
+        this.threeIsShown = threeIsShown;
+    }
+}

+ 39 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysUserDTO.java

@@ -0,0 +1,39 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+
+import java.io.Serializable;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swismp.dto.sysfunction
+ * FileName: SysUserDTO
+ *
+ * @author duanmin
+ * @description
+ * @created 2/17/2022 - 11:47 AM
+ * @last Modified
+ * @history
+ */
+public class SysUserDTO extends SysUser implements Serializable {
+    private String orgName;
+    private String lastLoginTime;
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public String getLastLoginTime() {
+        return lastLoginTime;
+    }
+
+    public void setLastLoginTime(String lastLoginTime) {
+        this.lastLoginTime = lastLoginTime;
+    }
+}

+ 62 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysUserManage.java

@@ -0,0 +1,62 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+* @Description:系统用户信息查询结果
+* @Author: zc
+* @CreateDate: 2018/11/16 13:13
+* @Remark:
+* @Version: 1.0
+*/
+public class SysUserManage extends SysUser implements Serializable {
+
+    //部门名称
+    private String orgName;
+
+    //角色名称
+    private String roleName;
+
+    //最近一次登录名称
+    private Date lastLoginTime;
+
+    //是否启用
+    private String isEnableStr;
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    public Date getLastLoginTime() {
+        return lastLoginTime;
+    }
+
+    public void setLastLoginTime(Date lastLoginTime) {
+        this.lastLoginTime = lastLoginTime;
+    }
+
+    public String getIsEnableStr() {
+        return isEnableStr;
+    }
+
+    public void setIsEnableStr(String isEnableStr) {
+        this.isEnableStr = isEnableStr;
+    }
+}

+ 50 - 0
swismp-api/src/main/java/com/sunwin/swismp/dto/sysfunction/SysUserOrg.java

@@ -0,0 +1,50 @@
+package com.sunwin.swismp.dto.sysfunction;
+
+import java.io.Serializable;
+
+public class SysUserOrg implements Serializable {
+    /** 管理员角色code */
+    private static final String ADMIN_ROLE_CODE = "10001";
+    private Integer userId;//用户id
+    private Integer orgId;//部门id
+    private String roleCode;//角色编号
+    public Integer getUserId() {
+        return userId;
+    }
+
+    /**
+     * 判断是否管理员
+     */
+    public boolean isAdmin(){
+        return ADMIN_ROLE_CODE.equals(this.roleCode);
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Integer orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getRoleCode() {
+        return roleCode;
+    }
+
+    public void setRoleCode(String roleCode) {
+        this.roleCode = roleCode;
+    }
+
+    public SysUserOrg(Integer userId, Integer orgId, String roleId) {
+        this.userId = userId;
+        this.orgId = orgId;
+        this.roleCode = roleId;
+    }
+
+    public SysUserOrg() {
+    }
+}

+ 23 - 0
swismp-api/src/main/java/com/sunwin/swismp/exception/SwismpBizException.java

@@ -0,0 +1,23 @@
+package com.sunwin.swismp.exception;
+
+
+/**
+ * <br>
+ * Copyright (c) 1/8/2020 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swismp.exception <br>
+ * FileName: ELPBizException <br>
+ * <br>
+ * 业务异常统一处理类
+ *
+ * @author duanmin
+ * @created 1/8/2020-10:29 AM
+ * @last Modified
+ * @history
+ */
+public class SwismpBizException extends Exception {
+
+    public SwismpBizException(String message) {
+        super(message);
+    }
+}

+ 68 - 0
swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysMenuService.java

@@ -0,0 +1,68 @@
+package com.sunwin.swismp.service.sysfunction;
+
+
+import com.sunwin.swismp.bean.TreeNode;
+import com.sunwin.swismp.bean.sysfunction.SysMenu;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysMenuDTO;
+import com.sunwin.swismp.dto.sysfunction.SysMenuResult;
+
+import java.util.List;
+
+public interface SysMenuService {
+
+    /**
+     * 查询角色能看到的菜单
+     * @param roleId
+     * @return
+     */
+    List<SysMenuResult> selectByRoleId(Integer roleId);
+    /**
+     * 用户id对应的菜单
+     * @param userId
+     * @return
+     */
+    List<SysMenuResult> selectByUserId(Integer userId);
+
+    /**
+     * 菜单明细
+     * @param menuId
+     * @return
+     */
+    SysMenuDTO selectMenuById(Integer menuId);
+
+    /**
+     * 查询次级菜单列表
+     * @param menuId
+     * @return
+     */
+    PageResult queryMenuSecondary(Integer menuId,
+                                  Integer resourceType, Integer isEnable, String keywords,
+                                  Integer pageNum, Integer pageSize);
+
+    /**
+     * 保存系统资源信息(新增、修改)
+     * @param sysMenu
+     * @return
+     */
+    HttpResult menuSave(SysMenu sysMenu);
+
+    /**
+     * 修改启用状态
+     * @param sysMenu
+     * @return
+     */
+    Integer updateEnabled(SysMenu sysMenu);
+    /**
+     * @Description : 删除资源
+     * @Return :
+     */
+    Integer deleteMenu(Integer menuId);
+
+    /**
+     * @Description : 系统资源菜单树
+     * @Return :
+     */
+    List<TreeNode> sysMenuTree();
+}

+ 18 - 0
swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysOperationLogService.java

@@ -0,0 +1,18 @@
+package com.sunwin.swismp.service.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysOperationLog;
+import com.sunwin.swismp.dto.PageResult;
+
+public interface SysOperationLogService {
+    /**
+     * 插入操作日志
+     * @param log
+     * @return
+     */
+    int insertOperationLog(SysOperationLog log);
+
+
+    PageResult querySysLogPage(String moduleName, String operateName, String roleId, String beginOperateTime,
+                               String endOperateTime, Integer pageNum, Integer pageSize);
+}

+ 37 - 0
swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysOrgService.java

@@ -0,0 +1,37 @@
+package com.sunwin.swismp.service.sysfunction;
+
+
+import com.sunwin.swismp.bean.TreeNode;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysOrgDTO;
+
+import java.util.List;
+
+/**
+ * Copyright (c) 12/20/2021 All Rights Reserved By SUNWIN
+ * <p>
+ * Package: com.sunwin.swurtmp.service.sysfunction
+ * FileName: SysOrgService
+ *
+ * @author duanmin
+ * @description
+ * @created 2/11/2022 - 5:25 PM
+ * @last Modified
+ * @history
+ */
+public interface SysOrgService {
+    Integer addSysOrg(SysOrgDTO sysOrgDTO);
+
+    Integer delSysOrg(Integer id);
+
+    Integer editSysOrg(SysOrgDTO sysOrgDTO);
+
+    Integer enableSysOrg(Integer sysOrgId, Integer enabled);
+
+    PageResult querySysOrgPage(String parentOrgId, String orgUserNum, String isEnabled, String keywords,
+                               String beginUpdateTime, String endUpdateTime, Integer pageNum, Integer pageSize);
+
+    List<TreeNode> sysOrgTree();
+
+    SysOrgDTO viewSysOrg(String sysOrgId);
+}

+ 22 - 0
swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysRoleMenuPermissionsService.java

@@ -0,0 +1,22 @@
+package com.sunwin.swismp.service.sysfunction;
+
+import java.util.Map;
+
+/**
+ * @Description: 系统角色菜单权限接口
+ * @Author: fengyong
+ * @CreateDate: 2019/7/12
+ * @Remark:
+ * @Version: 1.0
+ */
+public interface SysRoleMenuPermissionsService {
+    /**
+     * @Description : 查询权限信息
+     * @param roleId
+     * @param type
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:12
+     */
+    Map selectByRoleId(Integer roleId, String type);//type : all查询全部 ; self 查询已有的
+}

+ 55 - 0
swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysRoleService.java

@@ -0,0 +1,55 @@
+package com.sunwin.swismp.service.sysfunction;
+
+
+
+import com.sunwin.swismp.bean.sysfunction.SysRole;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.sysfunction.SysRoleDTO;
+
+import java.util.List;
+
+public interface SysRoleService {
+
+
+    /**
+     * 删除角色 根据id
+     * @param roleId
+     * @return
+     */
+    int deleteRoleByRoleId(Integer roleId);
+
+    /**
+     * 查询所有角色
+     * @return
+     */
+    List<SysRole> selectAll();
+
+    /**
+     *  分页-条件查询
+     * @param roleName
+     * @param roleCode
+     * @param isEnable
+     * @param page
+     * @param size
+     * @return
+     */
+     List<SysRoleDTO> selectPage(String roleName, String roleCode, Integer isEnable, String keywords, Integer page, Integer size);
+     Integer selectPageCount(String roleName, String roleCode, Integer isEnable,String keywords);
+
+    /**
+     * 保存角色信息(新增、修改)
+     * @param sysRole
+     * @return
+     */
+    HttpResult roleSave(SysRole sysRole);
+
+    /**
+     * 修改角色菜单对应关系
+     * @param roleId
+     * @param menuIds
+     * @return
+     */
+     boolean updateRoleMenu(Integer roleId, List<Integer> menuIds);
+
+    List<SysRole> selectAllByRoleCode(String roleCode);
+}

+ 175 - 0
swismp-api/src/main/java/com/sunwin/swismp/service/sysfunction/SysUserService.java

@@ -0,0 +1,175 @@
+package com.sunwin.swismp.service.sysfunction;
+
+
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+import com.sunwin.swismp.dto.HttpResult;
+import com.sunwin.swismp.dto.PageResult;
+import com.sunwin.swismp.dto.sysfunction.SysUserDTO;
+import com.sunwin.swismp.dto.sysfunction.SysUserManage;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SysUserService {
+    /**
+     * 验证码存储到redis
+     * @param key
+     * @param value
+     * @param codeTimeOut  验证码过期时间,分钟
+     */
+     void setCodeRedis(String key, String value, Integer codeTimeOut);
+
+    /**
+     * 根据用户名查询用户内容
+     * @param userName
+     * add by fengyong
+     * @return
+     */
+    SysUser queryUserByName(String userName);
+    SysUser queryUserById(Integer userId);
+    SysUser queryUserByTelephone(String telephone);
+    /**
+     * 添加用户
+     * @param user
+     * @return
+     */
+    HttpResult addUser(SysUser user);
+
+    Map queryUserOrgRoleView();
+
+    /**
+     * 登陆
+     * @param userName
+     * @param userPwd
+     * @return
+     */
+    Map login(String userName, String userPwd, String vCode);
+    /**
+     * 更新用户信息
+     * @param user
+     * @return
+     */
+    HttpResult updateUser(SysUser user);
+    /**
+     * 更新用户密码
+     * @param userId
+     * @param newPwd
+     * @param oldPwd
+     * @return
+     */
+    int updatePwd(Integer userId, String newPwd, String oldPwd);
+    /**
+     * 删除用户
+     * @param userId
+     * @return
+     */
+    int deleteUser(Integer userId);
+    /**
+     * 注销,暂停用户
+     * @param userId
+     * @return
+     */
+    int logoff(Integer userId);
+    /**
+     * 启用用户
+     * @param userId
+     * @param enabled
+     * @return
+     */
+    int enableUser(Integer userId, Integer enabled);
+    /**
+     * 查询所有系统用户管理信息
+     * @return
+     */
+    List<SysUserManage> selectAllUserManage(String param, Integer pageNo, Integer pageSize, Integer orgId);
+    /**
+     * 查询指定用户管理信息
+     * @return
+     */
+    SysUserManage selectUserManageById(Integer userId);
+    /**
+     * @Description : 多条件查询用户信息
+     * @param userName  名字
+     * @param phone  电话
+     * @param email 邮箱
+     * @param pageNo 第几页
+     * @param pageSize 每页条数
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/9 17:14
+     */
+    List<SysUserManage> selectUserManageByParams(String userName, String phone, String email, Integer pageNo, Integer pageSize, Integer orgId);
+    /**
+     * @Description : 根据用户姓名 手机号  邮箱 返回用户编号
+     * @param userName
+     * @param phone
+     * @param email
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:16
+     */
+    Integer selectUserManageByParamsCount(String userName, String phone, String email, Integer orgId);
+    /**
+     * @Description : 查询用户所有信息数
+     * @param param
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/2/28 15:17
+     */
+    Integer selectAllUserManageCount(String param, Integer orgId);
+    /**
+     * 重置用户密码
+     * @param userId
+     * @param newPwd
+     * @return
+     */
+    int resetPwd(Integer userId, String newPwd);
+    /**
+     * 用户修改电话号码
+     *
+     * @param newTelephone
+     * @param userId
+     * @return
+     */
+    boolean updateTelephone(Integer userId, String newTelephone);
+    //TODO: 暂时不用验证码
+    //boolean updateTelephone(Integer userId, String newTelephone, String newCode);
+    /**
+     * 用户修改邮箱
+     *
+     * @param userId
+     * @param email
+     * @return
+     */
+    boolean updateEmail(Integer userId, String email);
+
+    /**
+     * @Description : 更新该ip的连续登录失败次数   如果 连续超过5次 则直接锁定
+     * @param userName
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/9/25 16:08
+     * @return
+    */
+    Map<String,String> updateFailCount(String userName);
+    /**
+     * @Description : 检查是否是锁定状态
+     * @param userName
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/9/25 16:09
+    */
+    Boolean lock(String userName);
+
+    void unlock(String userName);
+
+    Integer addSysUser(SysUserDTO sysUserDTO);
+
+    PageResult querySysUserPage(Integer orgId, String orgType, String roleId, String realName, String isEnabled,
+                                String userName, String beginUpdateTime, String endUpdateTime, Integer pageNum,
+                                Integer pageSize);
+
+    SysUserDTO userView(Integer userId);
+
+    Integer editUser(SysUser user);
+}

+ 727 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/ChartUtil.java

@@ -0,0 +1,727 @@
+package com.sunwin.swismp.util;
+
+import com.sunwin.swismp.constant.ChartsParam;
+import com.sunwin.swismp.dto.ChartsResult;
+//import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
+//import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * <br>
+ * Copyright (c) 2019/9/18 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swbd.utils <br>
+ * FileName: ChartUtil <br>
+ * <br>
+ * 图表操作工具类。
+ *
+ * @author duanmin
+ * @created 2019/9/18 18:13
+ * @last Modified
+ * @history
+ */
+public class ChartUtil {
+    /**
+     * 简单直方图
+     */
+    public static final Integer HISTOGRAM_CHART = 0;
+    /**
+     * 饼图
+     */
+    public static final Integer PIE_CHART = 1;
+    /**
+     * 全国区域名称列表
+     */
+    public static final String[] AREA_NAMES = new String[]{"江苏", "北京", "天津", "上海", "重庆", "河北", "河南", "云南", "辽宁", "黑龙江", "湖南", "安徽", "山东", "新疆", "浙江", "江西", "湖北",
+            "广西", "甘肃", "山西", "内蒙古", "陕西", "吉林", "福建", "贵州", "广东", "青海", "西藏", "四川", "宁夏", "海南", "台湾", "香港", "澳门"};
+
+    private static Logger logger = Logger.getLogger("ChartUtil");
+
+    /**
+     * 封装name 、value结果
+     *
+     * @param name
+     * @param value
+     * @param ratio
+     * @param data
+     */
+    public static void setMapList(String name, Object value, String ratio, List<Map<String, Object>> data) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("name", name);
+        map.put("value", value);
+        if (ratio != null) {
+            map.put("ratio", ratio + "%");
+        }
+        data.add(map);
+    }
+
+    /**
+     * 处理查询的图表结果参数,比如折线图,如果结果包括两条线的结果
+     * 则需要对两个结果的x轴进行补齐,并且给y轴补齐
+     *
+     * @param resList
+     * @return
+     */
+    public static ChartsResult makeChartResult(List<ChartsParam> resList) {
+        if (resList == null || resList.isEmpty()) {
+            return new ChartsResult();
+        }
+        String title = null;
+        //初始化与legend数量相同的map,x轴并集去重
+        Map<String, Map> maps = new LinkedHashMap<>();
+        Set<String> xSet = new LinkedHashSet<>();
+        for (ChartsParam param : resList) {
+            if (title == null) {
+                title = param.getTitle();
+            }
+            xSet.add(param.getxAxis());
+            if (!maps.containsKey(param.getLegend())) {
+                Map map = new LinkedHashMap();
+                map.put(param.getxAxis(), param.getyAxis());
+                maps.put(param.getLegend(), map);
+            } else {
+                if (!maps.get(param.getLegend()).containsKey(param.getxAxis())) {
+                    maps.get(param.getLegend()).put(param.getxAxis(), param.getyAxis());
+                }
+            }
+        }
+        //如果legend只有一个,无需补全
+        if (maps.keySet().size() == 1) {
+            ChartsResult chartsResult = new ChartsResult();
+            List<String> legend = new ArrayList<>();
+            List<String> xList = new ArrayList<>();
+            List yList = new ArrayList();
+            legend.add(TimeUtils.dateFormat(resList.get(0).getLegend(), TimeUtils.YYYYMMDD, TimeUtils.YYYY_MM_DD));
+            for (ChartsParam param : resList) {
+                xList.add(param.getxAxis());
+                yList.add(param.getyAxis());
+            }
+            chartsResult.setLegend(legend);
+            chartsResult.setCategory(xList);
+            chartsResult.setData(yList);
+            chartsResult.setTitle(title);
+            return chartsResult;
+        }
+        //构造x轴,重新排序
+        List<String> xList = new ArrayList();
+        Iterator<String> it = xSet.iterator();
+        while (it.hasNext()) {
+            xList.add(it.next());
+        }
+        Collections.sort(xList);
+        //构造y轴数据,根据x轴数据补全,没有的补null
+        List<List> yList = new ArrayList<>();
+        List<String> legend = new ArrayList<>();
+        for (String key : maps.keySet()) {
+            legend.add(key);
+            List list = new ArrayList();
+            for (String x : xList) {
+                if (!maps.get(key).containsKey(x)) {
+                    //如果对应的数值没有,用null补全
+                    list.add(0);
+                } else {
+                    list.add(maps.get(key).get(x));
+                }
+            }
+            yList.add(list);
+        }
+        ChartsResult chartsResult = new ChartsResult();
+        chartsResult.setLegend(legend);
+        chartsResult.setCategory(xList);
+        chartsResult.setData(yList);
+        if (title != null) {
+            chartsResult.setTitle(title);
+        }
+        return chartsResult;
+    }
+
+
+    /**
+     * 处理查询的图表结果参数,比如折线图,如果结果包括两条线的结果
+     * 则需要对两个结果的x轴进行补齐,并且给y轴补齐
+     *
+     * @param resList
+     * @param beginDate
+     * @param endDate
+     * @param dayOrMonthOrHour
+     * @return
+     */
+    public static ChartsResult makeChartResultByBeginEndDate(List<ChartsParam> resList, String beginDate, String endDate, Integer dayOrMonthOrHour) {
+        if (CollectionUtils.isEmpty(resList)) {
+            return new ChartsResult();
+        }
+        String title = null;
+        //初始化与legend数量相同的map,x轴并集去重
+        Map<String, Map> maps = new LinkedHashMap<>();
+        maps.put("早高峰", new LinkedHashMap());
+        maps.put("晚高峰", new LinkedHashMap());
+        maps.put("平峰", new LinkedHashMap());
+
+        for (ChartsParam param : resList) {
+            if (title == null) {
+                title = param.getTitle();
+            }
+            if (StringUtils.isEmpty(param.getLegend())) {
+                maps.clear();
+                continue;
+            }
+            if (!maps.get(param.getLegend()).containsKey(param.getxAxis())) {
+                maps.get(param.getLegend()).put(param.getxAxis(), param.getyAxis());
+            }
+        }
+        //构造x轴,重新排序
+        List<String> xList = getBeginEndDateList(beginDate, endDate, dayOrMonthOrHour);
+
+        //构造y轴数据,根据x轴数据补全,没有的补null
+        ChartsResult chartsResult = getChartsResult(maps, xList);
+        if (title != null) {
+            chartsResult.setTitle(title);
+        }
+        return chartsResult;
+    }
+
+    /**
+     * @param maps
+     * @param xList
+     * @return
+     */
+    private static ChartsResult getChartsResult(Map<String, Map> maps, List<String> xList) {
+        List<List> yList = new ArrayList<>();
+        List<String> legend = new ArrayList<>();
+        for (Map.Entry<String, Map> entry : maps.entrySet()) {
+            String key = entry.getKey();
+            Map value = entry.getValue();
+            legend.add(key);
+            List list = new ArrayList();
+            for (String x : xList) {
+                if (!value.containsKey(x)) {
+                    //如果对应的数值没有,用null补全
+                    list.add(0);
+                } else {
+                    list.add(value.get(x));
+                }
+            }
+            yList.add(list);
+        }
+        ChartsResult chartsResult = new ChartsResult();
+        chartsResult.setLegend(legend);
+        chartsResult.setCategory(xList);
+        chartsResult.setData(yList);
+        return chartsResult;
+    }
+
+    /**
+     * @param beginDate
+     * @param endDate
+     * @param dayOrMonthOrHour
+     * @return
+     */
+    private static List<String> getBeginEndDateList(String beginDate, String endDate, Integer dayOrMonthOrHour) {
+        List<String> xList = new ArrayList();
+        Calendar beginCalendar = Calendar.getInstance();
+        Calendar endCalendar = Calendar.getInstance();
+        if (dayOrMonthOrHour == 1) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
+            try {
+                beginCalendar.setTime(format.parse(beginDate));
+                endCalendar.setTime(format.parse(endDate));
+                Calendar tempCalendar = beginCalendar;
+                do {
+                    xList.add(format1.format(tempCalendar.getTime()));
+                    tempCalendar.add(Calendar.DATE, 1);
+                } while (tempCalendar.before(endCalendar) || tempCalendar.equals(endCalendar));
+            } catch (ParseException e) {
+                logger.log(Level.INFO, e.getMessage());
+            }
+        } else if (dayOrMonthOrHour == 0) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
+            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM");
+            try {
+                beginCalendar.setTime(format.parse(beginDate.substring(0, 6)));
+                endCalendar.setTime(format.parse(endDate.substring(0, 6)));
+                Calendar tempCalendar = beginCalendar;
+                do {
+                    xList.add(format1.format(tempCalendar.getTime()));
+                    tempCalendar.add(Calendar.MONTH, 1);
+                } while (tempCalendar.before(endCalendar) || tempCalendar.equals(endCalendar));
+            } catch (ParseException e) {
+                logger.log(Level.INFO, e.getMessage());
+            }
+        } else if (dayOrMonthOrHour == 3) {
+            SimpleDateFormat format = new SimpleDateFormat("HH:mm");
+
+            try {
+                beginCalendar.setTime(format.parse("00:00"));
+                endCalendar.setTime(format.parse("23:00"));
+                Calendar tempCalendar = beginCalendar;
+                do {
+                    xList.add(format.format(tempCalendar.getTime()));
+                    tempCalendar.add(Calendar.HOUR, 1);
+                } while (tempCalendar.before(endCalendar) || tempCalendar.equals(endCalendar));
+            } catch (ParseException e) {
+                logger.log(Level.INFO, e.getMessage());
+            }
+        } else if (dayOrMonthOrHour == 4) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy");
+            SimpleDateFormat format1 = new SimpleDateFormat("yyyy");
+            try {
+                beginCalendar.setTime(format.parse(beginDate.substring(0, 4)));
+                endCalendar.setTime(format.parse(endDate.substring(0, 4)));
+                Calendar tempCalendar = beginCalendar;
+                do {
+                    xList.add(format1.format(tempCalendar.getTime()));
+                    tempCalendar.add(Calendar.YEAR, 1);
+                } while (tempCalendar.before(endCalendar) || tempCalendar.equals(endCalendar));
+            } catch (ParseException e) {
+                logger.log(Level.INFO, e.getMessage());
+            }
+        }
+
+        return xList;
+    }
+
+    /**
+     * 按照legend补齐
+     * http://echarts.baidu.com/examples/editor.html?c=bar-label-rotation
+     *
+     * @param resList
+     * @return
+     */
+    public static ChartsResult makeChartResultX2(List<ChartsParam> resList) {
+        if (resList == null || resList.isEmpty()) {
+            return new ChartsResult();
+        }
+        List<String> legend = new ArrayList<>();
+        List<String> xAxis = new ArrayList<>();
+        List<List> yAxis = new ArrayList<>();
+
+        Map<String, Map<String, Double>> mapMap = new HashMap<>();
+        for (ChartsParam param : resList) {
+
+            if (!xAxis.contains(param.getxAxis())) {
+                xAxis.add(param.getxAxis());
+            }
+
+            if (!legend.contains(param.getLegend())) {
+                legend.add(param.getLegend());
+            }
+
+            if (!mapMap.containsKey(param.getLegend())) {
+                Map<String, Double> map = new HashMap<>();
+                map.put(param.getxAxis(), param.getyAxis());
+                mapMap.put(param.getLegend(), map);
+            } else {
+                mapMap.get(param.getLegend()).put(param.getxAxis(), param.getyAxis());
+            }
+        }
+        for (String string : legend) {
+            List<Double> data = new ArrayList<>();
+            for (String x : xAxis) {
+                if (mapMap.get(string).containsKey(x)) {
+                    data.add(mapMap.get(string).get(x));
+                } else {
+                    data.add(null);
+                }
+            }
+            yAxis.add(data);
+        }
+        ChartsResult chartsResult = new ChartsResult(legend, xAxis, yAxis);
+        return chartsResult;
+    }
+
+    /**
+     * 修改日期字符串格式,yyyyMMdd -> yyyy-MM-dd
+     *
+     * @param dateList
+     * @return
+     */
+    public static List<String> dateFormatTransform(List<String> dateList) {
+        if (dateList == null || dateList.isEmpty()) {
+            return null;
+        }
+        List<String> newDateList = new ArrayList<>();
+        for (int i = 0; i < dateList.size(); i++) {
+            String date = dateList.get(i);
+            newDateList.add(date.substring(0, 4) + "-" + date.substring(4, 6) + "-" + date.substring(6));
+        }
+        return newDateList;
+    }
+
+    /**
+     * 根据给定的x轴和legend补齐数据,
+     *
+     * @param chartsParams
+     * @param legend
+     * @param xAxis
+     * @param type         0: 返回 legend.size * xAxis.size的矩阵, 否则返回 xAxis.size * legend.size
+     * @return ms.size * ns.size 的矩阵
+     */
+    public static List<List<Double>> completeChart(List<ChartsParam> chartsParams, List<String> legend, List<String> xAxis, Integer type) {
+        Map<String, Map<String, Double>> data = new HashMap<>();
+        if (type == null || type == 0) {
+            if (chartsParams != null && !chartsParams.isEmpty()) {
+                for (ChartsParam chartsParam : chartsParams) {
+                    if (data.containsKey(chartsParam.getLegend())) {
+                        data.get(chartsParam.getLegend()).put(chartsParam.getxAxis(), chartsParam.getyAxis());
+                    } else {
+                        Map<String, Double> temp = new HashMap<>();
+                        temp.put(chartsParam.getxAxis(), chartsParam.getyAxis());
+                        data.put(chartsParam.getLegend(), temp);
+                    }
+                }
+            }
+        } else {
+            if (chartsParams != null && !chartsParams.isEmpty()) {
+                for (ChartsParam chartsParam : chartsParams) {
+                    if (data.containsKey(chartsParam.getxAxis())) {
+                        data.get(chartsParam.getxAxis()).put(chartsParam.getLegend(), chartsParam.getyAxis());
+                    } else {
+                        Map<String, Double> temp = new HashMap<>();
+                        temp.put(chartsParam.getLegend(), chartsParam.getyAxis());
+                        data.put(chartsParam.getxAxis(), temp);
+                    }
+                }
+            }
+        }
+        List<List<Double>> result = new ArrayList<>();
+        for (String m : legend) {
+            List<Double> temp = new ArrayList<>();
+            for (String n : xAxis) {
+                if (data.containsKey(m) && data.get(m).containsKey(n)) {
+                    temp.add(data.get(m).get(n));
+                } else {
+                    temp.add(0.0);
+                }
+            }
+            result.add(temp);
+        }
+        return result;
+    }
+
+    /**
+     * 从map中构造图表的数据结构
+     *
+     * @param keyValue  键值对
+     * @param chartType 图表类型 0:直方图,折线图 1:饼图,评分Top图
+     * @return
+     */
+    public static <T extends Number> ChartsResult constructChartResult1(LinkedHashMap<String, T> keyValue,
+                                                                        Integer chartType) {
+        ChartsResult chartsResult = new ChartsResult();
+        List<String> xList = new ArrayList<>();
+        if (keyValue == null || keyValue.isEmpty()) {
+            return chartsResult;
+        }
+        if (chartType == 0) { /** 简单直方图*/
+            List<Object> data = new ArrayList<>();
+            for (String key : keyValue.keySet()) {
+                xList.add(key);
+                data.add(keyValue.get(key));
+            }
+            chartsResult.setCategory(xList);
+            chartsResult.setData(data);
+        } else if (chartType == 1) {/** 饼图\ 评分Top图*/
+            List<Map<String, Object>> data = new ArrayList<>();
+            List<Double> ratioList = new ArrayList<>();
+            for (String key : keyValue.keySet()) {
+                xList.add(key);
+                Map<String, Object> tmp = new HashMap<>();
+                tmp.put("name", key);
+                tmp.put("value", keyValue.get(key));
+                data.add(tmp);
+                ratioList.add(keyValue.get(key).doubleValue());
+            }
+            /**
+             * 获取占比并填充
+             */
+            int index = 0;
+            for (Map map : data) {
+                Double sum = 0.0;
+                for (int i = 0; i < ratioList.size(); i++) {
+                    sum += ratioList.get(i);
+                }
+                map.put("ratio", sum == 0.0 ? 0.0 : NumberUtils.getPercentValue(ratioList, index, 2));
+                index++;
+            }
+            chartsResult.setLegend(xList);
+            chartsResult.setData(data);
+        }
+        return chartsResult;
+    }
+
+    /**
+     * @param keyValues 雷达图
+     *                  多维度:radarvalue = {
+     *                  legend:['评分'],
+     *                  data:[
+     *                  { value: [100, 899, 200, 400], name: '小区综合评分1'},//value长度对应维度个数
+     *                  { value: [100, 899, 200, 400], name: '小区综合评分2'}
+     *                  ],
+     *                  category: [
+     *                  { name: '流动性', max: 1000,min: 0 },
+     *                  { name: '有利',max: 1000, min: 0 },
+     *                  { name: '周边配套', max: 1000, min: 0 }
+     *                  { name: '周边交通', max: 1000, min: 0 }
+     *                  ]
+     *                  }
+     * @return
+     */
+    public static <T extends Number> ChartsResult constructChartResult2(LinkedHashMap<String, LinkedHashMap<String, T>> keyValues, Integer max, Integer min) {
+        ChartsResult chartsResult = new ChartsResult();
+        List<String> legends = new ArrayList<>();
+        List<String> xList = new ArrayList<>();
+        List<List<Map<String, Object>>> categorysList = new ArrayList<>();
+        //data
+        List<Map<String, Object>> dataList = new ArrayList<>();
+        for (String key1 : keyValues.keySet()) {
+            Map<String, Object> dataMap = new HashMap<>();
+            List<Double> data = new ArrayList<>();
+            dataMap.put("name", key1);
+            //category
+            List<Map<String, Object>> categoryList = new ArrayList<>();
+            for (String key2 : keyValues.get(key1).keySet()) {
+                data.add((Double) keyValues.get(key1).get(key2));
+                Map<String, Object> categoryMap = new HashMap<>();
+                categoryMap.put("name", key2);
+                categoryMap.put("max", max);
+                categoryMap.put("min", min);
+                categoryList.add(categoryMap);
+            }
+            dataMap.put("value", data);
+            dataList.add(dataMap);
+            categorysList.add(categoryList);
+        }
+        chartsResult.setLegend(legends);
+        chartsResult.setCategory(categorysList);
+        chartsResult.setData(dataList);
+        return chartsResult;
+    }
+
+    /**
+     * @param keyValues 雷达图
+     *                  Map<String,Integer>  key \  max  \ min
+     *                  LinkedHashMap<String,List<T></>>  key 维度, 值
+     * @param <T>
+     * @return
+     */
+    public static <T extends Number> ChartsResult constructChartResult3(List<Map<String, Object>> mapList, LinkedHashMap<String, List<T>> keyValues) {
+        ChartsResult chartsResult = new ChartsResult();
+        //data
+        List<Map<String, Object>> dataList = new ArrayList<>();
+        for (String key1 : keyValues.keySet()) {
+            Map<String, Object> dataMap = new HashMap<>();
+            dataMap.put("name", key1);
+            dataMap.put("value", keyValues.get(key1));
+            dataList.add(dataMap);
+        }
+        chartsResult.setData(dataList);
+        //category
+        chartsResult.setCategory(mapList);
+
+        return chartsResult;
+    }
+
+    /**
+     * 构造堆叠直方图 (未排序)
+     *
+     * @param keyValues    两个分桶统计值,第一分桶作为legend,第二分桶作为x轴
+     * @param defaultValue
+     * @param <T>
+     * @return
+     */
+    public static <T extends Number> ChartsResult constructChartResult4(LinkedHashMap<String,
+            LinkedHashMap<String, T>> keyValues, T defaultValue) {
+        ChartsResult chartsResult = new ChartsResult();
+        List<String> legends = new ArrayList<>();
+        List<String> xList = new ArrayList<>();
+        for (String key1 : keyValues.keySet()) {
+            legends.add(key1);
+            for (String key2 : keyValues.get(key1).keySet()) {
+                if (!xList.contains(key2)) {
+                    xList.add(key2);
+                }
+            }
+        }
+        //TODO Collections.sort(xList);
+        List<List<T>> data = new ArrayList<>();
+        for (String key1 : keyValues.keySet()) {
+            LinkedHashMap<String, T> tmpMap = keyValues.get(key1);
+            List<T> tmpDataList = new ArrayList<>();
+            for (String key2 : xList) {
+                if (tmpMap.containsKey(key2)) {
+                    tmpDataList.add(tmpMap.get(key2));
+                } else {
+                    tmpDataList.add(defaultValue);
+                }
+            }
+            data.add(tmpDataList);
+        }
+        chartsResult.setLegend(legends);
+        chartsResult.setCategory(xList);
+        chartsResult.setData(data);
+        return chartsResult;
+    }
+
+    //将chartparam中的成员两个list合并成一个map类型的list
+    public static List<Map> listPairToMapList(List name, List value) {
+        List<Map> result = new ArrayList<Map>();
+        for (int i = 0; i < name.size(); i++) {
+            Map map = new HashMap();
+            map.put(MapKeysName.keyName, name.get(i));
+            map.put(MapKeysName.valueName, value.get(i));
+            result.add(map);
+        }
+        return result;
+    }
+
+    interface MapKeysName {
+        String keyName = "name";
+        String valueName = "value";
+    }
+
+    /**
+     * 将chartparam中图例的其他放到末尾或去除
+     * 判断data中是否有值
+     *
+     * @param o
+     * @return
+     */
+    public static boolean isPresentData(Object o) {
+        if (o instanceof ChartsResult) {
+            if (((ChartsResult) o).getData() == null) {
+                return false;
+            } else {
+                List data = ((ChartsResult) o).getData();
+                if (data.size() == 0) return false;
+                if (data.size() > 0) {
+                    Object obj = data.get(0);
+                    return obj != null && (!(obj instanceof List) || ((List) obj).size() != 0);
+                }
+            }
+        }
+        return true;
+    }
+
+//    /**
+//     * 两个分桶统计
+//     *
+//     * @param agg
+//     * @param secondAggName 第二个分桶名称
+//     * @return linkedHashMap 保证键值对的顺序正确,Map<第一分桶,<第二分桶,值>>
+//     */
+//    public static LinkedHashMap<String, LinkedHashMap<String, Long>> getKeyValueFromMultiAggrestion(InternalMultiBucketAggregation agg, String secondAggName) {
+//        LinkedHashMap<String, LinkedHashMap<String, Long>> resMap = new LinkedHashMap<>();
+//        List<MultiBucketsAggregation.Bucket> buckets = (List<MultiBucketsAggregation.Bucket>) agg.getBuckets();
+//        for (MultiBucketsAggregation.Bucket bucket : buckets) {
+//            String key = bucket.getKeyAsString();
+//            LinkedHashMap<String, Long> pMap = new LinkedHashMap<>(); //当前分类,每个时间点的统计值
+//            InternalMultiBucketAggregation internalMultiBucketAggregation = bucket.getAggregations().get(secondAggName);
+//            List<MultiBucketsAggregation.Bucket> bucketList = (List<MultiBucketsAggregation.Bucket>) internalMultiBucketAggregation.getBuckets();
+//            for (MultiBucketsAggregation.Bucket bucket2 : bucketList) {
+//                pMap.put(bucket2.getKeyAsString(), bucket2.getDocCount());
+//            }
+//            resMap.put(key, pMap);
+//        }
+//        return resMap;
+//    }
+
+//    /**
+//     * 从es单桶统计结果中转换成键值对
+//     *
+//     * @param agg
+//     * @return linkedHashMap 保证键值对的顺序正确
+//     */
+//    public static LinkedHashMap<String, Long> getKeyValueFromAggrestion(InternalMultiBucketAggregation agg) {
+//        LinkedHashMap<String, Long> cMap = new LinkedHashMap<>();
+//        List<MultiBucketsAggregation.Bucket> buckets = (List<MultiBucketsAggregation.Bucket>) agg.getBuckets();
+//        for (MultiBucketsAggregation.Bucket bucket : buckets) {
+//            cMap.put(bucket.getKeyAsString(), bucket.getDocCount());
+//        }
+//        return cMap;
+//    }
+
+    /**
+     * 修改图表x坐标轴的时间格式
+     *
+     * @param chartResult
+     * @param format
+     * @return
+     */
+    public static ChartsResult categoryDateFormat(ChartsResult chartResult, String format) throws ParseException {
+        DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        DateFormat df2 = new SimpleDateFormat(format);
+        List<String> newXAxis = new ArrayList<>();
+        for (String x : (List<String>) chartResult.getCategory()) {
+            newXAxis.add(df2.format(df1.parse(x)));
+        }
+        chartResult.setCategory(newXAxis);
+        return chartResult;
+    }
+
+
+    /**
+     * 构造堆叠直方图
+     *
+     * @param keyValues 两个分桶统计值,第一分桶作为legend,第二分桶作为x轴
+     * @return
+     */
+    public static <T extends Number> ChartsResult constructChartResult5(LinkedHashMap<String, LinkedHashMap<String, T>> keyValues, T defaultValue) {
+        ChartsResult chartResult = new ChartsResult();
+        List<String> legends = new ArrayList<>();
+        List<String> xList = new ArrayList<>();
+        for (String key1 : keyValues.keySet()) {
+            legends.add(key1);
+            for (String key2 : keyValues.get(key1).keySet()) {
+                if (!xList.contains(key2)) {
+                    xList.add(key2);
+                }
+            }
+        }
+        Collections.sort(xList);
+        List<List<T>> data = new ArrayList<>();
+        for (String key1 : keyValues.keySet()) {
+            LinkedHashMap<String, T> tmpMap = keyValues.get(key1);
+            List<T> tmpDataList = new ArrayList<>();
+            for (String key2 : xList) {
+                if (tmpMap.containsKey(key2)) {
+                    tmpDataList.add(tmpMap.get(key2));
+                } else {
+                    tmpDataList.add(defaultValue);
+                }
+            }
+            data.add(tmpDataList);
+        }
+        chartResult.setLegend(legends);
+        chartResult.setCategory(xList);
+        chartResult.setData(data);
+        return chartResult;
+    }
+
+    /**
+     * @param size size必须大于1
+     * @Description : 初始化具有多个图例的图表对象
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/4/16 16:53
+     */
+    public static ChartsResult intialMultiLegendChart(Integer size) {
+        List<String> category = new ArrayList<>();
+        List<String> legend = new ArrayList<>();
+        List data = new ArrayList();
+        for (int i = 0; i < size; i++) {
+            List dataMem = new ArrayList();
+            data.add(dataMem);
+        }
+        ChartsResult chartsResult = new ChartsResult(legend, category, data);
+        return chartsResult;
+    }
+}

+ 266 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/CronUtil.java

@@ -0,0 +1,266 @@
+package com.sunwin.swismp.util;
+
+import org.apache.logging.log4j.core.util.CronExpression;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName: CronUtil
+ * @Description: Cron表达式工具类 目前支持三种常用的cron表达式 1.每天的某个时间点执行 例:12 12 12 * *
+ *               ?表示每天12时12分12秒执行 2.每周的哪几天执行 例:12 12 12 ? * 1,2,3表示每周的周1周2周3
+ *               ,12时12分12秒执行 3.每月的哪几天执行 例:12 12 12 1,21,13 * ?表示每月的1号21号13号
+ *               12时12分12秒执行
+ * @author
+ * @date
+ *
+ */
+public class CronUtil {
+    /**
+     * 通过输入指定日期时间生成cron表达式
+     * @param date
+     * @return cron表达式
+     */
+    public static String getCron(Date date){
+        String dateFormat="ss mm HH dd MM ? yyyy";
+        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
+        String formatTimeStr = null;
+        if (date != null) {
+            formatTimeStr = sdf.format(date);
+        }
+        return formatTimeStr;
+    }
+
+    /**
+     * cron 获取去执行时间计划(取前N个)
+     * @param cronExpression  cron表达式
+     * @param num 获取个数
+     * @return
+     */
+    public static List<String> parser(String cronExpression,Integer num) {
+        List<String> result = new ArrayList<String>();
+        if (cronExpression == null || cronExpression.length() < 1) {
+            return result;
+        } else {
+            CronExpression exp = null;
+            try {
+                exp = new CronExpression(cronExpression);
+            } catch (ParseException e) {
+                e.printStackTrace();
+                return result;
+            }
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date dd = new Date();
+            dd = exp.getNextValidTimeAfter(dd);
+            //取前十个
+            for (int i=0;i<num;i++){
+                result.add(sdf.format(dd));
+                dd = exp.getNextValidTimeAfter(dd);
+            }
+            exp = null;
+        }
+        return result;
+    }
+
+    static final String xin="*";
+    static final String wenhao="?";
+    static final String dao="-";
+    static final String mei="/";
+    static final String huo=",";
+
+    public static String descCorn(String cronExp) {
+        String[] tmpCorns = cronExp.split(" ");
+        StringBuffer sBuffer = new StringBuffer();
+        if (tmpCorns.length != 6) {
+            throw new RuntimeException("请补全表达式,必须标准的cron表达式才能解析");
+        }
+        // 解析月
+        descMonth(tmpCorns[4], sBuffer);
+        // 解析周
+        descWeek(tmpCorns[5], sBuffer);
+
+        // 解析日
+        descDay(tmpCorns[3], sBuffer);
+
+        // 解析时
+        descHour(tmpCorns[2], sBuffer);
+
+        // 解析分
+        descMintue(tmpCorns[1], sBuffer);
+
+        // 解析秒
+        //descSecond(tmpCorns[0], sBuffer);
+        sBuffer.append(" 执行");
+        return sBuffer.toString();
+
+    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:01:09
+     */
+    private static void descSecond(String s, StringBuffer sBuffer) {
+        String danwei="秒";
+        desc(s, sBuffer, danwei);
+    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @param danwei
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:16:19
+     */
+    private static void desc(String s, StringBuffer sBuffer, String danwei) {
+        if (s.equals("1/1")) {
+            s="*";
+        }
+        if (s.equals("0/0")) {
+            s="0";
+        }
+        if (xin.equals(s)) {
+            sBuffer.append("每"+danwei);
+            return;
+        }
+        if (wenhao.equals(s)) {
+            return ;
+        }
+        if (s.contains(huo)) {
+            String[] arr = s.split(huo);
+            for (int i = 0; i < arr.length; i++) {
+                if (arr[i].length()!=0) {
+                    sBuffer.append("第"+arr[i]+danwei+"和");
+                }
+            }
+            sBuffer.deleteCharAt(sBuffer.length()-1);
+            sBuffer.append("的");
+            return;
+        }
+        if (s.contains(dao)) {
+            String[] arr = s.split(dao);
+            if (arr.length!=2) {
+                throw new RuntimeException("表达式错误"+s);
+            }
+            sBuffer.append("从第"+arr[0]+danwei+"到第"+arr[1]+danwei+"每"+danwei);
+            sBuffer.append("的");
+            return;
+        }
+
+        if (s.contains(mei)) {
+            String[] arr = s.split(mei);
+            if (arr.length!=2) {
+                throw new RuntimeException("表达式错误"+s);
+            }
+            if (arr[0].equals(arr[1])||arr[0].equals("0")) {
+                sBuffer.append("每"+arr[1]+danwei);
+            }else {
+                sBuffer.append("每"+arr[1]+danwei+"的第"+arr[0]+danwei);
+            }
+            return;
+        }
+        sBuffer.append("第"+s+danwei);
+    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:01:00
+     */
+    private static void descMintue(String s, StringBuffer sBuffer) {
+        desc(s, sBuffer, "分钟");
+    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:00:50
+     */
+    private static void descHour(String s, StringBuffer sBuffer) {
+        desc(s, sBuffer, "小时");
+    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:00:39
+     */
+    private static void descDay(String s, StringBuffer sBuffer) {
+        desc(s, sBuffer, "天");
+    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:00:30
+     */
+    private static void descWeek(String s, StringBuffer sBuffer) {
+        //不解释 太麻烦
+    }
+//    private static String turnWeek(String week){
+//        switch (week) {
+//        case "1":
+//            return"星期天";
+//        case "2":
+//            return"星期一";
+//        case "3":
+//            return"星期二";
+//        case "4":
+//            return"星期三";
+//        case "5":
+//            return"星期四";
+//        case "6":
+//            return"星期五";
+//        case "7":
+//            return"星期六";
+//        default:
+//            return null;
+//        }
+//    }
+
+    /**
+     * 描述
+     * @param s
+     * @param sBuffer
+     * @author Norton Lai
+     * @created 2019-2-27 下午5:00:15
+     */
+    private static void descMonth(String s, StringBuffer sBuffer) {
+        desc(s, sBuffer, "月");
+    }
+
+    // 测试方法
+    public static void main(String[] args) {
+        String CRON_EXPRESSION = "0 0 0/2 * * ?";
+       // String CRON_EXPRESSION = "* 5-8 1,5,7 * * ?";
+//        String CRON_EXPRESSION = "0 0 5-8 * * ?";
+
+        System.out.println(descCorn(CRON_EXPRESSION));
+    }
+
+
+  /*  public static void main(String[] args) {
+        String CRON_EXPRESSION = "0 0/15 * ? * *";
+        System.out.println(CRON_EXPRESSION);
+        List<String> lTime = new ArrayList<String>();
+        lTime = parser(CRON_EXPRESSION,5);
+        for (int i = 0; i < lTime.size(); i++) {
+            System.out.println(lTime.get(i));
+        }
+    }*/
+
+}

+ 50 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/FileUtils.java

@@ -0,0 +1,50 @@
+package com.sunwin.swismp.util;
+
+
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+
+public class FileUtils {
+
+    public static File MultipartFileToFile(MultipartFile multipartFile){
+        int n;
+        File f = null;
+        // 输出文件的新name 就是指上传后的文件名称
+        System.out.println("getName:"+multipartFile.getName());
+        // 输出源文件名称 就是指上传前的文件名称
+        System.out.println("Oriname:"+multipartFile.getOriginalFilename());
+        // 创建文件
+        f = new File(multipartFile.getOriginalFilename());
+        try (InputStream in  = multipartFile.getInputStream(); OutputStream os = new FileOutputStream(f)){
+            // 得到文件流。以文件流的方式输出到新文件
+            // 可以使用byte[] ss = multipartFile.getBytes();代替while
+            byte[] buffer = new byte[4096];
+            while ((n = in.read(buffer,0,4096)) != -1){
+                os.write(buffer,0,n);
+            }
+            // 读取文件第一行
+            BufferedReader bufferedReader = new BufferedReader(new FileReader(f));
+            System.out.println(bufferedReader.readLine());
+            // 输出路径
+            bufferedReader.close();
+
+            // 输出file的URL
+            System.out.println(f.toURI().toURL().toString());
+        }catch (IOException e){
+            e.printStackTrace();
+        }
+        // 输出文件的绝对路径
+        System.out.println(f.getAbsolutePath());
+        return f;
+    }
+    public static void deleteFlie(File file){
+        // 操作完上的文件 需要删除在根目录下生成的文件
+        //File file = new File(f.toURI());
+        if (file.delete()){
+            System.out.println("删除成功");
+        }else {
+            System.out.println("删除失败");
+        }
+    }
+}

+ 109 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/HolidayUtil.java

@@ -0,0 +1,109 @@
+package com.sunwin.swismp.util;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @Description:
+ * @Author: fengyong
+ * @CreateDate: 2022/4/29
+ * @Remark:  节假日-工作日-非工作日
+ * @Version: 1.0
+ */
+public class HolidayUtil {
+    //http://www.apihubs.cn/#/holiday
+    //https://api.apihubs.cn/holiday/get?field=date&month=202204&workday=2&order_by=1&cn=1&size=35
+    //{"code":0,"msg":"ok","data":{"list":[{"date":20220403,"date_cn":"2022年04月03日"},{"date":20220404,"date_cn":"2022年04月04日"},{"date":20220405,"date_cn":"2022年04月05日"},{"date":20220409,"date_cn":"2022年04月09日"},{"date":20220410,"date_cn":"2022年04月10日"},{"date":20220416,"date_cn":"2022年04月16日"},{"date":20220417,"date_cn":"2022年04月17日"},{"date":20220423,"date_cn":"2022年04月23日"},{"date":20220430,"date_cn":"2022年04月30日"}],"page":1,"size":35,"total":9}}
+
+
+    /**
+     * 传入格式 为 yyyyMM 日期
+     * @param date
+     * @param type
+     * @return
+     */
+    public static List<String> getDayList(String date,String type) {
+        try {
+            String filePath = "";
+            if ("non_working".equals(type)){
+                //非工作日
+                filePath="https://api.apihubs.cn/holiday/get?field=date&month="+ date+"&workday=2&order_by=1&cn=1&size=31";
+            }else if ("weekend".equals(type)){
+                //周末
+                filePath="https://api.apihubs.cn/holiday/get?field=date&month="+date+"&weekend=1&order_by=1&cn=1&size=31";
+            }
+            URL u = new URL(filePath);
+            InputStream in = u.openStream();
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            try {
+                byte buf[] = new byte[1024];
+                int read = 0;
+                while ((read = in.read(buf)) > 0) {
+                    out.write(buf, 0, read);
+                }
+            } finally {
+                if (in != null) {
+                    in.close();
+                }
+            }
+            byte b[] = out.toByteArray();
+            String s = new String(b, "utf-8");
+            JSONObject jsonObject = JSONObject.parseObject(s);
+            JSONObject data = jsonObject.getJSONObject("data");
+            JSONArray jsonArray = data.getJSONArray("list");
+            List<Map> maps = jsonArray.toJavaList(Map.class);
+            List<String> stringList = new ArrayList<>();
+            for (int i=0;i<maps.size();i++){
+                Map<String,Object> map = maps.get(i);
+                stringList.add(TimeUtils.dateFormat(map.get("date").toString(),TimeUtils.YYYYMMDD,TimeUtils.YYYY_MM_DD));
+            }
+            return stringList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("------------------调用获取日期接口失败------------------");
+            return null;
+        }
+    }
+
+    //获取周末  月从1开始
+    public static List<String> getMonthWekDay(int year,int mouth){
+        List<String> dateList = new ArrayList<>();
+        SimpleDateFormat simdf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = new GregorianCalendar(year, mouth-1 , 1);
+        Calendar endCalendar = new GregorianCalendar(year, mouth-1 , 1);
+        endCalendar.add(Calendar.MONTH,1);
+        while (true) {
+            int weekday=calendar.get(Calendar.DAY_OF_WEEK);
+            if(weekday == 1 || weekday== 7){
+                dateList.add(simdf.format(calendar.getTime()));
+            }
+            calendar.add(Calendar.DATE,1);
+            if (calendar.getTimeInMillis() >= endCalendar.getTimeInMillis()){
+                break;
+            }
+        }
+        return dateList;
+    }
+
+
+    /**
+     * 计算周六日
+     * @param args
+     * @throws ParseException
+     */
+    public static void main(String[] args) throws ParseException {
+       // List<String> monthWekDay = getMonthWekDay(2023, 5);
+        String month = "202205";
+        List<String> monthWekDay =  getMonthWekDay(Integer.parseInt(month.substring(0,4)), Integer.parseInt(month.substring(4)));
+        for (String str:monthWekDay){
+            System.out.println(str);
+        }
+    }
+}

+ 218 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/HttpUtil.java

@@ -0,0 +1,218 @@
+package com.sunwin.swismp.util;
+
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.*;
+import java.net.*;
+import java.util.Map;
+
+/**
+* @Description:
+* @Author: zc
+* @CreateDate: 2018/12/18 16:44
+* @Remark:  查询天气的接口,捕获异常
+* @Version: 1.0
+*/
+public class HttpUtil {
+    public static String doGet(String httpUrl) {
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(httpUrl);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("Content-Type","application/json");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            //读取结果
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                in.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
+
+	public static String doPost(String httpUrl, String json) {
+//        PrintWriter out = null;
+		OutputStream os = null;
+		BufferedReader in = null;
+		String result = "";
+		try {
+			URL realUrl = new URL(httpUrl);
+			// 打开和URL之间的连接
+			URLConnection conn = realUrl.openConnection();
+			// 设置通用的请求属性
+			conn.setRequestProperty("accept", "*/*");
+			conn.setRequestProperty("Content-Type","application/json");
+			conn.setRequestProperty("connection", "Keep-Alive");
+			conn.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+			// 发送POST请求必须设置如下两行
+			conn.setDoOutput(true);
+			conn.setDoInput(true);
+			//1.获取URLConnection对象对应的输出流
+//            out = new PrintWriter(conn.getOutputStream());
+			//2.中文有乱码的需要将PrintWriter改为如下
+			os = conn.getOutputStream();
+			//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
+			// 发送请求参数
+			os.write(json.getBytes());
+
+			// flush输出流的缓冲
+			os.flush();
+			// 定义BufferedReader输入流来读取URL的响应
+			in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+			String line;
+			while ((line = in.readLine()) != null) {
+				result += line;
+			}
+		} catch (Exception e) {
+			System.out.println("发送 POST 请求出现异常!"+e);
+			e.printStackTrace();
+		}
+		//使用finally块来关闭输出流、输入流
+		finally{
+			try{
+				if(os!=null){
+					os.close();
+				}
+				if(in!=null){
+					in.close();
+				}
+			}
+			catch(IOException ex){
+				ex.printStackTrace();
+			}
+		}
+		return result;
+	}
+
+    /**
+     * POST(x-www-form-urlencoded)请求
+     * @param httpUrl
+     * @param params
+     * @return
+     */
+    public static String doPost(String httpUrl, Map<String,Object> params) {
+        try {
+            PostMethod postMethod = new PostMethod(httpUrl) ;
+            postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") ;
+            postMethod.setRequestHeader("X-Requested-With","XMLHttpRequest");
+            //参数设置,需要注意的就是里边不能传NULL,要传空字符串
+            NameValuePair[] data= new NameValuePair[params.size()];
+            int i=0;
+            for (Map.Entry<String, Object> map :  params.entrySet()){
+                data[i] = new NameValuePair(map.getKey(), (String) map.getValue());
+                i++;
+            }
+            postMethod.setRequestBody(data);
+            org.apache.commons.httpclient.HttpClient httpClient = new org.apache.commons.httpclient.HttpClient();
+            int response = httpClient.executeMethod(postMethod); // 执行POST方法
+            String result = postMethod.getResponseBodyAsString() ;
+
+            return result;
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+	public static String getEncoding(String str){
+		String encoding = "UTF-8";
+		try {
+			if (str.equals(new String(str.getBytes(),encoding))) {
+				return encoding;
+			}
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+
+		encoding = "GBK";
+		try {
+			if (str.equals(new String(str.getBytes(),encoding))) {
+				return encoding;
+			}
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+
+		encoding = "ISO-8859-1";
+		try {
+			if (str.equals(new String(str.getBytes(),encoding))) {
+				return encoding;
+			}
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+
+		encoding = "GB2312";
+		try {
+			if (str.equals(new String(str.getBytes(),encoding))) {
+				return encoding;
+			}
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+    /**
+     * 获取客户端ip
+     * @param request
+     * @return
+     */
+    public static String getIpAddr(HttpServletRequest request) {
+        String ipAddress = null;
+        try {
+            ipAddress = request.getHeader("x-forwarded-for");
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("Proxy-Client-IP");
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("WL-Proxy-Client-IP");
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getRemoteAddr();
+                if (ipAddress.equals("127.0.0.1")) {
+                    // 根据网卡取本机配置的IP
+                    InetAddress inet = null;
+                    try {
+                        inet = InetAddress.getLocalHost();
+                    } catch (UnknownHostException e) {
+                        e.printStackTrace();
+                    }
+                    ipAddress = inet.getHostAddress();
+                }
+            }
+            // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+            if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
+                // = 15
+                if (ipAddress.indexOf(",") > 0) {
+                    ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
+                }
+            }
+        } catch (Exception e) {
+            ipAddress="";
+        }
+        // ipAddress = this.getRequest().getRemoteAddr();
+
+        return ipAddress;
+    }
+
+}

+ 78 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/Md5Util.java

@@ -0,0 +1,78 @@
+package com.sunwin.swismp.util;
+
+import com.sunwin.swismp.bean.sysfunction.SysUser;
+import org.springframework.util.DigestUtils;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+public class Md5Util {
+    public enum TimeMd5Type {
+        DATE("yyyy-MM-dd", Calendar.DATE, 0), MINIUTE("yyyy-MM-dd HH:mm", Calendar.MINUTE, 30);
+
+        TimeMd5Type(String format, Integer type, Integer adjust) {
+            this.format = format;
+            this.type = type;
+            this.adjust = adjust;
+        }
+
+        public Integer type;//时间类型细粒度
+        public String format;//时间格式
+        private Integer adjust;
+    }
+
+    //  获取时间偏差调整区间
+    public static List<String> md5AdjustTime(TimeMd5Type time) {
+        List<String> timeList = new ArrayList<>();
+        Date date = new Date();
+        DateFormat df = new SimpleDateFormat(time.format);
+        timeList.add(df.format(date));
+        Calendar calendarFront = Calendar.getInstance();
+        calendarFront.setTime(date);
+        Calendar calendarBehind = Calendar.getInstance();
+        calendarBehind.setTime(date);
+        for (int i = 0; i < time.adjust; i++) {
+            calendarFront.add(time.type, 1);
+            calendarBehind.add(time.type, -1);
+            timeList.add(df.format(calendarFront.getTime()));
+            timeList.add(df.format(calendarBehind.getTime()));
+        }
+        return timeList;
+    }
+
+    //md5加密
+    public static String md5(String plainText) {
+        return DigestUtils.md5DigestAsHex(plainText.getBytes());
+    }
+
+    //比较用户请求的md5值和系统生成的md5修正值
+    public static Boolean processUser(String md5Text, SysUser sysUser, TimeMd5Type time) {
+        List<String> timeList = md5AdjustTime(time);
+        for (String timeMem : timeList) {
+            String pwdMd5 = Md5Util.md5("userName:" + sysUser.getUserName() + "-userPwd:"
+                    + sysUser.getUserPwd() + "-time:" + timeMem);
+            if (md5Text.equals(pwdMd5))
+                return true;
+
+        }
+        return false;
+    }
+
+
+    //比较用户请求的md5值和系统生成的md5修正值
+    public static Boolean processUserId(String md5Text, SysUser sysUser, TimeMd5Type time) {
+        List<String> timeList = md5AdjustTime(time);
+        for (String timeMem : timeList) {
+            String pwdMd5 = Md5Util.md5("userId:" + sysUser.getUserId() + "-userName:" + sysUser.getUserName()
+                    + "-userPwd:" + sysUser.getUserPwd() + "-time:" + timeMem);
+            if (md5Text.equals(pwdMd5))
+                return true;
+
+        }
+        return false;
+    }
+}

+ 578 - 0
swismp-api/src/main/java/com/sunwin/swismp/util/NumberUtils.java

@@ -0,0 +1,578 @@
+package com.sunwin.swismp.util;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <br>
+ * Copyright (c) 2019/11/13 All Rights Reserved By SUNWIN<br>
+ * <br>
+ * Package: com.sunwin.swbd.utils <br>
+ * FileName: NumberUtil <br>
+ * <br>
+ *
+ * @author duanmin
+ * @created 2019/11/13 15:48
+ * @last Modified
+ * @history
+ */
+public class NumberUtils {
+
+    /**
+     * 返回带单位的数值
+     *
+     * @param originNum
+     * @return
+     */
+    public static DecimalFormat df = new DecimalFormat("0.0");//设置保留位数
+
+    public static String getNumWithUnit(String originNum) {
+        if (Long.parseLong(originNum) > 100000000) {
+            BigDecimal bigDecimal = new BigDecimal(Long.parseLong(originNum) / 100000000.0d);
+            return (bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).toString() + "亿");
+        } else if (Long.parseLong(originNum) > 10000) {
+            BigDecimal bigDecimal = new BigDecimal(Long.parseLong(originNum) / 10000.0d);
+            return (bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).toString() + "万");
+        }
+        return originNum;
+    }
+
+    /**
+     * 返回带单位的条目数值
+     *
+     * @param originNum
+     * @return
+     */
+    public static String getNumWithUnitByInt(Long originNum) {
+        if (originNum > 100000000) {
+            BigDecimal bigDecimal = new BigDecimal(originNum / 100000000.0d);
+            return (bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).toString() + "亿");
+        } else if (originNum > 10000) {
+            BigDecimal bigDecimal = new BigDecimal(originNum / 10000.0d);
+            return (bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).toString() + "万");
+        }
+        return originNum + "";
+    }
+
+    /**
+     * 将double形式的字符串转成long型
+     *
+     * @param a
+     * @return
+     */
+    public static Long doubleToLong(Object a) {
+        return Math.round(Double.valueOf(String.valueOf(a)));
+    }
+
+    /**
+     * 返回带单位的Map条目数值
+     *
+     * @param originNum
+     * @return
+     */
+    public static Map getMapNumWithUnitByInt(Long originNum) {
+        Map map = new HashMap();
+        if (originNum > 100000000) {
+            BigDecimal bigDecimal = new BigDecimal(originNum / 100000000.0d);
+            map.put("unit", "亿");
+            map.put("data", bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP));
+        } else if (originNum > 10000) {
+            BigDecimal bigDecimal = new BigDecimal(originNum / 10000.0d);
+            map.put("unit", "万");
+            map.put("data", bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP));
+        } else {
+            map.put("unit", "");
+            map.put("data", originNum);
+        }
+        return map;
+    }
+
+
+    /**
+     * 返回带单位的大小数值
+     *
+     * @param a
+     * @return
+     */
+    public static String getSizeWithUnit(Long a) {
+        if (a >= 1048576L && a < 1073741824L) {
+            return df.format(a / 1048576.0) + "M";
+        } else if (a >= 1073741824L) {
+            return df.format((a / 1048576.0) / 1024.0) + "G";
+        } else {
+            return df.format(a / 1024.0) + "K";
+        }
+    }
+
+    /**
+     * 返回带单位的Map大小数值
+     *
+     * @param a
+     * @return
+     */
+    public static Map getMapSizeWithUnit(Long a) {
+        Map map = new HashMap();
+        if (a >= 1048576L && a < 1073741824L) {
+            map.put("unit", "MB");
+            map.put("data", df.format(a / 1048576.0));
+        } else if (a >= 1073741824L && a < 1024 * 1024 * 1024 * 1024L) {
+            map.put("unit", "GB");
+            map.put("data", df.format((a / 1048576.0) / 1024.0));
+        } else if (a >= 1024 * 1024 * 1024 * 1024L) {
+            map.put("unit", "TB");
+            map.put("data", df.format((a / 1048576.0) / 1024.0 / 1024.0));
+        } else {
+            map.put("unit", "KB");
+            map.put("data", df.format((a) / 1024.0));
+        }
+        return map;
+    }
+
+    /**
+     * 将嵌套数组按照最大值统一单位
+     */
+    public static Map getSizeMultiListWithUnit(List<List<Double>> sizes) {
+        String unit = "kb";
+        Map mapTotal = new HashMap();
+        List dataTotal = new ArrayList();
+        for (List<Double> mem : sizes) {
+            for (Double size : mem) {
+                if (size != null) {
+                    if (size > 1073741824) {
+                        unit = !unit.equals("tb") ? "gb" : unit;
+                    } else if (size >= 1048576 && size < 1073741824) {
+                        unit = unit.equals("kb") ? "mb" : unit;
+                    } else if (size > 1024 * 1024 * 1024 * 1024L) {
+                        unit = "tb";
+                    }
+                }
+            }
+        }
+        for (List<Double> mem : sizes) {
+            Map map = computeSizeByUnit(mem, unit);
+            mapTotal.put("unit", map.get("unit"));
+            List memData = (List) map.get("list");
+            dataTotal.add(memData);
+        }
+        mapTotal.put("list", dataTotal);
+        return mapTotal;
+    }
+
+    /**
+     * 将数组按照最大条数的统一单位
+     */
+    public static Map getNumListWithUnit(List<Long> nums) {
+        String unit = "";
+        Map map = new HashMap<>();
+        for (Long num : nums) {
+            if (num != null) {
+                if (num > 100000000) {
+                    unit = "亿";
+                } else if (num > 10000) {
+                    unit = unit.equals("") ? "万" : unit;
+                }
+            }
+        }
+        switch (unit) {
+            case "万":
+                map.put("unit", "万");
+                map.put("list", computeNumByUnit(nums, unit));
+                break;
+            case "亿":
+                map.put("unit", "亿");
+                map.put("list", computeNumByUnit(nums, unit));
+                break;
+            default:
+                map.put("unit", "");
+                map.put("list", nums);
+        }
+        return map;
+    }
+
+    /**
+     * 将数组按照最大条数的统一单位
+     */
+    public static Map getNumListWithUnitDouble(List<Double> nums) {
+        String unit = "";
+        Map map = new HashMap<>();
+        for (Double num : nums) {
+            if (num > 100000000) {
+                unit = "亿";
+            } else if (num > 10000) {
+                unit = unit.equals("") ? "万" : unit;
+            }
+        }
+        switch (unit) {
+            case "万":
+                map.put("unit", "万");
+                map.put("list", computeNumByUnitDouble(nums, unit));
+                break;
+            case "亿":
+                map.put("unit", "亿");
+                map.put("list", computeNumByUnitDouble(nums, unit));
+                break;
+            default:
+                map.put("unit", "");
+                map.put("list", nums);
+        }
+        return map;
+    }
+
+    /**
+     * 将数组按照最大大小的统一单位
+     */
+    public static Map getSizeListWithUnit(List<Double> sizes) {
+        String unit = "kb";
+        for (Double size : sizes) {
+            if (size != null) {
+                if (size > 1073741824) {
+                    unit = !unit.equals("tb") ? "gb" : unit;
+                } else if (size >= 1048576 && size < 1073741824) {
+                    unit = unit.equals("kb") ? "mb" : unit;
+                } else if (size > 1024 * 1024 * 1024 * 1024L) {
+                    unit = "tb";
+                }
+            }
+        }
+        Map map = computeSizeByUnit(sizes, unit);
+        return map;
+    }
+
+    /**
+     * @param sizes
+     * @param unit
+     * @Description : 计算 G M K 级别的数据
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/4/16 13:22
+     */
+    private static Map computeSizeByUnit(List<Double> sizes, String unit) {
+        List<Double> numNew = new ArrayList<>();
+        Map map = new HashMap();
+        for (Double size : sizes) {
+            if (size != null) {
+                BigDecimal bigDecimal = null;
+                if (unit.equals("gb")) {
+                    bigDecimal = new BigDecimal((size / 1048576.0) / 1024.0);
+                } else if (unit.equals("mb")) {
+                    bigDecimal = new BigDecimal(size / 1048576.0);
+                } else if (unit.equals("kb")) {
+                    bigDecimal = new BigDecimal(size / 1024.0);
+                } else if (unit.equals("tb")) {
+                    bigDecimal = new BigDecimal((size / 1048576.0) / 1024.0 / 1024.0);
+                }
+                numNew.add(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+            } else {
+                numNew.add(null);
+            }
+        }
+        map.put("unit", unit);
+        map.put("list", numNew);
+        return map;
+    }
+
+    /**
+     * @param unit
+     * @Description : 根据单位大小 返回要除以的转换值
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/6/3 10:28
+     */
+    public static Integer convertValueBySizeUnit(String unit) {
+        Integer convertValue = 1;
+        switch (unit) {
+            case "kb":
+                convertValue = 1024;
+                break;
+            case "mb":
+                convertValue = 1024 * 1024;
+                break;
+            case "gb":
+                convertValue = 1024 * 1024 * 1024;
+                break;
+            case "tb":
+                convertValue = 1024 * 1024 * 1024 * 1024;
+        }
+        return convertValue;
+    }
+
+    /**
+     * @param nums
+     * @param unit
+     * @Description : 计算 亿 万 级别的数据
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/4/16 13:22
+     */
+    private static List computeNumByUnit(List<Long> nums, String unit) {
+        List<Double> numNew = new ArrayList<>();
+        for (Long num : nums) {
+            if (num != null) {
+                BigDecimal bigDecimal = null;
+                if (unit.equals("亿")) {
+                    bigDecimal = new BigDecimal(num / 100000000.0d);
+                } else if (unit.equals("万")) {
+                    bigDecimal = new BigDecimal(num / 10000.0d);
+                }
+                numNew.add(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+            } else {
+                numNew.add(null);
+            }
+
+        }
+        return numNew;
+
+    }
+
+    /**
+     * @param nums
+     * @param unit
+     * @Description : 计算 亿 万 级别的数据
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/4/16 13:22
+     */
+    private static List computeNumByUnitDouble(List<Double> nums, String unit) {
+        List<Double> numNew = new ArrayList<>();
+        for (Double num : nums) {
+            if (num != null) {
+                BigDecimal bigDecimal = null;
+                if (unit.equals("亿")) {
+                    bigDecimal = new BigDecimal(num / 100000000.0d);
+                } else if (unit.equals("万")) {
+                    bigDecimal = new BigDecimal(num / 10000.0d);
+                }
+                numNew.add(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+            } else {
+                numNew.add(null);
+            }
+        }
+        return numNew;
+
+    }
+
+    /**
+     * @param unit
+     * @Description : 根据单位大小 返回要除以的转换值
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/6/3 10:28
+     */
+    public static Integer convertValueByNumUnit(String unit) {
+        Integer convertValue = 1;
+        switch (unit) {
+            case "万":
+            case "万条":
+            case "万个":
+                convertValue = 10000;
+                break;
+            case "亿":
+            case "亿条":
+            case "亿个":
+                convertValue = 10000 * 10000;
+                break;
+        }
+        return convertValue;
+    }
+
+    /**
+     * @param d
+     * @param i
+     * @Description : 对double对象四舍五入 保留指定位数的小数
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/31 22:35
+     */
+    public static Double setScaleDouble(Double d, int newScale) {
+        String pattern = "0.";
+        for (int i = 0; i < newScale; i++) {
+            pattern += "0";
+        }
+        DecimalFormat format = new DecimalFormat(pattern);
+        BigDecimal b = new BigDecimal(d);
+        Double f = b.setScale(newScale, BigDecimal.ROUND_HALF_UP).doubleValue();
+        return Double.valueOf(format.format(b));
+    }
+
+    /**
+     * @param d
+     * @param i
+     * @Description : 对float对象四舍五入 保留指定位数的小数
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/3/31 22:35
+     */
+    public static Float setScaleFloat(Float d, int newScale) {
+        String pattern = "0.";
+        for (int i = 0; i < newScale; i++) {
+            pattern += "0";
+        }
+        DecimalFormat format = new DecimalFormat(pattern);
+        BigDecimal b = new BigDecimal(d);
+        Float f = b.setScale(newScale, BigDecimal.ROUND_HALF_UP).floatValue();
+        return Float.valueOf(format.format(b));
+    }
+
+    /**
+     * 保留两位小数,小数不足两位补0
+     *
+     * @param d
+     * @param i
+     * @return
+     */
+    public static String getTwoDigitDouble(Double d, int i) {
+        if (d == null){
+            d = 0.0;
+        }
+        String pattern = "#0.";
+        int n = i;
+        while (i > 0) {
+            pattern += "0";
+            i--;
+        }
+        DecimalFormat format = new DecimalFormat(pattern);
+        BigDecimal b = new BigDecimal(d);
+        Double f = b.setScale(n, BigDecimal.ROUND_HALF_UP).doubleValue();
+        return format.format(f);
+    }
+
+    /**
+     * @param d
+     * @param i
+     * @return
+     */
+    public static Double getDigitDouble(Double d, int i) {
+        BigDecimal b = new BigDecimal(d);
+        Double f = b.setScale(i, BigDecimal.ROUND_HALF_UP).doubleValue();
+        return f;
+    }
+
+    /**
+     * @param arr       数值列表
+     * @param idx       所求数占比的索引
+     * @param precision 保留小数点位数
+     * @Description : 最大余数法 求占比
+     * @Return :
+     * @Author : yangdong
+     * @Date : 2020/4/3 10:25
+     */
+    public static String getPercentValue(List<Double> arr, int idx, int precision) {
+        if ((arr.size() - 1) < idx) {
+            return "0.00%";
+        }
+        //求和
+        Double sum = 0.0;
+        for (int i = 0; i < arr.size(); i++) {
+            sum += arr.get(i);
+        }
+        //10的2次幂是100,用于计算精度。
+        double digits = Math.pow(10, precision);
+        //扩大比例100
+        double[] votesPerQuota = new double[arr.size()];
+        for (int i = 0; i < arr.size(); i++) {
+            double val = arr.get(i) / sum * digits * 100;
+            votesPerQuota[i] = val;
+        }
+        //总数,扩大比例意味的总数要扩大
+        double targetSeats = digits * 100;
+        //再向下取值,组成数组
+        double[] seats = new double[arr.size()];
+        for (int i = 0; i < votesPerQuota.length; i++) {
+            seats[i] = Math.floor(votesPerQuota[i]);
+        }
+        //再新计算合计,用于判断与总数量是否相同,相同则占比会100%
+        double currentSum = 0;
+        for (int i = 0; i < seats.length; i++) {
+            currentSum += seats[i];
+        }
+        //余数部分的数组:原先数组减去向下取值的数组,得到余数部分的数组
+        double[] remainder = new double[arr.size()];
+        for (int i = 0; i < seats.length; i++) {
+            remainder[i] = votesPerQuota[i] - seats[i];
+        }
+        while (currentSum < targetSeats) {
+            double max = 0;
+            int maxId = 0;
+            int len = 0;
+            for (int i = 0; i < remainder.length; ++i) {
+                if (remainder[i] > max) {
+                    max = remainder[i];
+                    maxId = i;
+                }
+            }
+            //对最大项余额加1
+            ++seats[maxId];
+            //已经增加最大余数加1,则下次判断就可以不需要再判断这个余额数。
+            remainder[maxId] = 0;
+            //总的也要加1,为了判断是否总数是否相同,跳出循环。
+            ++currentSum;
+        }
+        // 这时候的seats就会总数占比会100%
+        return getTwoDigitDouble(seats[idx] / digits, precision) + "%";
+    }
+
+    /**
+     * @param arr       数值列表
+     * @param idx       所求数占比的索引
+     * @param precision 保留小数点位数
+     * @Description : 最大余数法 求占比
+     */
+    public static Double getPercentValueDoubue(List<Double> arr, int idx, int precision) {
+        if ((arr.size() - 1) < idx) {
+            return 0.00d;
+        }
+        //求和
+        Double sum = 0.0;
+        for (int i = 0; i < arr.size(); i++) {
+            sum += arr.get(i);
+        }
+        //10的2次幂是100,用于计算精度。
+        double digits = Math.pow(10, precision);
+        //扩大比例100
+        double[] votesPerQuota = new double[arr.size()];
+        for (int i = 0; i < arr.size(); i++) {
+            double val = arr.get(i) / sum * digits * 100;
+            votesPerQuota[i] = val;
+        }
+        //总数,扩大比例意味的总数要扩大
+        double targetSeats = digits * 100;
+        //再向下取值,组成数组
+        double[] seats = new double[arr.size()];
+        for (int i = 0; i < votesPerQuota.length; i++) {
+            seats[i] = Math.floor(votesPerQuota[i]);
+        }
+        //再新计算合计,用于判断与总数量是否相同,相同则占比会100%
+        double currentSum = 0;
+        for (int i = 0; i < seats.length; i++) {
+            currentSum += seats[i];
+        }
+        //余数部分的数组:原先数组减去向下取值的数组,得到余数部分的数组
+        double[] remainder = new double[arr.size()];
+        for (int i = 0; i < seats.length; i++) {
+            remainder[i] = votesPerQuota[i] - seats[i];
+        }
+        while (currentSum < targetSeats) {
+            double max = 0;
+            int maxId = 0;
+            int len = 0;
+            for (int i = 0; i < remainder.length; ++i) {
+                if (remainder[i] > max) {
+                    max = remainder[i];
+                    maxId = i;
+                }
+            }
+            //对最大项余额加1
+            ++seats[maxId];
+            //已经增加最大余数加1,则下次判断就可以不需要再判断这个余额数。
+            remainder[maxId] = 0;
+            //总的也要加1,为了判断是否总数是否相同,跳出循环。
+            ++currentSum;
+        }
+        // 这时候的seats就会总数占比会100%
+        return getDigitDouble(seats[idx] / digits, precision);
+    }
+}

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