Browse Source

修改日志配置,增加链路ID,开发定制家具模块

xiewenjie 4 years ago
parent
commit
ef65ae4b66
100 changed files with 7306 additions and 368 deletions
  1. 4 0
      .gitignore
  2. 19 11
      docker-compose.yml
  3. 33 9
      pom.xml
  4. 26 0
      sxz-application/pom.xml
  5. 7 7
      sxz-application/src/main/resources/application-dev.properties
  6. 3 2
      sxz-application/src/main/resources/application-prod.properties
  7. 11 10
      sxz-application/src/main/resources/application-uat.properties
  8. 18 2
      sxz-application/src/main/resources/application.properties
  9. 4 2
      sxz-base/pom.xml
  10. 65 0
      sxz-base/src/main/java/com/fdkk/sxz/Interceptor/CommonInterceptor.java
  11. 19 0
      sxz-base/src/main/java/com/fdkk/sxz/annotation/auth/CurrentUser.java
  12. 29 0
      sxz-base/src/main/java/com/fdkk/sxz/annotation/auth/DataFilter.java
  13. 17 0
      sxz-base/src/main/java/com/fdkk/sxz/annotation/auth/NoAuthentication.java
  14. 21 0
      sxz-base/src/main/java/com/fdkk/sxz/annotation/log/AfterLog.java
  15. 21 0
      sxz-base/src/main/java/com/fdkk/sxz/annotation/log/AroundLog.java
  16. 21 0
      sxz-base/src/main/java/com/fdkk/sxz/annotation/log/BeforeLog.java
  17. 30 9
      sxz-base/src/main/java/com/fdkk/sxz/controller/BaseController.java
  18. 75 0
      sxz-base/src/main/java/com/fdkk/sxz/base/DataPermissionCondition.java
  19. 77 0
      sxz-base/src/main/java/com/fdkk/sxz/base/DataPermissionPage.java
  20. 1 1
      sxz-base/src/main/java/com/fdkk/sxz/mapper/IBaseMapper.java
  21. 1 2
      sxz-base/src/main/java/com/fdkk/sxz/service/IBaseService.java
  22. 78 0
      sxz-base/src/main/java/com/fdkk/sxz/base/PageResult.java
  23. 5 3
      sxz-base/src/main/java/com/fdkk/sxz/vo/request/RequestBase.java
  24. 31 1
      sxz-base/src/main/java/com/fdkk/sxz/util/Result.java
  25. 23 16
      sxz-base/src/main/java/com/fdkk/sxz/service/impl/BaseServiceImpl.java
  26. 131 0
      sxz-base/src/main/java/com/fdkk/sxz/config/ScanNoAuthenticationMethod.java
  27. 33 0
      sxz-base/src/main/java/com/fdkk/sxz/config/SpringContextBean.java
  28. 3 2
      sxz-common/src/main/java/com/fdkk/sxz/listener/Swagger2.java
  29. 8 0
      sxz-base/src/main/java/com/fdkk/sxz/constant/CodeConstant.java
  30. 97 0
      sxz-base/src/main/java/com/fdkk/sxz/constant/Constant.java
  31. 99 0
      sxz-base/src/main/java/com/fdkk/sxz/constant/ResponseConstant.java
  32. 16 0
      sxz-base/src/main/java/com/fdkk/sxz/util/CaptchaUtil.java
  33. 6 4
      sxz-base/src/main/java/com/fdkk/sxz/util/OkHttpUtils.java
  34. 12 0
      sxz-common/pom.xml
  35. 1 1
      sxz-base/src/main/java/com/fdkk/sxz/config/MyBatisPlusConfig.java
  36. 160 0
      sxz-common/src/main/java/com/fdkk/sxz/exception/BootControllerAdvice.java
  37. 58 0
      sxz-common/src/main/java/com/fdkk/sxz/exception/BusinessException.java
  38. 0 88
      sxz-common/src/main/java/com/fdkk/sxz/exception/GlobalExceptionHandler.java
  39. 23 0
      sxz-common/src/main/java/com/fdkk/sxz/exception/UnauthorizedException.java
  40. 0 2
      sxz-common/src/main/java/com/fdkk/sxz/handler/MyMetaObjectHandler.java
  41. 0 60
      sxz-common/src/main/java/com/fdkk/sxz/listener/CommonInterceptor.java
  42. 0 31
      sxz-common/src/main/java/com/fdkk/sxz/listener/WebMvcConfig.java
  43. 1 0
      sxz-common/src/main/java/com/fdkk/sxz/logging/LogAppender.java
  44. 0 4
      sxz-common/src/main/java/com/fdkk/sxz/logging/LogTask.java
  45. 26 0
      sxz-core/src/main/java/com/fdkk/sxz/ChangeingApplication.java
  46. 232 64
      sxz-core/src/main/java/com/fdkk/sxz/listener/RunBuild.java
  47. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/mq/TopicManReceiver.java
  48. 1 1
      sxz-core/src/main/java/com/fdkk/sxz/mq/TopicRabbitConfig.java
  49. 35 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/CurrentUserMethodArgumentResolver.java
  50. 19 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/FastJsonHttpMessageConverterEx.java
  51. 171 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/JWTFilter.java
  52. 33 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/JWTToken.java
  53. 141 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/ShiroConfig.java
  54. 124 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/UserRealm.java
  55. 98 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/WebMvcConfigurer.java
  56. 99 0
      sxz-core/src/main/java/com/fdkk/sxz/other/shiro/conponent/JwtComponent.java
  57. 0 15
      sxz-core/src/main/java/com/fdkk/sxz/service/impl/CompanyServiceImpl.java
  58. 0 20
      sxz-core/src/main/java/com/fdkk/sxz/service/impl/RenovationPartsColorServiceImpl.java
  59. 136 0
      sxz-core/src/main/java/com/fdkk/sxz/system/aspect/DataFilterAspect.java
  60. 252 0
      sxz-core/src/main/java/com/fdkk/sxz/system/aspect/SystemLogAspect.java
  61. 128 0
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/ResourceController.java
  62. 235 0
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/RoleController.java
  63. 62 0
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysLogController.java
  64. 460 0
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysLoginController.java
  65. 151 0
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysOrganizationController.java
  66. 326 0
      sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysUserController.java
  67. 264 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateOrganization.java
  68. 195 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateResource.java
  69. 154 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateRole.java
  70. 149 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateUser.java
  71. 61 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/LogInfo.java
  72. 63 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/LoginUser.java
  73. 141 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/PwdUser.java
  74. 53 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/QueryLog.java
  75. 262 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/QueryUser.java
  76. 147 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/RegisterUser.java
  77. 73 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/SmsDto.java
  78. 39 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateDataPermission.java
  79. 264 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateOrganization.java
  80. 195 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateResource.java
  81. 153 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateRole.java
  82. 50 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateRoleResource.java
  83. 327 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateUser.java
  84. 322 0
      sxz-core/src/main/java/com/fdkk/sxz/system/dto/UserInfo.java
  85. 20 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/DataPermissionMapper.java
  86. 26 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/LogMapper.java
  87. 28 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/OrganizationMapper.java
  88. 19 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/OrganizationRoleMapper.java
  89. 19 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/OrganizationUserMapper.java
  90. 39 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/ResourceMapper.java
  91. 29 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/RoleMapper.java
  92. 19 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/RoleResourceMapper.java
  93. 31 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/UserMapper.java
  94. 19 0
      sxz-core/src/main/java/com/fdkk/sxz/system/mapper/UserRoleMapper.java
  95. 23 0
      sxz-core/src/main/java/com/fdkk/sxz/system/service/IDataPermissionService.java
  96. 27 0
      sxz-core/src/main/java/com/fdkk/sxz/system/service/ILogService.java
  97. 15 0
      sxz-core/src/main/java/com/fdkk/sxz/system/service/IOrganizationRoleService.java
  98. 48 0
      sxz-core/src/main/java/com/fdkk/sxz/system/service/IOrganizationService.java
  99. 15 0
      sxz-core/src/main/java/com/fdkk/sxz/system/service/IOrganizationUserService.java
  100. 0 0
      sxz-core/src/main/java/com/fdkk/sxz/system/service/IResourceService.java

+ 4 - 0
.gitignore

@@ -34,4 +34,8 @@ gen
 rebel.xml
 /target/
 
+
+*.iws
+*.ipr
 !/.gitignore
+!/logs/

+ 19 - 11
docker-compose.yml

@@ -1,15 +1,23 @@
-version: "3.3"
-
+version: "3"
 services:
-  java:
-    image: tomcat:8.5-jdk8
+  changeing-service:
+    # 指定容器名称
     container_name: sxz_web_java
+    # 重启机制
     restart: always
-    # depends_on:
-    #   - db
-    ports:
-      - 8020:8080
+    image: java:8
     volumes:
-      - ./target/changeing-0.0.1-SNAPSHOT.war:/usr/local/tomcat/webapps/ROOT.war
-      - /var/log/sxz_web_java/tomcat/logs:/usr/local/tomcat/logs
-      - /var/log/sxz_web_java/changing/logs:/var/log/sxz_web_java/project/logs
+      # 本地jar包路径
+      - ./sxz-application/target/changeing.jar:/changeing.jar
+      # 挂载日志 -v A:B ,A指宿主机位置,B指容器位置
+      - /var/log/sxz_web_java/tomcat/logs:/logs
+      # 指定容器时间为宿主机时间
+      - /etc/localtime:/etc/localtime
+    # 访问端口
+    ports:
+      - "8020:8082"
+      - "5525:5525"
+    environment:
+      - TZ="Asia/Shanghai"
+    #启动容器后执行的命令
+    entrypoint: java -server -Xms256m -Xmx256m -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5525 -Dserver.port=8082 changeing.jar

+ 33 - 9
pom.xml

@@ -90,7 +90,21 @@
             <artifactId>springfox-swagger-ui</artifactId>
             <version>${swagger.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-annotations</artifactId>
+            <version>1.5.22</version>
+        </dependency>
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-models</artifactId>
+            <version>1.5.22</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.0.17.Final</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-tomcat</artifactId>
@@ -121,7 +135,6 @@
             <version>1.3.1</version>
         </dependency>
         <!-- 					-->
-
         <dependency>
             <groupId>com.github.jsqlparser</groupId>
             <artifactId>jsqlparser</artifactId>
@@ -170,12 +183,6 @@
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <version>2.12.4</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.fasterxml.jackson.core</groupId>
-                    <artifactId>jackson-annotations</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
@@ -232,7 +239,7 @@
         <dependency>
             <groupId>com.github.xiaoymin</groupId>
             <artifactId>knife4j-spring-boot-starter</artifactId>
-            <version>2.0.2</version>
+            <version>2.0.3</version>
         </dependency>
 
         <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
@@ -296,6 +303,23 @@
             <scope>test</scope>
         </dependency>
 
+
+        <dependency>
+            <groupId>com.github.t3hnar</groupId>
+            <artifactId>scala-bcrypt_2.10</artifactId>
+            <version>2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.7.0</version>
+        </dependency>
+        <!-- j2cache -->
         <!-- 钉钉告警 -->
         <!--		<dependency>-->
         <!--			<groupId>com.aliyun</groupId>-->

+ 26 - 0
sxz-application/pom.xml

@@ -46,6 +46,32 @@
         <java.version>1.8</java.version>
         <failOnMissingWebXml>false</failOnMissingWebXml>
     </properties>
+
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <package.environment>dev</package.environment>
+            </properties>
+
+        </profile>
+        <profile>
+            <id>uat</id>
+            <properties>
+                <package.environment>uat</package.environment>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 生产环境 -->
+            <id>prod</id>
+            <properties>
+                <package.environment>prod</package.environment>
+            </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+    </profiles>
     <build>
         <finalName>changeing</finalName>
         <plugins>

+ 7 - 7
sxz-application/src/main/resources/application-dev.properties

@@ -1,4 +1,4 @@
-server.file.location=E:\\Downloads
+server.file.location=E:\\Downloads\\
 upload.file.location=${server.file.location}/upload/
 #log
 logging.file.path=E:/prox/sxz/logs
@@ -17,9 +17,9 @@ spring.servlet.multipart.enabled=true
 spring.mvc.async.request-timeout=600000
 spring.web.static-locations=classpath:/META-INF/resources/,classpath:/data/, classpath:/static/, file:${server.file.location}
 #数据库配置
-spring.datasource.url=jdbc:mysql://192.168.0.47:3306/change_clothes?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
-spring.datasource.username=root
-spring.datasource.password=123123
+spring.datasource.url=jdbc:mysql://192.168.0.26:3306/change_clothes?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.username=test
+spring.datasource.password=123456
 # Hikari will use the above plus the following to setup connection pooling
 spring.datasource.type=com.zaxxer.hikari.HikariDataSource
 spring.datasource.hikari.minimum-idle=5
@@ -44,7 +44,7 @@ mybatis-plus.global-config.db-config.logic-delete-value=A
 mybatis-plus.global-config.db-config.logic-not-delete-value=I
 mybatis-plus.global-config.db-config.table-prefix=tb_
 mybatis-plus.global-config.db-config.table-underline=true
-mybatis-plus.mapper-locations=classpath:/mapper/*.xml
+mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
 ## pagehelper分页插件配置 ##
 #标识是哪一种数据库
 pagehelper.helperDialect=mysql
@@ -86,5 +86,5 @@ model.build.url=http://192.168.0.30:8100/
 #.max转datasmith和obj加减面url
 max.obj.url=http://192.168.0.75:8080/
 dingding.warning.address=https://oapi.dingtalk.com/robot/send?access_token=13ae02d6821a56ce86c3e6ad98d0260896eba5888a9bd18aed141c39f11299a8
-#缓存接口日志时间
-logsTimeOut=1
+#缓存接口日志时间(单位小时)
+logsTimeOut=4

+ 3 - 2
sxz-application/src/main/resources/application-prod.properties

@@ -44,7 +44,7 @@ mybatis-plus.global-config.db-config.logic-delete-value=A
 mybatis-plus.global-config.db-config.logic-not-delete-value=I
 mybatis-plus.global-config.db-config.table-prefix=t_
 mybatis-plus.global-config.db-config.table-underline=true
-mybatis-plus.mapper-locations=classpath:/mapper/*.xml
+mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
 ## pagehelper分页插件配置 ##
 #标识是哪一种数据库
 pagehelper.helperDialect=mysql
@@ -88,4 +88,5 @@ light.build.url=http://101.66.188.5:8100/
 model.build.url=http://101.66.188.5:8100/
 #.max转datasmith和obj加减面url
 max.obj.url=http://120.78.65.189:8080/
-logsTimeOut=1
+#缓存接口日志时间(单位小时)
+logsTimeOut=4

+ 11 - 10
sxz-application/src/main/resources/application-uat.properties

@@ -17,9 +17,9 @@ spring.servlet.multipart.enabled=true
 spring.mvc.async.request-timeout=600000
 spring.web.static-locations=classpath:/META-INF/resources/,classpath:/resources/, classpath:/static/, file:${server.file.location}
 #数据库配置
-spring.datasource.url=jdbc:mysql://47.112.166.173:3306/zhi_house?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.url=jdbc:mysql://192.168.0.47:3306/change_clothes_x?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
 spring.datasource.username=root
-spring.datasource.password=4dkankan4dage
+spring.datasource.password=123123
 # Hikari will use the above plus the following to setup connection pooling
 spring.datasource.type=com.zaxxer.hikari.HikariDataSource
 spring.datasource.hikari.minimum-idle=5
@@ -30,7 +30,7 @@ spring.datasource.hikari.pool-name=DatebookHikariCP
 spring.datasource.hikari.max-lifetime=1800000
 spring.datasource.hikari.connection-timeout=30000
 #rabbitmq
-spring.rabbitmq.host=192.168.0.47
+spring.rabbitmq.host=192.168.0.26
 spring.rabbitmq.port=5672
 spring.rabbitmq.username=guest
 spring.rabbitmq.password=guest
@@ -44,7 +44,7 @@ mybatis-plus.global-config.db-config.logic-delete-value=A
 mybatis-plus.global-config.db-config.logic-not-delete-value=I
 mybatis-plus.global-config.db-config.table-prefix=t_
 mybatis-plus.global-config.db-config.table-underline=true
-mybatis-plus.mapper-locations=classpath:/mapper/*.xml
+mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
 ## pagehelper分页插件配置 ##
 #标识是哪一种数据库
 pagehelper.helperDialect=mysql
@@ -64,8 +64,8 @@ spring.redis.lettuce.pool.max-idle=8
 spring.redis.lettuce.pool.min-idle=-1
 spring.redis.port=6379
 spring.redis.host=127.0.0.1
-spring.redis.password=1234
-spring.redis.database=1
+spring.redis.password=
+spring.redis.database=15
 #Cluster集群
 #spring.redis.cluster.nodes=1
 #哨兵模式配置-开始
@@ -80,10 +80,11 @@ oss.bucket=4dkankan
 oss.type=oss
 prefix.ali=https://houseoss.4dkankan.com/
 main.url=https://test.4dkankan.com/
-build.url=http://192.168.0.30:8100/
-light.build.url=http://192.168.0.30:8100/
-model.build.url=http://192.168.0.30:8100/
+build.url=http://192.168.0.142:8100/
+light.build.url=http://192.168.0.142:8100/
+model.build.url=http://192.168.0.142:8100/
 #.max转datasmith和obj加减面url
 max.obj.url=http://192.168.0.75:8080/
 dingding.warning.address=https://oapi.dingtalk.com/robot/send?access_token=13ae02d6821a56ce86c3e6ad98d0260896eba5888a9bd18aed141c39f11299a8
-logsTimeOut=1
+#缓存接口日志时间(单位小时)
+logsTimeOut=4

+ 18 - 2
sxz-application/src/main/resources/application.properties

@@ -1,5 +1,21 @@
-server.port=8080
+server.port=8082
 
 #开发 dev ,测试 uat ,生产 prod
-spring.profiles.active=dev
+spring.profiles.active=uat
+
+
+system.defaultPwd=123456
+system.defaultRoleId=100
+system.defaultOrgId=0
+system.noDataFilterRole=DATA_NO_FILTER
+system.smsTimes=25
+system.expireTime={web: 10800000l, app: 15768000000l}
+
+#扫描controller中不需要鉴权的method
+
+controller.scanPackage= classpath*:com/fdkk/sxz/*/controller/*.class,classpath*:com/fdkk/sxz/*/controller/*.class
+
+
+
+
 

+ 4 - 2
sxz-base/pom.xml

@@ -54,7 +54,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-amqp</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+        </dependency>
         <!-- swagger -->
         <dependency>
             <groupId>io.springfox</groupId>
@@ -232,7 +235,6 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>
         </dependency>
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

+ 65 - 0
sxz-base/src/main/java/com/fdkk/sxz/Interceptor/CommonInterceptor.java

@@ -0,0 +1,65 @@
+package com.fdkk.sxz.Interceptor;
+
+import cn.hutool.core.util.IdUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+@Component
+public class CommonInterceptor implements HandlerInterceptor {
+
+    private long startTime;
+    private long endTime;
+
+    private boolean isaBoolean(HttpServletRequest request) {
+        return !request.getRequestURI().contains("/static/")
+                && !request.getRequestURI().contains("/sendUserInfo")
+                && !request.getRequestURI().contains("/webjars")
+                && !request.getRequestURI().contains("/swagger")
+                && !request.getRequestURI().contains(".json")
+                && !request.getRequestURI().contains(".png")
+                && !request.getRequestURI().contains(".html")
+                && !request.getRequestURI().contains(".mp3")
+                && !request.getRequestURI().contains(".jpg")
+                && !request.getRequestURI().equals("/")
+                && !request.getRequestURI().contains("/logging/");
+    }
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
+        String traceId = IdUtil.getSnowflake().nextIdStr();
+        MDC.put("TRACE_ID", traceId);
+        request.setAttribute("TRACE_ID", traceId);
+        if (isaBoolean(request)) {
+            log.info(request.getRequestURI() + "::进入该请求!");
+            startTime = System.currentTimeMillis();
+        }
+        return true;
+    }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
+        request.setAttribute("ctx", request.getContextPath());
+    }
+
+    @Override
+    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
+
+        if (isaBoolean(request)) {
+            endTime = System.currentTimeMillis();
+            long time = endTime - startTime;
+            log.info(request.getRequestURI() + "::完成请求!接口耗时" + time + "ms");
+            MDC.clear();
+            request.removeAttribute("TRACE_ID");
+
+        }
+    }
+
+
+}

+ 19 - 0
sxz-base/src/main/java/com/fdkk/sxz/annotation/auth/CurrentUser.java

@@ -0,0 +1,19 @@
+package com.fdkk.sxz.annotation.auth;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @ClassName: CurrentUser
+ * @Description: 在Controller的方法参数中使用此注解,该方法在映射时会注入当前登录的User对象
+ * @author Xiewj
+ * @date 2018年5月18日 下午11:52:43
+ *
+ */
+@Target(ElementType.PARAMETER) // 可用在方法的参数上
+@Retention(RetentionPolicy.RUNTIME) // 运行时有效
+public @interface CurrentUser {
+}

+ 29 - 0
sxz-base/src/main/java/com/fdkk/sxz/annotation/auth/DataFilter.java

@@ -0,0 +1,29 @@
+package com.fdkk.sxz.annotation.auth;
+
+import java.lang.annotation.*;
+
+/**
+ * 数据过滤
+ *
+ * @author Xiewj
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface DataFilter {
+
+    /**
+     * 数据权限中,需要过滤的表字段organizationId的别名
+     */
+    String orgIdAlias() default  "";
+
+    /**
+     * 数据权限中,需要过滤的表字段userId的别名
+     */
+    String userIdAlias() default  "";
+
+    /**
+     * 数据权限中,没有本部门数据权限时,是否可以查询本人数据
+     */
+    boolean ownQuery() default false;
+}

+ 17 - 0
sxz-base/src/main/java/com/fdkk/sxz/annotation/auth/NoAuthentication.java

@@ -0,0 +1,17 @@
+package com.fdkk.sxz.annotation.auth;
+
+import java.lang.annotation.*;
+
+/**
+ *
+ * @ClassName: Pass
+ * @Description: 在Controller方法上加入该注解不会验证身份
+ * @author Xiewj
+ * @date 2018年5月18日 下午11:52:07
+ *
+ */
+@Target({ ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface NoAuthentication {
+}

+ 21 - 0
sxz-base/src/main/java/com/fdkk/sxz/annotation/log/AfterLog.java

@@ -0,0 +1,21 @@
+package com.fdkk.sxz.annotation.log;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @ClassName: AfterLog
+ * @Description: 记录后置日志
+ * @author Xiewj
+ * @date 2021年8月27日10:28:23
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD })
+public @interface AfterLog {
+
+    String name() default "";
+}

+ 21 - 0
sxz-base/src/main/java/com/fdkk/sxz/annotation/log/AroundLog.java

@@ -0,0 +1,21 @@
+package com.fdkk.sxz.annotation.log;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @ClassName: AroundLog
+ * @Description:记录around日志
+ * @author Xiewj
+ * @date 2021年8月27日10:28:23
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD })
+public @interface AroundLog {
+
+    String name() default "";
+}

+ 21 - 0
sxz-base/src/main/java/com/fdkk/sxz/annotation/log/BeforeLog.java

@@ -0,0 +1,21 @@
+package com.fdkk.sxz.annotation.log;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @ClassName: BeforeLog
+ * @Description: 记录前置日志
+ * @author Xiewj
+ * @date 2021年8月27日10:28:23
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD })
+public @interface BeforeLog {
+
+    String name() default "";
+}

+ 30 - 9
sxz-base/src/main/java/com/fdkk/sxz/controller/BaseController.java

@@ -1,10 +1,10 @@
-package com.fdkk.sxz.controller;
+package com.fdkk.sxz.base;
 
 import cn.hutool.core.io.IoUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.fdkk.sxz.constant.ResponseConstant;
 import com.fdkk.sxz.util.IPUtil;
-import com.fdkk.sxz.util.Result;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -49,7 +49,7 @@ public class BaseController {
      * @return ip地址
      */
     public static String getIp(HttpServletRequest request) {
-       return IPUtil.getIP(request);
+        return IPUtil.getIP(request);
     }
 
     /**
@@ -92,6 +92,18 @@ public class BaseController {
     }
 
     /**
+     * 放入object
+     */
+    public <K> Result successPut(Object object) {
+        return new Result().successPut(object);
+    }
+    /**
+     * 放入object
+     */
+    public <K> Result errorPut(Object object) {
+        return new Result().errorPut(object);
+    }
+    /**
      * 处理失败,并返回数据(一般为错误信息)
      *
      * @param code 错误代码
@@ -113,11 +125,20 @@ public class BaseController {
     }
 
     /**
-     *  下载文件
-     * @param file 文件
-     * @param fileName  文件名
-     * @param suffix  后缀
-     * @param deleteOnExit  是否删除 ture/false
+     * 返回信息
+     */
+    public <K> Result error(ResponseConstant constant) {
+        return Result.error(constant);
+    }
+
+
+    /**
+     * 下载文件
+     *
+     * @param file         文件
+     * @param fileName     文件名
+     * @param suffix       后缀
+     * @param deleteOnExit 是否删除 ture/false
      */
     public void downloadFile(File file, String fileName, String suffix, boolean deleteOnExit) {
         response.setCharacterEncoding(request.getCharacterEncoding());
@@ -126,7 +147,7 @@ public class BaseController {
         try {
             fis = new FileInputStream(file);
             response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("gb2312"), "ISO8859-1"));
-            IoUtil.copy(fis,response.getOutputStream());
+            IoUtil.copy(fis, response.getOutputStream());
             response.flushBuffer();
         } catch (Exception e) {
             log.error(e.getMessage(), e);

+ 75 - 0
sxz-base/src/main/java/com/fdkk/sxz/base/DataPermissionCondition.java

@@ -0,0 +1,75 @@
+package com.fdkk.sxz.base;
+
+import java.util.List;
+
+/**
+ * @author Xiewj
+ */
+public class DataPermissionCondition {
+
+    /**
+     * 数据权限中,需要过滤的表字段organizationId的别名
+     */
+    private String orgIdAlias;
+
+    /**
+     * 数据权限中,拥有该权限organizationId的列表
+     */
+    private List<String> orgIdList;
+
+    /**
+     * 数据权限中,需要过滤的表字段userId的别名
+     */
+    private String userIdAlias;
+
+    /**
+     * 数据权限中,拥有该权限userId的值
+     */
+    private String userId;
+
+    /**
+     * 数据权限中,没有本部门数据权限时,是否可以查询本人数据
+     */
+    private boolean ownQuery;
+
+
+    public String getOrgIdAlias() {
+        return orgIdAlias;
+    }
+
+    public void setOrgIdAlias(String orgIdAlias) {
+        this.orgIdAlias = orgIdAlias;
+    }
+
+    public List<String> getOrgIdList() {
+        return orgIdList;
+    }
+
+    public void setOrgIdList(List<String> orgIdList) {
+        this.orgIdList = orgIdList;
+    }
+
+    public String getUserIdAlias() {
+        return userIdAlias;
+    }
+
+    public void setUserIdAlias(String userIdAlias) {
+        this.userIdAlias = userIdAlias;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public boolean isOwnQuery() {
+        return ownQuery;
+    }
+
+    public void setOwnQuery(boolean ownQuery) {
+        this.ownQuery = ownQuery;
+    }
+}

+ 77 - 0
sxz-base/src/main/java/com/fdkk/sxz/base/DataPermissionPage.java

@@ -0,0 +1,77 @@
+package com.fdkk.sxz.base;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import java.util.List;
+
+/**
+ * @author Xiewj
+ */
+public class DataPermissionPage<T> extends Page{
+
+    /**
+     * 数据权限中,需要过滤的表字段organizationId的别名
+     */
+    private String orgIdAlias;
+
+    /**
+     * 数据权限中,拥有该权限organizationId的列表
+     */
+    private List<String> orgIdList;
+
+    /**
+     * 数据权限中,需要过滤的表字段userId的别名
+     */
+    private String userIdAlias;
+
+    /**
+     * 数据权限中,拥有该权限userId的值
+     */
+    private String userId;
+
+    /**
+     * 数据权限中,没有本部门数据权限时,是否可以查询本人数据
+     */
+    private boolean ownQuery;
+
+
+    public String getOrgIdAlias() {
+        return orgIdAlias;
+    }
+
+    public void setOrgIdAlias(String orgIdAlias) {
+        this.orgIdAlias = orgIdAlias;
+    }
+
+    public List<String> getOrgIdList() {
+        return orgIdList;
+    }
+
+    public void setOrgIdList(List<String> orgIdList) {
+        this.orgIdList = orgIdList;
+    }
+
+    public String getUserIdAlias() {
+        return userIdAlias;
+    }
+
+    public void setUserIdAlias(String userIdAlias) {
+        this.userIdAlias = userIdAlias;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public boolean isOwnQuery() {
+        return ownQuery;
+    }
+
+    public void setOwnQuery(boolean ownQuery) {
+        this.ownQuery = ownQuery;
+    }
+}

+ 1 - 1
sxz-base/src/main/java/com/fdkk/sxz/mapper/IBaseMapper.java

@@ -1,4 +1,4 @@
-package com.fdkk.sxz.mapper;
+package com.fdkk.sxz.base;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 

+ 1 - 2
sxz-base/src/main/java/com/fdkk/sxz/service/IBaseService.java

@@ -1,10 +1,9 @@
-package com.fdkk.sxz.service;
+package com.fdkk.sxz.base;
 
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.github.pagehelper.PageInfo;
-import com.fdkk.sxz.vo.request.RequestBase;
 
 import java.io.Serializable;
 import java.util.List;

+ 78 - 0
sxz-base/src/main/java/com/fdkk/sxz/base/PageResult.java

@@ -0,0 +1,78 @@
+package com.fdkk.sxz.base;
+
+import java.util.List;
+
+/**
+ * @ClassName: PageResult
+ * @Description: TODO
+ * @author Xiewj
+ * @date 2018年5月25日 下午9:24:50
+ * @param <T>
+ */
+public class PageResult<T> {
+
+    /**
+     * 状态码, 200表示成功
+     */
+    private int code;
+
+    /**
+     * 提示信息
+     */
+    private String msg;
+
+    /**
+     * 总数量
+     */
+    private long count;
+
+    /**
+     * 当前数据
+     */
+    private List<T> data;
+
+    /**
+     * 默认构造方法
+     */
+    public PageResult() {
+    }
+
+    public PageResult(long total, List<T> rows) {
+        this.count = total;
+        this.data = rows;
+        this.code = 0;
+        this.msg = "";
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public long getCount() {
+        return count;
+    }
+
+    public void setCount(long count) {
+        this.count = count;
+    }
+
+    public List<T> getData() {
+        return data;
+    }
+
+    public void setData(List<T> data) {
+        this.data = data;
+    }
+}

+ 5 - 3
sxz-base/src/main/java/com/fdkk/sxz/vo/request/RequestBase.java

@@ -1,4 +1,4 @@
-package com.fdkk.sxz.vo.request;
+package com.fdkk.sxz.base;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -10,8 +10,8 @@ import java.io.Serializable;
 @ApiModel(value = "分页对象", description = "RequestBase")
 public class RequestBase implements Serializable {
 
-    @ApiModelProperty(value = "当前页", name = "pageNum")
-    private int pageNum;
+    @ApiModelProperty(value = "当前页,默认 1", name = "pageNum")
+    private int pageNum=1;
 
     @ApiModelProperty(value = "每页显示条数,默认 20", name = "pageSize")
     private int pageSize=20;
@@ -19,6 +19,8 @@ public class RequestBase implements Serializable {
     @ApiModelProperty(value = "排序字段", name = "orderBy")
     private String orderBy;
 
+    @ApiModelProperty(value = "是否查询全部 true false", name = "isALL")
+    private Boolean isALL=false;
 
     @ApiModelProperty(value = "查询排序方式,默认 DESC", name = "sortBy")
     private String sortBy="DESC";

+ 31 - 1
sxz-base/src/main/java/com/fdkk/sxz/util/Result.java

@@ -1,6 +1,7 @@
-package com.fdkk.sxz.util;
+package com.fdkk.sxz.base;
 
 //import io.swagger.annotations.ApiModelProperty;
+import com.fdkk.sxz.constant.ResponseConstant;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -18,6 +19,8 @@ import java.io.Serializable;
 public class Result<T> implements Serializable {
     private static final long serialVersionUID = -1491499610244557029L;
     public static final String SUCCESS_MSG = "操作成功";
+    public static final String ERROR_MSG = "操作成功";
+
     public static int CODE_SUCCESS = 0;
     public static int CODE_FAILURE = -1;
     public static String[] NOOP = new String[]{};
@@ -83,6 +86,7 @@ public class Result<T> implements Serializable {
     public static Result failure(int code, String msg) {
         return new Result(code, msg, NOOP);
     }
+
     /**
      * 处理失败
      *
@@ -93,9 +97,35 @@ public class Result<T> implements Serializable {
         return failure(CODE_FAILURE, msg);
     }
 
+
+
+    /**
+     * 放入object
+     */
+    public Result<T> successPut(T object) {
+        return new Result(CODE_SUCCESS, SUCCESS_MSG, object);
+    }
+    /**
+     * 放入object
+     */
+    public Result<T> errorPut(T object) {
+        return new Result(CODE_FAILURE, ERROR_MSG, object);
+    }
+
+
+
+    /**
+     * 返回信息
+     */
+    public static Result error(ResponseConstant constant) {
+        return failure( constant.getResult(),constant.getMsg());
+    }
+
     @Override
     public String toString() {
         return "JsonResult [code=" + code + ", msg=" + msg + ", data="
                 + data + "]";
     }
+
+
 }

+ 23 - 16
sxz-base/src/main/java/com/fdkk/sxz/service/impl/BaseServiceImpl.java

@@ -1,14 +1,15 @@
-package com.fdkk.sxz.service.impl;
+package com.fdkk.sxz.base.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.fdkk.sxz.mapper.IBaseMapper;
-import com.fdkk.sxz.service.IBaseService;
-import com.fdkk.sxz.vo.request.RequestBase;
+import com.fdkk.sxz.base.IBaseMapper;
+import com.fdkk.sxz.base.IBaseService;
+import com.fdkk.sxz.base.RequestBase;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -52,10 +53,12 @@ public abstract class BaseServiceImpl<M extends IBaseMapper<T>, T> extends Servi
 
     @Override
     public PageInfo<T>  listByPage(RequestBase page, T condition) {
-        if (page != null) {
-            PageHelper.startPage(page.getPageNum(),page.getPageSize());
-            if (StrUtil.isNotEmpty(page.getOrderBy())){
-                PageHelper.orderBy(page.getOrderBy()+" "+page.getSortBy());
+        if (ObjectUtil.isNotNull(page)) {
+            if (!page.getIsALL()){
+                PageHelper.startPage(page.getPageNum(), page.getPageSize());
+                if (StrUtil.isNotEmpty(page.getOrderBy())) {
+                    PageHelper.orderBy(page.getOrderBy() + " " + page.getSortBy());
+                }
             }
         }
         return  new PageInfo<T>(super.list(new QueryWrapper<>(condition)));
@@ -63,10 +66,12 @@ public abstract class BaseServiceImpl<M extends IBaseMapper<T>, T> extends Servi
 
     @Override
     public PageInfo<T> listByPage(RequestBase page, Wrapper<T> queryWrapper) {
-        if (page != null) {
-            PageHelper.startPage(page.getPageNum(),page.getPageSize());
-            if (StrUtil.isNotEmpty(page.getOrderBy())){
-                PageHelper.orderBy(page.getOrderBy()+" "+page.getSortBy());
+        if (ObjectUtil.isNotNull(page)) {
+            if (!page.getIsALL()){
+                PageHelper.startPage(page.getPageNum(),page.getPageSize());
+                if (StrUtil.isNotEmpty(page.getOrderBy())){
+                    PageHelper.orderBy(page.getOrderBy()+" "+page.getSortBy());
+                }
             }
         }
         return new PageInfo<T>(super.list(queryWrapper));
@@ -74,10 +79,12 @@ public abstract class BaseServiceImpl<M extends IBaseMapper<T>, T> extends Servi
 
     @Override
     public PageInfo<T> listByPage(RequestBase page) {
-        if (page != null) {
-            PageHelper.startPage(page.getPageNum(),page.getPageSize());
-            if (StrUtil.isNotEmpty(page.getOrderBy())){
-                PageHelper.orderBy(page.getOrderBy()+" "+page.getSortBy());
+        if (ObjectUtil.isNotNull(page)) {
+            if (!page.getIsALL()){
+                PageHelper.startPage(page.getPageNum(), page.getPageSize());
+                if (StrUtil.isNotEmpty(page.getOrderBy())) {
+                    PageHelper.orderBy(page.getOrderBy() + " " + page.getSortBy());
+                }
             }
         }
         return new PageInfo<T>(super.list());

+ 131 - 0
sxz-base/src/main/java/com/fdkk/sxz/config/ScanNoAuthenticationMethod.java

@@ -0,0 +1,131 @@
+package com.fdkk.sxz.config;
+
+import com.fdkk.sxz.annotation.auth.NoAuthentication;
+import com.fdkk.sxz.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @ClassName: MyCommandLineRunner
+ * @Description:
+ * @author Xiewj
+ * @date 2018年5月18日 下午5:18:42
+ */
+@Component
+public class ScanNoAuthenticationMethod implements CommandLineRunner {
+
+    private Logger logger = LoggerFactory.getLogger(ScanNoAuthenticationMethod.class);
+
+    @Value("${controller.scanPackage}")
+    private String[] scanPackage;
+
+    @Override
+    public void run(String... args) throws Exception {
+        for (String s : scanPackage) {
+            doScanner(s);
+        }
+        Set<String> urlAndMethodSet = new HashSet<>();
+        for (String aClassName : Constant.METHOD_URL_SET) {
+            Class<?> clazz = Class.forName(aClassName);
+            String baseUrl = "";
+            String[] classUrl = {};
+            if (!StringUtils.isEmpty(clazz.getAnnotation(RequestMapping.class))) {
+                classUrl = clazz.getAnnotation(RequestMapping.class).value();
+            }
+            Method[] methods = clazz.getMethods();
+            for (Method method : methods) {
+                if (method.isAnnotationPresent(NoAuthentication.class)) {
+                    String[] methodUrl = null;
+                    StringBuilder sb = new StringBuilder();
+                    if (!StringUtils.isEmpty(method.getAnnotation(PostMapping.class))) {
+                        methodUrl = method.getAnnotation(PostMapping.class).value();
+                        if (StringUtils.isEmpty(methodUrl)) {
+                            methodUrl = method.getAnnotation(PostMapping.class).path();
+                        }
+                        baseUrl = getRequestUrl(classUrl, methodUrl, sb, "POST");
+                    } else if (!StringUtils.isEmpty(method.getAnnotation(GetMapping.class))) {
+                        methodUrl = method.getAnnotation(GetMapping.class).value();
+                        if (StringUtils.isEmpty(methodUrl)) {
+                            methodUrl = method.getAnnotation(GetMapping.class).path();
+                        }
+                        baseUrl = getRequestUrl(classUrl, methodUrl, sb, "GET");
+                    } else if (!StringUtils.isEmpty(method.getAnnotation(DeleteMapping.class))) {
+                        methodUrl = method.getAnnotation(DeleteMapping.class).value();
+                        if (StringUtils.isEmpty(methodUrl)) {
+                            methodUrl = method.getAnnotation(DeleteMapping.class).path();
+                        }
+                        baseUrl = getRequestUrl(classUrl, methodUrl, sb, "DELETE");
+                    } else if (!StringUtils.isEmpty(method.getAnnotation(PutMapping.class))) {
+                        methodUrl = method.getAnnotation(PutMapping.class).value();
+                        if (StringUtils.isEmpty(methodUrl)) {
+                            methodUrl = method.getAnnotation(PutMapping.class).path();
+                        }
+                        baseUrl = getRequestUrl(classUrl, methodUrl, sb, "PUT");
+                    } else {
+                        methodUrl = method.getAnnotation(RequestMapping.class).value();
+                        baseUrl = getRequestUrl(classUrl, methodUrl, sb, RequestMapping.class.getSimpleName());
+                    }
+                    if (!StringUtils.isEmpty(baseUrl)) {
+                        urlAndMethodSet.add(baseUrl);
+                    }
+                }
+            }
+        }
+        Constant.METHOD_URL_SET = urlAndMethodSet;
+        logger.info("@NoAuthentication:" + urlAndMethodSet);
+    }
+
+    private String getRequestUrl(String[] classUrl, String[] methodUrl, StringBuilder sb, String requestName) {
+        if (!StringUtils.isEmpty(classUrl)) {
+            for (String url : classUrl) {
+                sb.append(url + "/");
+            }
+        }
+        for (String url : methodUrl) {
+            sb.append(url);
+        }
+        return sb.toString().replaceAll("/+", "/") + ":" + requestName;
+    }
+
+    private void doScanner(String packageName) throws IOException {
+        ResourcePatternResolver resourceLoader = new PathMatchingResourcePatternResolver();
+        Resource[] source = resourceLoader.getResources(packageName);
+        for (int i = 0; i < source.length; i++) {
+            Resource resource = source[i];
+            String resourcePath = resource.getURI().toString();
+            String soua = "";
+//            logger.info(resourcePath);
+            if (resourcePath.startsWith("jar:")) {
+                int firstIndex = resourcePath.indexOf("!");
+                int secondIndex = resourcePath.indexOf("!", firstIndex + 1);
+                String fpath = resourcePath.substring(0, secondIndex + 1);
+                soua = resourcePath.replace(fpath, "");
+            } else if (resourcePath.startsWith("file:")) {
+                soua = resource.getURI().getPath().replaceFirst("/", "");
+                String path = System.getProperty("java.class.path").replace("\\", "/");
+                String[] paths = path.split(";");
+                for (String p : paths) {
+                    if (soua.startsWith(p)) {
+                        soua = soua.replace(p, "");
+                        break;
+                    }
+                }
+            }
+            String souc = soua.replace(".class", "").replaceFirst("/", "").replace("/", ".");
+            Constant.METHOD_URL_SET.add(souc);
+        }
+    }
+}

+ 33 - 0
sxz-base/src/main/java/com/fdkk/sxz/config/SpringContextBean.java

@@ -0,0 +1,33 @@
+package com.fdkk.sxz.config;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+/**
+ * @ClassName: SpringContextBean
+ * @Description: 获取spring上下文
+ * @author Xiewj
+ * @date 2018年5月18日 下午5:19:02
+ */
+@Component
+public class SpringContextBean implements ApplicationContextAware {
+
+    private static ApplicationContext context = null;
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        context = applicationContext;
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> T getBean(String name) {
+        T bean = (T) context.getBean(name);
+        return bean;
+    }
+
+    public static <T> T getBean(Class<T> beanClass) {
+        return context.getBean(beanClass);
+    }
+}

+ 3 - 2
sxz-common/src/main/java/com/fdkk/sxz/listener/Swagger2.java

@@ -1,6 +1,7 @@
-package com.fdkk.sxz.listener;
+package com.fdkk.sxz.config;
 
 import com.google.common.collect.Lists;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import springfox.documentation.builders.ApiInfoBuilder;
@@ -38,7 +39,7 @@ public class Swagger2 {
         return new Docket(DocumentationType.SWAGGER_2)
                 .apiInfo(apiInfo())
                 .select()
-                .apis(RequestHandlerSelectors.basePackage("com.fdkk.sxz.controller"))
+                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).paths(PathSelectors.any())
                 .paths(PathSelectors.any())
                 .build()
                 //添加登录认证,可以使用token

+ 8 - 0
sxz-base/src/main/java/com/fdkk/sxz/constant/CodeConstant.java

@@ -54,4 +54,12 @@ public class CodeConstant {
 
     public static final int FAILURE_CODE_4016 = 4016;
     public static final String FAILURE_MSG_4016 = "全景图预览渲染中,请稍后重试";
+
+    public static final int INVALID_RE_VCODE_10000011= 10000011;
+    public static final String FAILURE_MSG_10000011 = "验证码错误";
+
+
+
+
+
 }

+ 97 - 0
sxz-base/src/main/java/com/fdkk/sxz/constant/Constant.java

@@ -0,0 +1,97 @@
+package com.fdkk.sxz.constant;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @ClassName: Constant
+ * @Description: 常量类
+ * @author Xiewj
+ * @date 2018年5月18日 下午11:49:21
+ */
+public class Constant {
+
+    /**
+     * 忽略鉴权的方法列表
+     */
+    public static Set<String> METHOD_URL_SET = new HashSet<>();
+
+    /**
+     * 根节点id
+     */
+    public static final String PARENT_ID = "0";
+
+    /**
+     * 启用
+     */
+    public static final int ENABLE = 1;
+
+    /**
+     * 禁用
+     */
+    public static final int DISABLE = 0;
+
+    /**
+     * 未知
+     */
+    public static final String UNKNOWN = "unknown";
+
+    /**
+     * 本机IP
+     */
+    public static final String LOCALHOST_IP = "127.0.0.1";
+
+    /**
+     * 逗号分隔符
+     */
+    public static final String DELIMITER_COMMA = ",";
+
+    /**
+     * 微信openid
+     */
+    public static final String WEI_XIN_OPENID = "openid";
+
+    /**
+     * 数组取值
+     */
+    public class Number {
+
+        public static final int ZERO = 0;
+
+        public static final int ONE = 1;
+
+        public static final int TWO = 2;
+
+        public static final int THREE = 3;
+
+        public static final int FOUR = 4;
+
+        public static final int FIVE = 5;
+
+        public static final int FIFTEEN = 15;
+    }
+
+    /**
+     * 地址
+     */
+    public class Address {
+
+        public static final int PROVINCE = 0;
+
+        public static final int CITY = 1;
+
+        public static final int AREA = 2;
+
+    }
+
+    /**
+     * 超时时间类型
+     */
+    public class ExpTimeType {
+
+        public static final String WEB = "web";
+
+        public static final String APP = "app";
+
+    }
+}

+ 99 - 0
sxz-base/src/main/java/com/fdkk/sxz/constant/ResponseConstant.java

@@ -0,0 +1,99 @@
+package com.fdkk.sxz.constant;
+
+/**
+ * @ClassName: PublicResultConstant
+ * @Description: TODO
+ * @author Xiewj
+ * @date 2018年5月18日 下午11:49:45
+ */
+public enum ResponseConstant {
+    /**
+     * 成功
+     */
+    SUCCESS(200, "success"),
+    /**
+     * 异常
+     */
+    FAILED(500, "系统错误"),
+    /**
+     * 操作失败
+     */
+    ERROR(90000000, "操作失败"),
+    /**
+     * 未登录/token过期
+     */
+    UNAUTHORIZED(90000002, "登录超时"),
+    /**
+     * 参数错误
+     */
+    PARAM_ERROR(90000003, "参数错误"),
+    /**
+     * 验证码错误
+     */
+    INVALID_RE_VCODE(10000011, "验证码错误"),
+    /**
+     * 用户名或密码错误
+     */
+    INVALID_USERNAME_PASSWORD(10000003, "账号或密码错误"),
+    /**
+     *
+     */
+    INVALID_RE_PASSWORD(10000010, "两次输入密码不一致"),
+    /**
+     * 用户名或密码错误
+     */
+    INVALID_PASSWORD(10000009, "旧密码错误"),
+    /**
+     * 用户名重复
+     */
+    USERNAME_ALREADY_IN(10000002, "用户已存在"),
+    /**
+     * 用户不存在
+     */
+    INVALID_USER(10000001, "用户不存在"),
+    /**
+     * 角色不存在
+     */
+    INVALID_ROLE(10000004, "角色不存在"),
+    /**
+     * 角色不存在
+     */
+    ROLE_USER_USED(10000008, "角色使用中,不可删除"),
+    /**
+     * 参数错误-已存在
+     */
+    INVALID_PARAM_EXIST(10000005, "请求参数已存在"),
+    /**
+     * 参数错误
+     */
+    INVALID_PARAM_EMPTY(10000006, "请求参数为空"),
+    /**
+     * 没有权限
+     */
+    USER_NO_PERMITION(10000007, "当前用户无该接口权限");
+
+    public int result;
+
+    public String msg;
+
+    ResponseConstant(int result, String msg) {
+        this.result = result;
+        this.msg = msg;
+    }
+
+    public int getResult() {
+        return result;
+    }
+
+    public void setResult(int result) {
+        this.result = result;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 16 - 0
sxz-base/src/main/java/com/fdkk/sxz/util/CaptchaUtil.java

@@ -0,0 +1,16 @@
+package com.fdkk.sxz.util;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author xiewj
+ */
+public class CaptchaUtil {
+
+    public static boolean isVerified(String verKey, String verCode, HttpServletRequest request) {
+        ServletContext servletContext = request.getSession().getServletContext();
+        String cacheVerCode = (String) servletContext.getAttribute("code_" + verKey);
+        return verCode.equalsIgnoreCase(cacheVerCode);
+    }
+}

+ 6 - 4
sxz-base/src/main/java/com/fdkk/sxz/util/OkHttpUtils.java

@@ -1,6 +1,8 @@
 package com.fdkk.sxz.util;
 
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.fdkk.sxz.Interceptor.OkHttpLogInterceptor;
 import okhttp3.*;
 import org.slf4j.Logger;
@@ -200,13 +202,13 @@ public class OkHttpUtils {
      * @param headers
      * @return
      */
-    public static String httpPostJson(String url, String json, Map<String, String> headers) {
+    public static JSONObject httpPostJson(String url, String json, Map<String, String> headers) {
         if (CollectionUtils.isEmpty(headers)) {
             httpPostJson(url, json);
         }
 
-        MediaType JSON = MediaType.parse(HTTP_JSON);
-        RequestBody body = RequestBody.create(JSON, json);
+        MediaType mediaType = MediaType.parse(HTTP_JSON);
+        RequestBody body = RequestBody.create(mediaType, json);
         Request.Builder requestBuilder = new Request.Builder().url(url);
         if (ObjectUtil.isNotNull(headers)) {
             headers.forEach((k, v) -> requestBuilder.addHeader(k, v));
@@ -216,7 +218,7 @@ public class OkHttpUtils {
             Response response = okHttpClient.newCall(request).execute();
             if (response.code() == 200) {
                 log.info("http Post 请求成功; [url={}, requestContent={} ,headers{}]", url, json, headers);
-                return response.body().string();
+                return JSON.parseObject(response.body().string());
             } else {
                 log.warn("Http POST 请求失败; [ errorCode = {}, url={}, param={},headers{}]", response.code(), url, json, headers);
             }

+ 12 - 0
sxz-common/pom.xml

@@ -32,6 +32,18 @@
             <version>9.0.45</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.t3hnar</groupId>
+            <artifactId>scala-bcrypt_2.10</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+        </dependency>
     </dependencies>
 
     <properties>

+ 1 - 1
sxz-base/src/main/java/com/fdkk/sxz/config/MyBatisPlusConfig.java

@@ -11,7 +11,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @Configuration
 @EnableTransactionManagement
-@MapperScan("com.fdkk.**.mapper")
+@MapperScan({"com.fdkk.sxz.system.mapper","com.fdkk.sxz.webApi.mapper"})
 public class MyBatisPlusConfig {
     /*
      * 分页插件,自动识别数据库类型

+ 160 - 0
sxz-common/src/main/java/com/fdkk/sxz/exception/BootControllerAdvice.java

@@ -0,0 +1,160 @@
+package com.fdkk.sxz.exception;
+
+import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.constant.Constant;
+import com.fdkk.sxz.constant.ResponseConstant;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.ShiroException;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.springframework.context.support.DefaultMessageSourceResolvable;
+import org.springframework.http.HttpStatus;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindException;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.*;
+import org.thymeleaf.exceptions.TemplateInputException;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName: AllControllerAdvice
+ * @Description: Controller统一异常处理
+ * @author Xiewj
+ * @date 2018年5月18日 下午5:13:32
+ */
+@RestControllerAdvice
+@Slf4j
+public class BootControllerAdvice {
+
+
+    /**
+     * 应用到所有@RequestMapping注解方法,在其执行之前初始化数据绑定器
+     */
+    @InitBinder
+    public void initBinder(WebDataBinder binder) {
+    }
+
+    /**
+     * 把值绑定到Model中,使全局@RequestMapping可以获取到该值
+     */
+    @ModelAttribute
+    public void addAttributes(Model model) {
+    }
+
+    /**
+     * 全局异常捕捉处理
+     */
+    @ExceptionHandler(value = Exception.class)
+    @ResponseBody
+    public Result<?> errorHandler(Exception e) {
+        log.error("接口出现严重异常:", e);
+        return Result.error(ResponseConstant.ERROR);
+
+    }
+
+    /**
+     * 捕捉UnauthorizedException
+     *
+     * @return
+     */
+    @ResponseStatus(HttpStatus.OK)
+    @ExceptionHandler(UnauthorizedException.class)
+    @ResponseBody
+    public Result<?> handle401() {
+         return Result.error(ResponseConstant.UNAUTHORIZED);
+    }
+
+    /**
+     * 捕捉shiro的异常
+     *
+     * @param e
+     * @return
+     */
+    @ResponseStatus(HttpStatus.OK)
+    @ExceptionHandler(ShiroException.class)
+    @ResponseBody
+    public Result<?> handle401(ShiroException e) {
+          log.info(ResponseConstant.USER_NO_PERMITION.getMsg());
+         return Result.error(ResponseConstant.USER_NO_PERMITION);
+    }
+    /**
+     * 处理其他异常
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(value = MissingServletRequestParameterException.class)
+    public Result exceptionHandler(MissingServletRequestParameterException e){
+        log.error("缺少必要参数:", e);
+        return Result.failure(HttpStatus.BAD_REQUEST.value(), "缺少必要参数");
+    }
+
+    @ResponseStatus(HttpStatus.OK)
+    @ExceptionHandler(TemplateInputException.class)
+    @ResponseBody
+    public Result<?> handle401(TemplateInputException e) {
+        log.info(ResponseConstant.USER_NO_PERMITION.getMsg());
+        return Result.error(ResponseConstant.USER_NO_PERMITION);
+    }
+
+//    @ResponseStatus(HttpStatus.OK)
+//    @ExceptionHandler(value = ParamJsonException.class)
+//    @ResponseBody
+//    public Result<?> handleParam(Exception e) {
+//        if (e instanceof ParamJsonException) {
+//            log.error("参数错误:" + e.getMessage());
+//             return Result.error(ResponseConstant.PARAM_ERROR);
+//        }
+//         return Result.error();
+//    }
+
+    @ResponseStatus(HttpStatus.OK)
+    @ExceptionHandler(value = BusinessException.class)
+    @ResponseBody
+    public Result<?> handleBuiness(BusinessException e) {
+        log.error("业务逻辑错误:" + e.getExceptionMsg());
+         return Result.failure(e.getExceptionMsg());
+    }
+
+    /**
+     * 处理Get请求中 使用@Valid 验证路径中请求实体校验失败后抛出的异常
+     */
+    @ExceptionHandler(BindException.class)
+    public Result BindExceptionHandler(BindException e) {
+        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
+        return Result.failure(HttpStatus.BAD_REQUEST.value(), message);
+    }
+
+    @ExceptionHandler(RuntimeException.class)
+    @ResponseStatus(HttpStatus.OK)
+    public Result runtimeExceptionHandler(HttpServletRequest request, RuntimeException e) {
+        log.error("uri:{},stack trace:",request.getRequestURI(),e);
+        return Result.failure(e.getMessage());
+    }
+    /**
+     * 处理实体字段校验不通过异常
+     *
+     * @param e
+     * @return
+     */
+    @ResponseStatus(HttpStatus.OK)
+    @ExceptionHandler(MethodArgumentNotValidException.class)
+    @ResponseBody
+    public Result<String> validationError(MethodArgumentNotValidException e) {
+        log.info("参数校验不通过 : " + e.getMessage());
+        BindingResult result = e.getBindingResult();
+        final List<FieldError> fieldErrors = result.getFieldErrors();
+        StringBuilder builder = new StringBuilder();
+        int i = Constant.Number.ZERO;
+        for (FieldError error : fieldErrors) {
+            i++;
+            builder.append(i).append(") ").append(error.getDefaultMessage()).append("\n ");
+        }
+         return Result.failure(builder.toString());
+    }
+}

+ 58 - 0
sxz-common/src/main/java/com/fdkk/sxz/exception/BusinessException.java

@@ -0,0 +1,58 @@
+package com.fdkk.sxz.exception;
+
+/**
+ * @ClassName: BusinessException
+ * @Description: TODO
+ * @author Xiewj
+ * @date 2018年5月18日 下午11:49:12
+ */
+public class BusinessException extends RuntimeException {
+
+    /**
+     * Comment for &lt;code&gt;serialVersionUID&lt;/code&gt;
+     */
+    private static final long serialVersionUID = 3455708526465670030L;
+
+    private int code;
+
+    private String msg;
+
+    public BusinessException() {
+        this.code = 500;
+        this.msg = "未知错误";
+    }
+
+    public BusinessException(String message) {
+        this.code = 500;
+        this.msg = message;
+    }
+
+    public BusinessException(Throwable cause) {
+        super(cause);
+    }
+
+    public BusinessException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public BusinessException(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getExceptionCode() {
+        return code;
+    }
+
+    public void setExceptionCode(int code) {
+        this.code = code;
+    }
+
+    public String getExceptionMsg() {
+        return msg;
+    }
+
+    public void setExceptionMsg(String exceptionMsg) {
+        this.msg = exceptionMsg;
+    }
+}

+ 0 - 88
sxz-common/src/main/java/com/fdkk/sxz/exception/GlobalExceptionHandler.java

@@ -1,88 +0,0 @@
-package com.fdkk.sxz.exception;
-
-import com.fdkk.sxz.util.Result;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.support.DefaultMessageSourceResolvable;
-import org.springframework.http.HttpStatus;
-import org.springframework.validation.BindException;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.MissingServletRequestParameterException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.stream.Collectors;
-
-/**
- * 全局异常捕获统一返回客户端
- * @author Admin
- */
-@Slf4j
-@RestControllerAdvice
-public class GlobalExceptionHandler {
-
-    /**
-     * 处理其他异常
-     * @param e
-     * @return
-     */
-    @ExceptionHandler(value = Exception.class)
-    public Result exceptionHandler(Exception e){
-        log.error("程序错误原因:", e);
-        return Result.failure("服务端异常");
-    }
-
-
-    /**
-     * 处理其他异常
-     * @param e
-     * @return
-     */
-    @ExceptionHandler(value = MissingServletRequestParameterException.class)
-    public Result exceptionHandler(MissingServletRequestParameterException e){
-        log.error("缺少必要参数:", e);
-        return Result.failure(HttpStatus.BAD_REQUEST.value(), "缺少必要参数");
-    }
-
-
-
-    /**
-     * 处理请求参数格式错误 @RequestBody上validate失败后抛出的异常是MethodArgumentNotValidException异常
-     */
-    @ExceptionHandler(MethodArgumentNotValidException.class)
-    public Result MethodArgumentNotValidExceptionHandler(MethodArgumentNotValidException e) {
-        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
-        //下边ResultCodeEnum.PARAMS_BS_ERROR.getCode()就是你自己自定义的返回code码
-        return Result.failure(HttpStatus.BAD_REQUEST.value(), message);
-    }
-
-    /**
-     * 处理Get请求中 使用@Valid 验证路径中请求实体校验失败后抛出的异常
-     */
-    @ExceptionHandler(BindException.class)
-    public Result BindExceptionHandler(BindException e) {
-        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
-        return Result.failure(HttpStatus.BAD_REQUEST.value(), message);
-    }
-
-    /**
-     * @link https://www.cnblogs.com/cjyboy/p/11465876.html
-     * 处理请求参数格式错误 @RequestParam上validate失败后抛出的异常是ConstraintViolationException
-     */
-//    @ExceptionHandler(ConstraintViolationException.class)
-//    public ViewResult ConstraintViolationExceptionHandler(ConstraintViolationException e) {
-//        String message = e.getConstraintViolations().stream().map(ConstraintViolation::getMessage).collect(Collectors.joining());
-//        return ViewResult.error(HttpStatus.BAD_REQUEST.value(), message);
-//    }
-
-
-
-    @ExceptionHandler(RuntimeException.class)
-    @ResponseStatus(HttpStatus.OK)
-    public Result runtimeExceptionHandler(HttpServletRequest request, RuntimeException e) {
-        log.error("uri:{},stack trace:",request.getRequestURI(),e);
-        return Result.failure(e.getMessage());
-    }
-
-}

+ 23 - 0
sxz-common/src/main/java/com/fdkk/sxz/exception/UnauthorizedException.java

@@ -0,0 +1,23 @@
+package com.fdkk.sxz.exception;
+
+/**
+ * @ClassName: UnauthorizedException
+ * @Description: 身份认证异常
+ * @author Xiewj
+ * @date 2018年5月18日 下午11:50:14
+ */
+public class UnauthorizedException extends RuntimeException {
+
+    /**
+     * @Fields serialVersionUID
+     */
+    private static final long serialVersionUID = -2804627713269695216L;
+
+    public UnauthorizedException(String msg) {
+        super(msg);
+    }
+
+    public UnauthorizedException() {
+        super();
+    }
+}

+ 0 - 2
sxz-common/src/main/java/com/fdkk/sxz/handler/MyMetaObjectHandler.java

@@ -18,14 +18,12 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
 
     @Override
     public void insertFill(MetaObject metaObject) {
-        log.info("开始插入填充创建时间createTime ....");
         // 起始版本 3.3.3(推荐)
         this.strictInsertFill(metaObject, "createTime", () -> new Date(), Date.class);
     }
 
     @Override
     public void updateFill(MetaObject metaObject) {
-        log.info("开始更新填充updateTime....");
         // 起始版本 3.3.3(推荐)
         this.strictUpdateFill(metaObject, "updateTime", () ->new Date(), Date.class);
     }

+ 0 - 60
sxz-common/src/main/java/com/fdkk/sxz/listener/CommonInterceptor.java

@@ -1,60 +0,0 @@
-package com.fdkk.sxz.listener;
-
-import cn.hutool.core.util.IdUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-import org.springframework.web.servlet.HandlerInterceptor;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-@Slf4j
-@Component
-public class CommonInterceptor implements HandlerInterceptor {
-
-    private long startTime;
-    private long endTime;
-
-    @Override
-    public boolean preHandle(HttpServletRequest request,
-                             HttpServletResponse response, Object handler) throws Exception {
-        MDC.put("TRACE_ID", IdUtil.getSnowflake().nextIdStr());
-        if (!request.getRequestURI().contains("/static/") && !request.getRequestURI().contains("/sendUserInfo")
-                && !request.getRequestURI().contains(".json") && !request.getRequestURI().contains(".png")
-                && !request.getRequestURI().contains(".html") && !request.getRequestURI().contains(".mp3")
-                && !request.getRequestURI().contains(".jpg") && !request.getRequestURI().equals("/")
-                && !request.getRequestURI().contains("/logging/")) {
-            log.info(request.getRequestURI() + "::进入该请求!");
-            startTime = System.currentTimeMillis();
-        }
-        return true;
-    }
-
-    @Override
-    public void postHandle(HttpServletRequest request,
-                           HttpServletResponse response, Object handler,
-                           ModelAndView modelAndView) throws Exception {
-        request.setAttribute("ctx", request.getContextPath());
-    }
-
-    @Override
-    public void afterCompletion(HttpServletRequest request,
-                                HttpServletResponse response, Object handler, Exception ex)
-            throws Exception {
-
-        if (!request.getRequestURI().contains("/static/") && !request.getRequestURI().contains("/sendUserInfo")
-                && !request.getRequestURI().contains(".json") && !request.getRequestURI().contains(".png")
-                && !request.getRequestURI().contains(".html") && !request.getRequestURI().contains(".mp3")
-                && !request.getRequestURI().contains(".jpg") && !request.getRequestURI().equals("/")
-                && !request.getRequestURI().contains("/logging/")) {
-            endTime = System.currentTimeMillis();
-            long time = endTime - startTime;
-            log.info(request.getRequestURI() + "::完成请求!接口耗时" + time + "ms");
-            MDC.clear();
-        }
-    }
-
-
-}

+ 0 - 31
sxz-common/src/main/java/com/fdkk/sxz/listener/WebMvcConfig.java

@@ -1,31 +0,0 @@
-package com.fdkk.sxz.listener;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-@Configuration
-public class WebMvcConfig extends WebMvcConfigurerAdapter {
-
-    @Autowired
-    private CommonInterceptor commonInterceptor;
-
-    /**
-     * 添加拦截器
-     */
-    @Override
-    public void addInterceptors(InterceptorRegistry registry) {
-        registry.addInterceptor(commonInterceptor).addPathPatterns("/**");
-    }
-
-    @Override
-    public void addViewControllers(ViewControllerRegistry registry ) {
-        registry.addViewController("/" ).setViewName( "forward:/index.html" );
-        registry.setOrder(Ordered.HIGHEST_PRECEDENCE );
-        super.addViewControllers(registry);
-    }
-
-}

+ 1 - 0
sxz-common/src/main/java/com/fdkk/sxz/logging/LogAppender.java

@@ -28,6 +28,7 @@ public class LogAppender extends ConsoleAppender<ILoggingEvent> {
         //添加到阻塞队列
         if (!log.getMessage().contains("/logging/") &&
                 !log.getMessage().contains("/webjars/") &&
+                !log.getLoggerName().contains("LogMapper") &&
                 !log.getMessage().contains("error") &&
                 !log.getMessage().contains("precache") &&
                 !log.getMessage().contains("robots.txt") &&

+ 0 - 4
sxz-common/src/main/java/com/fdkk/sxz/logging/LogTask.java

@@ -32,16 +32,12 @@ public class LogTask {
         Log log = null;
         while ((log = DataContext.tempLogQueue.poll()) != null) {
             if (log.getTraceId() != null) {
-                redisUtil.setEx("TraceId" + log.getTraceId(), log.getTraceId(), timeOut, TimeUnit.HOURS);
                 if (!redisUtil.hasKey(log.getTraceId())) {
                     JSONObject logList = new JSONObject();
                     logList.put("traceId", log.getTraceId());
                     logList.put("time", log.getTimeStamp());
                     logList.put("action", log.getAction());
-                    redisUtil.lRightPush("LogList", logList.toJSONString());
-                    redisUtil.lRightPush("newLogList", logList.toJSONString());
                 }
-
                 redisUtil.lRightPush(log.getTraceId(), JSON.toJSONString(log), timeOut, TimeUnit.HOURS);
             }
         }

+ 26 - 0
sxz-core/src/main/java/com/fdkk/sxz/ChangeingApplication.java

@@ -0,0 +1,26 @@
+package com.fdkk.sxz;
+
+import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@EnableScheduling
+@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class,PageHelperAutoConfiguration.class})
+public class ChangeingApplication extends SpringBootServletInitializer {
+
+	@Override
+	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+		return application.sources(ChangeingApplication.class);
+	}
+
+	public static void main(String[] args) {
+		ConfigurableApplicationContext configurableBootstrapContext=		SpringApplication.run(ChangeingApplication.class, args);
+
+	}
+
+}

+ 232 - 64
sxz-core/src/main/java/com/fdkk/sxz/listener/RunBuild.java

@@ -1,19 +1,21 @@
-package com.fdkk.sxz.listener;
-
+package com.fdkk.sxz.other.listener;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.file.FileReader;
+import cn.hutool.core.io.file.FileWriter;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fdkk.sxz.constant.ConstantFileName;
 import com.fdkk.sxz.constant.ConstantFilePath;
-import com.fdkk.sxz.entity.ModelUploadEntity;
-import com.fdkk.sxz.entity.SceneLightEntity;
-import com.fdkk.sxz.entity.SceneStyleEntity;
-import com.fdkk.sxz.entity.StatisticsEntity;
-import com.fdkk.sxz.service.IModelUploadService;
-import com.fdkk.sxz.service.ISceneLightService;
-import com.fdkk.sxz.service.ISceneStyleService;
-import com.fdkk.sxz.service.IStatisticsService;
+import com.fdkk.sxz.entity.*;
+import com.fdkk.sxz.other.mq.TopicRabbitConfig;
+import com.fdkk.sxz.webApi.service.*;
 import com.fdkk.sxz.util.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.amqp.rabbit.annotation.RabbitHandler;
@@ -25,7 +27,9 @@ import org.springframework.util.CollectionUtils;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URI;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Created by Hb_zzZ on 2020/7/3.
@@ -49,6 +53,9 @@ public class RunBuild {
     @Autowired
     private IStatisticsService statisticsService;
 
+    @Autowired
+    private IComponentModelUploadService componentModelUploadService;
+
     @Value("${server.file.location}")
     private String buildPath;
 
@@ -67,6 +74,9 @@ public class RunBuild {
     @Value("${max.obj.url}")
     private String maxObjUrl;
 
+    @Autowired
+    private RedisUtil redisUtil;
+
     @RabbitHandler
     @RabbitListener(queues = "topic.change")
     public void change(String str) {
@@ -88,7 +98,7 @@ public class RunBuild {
 
     @RabbitHandler
 //    @RabbitListener(queues = "topic.model.copy")
-    @RabbitListener(queues = "topic.model")
+    @RabbitListener(queues = TopicRabbitConfig.MODEL)
     public void model(String str) {
         log.info("模型转换:" + str);
         modelBuild(str);
@@ -672,6 +682,8 @@ public class RunBuild {
         String fileId = datas[1];
         String userId = datas[2];
         String modelType = datas[3];
+        //true表示定制,FALSE表示成品
+        String flag = datas[4];
 
 
         ModelUploadEntity modelUploadEntity = modelUploadService.findById(Long.valueOf(modelUploadId));
@@ -696,7 +708,7 @@ public class RunBuild {
             String max = new File(maxPath).getName();
             Thread.sleep(1000);
             log.info("开始运行maxToDatasmith");
-            String maxUrl = maxObjUrl + "maxToDatasmith?uuid=" + fileId + "&max=" + maxName;
+            String maxUrl = maxObjUrl + "maxToDatasmith?uuid=" + fileId + "&max=" + maxName + "&flag=" + flag;
             log.info("请求maxToDatasmith地址-{}", maxUrl);
             OkHttpUtils.httpGet(maxUrl);
             log.info("运行maxToDatasmith结束-{}", fileId);
@@ -707,15 +719,29 @@ public class RunBuild {
                 throw new RuntimeException(fileId + ":运行maxToDatasmith失败,没有files.txt文件");
             }
 
+
             String[] files = FileUtils.readFile(filesTxt).split(";");
 
             //判断obj文件是否有vt 开头
             String obj = filePath + max.replace(".max", "");
+            //判断是否存在/furniture.json
+            String furniture = filePath + max.replace(".max", "");
+
+            //判断是否存在/MeshMatMap.txt
+            String MeshMatMap = filePath + max.replace(".max", "");
+
             for (String file : files) {
                 if (file.endsWith("Output.obj")) {
                     obj = obj + file;
                 }
+                if (file.endsWith("furniture.json")) {
+                    furniture = furniture + file;
+                }
+                if (file.endsWith("MeshMatMap.txt")) {
+                    MeshMatMap = MeshMatMap + file;
+                }
             }
+
             if (!ObjProcess.hasVt(obj)) {
                 //没有vt,直接报错
                 modelUploadEntity.setStatus(-2);
@@ -723,78 +749,219 @@ public class RunBuild {
                 return;
             }
 
-            File target = null;
-            for (String file : files) {
-                target = new File(filePath + max.replace(".max", "") + file);
-                uploadToOssUtil.uploadTo4dTjw(filePath + max.replace(".max", "") + file, "domain/eHome/furniture/InitialData/" + modelType + "/" + fileId + "/" + target.getName());
-            }
+            if (flag.equals("true")) {
 
-            Thread.sleep(2000L);
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("name", fileId);
+                jsonObject.put("taskType", "customFurniture");
+                jsonObject.put("taskId", userId);
+                jsonObject.put("postfix", modelType);
+                JSONArray params1 = new JSONArray();
 
 
-            String objPath = filePath + fileId + ".obj";
-            String imgPath = filePath + fileId + ".jpg";
+                //处理 furniture.json
+                JSONArray furnitureJson = null;
+                if (StrUtil.isNotEmpty(furniture)) {
+                    FileReader fileReader = new FileReader(furniture);
+                    furnitureJson = JSON.parseArray(fileReader.readString());
+                }
+                JSONObject jsonObj = JSON.parseObject(JSON.toJSONString(furnitureJson.get(0)));
+                JSONArray componentSlots = jsonObj.getJSONArray("componentSlots");
+
+                for (Object componentSlot : componentSlots) {
+                    JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("component");
+                    String filesId = component.getString("name");
+                    String componentPath = filePath + max.replace(".max", "") + "/" + filesId;
+
+                    String objFileRealPath = "";
+                    String udatasmitFileRealPath = "";
+                    String udsmeshFileRealPath = "";
+                    String mtlPathFileRealPath= "";
+                    String keyPath = "domain/eHome/furniture/InitialData/" + modelType + "/" + filesId + "/";
+
+                    if (StrUtil.isNotEmpty(component.getString("template"))) {
+                        objFileRealPath = component.getString("template").replaceAll("Z:/OneKeyDecorate", buildPath);
+                    }
 
+                    if (StrUtil.isNotEmpty(component.getString("mtlPath"))) {
+                         mtlPathFileRealPath = component.getString("mtlPath").replaceAll("Z:/OneKeyDecorate", buildPath);
+                    }
 
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put("name", fileId);
-            jsonObject.put("taskType", "datafactory");
-            jsonObject.put("taskId", userId);
-            jsonObject.put("postfix", modelType);
-//            String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
+                    if (StrUtil.isNotEmpty(component.getString("datasmith"))) {
+                        udatasmitFileRealPath = component.getString("datasmith").replaceAll("Z:/OneKeyDecorate", buildPath);
+                    }
 
-            postJson(fileId, filePath, jsonObject);
+                    if (StrUtil.isNotEmpty(component.getString("smithAssetPath"))) {
+                        //贴图和udsmesh都在这个目录,直接批量传
+                        udsmeshFileRealPath = component.getString("smithAssetPath").replaceAll("Z:/OneKeyDecorate", buildPath);
+                        //获取目录所有文件然后上传
+                        List<File> udsmeshfiles = FileUtil.loopFiles(udsmeshFileRealPath);
+                        for (File file : udsmeshfiles) {
+                            uploadToOssUtil.uploadTo4dTjw(file.getPath(), keyPath + file.getName());
+                        }
 
-            Thread.sleep(1000L);
+                    }
 
-            checkResultJson(fileId, filePath, jsonObject, modelUploadId);
 
-            Integer facesNum = 0;
-            if ("fbx".equals(modelType)) {
-                String ossUrl = "domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg";
-                String localUrl = filePath + fileId + "_preview.jpg";
-                uploadToOssUtil.downloadFileTo4dTjw(ossUrl, localUrl);
-                log.info("ossUrl-{}", ossUrl);
-                log.info("本地Url-{}", localUrl);
+                    uploadToOssUtil.uploadTo4dTjw(objFileRealPath, keyPath + filesId + ".obj");
 
-                String maxObjUrlGet = maxObjUrl + "fbxToObj?uuid=" + fileId + "&fbx=" + fileId +
-                        ".fbx&obj=" + fileId + ".obj&jpg=" + fileId + ".jpg&r=30";
-                OkHttpUtils.httpGet(maxObjUrlGet);
-                log.info("请求maxObj地址-{}", maxObjUrlGet);
-            }
+                    uploadToOssUtil.uploadTo4dTjw(udatasmitFileRealPath, keyPath + filesId + ".udatasmith");
+
+                    uploadToOssUtil.uploadTo4dTjw(mtlPathFileRealPath, keyPath + filesId + ".mtl");
+
+
+                    //覆盖json里面的name
+
+                    params1.add(filesId);
+
+
+                    log.info("处理配件,大小为{}", component.toJSONString());
+                    ComponentModelUploadEntity componentModelUploadEntity = new ComponentModelUploadEntity();
+
+                    BeanUtil.copyProperties(modelUploadEntity, componentModelUploadEntity, false);
+
+                    String objPaths = objFileRealPath;
+                    componentModelUploadEntity.setId(null);
+                    componentModelUploadEntity.setFileId(filesId);
+                    componentModelUploadEntity.setObjPath(objPaths.replace(buildPath, ""));
+                    componentModelUploadEntity.setStatus(1);
+                    componentModelUploadEntity.setProgress(100);
+                    componentModelUploadEntity.setMtlPath(mtlPathFileRealPath);
+                    if (JSON.parseObject(JSONObject.toJSONString(componentSlot)).containsKey("origin")) {
+                        componentModelUploadEntity.setCacheData(JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("origin").toJSONString());
+                    }
+                    componentModelUploadEntity.setPartsModelUploadId(modelUploadEntity.getId());
+                    componentModelUploadService.save(componentModelUploadEntity);
+                    //保存id,方便后续拿预览图
+                    component.put("id",componentModelUploadEntity.getId());
+                    log.info("处理配件集合,完成保存配件,ID:{}", componentModelUploadEntity);
+
+                }
+
+                uploadToOssUtil.uploadTo4dTjw(furniture, "domain/eHome/furniture/CustomFurniture/" + fileId + "/" + fileId + ".json");
+
+
+                uploadToOssUtil.uploadTo4dTjw(MeshMatMap, "domain/eHome/furniture/CustomFurniture/" + fileId + "/" + "MeshMatMap.txt");
+
+
+                //分组处理文件
+                Thread.sleep(2000L);
+
+                jsonObject.put("params1", params1);
+                postJson(fileId, filePath, jsonObject);
 
-            if ("datasmith".equals(modelType)) {
-                String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
-                CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
-                log.info("oss下载datasmith-{}", ossDownlUrl);
+                Thread.sleep(1000L);
 
-                if (new File(filePath + fileId + "-base.obj").exists()) {
-                    facesNum = ObjProcess.findFacesNum(filePath + fileId + "-base.obj");
+                checkResultJson(fileId, filePath, jsonObject, modelUploadId);
 
-                    String maxObjUrlGet = maxObjUrl + "objToObj?uuid=" + fileId + "&inObj=" + fileId +
-                            "-base.obj&outObj=" + fileId + ".obj&r=3000";
+
+                //拿预览图+obj 成品+组件
+                if (jsonObj.containsKey("name")) {
+                    String productName = jsonObj.getString("name");
+                    uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + productName + "_preview.jpg", filePath + productName + "_preview.jpg");
+                    uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + productName + "/" + productName + ".obj", filePath + productName + "-base.obj");
+                    modelUploadEntity.setThumPath(filePath + productName + "_preview.jpg");
+                    modelUploadEntity.setObjPath(filePath + productName + ".obj");
+                    Thread.sleep(1000L);
+
+                }
+
+                for (Object componentSlot : componentSlots) {
+                    JSONObject component = JSON.parseObject(JSONObject.toJSONString(componentSlot)).getJSONObject("component");
+                    if (component.containsKey("name")) {
+                        String componentName = component.getString("name");
+                        uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + componentName + "/" + componentName + "_preview.jpg", filePath + componentName + "_preview.jpg");
+                        uploadToOssUtil.downloadFileTo4dTjw("domain/eHome/furniture/ue4data/" + componentName + "/" + componentName + "-base.obj", filePath + componentName + ".obj");
+                        ComponentModelUploadEntity componentEntity =componentModelUploadService.findById(component.getLong("id"));
+                        componentEntity.setThumPath(filePath + componentName + "_preview.jpg");
+                        componentEntity.setObjPath(filePath + componentName + ".obj");
+                        componentEntity.setStatus(1);
+                        componentModelUploadService.updateById(componentEntity);
+                        Thread.sleep(1000L);
+
+                    }
+
+                }
+
+                modelUploadEntity.setStatus(1);
+                modelUploadEntity.setProgress(100);
+//                modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
+                modelUploadService.updateById(modelUploadEntity);
+
+            } else {
+
+                File target = null;
+                for (String file : files) {
+                    target = new File(filePath + max.replace(".max", "") + file);
+                    uploadToOssUtil.uploadTo4dTjw(filePath + max.replace(".max", "") + file, "domain/eHome/furniture/InitialData/" + modelType + "/" + fileId + "/" + target.getName());
+                }
+
+                Thread.sleep(2000L);
+
+
+                String objPath = filePath + fileId + ".obj";
+                String imgPath = filePath + fileId + ".jpg";
+
+
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("name", fileId);
+                jsonObject.put("taskType", "datafactory");
+                jsonObject.put("taskId", userId);
+                jsonObject.put("postfix", modelType);
+//            String buildResult = OkHttpUtils.httpPostJson(buildUrl + "pro", jsonObject.toJSONString());
+
+                postJson(fileId, filePath, jsonObject);
+
+                Thread.sleep(1000L);
+
+                checkResultJson(fileId, filePath, jsonObject, modelUploadId);
+
+                Integer facesNum = 0;
+                if ("fbx".equals(modelType)) {
+                    String ossUrl = "domain/eHome/furniture/ue4data/" + fileId + "/" + fileId + "_preview.jpg";
+                    String localUrl = filePath + fileId + "_preview.jpg";
+                    uploadToOssUtil.downloadFileTo4dTjw(ossUrl, localUrl);
+                    log.info("ossUrl-{}", ossUrl);
+                    log.info("本地Url-{}", localUrl);
+
+                    String maxObjUrlGet = maxObjUrl + "fbxToObj?uuid=" + fileId + "&fbx=" + fileId +
+                            ".fbx&obj=" + fileId + ".obj&jpg=" + fileId + ".jpg&r=30";
                     OkHttpUtils.httpGet(maxObjUrlGet);
                     log.info("请求maxObj地址-{}", maxObjUrlGet);
                 }
-            }
 
-            log.info("obj路径-{}", objPath);
-            if (!new File(objPath).exists()) {
-                log.info("obj文件生成失败:" + objPath);
-                throw new RuntimeException("obj文件生成失败");
-            }
+                if ("datasmith".equals(modelType)) {
+                    String ossDownlUrl = "domain/eHome/furniture/ue4data/" + fileId;
+                    CreateObjUtil.ossCommonUtilCp(ossDownlUrl, filePath);
+                    log.info("oss下载datasmith-{}", ossDownlUrl);
 
-            if (new File(filePath + fileId + "_preview.jpg").exists()) {
-                modelUploadEntity.setThumPath((filePath + fileId + "_preview.jpg").replace(buildPath, ""));
-            }
+                    if (new File(filePath + fileId + "-base.obj").exists()) {
+                        facesNum = ObjProcess.findFacesNum(filePath + fileId + "-base.obj");
+
+                        String maxObjUrlGet = maxObjUrl + "objToObj?uuid=" + fileId + "&inObj=" + fileId +
+                                "-base.obj&outObj=" + fileId + ".obj&r=3000";
+                        OkHttpUtils.httpGet(maxObjUrlGet);
+                        log.info("请求maxObj地址-{}", maxObjUrlGet);
+                    }
+                }
 
+                log.info("obj路径-{}", objPath);
+                if (!new File(objPath).exists()) {
+                    log.info("obj文件生成失败:" + objPath);
+                    throw new RuntimeException("obj文件生成失败");
+                }
+
+                if (new File(filePath + fileId + "_preview.jpg").exists()) {
+                    modelUploadEntity.setThumPath((filePath + fileId + "_preview.jpg").replace(buildPath, ""));
+                }
+
+                modelUploadEntity.setStatus(1);
+                modelUploadEntity.setProgress(100);
+                modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
+                modelUploadEntity.setFacesNum(facesNum);
+                modelUploadService.updateById(modelUploadEntity);
+            }
 
-            modelUploadEntity.setStatus(1);
-            modelUploadEntity.setProgress(100);
-            modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
-//            modelUploadEntity.setImgPath(imgPath.replace(buildPath, ""));
-            modelUploadEntity.setFacesNum(facesNum);
-            modelUploadService.updateById(modelUploadEntity);
         } catch (Exception e) {
             e.printStackTrace();
             log.error("修改模型报错-{}", e.getMessage());
@@ -804,6 +971,7 @@ public class RunBuild {
 
     }
 
+
     /**
      * 循环检查3d渲染
      *

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/mq/TopicManReceiver.java

@@ -1,4 +1,4 @@
-package com.fdkk.sxz.mq;
+package com.fdkk.sxz.other.mq;
 
 /**
  * Created by Hb_zzZ on 2020/9/17.

+ 1 - 1
sxz-core/src/main/java/com/fdkk/sxz/mq/TopicRabbitConfig.java

@@ -1,4 +1,4 @@
-package com.fdkk.sxz.mq;
+package com.fdkk.sxz.other.mq;
 
 import org.springframework.amqp.core.Binding;
 import org.springframework.amqp.core.BindingBuilder;

+ 35 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/CurrentUserMethodArgumentResolver.java

@@ -0,0 +1,35 @@
+package com.fdkk.sxz.other.shiro;
+
+import com.fdkk.sxz.annotation.auth.CurrentUser;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.exception.UnauthorizedException;
+import org.springframework.core.MethodParameter;
+import org.springframework.web.bind.support.WebDataBinderFactory;
+import org.springframework.web.context.request.NativeWebRequest;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.method.support.ModelAndViewContainer;
+
+/**
+ * @ClassName: CurrentUserMethodArgumentResolver
+ * @Description: 增加方法注入,将含有 @CurrentUser 注解的方法参数注入当前登录用户
+ * @author Xiewj
+ */
+public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentResolver {
+
+    @Override
+    public boolean supportsParameter(MethodParameter parameter) {
+        return parameter.getParameterType().isAssignableFrom(User.class)
+                && parameter.hasParameterAnnotation(CurrentUser.class);
+    }
+
+    @Override
+    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
+            NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
+        User user = (User) webRequest.getAttribute("currentUser", RequestAttributes.SCOPE_REQUEST);
+        if (user == null) {
+            throw new UnauthorizedException("获取用户信息失败");
+        }
+        return user;
+    }
+}

+ 19 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/FastJsonHttpMessageConverterEx.java

@@ -0,0 +1,19 @@
+package com.fdkk.sxz.other.shiro;
+
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+
+/**
+ * @ClassName: FastJsonHttpMessageConverterEx
+ * @Description: TODO
+ * @author Xiewj
+ */
+public class FastJsonHttpMessageConverterEx extends FastJsonHttpMessageConverter {
+
+    public FastJsonHttpMessageConverterEx() {
+    }
+
+    @Override
+    protected boolean supports(Class<?> clazz) {
+        return super.supports(clazz);
+    }
+}

+ 171 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/JWTFilter.java

@@ -0,0 +1,171 @@
+package com.fdkk.sxz.other.shiro;
+
+import com.fdkk.sxz.config.SpringContextBean;
+import com.fdkk.sxz.constant.Constant;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.other.shiro.conponent.JwtComponent;
+import com.fdkk.sxz.system.service.IUserService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @ClassName: JWTFilter
+ * @Description: 代码的执行流程preHandle->isAccessAllowed->isLoginAttempt->executeLogin
+ * @author Xiewj
+ */
+@Slf4j
+public class JWTFilter extends BasicHttpAuthenticationFilter {
+
+
+    @Autowired
+    private JwtComponent jwtComponent;
+
+    @Autowired
+    private IUserService userService;
+
+    /**
+     * 判断用户是否想要登入。 检测header里面是否包含Authorization字段即可
+     */
+    @Override
+    protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) {
+        HttpServletRequest req = (HttpServletRequest) request;
+        String authorization = req.getHeader("Authorization");
+        return authorization != null;
+    }
+
+    /**
+     *
+     */
+    @Override
+    protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+        String authorization = httpServletRequest.getHeader("Authorization");
+        JWTToken token = new JWTToken(authorization);
+        // 提交给realm进行登入,如果错误他会抛出异常并被捕获
+        getSubject(request, response).login(token);
+        // 如果没有抛出异常则代表登入成功,返回true
+        setUserBean(request, response, token);
+        return true;
+    }
+
+    @Override
+    protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws IOException {
+        response401(request, response);
+        return false;
+    }
+
+    /**
+     * 这里我们详细说明下为什么最终返回的都是true,即允许访问 例如我们提供一个地址 GET /article 登入用户和游客看到的内容是不同的
+     * 如果在这里返回了false,请求会被直接拦截,用户看不到任何东西 所以我们在这里返回true,Controller中可以通过
+     * subject.isAuthenticated() 来判断用户是否登入
+     * 如果有些资源只有登入用户才能访问,我们只需要在方法上面加上 @RequiresAuthentication 注解即可
+     * 但是这样做有一个缺点,就是不能够对GET,POST等请求进行分别过滤鉴权(因为我们重写了官方的方法),但实际上对应用影响不大
+     */
+    @Override
+    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
+        if (isLoginAttempt(request, response)) {
+            try {
+                // 执行登录
+                executeLogin(request, response);
+                Subject subject = getSubject(request, response);
+                String[] perms = (String[]) mappedValue;
+                boolean isPermitted = true;
+                if (perms != null && perms.length > 0)
+                {
+                    if (perms.length == 1)
+                    {
+                        if (!subject.isPermitted(perms[0]))
+                        {
+                            isPermitted = false;
+                        }
+
+                    } else if (!subject.isPermittedAll(perms))
+                    {
+                        isPermitted = false;
+                    }
+
+                }
+
+                return isPermitted;
+            } catch (Exception e) {
+                e.printStackTrace();
+                responseTimeOut(request, response);
+            }
+        }
+        return true;
+    }
+
+    private void setUserBean(ServletRequest request, ServletResponse response, JWTToken token) {
+        if (this.userService == null) {
+            this.userService = SpringContextBean.getBean(IUserService.class);
+        }
+        String userAccount = jwtComponent.getUserAccount(String.valueOf(token.getCredentials()));
+        User userBean = userService.queryUserByAccount(userAccount);
+        request.setAttribute("currentUser", userBean);
+    }
+
+    /**
+     * 对跨域提供支持
+     */
+    @Override
+    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+        httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin"));
+        httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE");
+        httpServletResponse.setHeader("Access-Control-Allow-Headers",
+                httpServletRequest.getHeader("Access-Control-Request-Headers"));
+        // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态
+        if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {
+            httpServletResponse.setStatus(HttpStatus.OK.value());
+            return false;
+        }
+        for (String urlMethod : Constant.METHOD_URL_SET) {
+            String[] split = urlMethod.split(":");
+            if (split[0].equals(httpServletRequest.getRequestURI())
+                    && (split[1].equals(httpServletRequest.getMethod()) || "RequestMapping".equals(split[1]))) {
+                return true;
+            } else if (split[0].contains("{")) {
+                String uri = split[0].substring(0, split[0].indexOf("{"));
+                if (httpServletRequest.getRequestURI().startsWith(uri)) {
+                    return true;
+                }
+            }
+        }
+        return super.preHandle(request, response);
+    }
+
+    /**
+     * 将非法请求跳转到 /401
+     */
+    private void response401(ServletRequest req, ServletResponse resp) {
+        try {
+            HttpServletResponse httpServletResponse = (HttpServletResponse) resp;
+            httpServletResponse.sendRedirect("/auth/401");
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 超时跳转到 /timeout
+     */
+    private void responseTimeOut(ServletRequest req, ServletResponse resp) {
+        try {
+            HttpServletResponse httpServletResponse = (HttpServletResponse) resp;
+            httpServletResponse.sendRedirect("/auth/timeout");
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+    }
+}

+ 33 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/JWTToken.java

@@ -0,0 +1,33 @@
+package com.fdkk.sxz.other.shiro;
+
+import org.apache.shiro.authc.AuthenticationToken;
+
+/**
+ * @ClassName: JWTToken
+ * @Description:
+ * @author Xiewj
+ * @date 2018年5月18日 下午4:00:43
+ */
+public class JWTToken implements AuthenticationToken {
+
+    private static final long serialVersionUID = -2819620437297382200L;
+
+    /**
+     * 密钥
+     */
+    private String token;
+
+    public JWTToken(String token) {
+        this.token = token;
+    }
+
+    @Override
+    public Object getPrincipal() {
+        return token;
+    }
+
+    @Override
+    public Object getCredentials() {
+        return token;
+    }
+}

+ 141 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/ShiroConfig.java

@@ -0,0 +1,141 @@
+package com.fdkk.sxz.other.shiro;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkk.sxz.constant.Constant;
+import com.fdkk.sxz.entity.system.Resource;
+import com.fdkk.sxz.system.service.IResourceService;
+import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
+import org.apache.shiro.mgt.DefaultSubjectDAO;
+import org.apache.shiro.spring.LifecycleBeanPostProcessor;
+import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
+import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.util.StringUtils;
+
+import javax.servlet.Filter;
+import java.text.MessageFormat;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @ClassName: ShiroConfig
+ * @Description:
+ * @author Xiewj
+ *
+ */
+@Configuration
+public class ShiroConfig {
+
+    @Autowired
+    private IResourceService resourceService;
+
+    /**
+     * 默认premission字符串
+     */
+    public static final String PERMISSION_STRING = "perms[\"{0}\"]";
+
+    @Bean
+    public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
+
+    @Bean
+    public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        defaultAdvisorAutoProxyCreator.setUsePrefix(true);
+        return defaultAdvisorAutoProxyCreator;
+    }
+
+    @Bean("securityManager")
+    public DefaultWebSecurityManager getManager() {
+        DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
+        // 使用自己的realm
+        manager.setRealm(userRealm());
+        /*
+         * 关闭shiro自带的session,详情见文档
+         * http://shiro.apache.org/session-management.html#SessionManagement-
+         * StatelessApplications%28Sessionless%29
+         */
+        DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
+        DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
+        defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
+        subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
+        manager.setSubjectDAO(subjectDAO);
+        return manager;
+    }
+
+    @Bean("shiroFilter")
+    public ShiroFilterFactoryBean factory(DefaultWebSecurityManager securityManager) {
+        ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean();
+        // 添加自己的过滤器并且取名为jwt
+        Map<String, Filter> filterMap = new LinkedHashMap<>(Constant.Number.ONE);
+        filterMap.put("jwt", jwtFilter());
+        filterMap.put("perms", jwtFilter());
+        factoryBean.setFilters(filterMap);
+        factoryBean.setSecurityManager(securityManager);
+        factoryBean.setUnauthorizedUrl("/401");
+        /*
+         * 自定义url规则 http://shiro.apache.org/web.html#urls-
+         */
+        Map<String, String> filterRuleMap = new LinkedHashMap<>(Constant.Number.TWO);
+        // 访问401和404页面不通过我们的Filter
+        filterRuleMap.put("/logging/*", "anon");
+        filterRuleMap.put("/401", "anon");
+        filterRuleMap.put("/404", "anon");
+        filterRuleMap.put("/500", "anon");
+        filterRuleMap.put("/swagger-ui.html", "anon");
+        filterRuleMap.put("/service-worker.js", "anon");
+        filterRuleMap.put("/doc.html", "anon");
+        filterRuleMap.put("/v2/api-docs-ext", "anon");
+        filterRuleMap.put("/service-worker", "anon");
+        filterRuleMap.put("/swagger-resources/configuration/ui", "anon");
+        filterRuleMap.put("/swagger-resources", "anon");
+        filterRuleMap.put("/swagger-resources/configuration/security", "anon");
+        filterRuleMap.put("/v2/api-docs", "anon");
+        filterRuleMap.put("/error", "anon");
+        filterRuleMap.put("/webjars/springfox-swagger-ui/**", "anon");
+        QueryWrapper<Resource> wrapper = new QueryWrapper<Resource>();
+        // 获取所有Permission
+        List<Resource> list = resourceService.selectResourceList(wrapper);
+        // 循环Permission的url,逐个添加到filterChainDefinitionMap中。
+        // 里面的键就是链接URL,值就是存在什么条件才能访问该链接
+        for (Iterator<Resource> it = list.iterator(); it.hasNext();) {
+            Resource resource = it.next();
+            String pUrl = resource.getResourceUrl();
+            String pKey = resource.getResourceKey();
+            // 如果不为空值添加到section中
+            if (!StringUtils.isEmpty(pUrl) && !StringUtils.isEmpty(pKey)) {
+                filterRuleMap.put(pUrl, MessageFormat.format(PERMISSION_STRING, pKey));
+            }
+        }
+        // 所有请求通过我们自己的JWT Filter
+        filterRuleMap.put("/**", "jwt");
+        factoryBean.setFilterChainDefinitionMap(filterRuleMap);
+        return factoryBean;
+    }
+
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(
+            DefaultWebSecurityManager securityManager) {
+        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+        advisor.setSecurityManager(securityManager);
+        return advisor;
+    }
+
+    @Bean
+    public UserRealm userRealm(){
+        return new UserRealm();
+    }
+
+    @Bean
+    public JWTFilter jwtFilter(){
+        return new JWTFilter();
+    }
+}

+ 124 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/UserRealm.java

@@ -0,0 +1,124 @@
+package com.fdkk.sxz.other.shiro;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkk.sxz.config.SpringContextBean;
+import com.fdkk.sxz.entity.system.Resource;
+import com.fdkk.sxz.entity.system.Role;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.exception.UnauthorizedException;
+import com.fdkk.sxz.other.shiro.conponent.JwtComponent;
+import com.fdkk.sxz.system.service.IRoleResourceService;
+import com.fdkk.sxz.system.service.IUserRoleService;
+import com.fdkk.sxz.system.service.IUserService;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @ClassName: MyRealm
+ * @Description: TODO
+ * @author Xiewj
+ */
+public class UserRealm extends AuthorizingRealm {
+
+    @Autowired
+    private JwtComponent jwtComponent;
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private IUserRoleService userRoleService;
+
+    @Autowired
+    private IRoleResourceService roleResourceService;
+
+    @Override
+    public boolean supports(AuthenticationToken token) {
+        /**
+         * 表示此Realm只支持JWTToken类型
+         */
+        return token instanceof JWTToken;
+    }
+
+    /**
+     * 只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的
+     */
+    @Override
+    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+
+        JSONObject userObj = JSON.parseObject(principals.toString());
+        Long userId = userObj.getLong("id");
+        SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo();
+        // 查询角色
+        ArrayList<String> roles = new ArrayList<>();
+        // 查询权限
+        ArrayList<String> permissions = new ArrayList<>();
+        // 查询用户权限
+        List<Role> roleList = userRoleService.queryRolesByUserId(userId);
+        // 查询用户所在组织权限(暂不启用)
+        // List<Role> orgRoleList =
+        // organizationRoleService.queryRolesByOrganizationId( );
+        for (Role role : roleList) {
+            if (!StringUtils.isEmpty(role.getRoleKey())) {
+                if (!StringUtils.isEmpty(role.getRoleKey().replace(" ", ""))) {
+                    roles.add(role.getRoleKey());
+                }
+            }
+            List<Resource> resourceList = roleResourceService.queryResourceByRoleId(role.getId());
+            if(!CollectionUtils.isEmpty(resourceList))
+            {
+                for (Resource res : resourceList) {
+                    if (!StringUtils.isEmpty(res.getResourceKey())) {
+                        if (!StringUtils.isEmpty(res.getResourceKey().replace(" ", ""))) {
+                            permissions.add(res.getResourceKey());
+                        }
+                    }
+                }
+            }
+        }
+        Set<String> rolesSet = new HashSet<>(roles);
+        simpleAuthorizationInfo.addRoles(rolesSet);
+        Set<String> permission = new HashSet<>(permissions);
+        simpleAuthorizationInfo.addStringPermissions(permission);
+        return simpleAuthorizationInfo;
+    }
+
+    /**
+     * 默认使用此方法进行用户名正确与否验证,错误抛出异常即可。
+     */
+    @Override
+    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws UnauthorizedException {
+        if (null == userService) {
+            this.userService = SpringContextBean.getBean(IUserService.class);
+        }
+        String token = (String) auth.getCredentials();
+        // 解密token获得username,用于和数据库进行对比
+        String userAccount = jwtComponent.getUserAccount(token);
+        if (userAccount == null) {
+            throw new UnauthorizedException("token invalid");
+        }
+        User userBean = userService.queryUserByAccount(userAccount);
+        if (userBean == null) {
+            throw new UnauthorizedException("User didn't existed!");
+        }
+        if (!jwtComponent.verify(token, userAccount, userBean.getUserPassword())) {
+            throw new UnauthorizedException("Username or password error");
+        }
+        String userString = JSONObject.toJSONString(userBean);
+        return new SimpleAuthenticationInfo(userString, token, this.getName());
+    }
+}

+ 98 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/WebMvcConfigurer.java

@@ -0,0 +1,98 @@
+package com.fdkk.sxz.other.shiro;
+
+import com.alibaba.fastjson.serializer.SerializeConfig;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.serializer.ToStringSerializer;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.fdkk.sxz.Interceptor.CommonInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName: WebMvcConfigurer
+ * @Description: TODO
+ * @author Xiewj
+ */
+@Configuration
+public class WebMvcConfigurer extends WebMvcConfigurationSupport {
+
+    @Autowired
+    private CommonInterceptor commonInterceptor;
+
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(commonInterceptor);
+    }
+
+    @Override
+    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
+        argumentResolvers.add(currentUserMethodArgumentResolver());
+        super.addArgumentResolvers(argumentResolvers);
+    }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        converters.add(fastJsonHttpMessageConverterEx());
+        super.configureMessageConverters(converters);
+    }
+
+    @Bean
+    public FastJsonHttpMessageConverterEx fastJsonHttpMessageConverterEx() {
+        // 创建fastJson消息转换器
+        FastJsonHttpMessageConverterEx fastConverter = new FastJsonHttpMessageConverterEx();
+        List<MediaType> supportedMediaTypes = new ArrayList<>();
+        supportedMediaTypes.add(MediaType.APPLICATION_JSON);
+        supportedMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        supportedMediaTypes.add(MediaType.APPLICATION_ATOM_XML);
+        supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
+        supportedMediaTypes.add(MediaType.APPLICATION_OCTET_STREAM);
+        supportedMediaTypes.add(MediaType.APPLICATION_PDF);
+        supportedMediaTypes.add(MediaType.APPLICATION_RSS_XML);
+        supportedMediaTypes.add(MediaType.APPLICATION_XHTML_XML);
+        supportedMediaTypes.add(MediaType.APPLICATION_XML);
+        supportedMediaTypes.add(MediaType.IMAGE_GIF);
+        supportedMediaTypes.add(MediaType.IMAGE_JPEG);
+        supportedMediaTypes.add(MediaType.IMAGE_PNG);
+        supportedMediaTypes.add(MediaType.TEXT_EVENT_STREAM);
+        supportedMediaTypes.add(MediaType.TEXT_HTML);
+        supportedMediaTypes.add(MediaType.TEXT_MARKDOWN);
+        supportedMediaTypes.add(MediaType.TEXT_PLAIN);
+        supportedMediaTypes.add(MediaType.TEXT_XML);
+        fastConverter.setSupportedMediaTypes(supportedMediaTypes);
+        // 添加fastjson的配置信息 比如 :是否要格式化返回的json数据
+        FastJsonConfig fastJsonConfig = new FastJsonConfig();
+        fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat/*,SerializerFeature.WriteMapNullValue*/);
+        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        SerializeConfig serializeConfig = SerializeConfig.globalInstance;
+        serializeConfig.put(BigInteger.class, ToStringSerializer.instance);
+        fastJsonConfig.setSerializeConfig(serializeConfig);
+
+        // 在转换器中添加配置信息
+        fastConverter.setFastJsonConfig(fastJsonConfig);
+        return fastConverter;
+    }
+
+    @Bean
+    public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
+        return new CurrentUserMethodArgumentResolver();
+    }
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
+        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
+        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
+    }
+}

+ 99 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/conponent/JwtComponent.java

@@ -0,0 +1,99 @@
+package com.fdkk.sxz.other.shiro.conponent;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTVerifier;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.exceptions.JWTDecodeException;
+import com.auth0.jwt.exceptions.TokenExpiredException;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author Xiewj
+ */
+@Component
+public class JwtComponent {
+
+    /**
+     * 过期时间
+     */
+    @Value("#{${system.expireTime}}")
+    private Map<String, Long> expireTime;
+
+    /**
+     * 生成签名,expireTime后过期
+     *
+     * @param userAccount
+     *            用户账号
+     * @param secret
+     *            用户的密码
+     * @param expTimeType
+     *            (1、web 2、 app) 失效时间类型
+     * @return 加密的token
+     */
+    public String sign(String userAccount, String secret, String expTimeType) {
+        try {
+            long expTime = expireTime.get(expTimeType);
+            Date date = new Date(System.currentTimeMillis() + expTime);
+            Algorithm algorithm = Algorithm.HMAC256(userAccount + secret);
+            // 附带username信息
+            return JWT.create().withClaim("useraccount", userAccount).withExpiresAt(date).sign(algorithm);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /**
+     * 校验token是否正确
+     *
+     * @param token
+     *            密钥
+     * @param secret
+     *            用户的密码
+     * @return 是否正确
+     */
+    public boolean verify(String token, String userAccount, String secret) {
+        try {
+            Algorithm algorithm = Algorithm.HMAC256(userAccount + secret);
+            JWTVerifier verifier = JWT.require(algorithm).withClaim("useraccount", userAccount).build();
+            verifier.verify(token);
+            return true;
+        } catch (TokenExpiredException expiredException) {
+            throw expiredException;
+        } catch (Exception exception) {
+            return false;
+        }
+    }
+
+    /**
+     * 获得token中的信息无需secret解密也能获得
+     *
+     * @return token中包含的用户名
+     */
+    public String getUserAccount(String token) {
+        try {
+            DecodedJWT jwt = JWT.decode(token);
+            return jwt.getClaim("useraccount").asString();
+        } catch (JWTDecodeException e) {
+            return null;
+        }
+    }
+
+    /**
+     * 获得token中的过期时间,判断是否重新生成token
+     *
+     * @return token中包含的过期时间
+     */
+    public Date getExpiresAt(String token) {
+        try {
+            DecodedJWT jwt = JWT.decode(token);
+            return jwt.getExpiresAt();
+        } catch (JWTDecodeException e) {
+            return null;
+        }
+    }
+}

+ 0 - 15
sxz-core/src/main/java/com/fdkk/sxz/service/impl/CompanyServiceImpl.java

@@ -1,15 +0,0 @@
-package com.fdkk.sxz.service.impl;
-
-import com.fdkk.sxz.entity.CompanyEntity;
-import com.fdkk.sxz.mapper.ICompanyMapper;
-import com.fdkk.sxz.service.ICompanyService;
-import org.springframework.stereotype.Service;
-
-/**
- * Created by Hb_zzZ on 2020/12/24.
- */
-@Service
-public class CompanyServiceImpl extends BaseServiceImpl<ICompanyMapper, CompanyEntity> implements ICompanyService{
-
-
-}

+ 0 - 20
sxz-core/src/main/java/com/fdkk/sxz/service/impl/RenovationPartsColorServiceImpl.java

@@ -1,20 +0,0 @@
-package com.fdkk.sxz.service.impl;
-
-import com.fdkk.sxz.entity.RenovationPartsColorEntity;
-import com.fdkk.sxz.mapper.IRenovationPartsColorMapper;
-import com.fdkk.sxz.service.IRenovationPartsColorService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Created by Hb_zzZ on 2020/11/12.
- */
-@Service
-@Transactional
-public class RenovationPartsColorServiceImpl extends  BaseServiceImpl<IRenovationPartsColorMapper , RenovationPartsColorEntity> implements IRenovationPartsColorService{
-
-    @Autowired
-    private IRenovationPartsColorMapper mapper;
-
-}

+ 136 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/aspect/DataFilterAspect.java

@@ -0,0 +1,136 @@
+package com.fdkk.sxz.system.aspect;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.fdkk.sxz.annotation.auth.DataFilter;
+import com.fdkk.sxz.base.DataPermissionCondition;
+import com.fdkk.sxz.base.DataPermissionPage;
+import com.fdkk.sxz.entity.system.DataPermission;
+import com.fdkk.sxz.entity.system.Organization;
+import com.fdkk.sxz.exception.BusinessException;
+import com.fdkk.sxz.system.service.IDataPermissionService;
+import com.fdkk.sxz.system.service.IOrganizationService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 数据过滤,切面处理类
+ * @author Xiewj
+ */
+@Aspect
+@Component
+public class DataFilterAspect {
+
+    @Autowired
+    IDataPermissionService dataPermissionService;
+
+    @Autowired
+    private IOrganizationService organizationService;
+
+    @Pointcut("@annotation(com.fdkk.sxz.annotation.auth.DataFilter)")
+    public void dataFilterCut() {
+
+    }
+
+    @Before("dataFilterCut()")
+    public void dataFilter(JoinPoint point) throws Throwable {
+        Object[] params = point.getArgs();
+        if(!ArrayUtils.isEmpty(params))
+        {
+            try
+            {
+                for (Object param: params)
+                {
+                    if(param != null
+                            && (param instanceof DataPermissionCondition || param instanceof DataPermissionPage)){
+                        String principal = (String) SecurityUtils.getSubject().getPrincipal();
+                        String userId = null;
+
+                        if (null != principal) {
+                            JSONObject userObj = JSON.parseObject(principal);
+                            userId = userObj.getString("id");
+                        }
+                        if(StringUtils.isEmpty(userId))
+                        {
+                            throw new BusinessException("实现数据权限,获取登录用户失败");
+                        }
+
+                        //给数据权限参数赋值
+                        MethodSignature signature = (MethodSignature) point.getSignature();
+                        DataFilter dataFilter = signature.getMethod().getAnnotation(DataFilter.class);
+                        String orgIdAlias = dataFilter.orgIdAlias();
+                        String userIdAlias = dataFilter.userIdAlias();
+                        boolean ownQuery = dataFilter.ownQuery();
+
+                        //添加拥有的数据权限列表
+                        QueryWrapper<DataPermission> wrapper = new QueryWrapper<>();
+                        wrapper.eq("user_id", userId);
+                        List<DataPermission> dataPermissionList = dataPermissionService.list(wrapper);
+                        List<String> orgIdList = null;
+                        if (!CollectionUtils.isEmpty(dataPermissionList))
+                        {
+                            orgIdList = new ArrayList<>();
+                            for (DataPermission dp : dataPermissionList)
+                            {
+                                List<Organization> childrenList = organizationService.queryOrgList(dp.getOrganizationId());
+                                if (!CollectionUtils.isEmpty(childrenList))
+                                {
+                                    for (Organization childOrg : childrenList)
+                                    {
+                                        orgIdList.add(String.valueOf(childOrg.getId()));
+                                    }
+                                }
+                                else
+                                {
+                                    orgIdList.add(String.valueOf(dp.getOrganizationId()));
+                                }
+                            }
+                        }
+
+                        if(param instanceof DataPermissionCondition)
+                        {
+                            DataPermissionCondition dataPermissionCondition = (DataPermissionCondition) param;
+                            dataPermissionCondition.setOrgIdAlias(orgIdAlias);
+                            dataPermissionCondition.setUserIdAlias(userIdAlias);
+                            dataPermissionCondition.setUserId(userIdAlias);
+                            dataPermissionCondition.setOwnQuery(ownQuery);
+                            dataPermissionCondition.setOrgIdList(orgIdList);
+                        }
+                        else if(param instanceof DataPermissionPage)
+                        {
+                            DataPermissionPage dataPermissionPage = (DataPermissionPage) param;
+                            dataPermissionPage.setOrgIdAlias(orgIdAlias);
+                            dataPermissionPage.setUserIdAlias(userIdAlias);
+                            dataPermissionPage.setUserId(userId);
+                            dataPermissionPage.setOwnQuery(ownQuery);
+                            dataPermissionPage.setOrgIdList(orgIdList);
+                        }
+                        break;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                throw new BusinessException("解析数据权限参数时发生异常:" + e);
+            }
+        }
+        else
+        {
+            throw new BusinessException("要实现数据权限,必须添加DataPermissionCondition或者DataPermissionPage参数");
+        }
+
+    }
+}

+ 252 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/aspect/SystemLogAspect.java

@@ -0,0 +1,252 @@
+package com.fdkk.sxz.system.aspect;
+
+import com.alibaba.fastjson.JSON;
+import com.fdkk.sxz.annotation.log.AfterLog;
+import com.fdkk.sxz.annotation.log.AroundLog;
+import com.fdkk.sxz.annotation.log.BeforeLog;
+import com.fdkk.sxz.entity.system.Log;
+import com.fdkk.sxz.system.service.ILogService;
+import com.fdkk.sxz.util.IPUtil;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+
+/**
+ * @author jeebase-DN-JBKGJ72
+ * @ClassName: SystemLogAspect
+ * @Description:
+ * @date 2016年4月27日 下午4:02:12
+ */
+@Aspect
+@Component
+public class SystemLogAspect {
+
+    /**
+     * 本地异常日志记录对象
+     */
+    private static final Logger logger = LoggerFactory.getLogger(SystemLogAspect.class);
+
+    /**
+     * 注入Service用于把日志保存数据库
+     */
+    @Autowired
+    private ILogService logService;
+
+    /**
+     * Before切点
+     */
+    @Pointcut("@annotation(com.fdkk.sxz.annotation.log.BeforeLog)")
+    public void beforeAspect() {
+    }
+
+    /**
+     * After切点
+     */
+    @Pointcut("@annotation(com.fdkk.sxz.annotation.log.AfterLog)")
+    public void afterAspect() {
+    }
+
+    /**
+     * Around切点
+     */
+    @Pointcut("@annotation(com.fdkk.sxz.annotation.log.AroundLog)")
+    public void aroundAspect() {
+    }
+
+    /**
+     * 前置通知 记录用户的操作
+     *
+     * @param joinPoint 切点
+     */
+    @Before("beforeAspect()")
+    public void doBefore(JoinPoint joinPoint) {
+        try {
+            // 处理入参
+            Object[] args = joinPoint.getArgs();
+            StringBuffer inParams = new StringBuffer();
+            for (Object obj : args) {
+                if (null != obj && !(obj instanceof ServletRequest) && !(obj instanceof ServletResponse)) {
+                    String objJson = JSON.toJSONString(obj);
+                    inParams.append(objJson);
+                }
+            }
+            Method method = getMethod(joinPoint);
+            String operationName = getBeforeLogName(method);
+            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+            HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
+            String traceId = (String) request.getAttribute("TRACE_ID");
+
+            addSysLog(traceId, joinPoint, String.valueOf(inParams), "BeforeLog", operationName);
+        } catch (Exception e) {
+            logger.error("doBefore日志记录异常,异常信息:{}", e.getMessage());
+        }
+    }
+
+    /**
+     * 后置通知 记录用户的操作
+     *
+     * @param joinPoint 切点
+     */
+    @AfterReturning(value = "afterAspect()", returning = "returnObj")
+    public void doAfter(JoinPoint joinPoint, Object returnObj) {
+        try {
+            // 处理出参
+            String outParams = JSON.toJSONString(returnObj);
+            Method method = getMethod(joinPoint);
+            String operationName = getAfterLogName(method);
+            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+            HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
+            String traceId = (String) request.getAttribute("TRACE_ID");
+
+            addSysLog(traceId, joinPoint, "AfterLog", outParams, operationName);
+        } catch (Exception e) {
+            logger.error("doAfter日志记录异常,异常信息:{}", e.getMessage());
+        }
+    }
+
+    /**
+     * 前后通知 用于拦截记录用户的操作记录
+     *
+     * @param joinPoint 切点
+     * @throws Throwable
+     */
+    @Around("aroundAspect()")
+    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
+        // 出参
+        Object value = null;
+        // 拦截的方法是否执行
+        boolean execute = false;
+        // 入参
+        Object[] args = joinPoint.getArgs();
+        try {
+            // 处理入参
+            StringBuffer inParams = new StringBuffer();
+            for (Object obj : args) {
+                if (null != obj &&  !(obj instanceof MultipartFile) && !(obj instanceof ServletRequest) && !(obj instanceof ServletResponse)) {
+                    String objJson = JSON.toJSONString(obj);
+                    inParams.append(objJson);
+                }
+            }
+            execute = true;
+            // 执行目标方法
+            value = joinPoint.proceed(args);
+            // 处理出参
+            String outParams = JSON.toJSONString(value);
+            Method method = getMethod(joinPoint);
+            String operationName = getAroundLogName(method);
+            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+            HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
+            String traceId = (String) request.getAttribute("TRACE_ID");
+            // 记录日志
+            addSysLog(traceId, joinPoint, String.valueOf(inParams), String.valueOf(outParams), operationName);
+        } catch (Exception e) {
+            logger.error("around日志记录异常,异常信息:{}", e.getMessage());
+            // 如果未执行则继续执行,日志异常不影响操作流程继续
+            if (!execute) {
+                value = joinPoint.proceed(args);
+            }
+            throw e;
+        }
+        return value;
+    }
+
+    /**
+     * 日志入库 addSysLog(这里用一句话描述这个方法的作用)
+     *
+     * @Title: addSysLog @Description: @param @param joinPoint @param @param
+     * inParams @param @param outParams @param @param operationName
+     * 设定文件 @return void 返回类型 @throws
+     */
+    public void addSysLog(String traceId, JoinPoint joinPoint, String inParams, String outParams, String operationName) {
+        try {
+            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
+                    .getRequest();
+            String ip = IPUtil.getIP(request);
+            Log sysLog = new Log();
+            sysLog.setUrl(request.getRequestURI());
+            sysLog.setMethodName(joinPoint.getSignature().getName());
+            sysLog.setTraceId(traceId);
+            sysLog.setInParams(String.valueOf(inParams));
+            sysLog.setOutParams(String.valueOf(outParams));
+            sysLog.setOperationIp(ip);
+            sysLog.setOperationName(operationName);
+            logService.save(sysLog);
+        } catch (Exception e) {
+            logger.error("addSysLog日志记录异常,异常信息:{}", e.getMessage());
+            throw e;
+        }
+    }
+
+    /**
+     * 获取注解中对方法的描述信息
+     *
+     * @param joinPoint 切点
+     * @return 方法描述
+     * @throws Exception
+     */
+    public Method getMethod(JoinPoint joinPoint) throws Exception {
+        String targetName = joinPoint.getTarget().getClass().getName();
+        String methodName = joinPoint.getSignature().getName();
+        Object[] arguments = joinPoint.getArgs();
+        Class<?> targetClass = Class.forName(targetName);
+        Method[] methods = targetClass.getMethods();
+        Method methodReturn = null;
+        for (Method method : methods) {
+            if (method.getName().equals(methodName)) {
+                Class<?>[] clazzs = method.getParameterTypes();
+                if (clazzs.length == arguments.length) {
+                    methodReturn = method;
+                    break;
+                }
+            }
+        }
+        return methodReturn;
+    }
+
+    /**
+     * getBeforeLogName(获取before名称)
+     *
+     * @Title: getBeforeLogName @Description: @param @param
+     * method @param @return 设定文件 @return String 返回类型 @throws
+     */
+    public String getBeforeLogName(Method method) {
+        String name = method.getAnnotation(BeforeLog.class).name();
+        return name;
+    }
+
+    /**
+     * getAfterLogName(获取after名称)
+     *
+     * @Title: getAfterLogName @Description: @param @param method @param @return
+     * 设定文件 @return String 返回类型 @throws
+     */
+    public String getAfterLogName(Method method) {
+        String name = method.getAnnotation(AfterLog.class).name();
+        return name;
+    }
+
+    /**
+     * getAroundLogName(获取around名称)
+     *
+     * @Title: getAroundLogName @Description: @param @param
+     * method @param @return 设定文件 @return String 返回类型 @throws
+     */
+    public String getAroundLogName(Method method) {
+        String name = method.getAnnotation(AroundLog.class).name();
+        return name;
+    }
+}

+ 128 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/controller/ResourceController.java

@@ -0,0 +1,128 @@
+package com.fdkk.sxz.system.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkk.sxz.annotation.auth.CurrentUser;
+import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.system.dto.CreateResource;
+import com.fdkk.sxz.system.dto.UpdateResource;
+import com.fdkk.sxz.entity.system.Resource;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.system.service.IResourceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.beans.BeanCopier;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 权限表 前端控制器
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@RestController
+@RequestMapping("/resource")
+@Api(tags = "ResourceController|权限资源相关的前端控制器")
+public class ResourceController extends BaseController {
+
+    @Autowired
+    private IResourceService resourceService;
+
+    @GetMapping(value = "/tree")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "查询权限资源树", notes = "树状展示权限资源信息")
+    @ApiImplicitParam(paramType = "query", name = "parentId", value = "父级ID", required = false, dataType = "Integer")
+    public Result<List<Resource>> queryResourceTree(Long parentId) {
+        List<Resource> treeList = resourceService.queryResourceByParentId(parentId);
+        return success(treeList);
+    }
+
+    /**
+     * 添加资源
+     */
+    @PostMapping("/create")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "添加权限资源")
+    public Result<Resource> createResource(@RequestBody CreateResource resource) {
+        Resource resEntity = new Resource();
+        BeanCopier.create(CreateResource.class, Resource.class, false).copy(resource, resEntity, null);
+        boolean result = resourceService.createResource(resEntity);
+        if (result) {
+            return success("添加成功",resEntity);
+        } else {
+            return failure("添加失败,请重试");
+        }
+    }
+
+    /**
+     * 修改资源
+     */
+    @PostMapping("/update")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "更新权限资源")
+    public Result<Resource> updateResource(@RequestBody UpdateResource resource) {
+        Resource resEntity = new Resource();
+        BeanCopier.create(UpdateResource.class, Resource.class, false).copy(resource, resEntity, null);
+        boolean result = resourceService.updateResource(resEntity);
+        if (result) {
+            return success("修改成功",resEntity);
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 删除资源
+     */
+    @RequiresRoles("SYSADMIN")
+    @PostMapping("/delete/{resId}")
+    @ApiOperation(value = "删除权限资源")
+    @ApiImplicitParam(paramType = "path", name = "resId", value = "权限资源ID", required = true, dataType = "Integer")
+    public Result deleteResource(@PathVariable("resId") Integer resId) {
+        boolean result = resourceService.deleteResource(resId);
+        if (result) {
+            return success("删除成功");
+        } else {
+            return failure("删除失败");
+        }
+    }
+
+    @PostMapping(value = "/key/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验ResourceKey是否存在", notes = "校验ResourceKey是否存在")
+    public Result<Boolean> checkResourceKey(CreateResource resource) {
+        String resourceKey = resource.getResourceKey();
+        QueryWrapper<Resource> resourceQueryWrapper = new QueryWrapper<>();
+        resourceQueryWrapper.eq("resource_key", resourceKey);
+        if(null != resource.getId()) {
+            resourceQueryWrapper.ne("id", resource.getId());
+        }
+        int count = resourceService.count(resourceQueryWrapper);
+        if (count == 0){
+            return successPut(true);
+        } else{
+            return errorPut(false);
+        }
+    }
+
+    /**
+     * 获取登录后的菜单权限
+     */
+    @GetMapping("/menu")
+    @RequiresAuthentication
+    @ApiOperation(value = "登陆后获取个人权限资源")
+    public Result<List<Resource>> navMenu(@ApiIgnore @CurrentUser User currentUser) {
+        Long userId = currentUser.getId();
+        List<Resource> resourceList = resourceService.queryResourceByUserId(userId);
+        return successPut(resourceList);
+    }
+}

+ 235 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/controller/RoleController.java

@@ -0,0 +1,235 @@
+package com.fdkk.sxz.system.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkk.sxz.base.PageResult;
+import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.system.dto.CreateRole;
+import com.fdkk.sxz.system.dto.UpdateRole;
+import com.fdkk.sxz.system.dto.UpdateRoleResource;
+import com.fdkk.sxz.entity.system.Role;
+import com.fdkk.sxz.entity.system.RoleResource;
+import com.fdkk.sxz.system.service.IRoleResourceService;
+import com.fdkk.sxz.system.service.IRoleService;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @ClassName: RoleController
+ * @Description: Role前端控制器
+ * @author Xiewj
+ * @date 2018年5月18日 下午4:06:17
+ */
+@RestController
+@RequestMapping("/role")
+@Api(tags = "RoleController|角色相关的前端控制器")
+public class RoleController extends BaseController {
+
+    @Autowired
+    private IRoleService roleService;
+
+    @Autowired
+    private IRoleResourceService roleResourceService;
+
+    /**
+     * 查询角色列表
+     */
+    @GetMapping("/list")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "查询角色列表")
+    public PageResult<Role> list(Role role, Page<Role> page) {
+        PageInfo<Role> pageRole = roleService.selectRoleList(page, role);
+        PageResult<Role> pageResult = new PageResult<Role>(pageRole.getTotal(), pageRole.getList());
+        return pageResult;
+    }
+
+    /**
+     * 添加角色
+     */
+    @PostMapping("/create")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "添加角色")
+    public Result<?> create(@RequestBody CreateRole role) {
+        boolean result = roleService.createRole(role);
+        if (result) {
+            return success("添加成功");
+        } else {
+            return failure("添加失败,请重试");
+        }
+    }
+
+    /**
+     * 修改角色
+     */
+    @PostMapping("/update")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "更新角色")
+    public Result<?> update(@RequestBody UpdateRole role) {
+        boolean result = roleService.updateRole(role);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 删除角色
+     */
+    @RequiresRoles("SYSADMIN")
+    @PostMapping("/delete/{roleId}")
+    @ApiOperation(value = "删除角色")
+    @ApiImplicitParam(paramType = "path", name = "roleId", value = "角色ID", required = true, dataType = "Integer")
+    public Result delete(@PathVariable("roleId") Integer roleId) {
+        if (null == roleId) {
+            return failure("ID不能为空");
+        }
+        boolean result = roleService.deleteRole(roleId);
+        if (result) {
+            return success("删除成功");
+        } else {
+            return failure("删除失败");
+        }
+    }
+
+    /**
+     * 批量删除角色
+     */
+    @RequiresRoles("SYSADMIN")
+    @PostMapping("/batch/delete")
+    @ApiOperation(value = "批量删除角色")
+    @ApiImplicitParam(name = "roleIds", value = "角色ID列表", required = true, dataType = "List")
+    public Result  batchDelete(@RequestBody List<Integer> roleIds) {
+        if (CollectionUtils.isEmpty(roleIds)) {
+            return failure("角色ID列表不能为空");
+        }
+        boolean result = roleService.batchDeleteRole(roleIds);
+        if (result) {
+            return success("删除成功");
+        } else {
+            return failure("删除失败");
+        }
+    }
+
+    /**
+     * 修改角色状态
+     */
+    @PostMapping("/status/{roleId}/{roleStatus}")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "修改角色状态")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "roleId", value = "角色ID", required = true, dataType = "Integer", paramType = "path"),
+            @ApiImplicitParam(name = "roleStatus", value = "角色状态", required = true, dataType = "String", paramType = "path") })
+    public Result  updateStatus(@PathVariable("roleId") Integer roleId,
+            @PathVariable("roleStatus") String roleStatus) {
+        if (null == roleId || StringUtils.isEmpty(roleStatus)) {
+            return failure("ID和状态不能为空");
+        }
+        UpdateRole role = new UpdateRole();
+        role.setId(roleId);
+        role.setRoleStatus(roleStatus);
+        boolean result = roleService.updateRole(role);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 获取角色资源
+     *
+     * @param roleId
+     * @return
+     */
+    @GetMapping(value = "/resource/{roleId}")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "获取角色的权限资源")
+    @ApiImplicitParam(paramType = "path", name = "roleId", value = "角色ID", required = true, dataType = "Integer")
+    public Result<List<RoleResource>> queryRoleResource(@PathVariable("roleId") Integer roleId) {
+        QueryWrapper<RoleResource> ew = new QueryWrapper<>();
+        ew.eq("role_id", roleId);
+        List<RoleResource> list = roleResourceService.list(ew);
+        return successPut(list);
+    }
+
+    /**
+     * 修改角色资源
+     *
+     * @param updateRoleResource
+     * @return
+     */
+    @PostMapping(value = "/resource/update")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "修改角色的权限资源")
+    public Result<?> updateRoleResource(@RequestBody UpdateRoleResource updateRoleResource) {
+        boolean result = roleResourceService.updateList(updateRoleResource);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 查询所有角色列表
+     *
+     * @return
+     */
+    @GetMapping(value = "/all")
+    @RequiresAuthentication
+    @ApiOperation(value = "查询所有角色列表")
+    public Result<List<Role>> queryAll() {
+        QueryWrapper<Role> ew = new QueryWrapper<>();
+        List<Role> result = roleService.list(ew);
+        return successPut(result);
+    }
+
+    @PostMapping(value = "/name/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验角色名称是否存在", notes = "校验角色名称是否存在")
+    public Result<Boolean> checkRoleName(CreateRole role) {
+        String roleName = role.getRoleName();
+        QueryWrapper<Role> roleQueryWrapper = new QueryWrapper<>();
+        roleQueryWrapper.eq("role_name", roleName);
+        if(null != role.getId()) {
+            roleQueryWrapper.ne("id", role.getId());
+        }
+        int count = roleService.count(roleQueryWrapper);
+        if (count == 0){
+            return successPut(true);
+        } else{
+            return errorPut(false);
+        }
+    }
+
+    @PostMapping(value = "/key/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验角色标识是否存在", notes = "校验角色标识是否存在")
+    public Result<Boolean> checkRoleKey(CreateRole role) {
+        String roleKey = role.getRoleKey();
+        QueryWrapper<Role> roleQueryWrapper = new QueryWrapper<>();
+        roleQueryWrapper.eq("role_key", roleKey);
+        if(null != role.getId()) {
+            roleQueryWrapper.ne("id", role.getId());
+        }
+        int count = roleService.count(roleQueryWrapper);
+        if (count == 0){
+            return successPut(true);
+        } else{
+            return errorPut(false);
+        }
+    }
+}

+ 62 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysLogController.java

@@ -0,0 +1,62 @@
+package com.fdkk.sxz.system.controller;
+
+
+import com.alibaba.fastjson.JSON;
+import com.fdkk.sxz.base.PageResult;
+import com.fdkk.sxz.system.dto.LogInfo;
+import com.fdkk.sxz.system.dto.QueryLog;
+import com.fdkk.sxz.system.service.ILogService;
+import com.fdkk.sxz.util.RedisUtil;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+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.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author jeebase
+ * @since 2018-10-24
+ */
+@RestController
+@RequestMapping("/common/log")
+public class SysLogController {
+
+    @Autowired
+    ILogService logService;
+
+    @Autowired
+    RedisUtil redisUtil;
+    /**
+     * 查询所有用户
+     */
+    @GetMapping("/list")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "查询操作日志列表")
+    public PageResult<LogInfo> list(QueryLog log, Page<LogInfo> page) {
+        PageInfo<LogInfo> pageLog = logService.selectLogList(page, log);
+        PageResult<LogInfo> pageResult = new PageResult<LogInfo>(pageLog.getTotal(), pageLog.getList());
+        return pageResult;
+    }
+    /**
+     * 查询所有用户
+     */
+    @GetMapping("/details")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "查询操作日志详情列表")
+    public PageResult<Object> details(QueryLog log, Page<LogInfo> page) {
+
+        List<String> list = redisUtil.lRange(log.getTraceId(), 0, -1);
+
+        PageResult<Object> pageResult = new PageResult<>(list.size(), JSON.parseArray(list.toString()));
+        return pageResult;
+    }
+}

+ 460 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysLoginController.java

@@ -0,0 +1,460 @@
+package com.fdkk.sxz.system.controller;
+
+import cn.hutool.captcha.GifCaptcha;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkk.sxz.annotation.auth.CurrentUser;
+import com.fdkk.sxz.annotation.auth.NoAuthentication;
+import com.fdkk.sxz.system.dto.UserInfo;
+import com.fdkk.sxz.entity.system.Resource;
+import com.fdkk.sxz.entity.system.Role;
+import com.fdkk.sxz.constant.Constant;
+import com.fdkk.sxz.constant.ResponseConstant;
+import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.system.dto.LoginUser;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.other.shiro.conponent.JwtComponent;
+import com.fdkk.sxz.system.service.IResourceService;
+import com.fdkk.sxz.system.service.IUserRoleService;
+import com.fdkk.sxz.system.service.IUserService;
+import com.fdkk.sxz.base.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.mindrot.jbcrypt.BCrypt;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cglib.beans.BeanCopier;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @ClassName: LoginController
+ * @Description: 登录相关前端控制器
+ * @author Xiewj
+ * @date 2018年5月18日 下午4:08:26
+ */
+@RestController
+@RequestMapping("/auth")
+@Api(tags = "LoginController|登录鉴权相关的前端控制器")
+public class SysLoginController extends BaseController {
+
+    @Autowired
+    private JwtComponent jwtComponent;
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private IUserRoleService userRoleService;
+
+    @Autowired
+    private IResourceService resourceService;
+
+//    @Autowired
+//    ISmsService iSmsService;
+
+    @Value("${system.smsTimes}")
+    private int smsTimes;
+
+
+    @GetMapping("/vcode")
+    @NoAuthentication
+    @ApiOperation(value = "获取登录时的验证码")
+    @ApiImplicitParam(paramType = "query", name = "codeKey", value = "验证码唯一标识", required = true, dataType = "String")
+    public void defaultKaptcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        String codeKey = request.getParameter("codeKey");
+        if (codeKey != null && !codeKey.trim().isEmpty()) {
+            response.setContentType("image/gif");
+            response.setHeader("Pragma", "No-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            response.setDateHeader("Expires", 0L);
+            GifCaptcha captcha = new GifCaptcha(130, 38, 5);
+            ServletContext servletContext = request.getSession().getServletContext();
+            servletContext.setAttribute("code_" + codeKey, captcha.getCode().toLowerCase(Locale.ROOT));
+            captcha.write(response.getOutputStream());
+        }
+    }
+
+    @PostMapping("/login")
+    @NoAuthentication
+    @ApiOperation(value = "执行登录", notes = "返回token")
+    public Result<String> login(@RequestBody LoginUser loginUser, HttpServletRequest request) throws Exception {
+        String userAccount = loginUser.getUserAccount();
+        String userPassword = loginUser.getUserPassword();
+        String vcode = loginUser.getVcode();
+        String verkey = loginUser.getVerkey();
+//        if (!CaptchaUtil.isVerified(verkey, vcode, request)) {
+//            return error(ResponseConstant.INVALID_RE_VCODE);
+//        }
+        if (StringUtils.isEmpty(userAccount) || StringUtils.isEmpty(userPassword)) {
+            return error(ResponseConstant.PARAM_ERROR);
+        }
+        // 查询用户是否存在
+        QueryWrapper<User> ew = new QueryWrapper<>();
+        ew.eq("user_account", userAccount).or().eq("user_mobile", userAccount).or().eq("user_email", userAccount);
+        User user = userService.getOne(ew);
+        if (StringUtils.isEmpty(user) || !BCrypt.checkpw(user.getUserAccount() + userPassword, user.getUserPassword())) {
+            return error(ResponseConstant.INVALID_USERNAME_PASSWORD);
+        }
+        String token = jwtComponent.sign(user.getUserAccount(), user.getUserPassword(), Constant.ExpTimeType.WEB);
+        return successPut(token);
+    }
+
+    /**
+     * 获取登录后的用户信息
+     */
+    @GetMapping("/user/info")
+    @RequiresAuthentication
+    @ApiOperation(value = "登录后获取用户个人信息")
+    public Result<UserInfo> userInfo(HttpServletRequest request, @ApiIgnore @CurrentUser User currentUser) {
+        Long userId = currentUser.getId();
+        UserInfo userInfo = new UserInfo();
+        BeanCopier.create(User.class, UserInfo.class, false).copy(currentUser, userInfo, null);
+        List<Role> userRole = userRoleService.queryRolesByUserId(userId);
+        if (!CollectionUtils.isEmpty(userRole)) {
+            List<String> roles = new ArrayList<String>();
+            StringBuffer roleNames = new StringBuffer();
+            for (Role role : userRole) {
+                roles.add(role.getRoleKey());
+                roleNames.append(role.getRoleName());
+            }
+            userInfo.setRoles(roles);
+            userInfo.setRoleName(roleNames.toString());
+        }
+        List<Resource> resourceList = resourceService.queryResourceByUserId(userId);
+        userInfo.setResources(resourceList);
+
+        List<String> resourceStringList = resourceService.queryResourceListByUserId(userId);
+        userInfo.setStringResources(resourceStringList);
+        return successPut(userInfo);
+    }
+
+    /**
+     * 刷新token
+     */
+    @GetMapping("/token/refresh")
+    @RequiresAuthentication
+    @ApiOperation(value = "刷新token")
+    public Result<String> refreshToken( @ApiIgnore @CurrentUser User currentUser) {
+        Long userId = currentUser.getId();
+        User user = userService.getById(userId);
+        String token = jwtComponent.sign(user.getUserAccount(), user.getUserPassword(), Constant.ExpTimeType.WEB);
+        return successPut(token);
+    }
+
+//    /**
+//     * 发送短信验证码
+//     */
+//    @PostMapping("/sms/reg")
+//    @NoAuthentication
+//    @ApiOperation(value = "注册用户时,发送短信验证码")
+//    public Result<?> sendSmsReg(@Valid @RequestBody SmsDto smsDto) {
+//        String phoneNumber = smsDto.getUserMobile();
+//        QueryWrapper<User> ew = new QueryWrapper<>();
+//        ew.eq("user_account", phoneNumber).or().eq("user_nick_name", phoneNumber).or().eq("user_email", phoneNumber)
+//                .or().eq("user_mobile", phoneNumber);
+//        List<User> userList = userService.list(ew);
+//        if (!CollectionUtils.isEmpty(userList)) {
+//            throw new BusinessException("账号已经存在");
+//        }
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("验证码发送超过最大次数");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_times", 1);
+//        }
+//        String smsCode = String.valueOf(new Random().nextInt(899999) + 100000);
+//        System.out.println("注册短信:" + smsCode);
+//        iSmsService.sendVcodeSms(phoneNumber, smsCode);
+//        cacheChannel.set("smsCode", phoneNumber + "_sms_reg", smsCode);
+//        return new Result<>().success("验证码发送成功");
+//    }
+
+//    /**
+//     * 注册用户
+//     */
+//    @PostMapping("/register")
+//    @NoAuthentication
+//    @ApiOperation(value = "注册用户")
+//    public Result<?> create(@Valid @RequestBody RegisterUser user) {
+//        String phoneNumber = user.getUserMobile();
+//        String userSmsCode = user.getSmsCode();
+//        CacheObject smsCodeCache = cacheChannel.get("smsCode", phoneNumber + "_sms_reg");
+//        String smsCode = (String) smsCodeCache.getValue();
+//        if (StringUtils.isEmpty(smsCode)) {
+//            return new Result<>().error("短信验证码已失效,请重新获取");
+//        }
+//        if (!smsCode.equals(userSmsCode)) {
+//            return new Result<>().error("短信验证码错误,请重新输入");
+//        }
+//        CreateUser createUser = new CreateUser();
+//        BeanCopier.create(RegisterUser.class, CreateUser.class, false).copy(user, createUser, null);
+//        createUser.setRoleId(8);
+//        createUser.setUserStatus("1");
+//        createUser.setUserAccount(phoneNumber);
+//        boolean result = userService.createUser(createUser);
+//        if (result) {
+//            return new Result<>().success("注册成功");
+//        } else {
+//            return new Result<>().error("添加失败,请重试");
+//        }
+//    }
+
+//    /**
+//     * 发送修改密码的短信验证码
+//     */
+//    @PostMapping("/sms/pwd")
+//    @NoAuthentication
+//    @ApiOperation(value = "未登录用户找回密码,发送修改密码的短信验证码")
+//    public Result<?> sendSmsPwd(@Valid @RequestBody SmsDto smsDto) {
+//        String phoneNumber = smsDto.getUserMobile();
+//        QueryWrapper<User> wrapper = new QueryWrapper<User>();
+//        wrapper.eq("USER_MOBILE", smsDto.getUserMobile());
+//        User user = userService.getOne(wrapper);
+//        if (null == user) {
+//            return new Result<>().error("该手机尚未注册");
+//        }
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("验证码发送超过最大次数");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_times", 1);
+//        }
+//        String smsCode = String.valueOf(new Random().nextInt(899999) + 100000);
+//        System.out.println("注册短信:" + smsCode);
+//        iSmsService.sendVcodeSms(phoneNumber, smsCode);
+//        cacheChannel.set("smsCode", phoneNumber + "_sms_pwd", smsCode);
+//        return new Result<>().success("验证码发送成功");
+//    }
+//
+//    /**
+//     * 验证找回密码
+//     */
+//    @PostMapping("/pwd/code/check")
+//    @NoAuthentication
+//    @ApiOperation(value = "未登录用户找回密码,判断验证码是否正确")
+//    public Result<?> pwdCodeCheck(@Valid @RequestBody RegisterUser user) {
+//        String phoneNumber = user.getUserMobile();
+//        String userSmsCode = user.getSmsCode();
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("超过最大验证次数,请明天再试");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pwd_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pwd_times", 1);
+//        }
+//        CacheObject smsCodeCache = cacheChannel.get("smsCode", phoneNumber + "_sms_pwd");
+//        String smsCode = (String) smsCodeCache.getValue();
+//        if (StringUtils.isEmpty(smsCode)) {
+//            return new Result<>().error("短信验证码已失效,请重新获取");
+//        }
+//        if (!smsCode.equals(userSmsCode)) {
+//            return new Result<>().error("短信验证码错误,请重新输入");
+//        }
+//        return new Result<>().success("验证码");
+//    }
+//
+//    /**
+//     * 更新密码
+//     */
+//    @PostMapping("/pwd/update")
+//    @NoAuthentication
+//    @ApiOperation(value = "未登录用户找回密码,更新密码")
+//    public Result<?> changePwd(@Valid @RequestBody PwdUser user) {
+//        String phoneNumber = user.getUserMobile();
+//        String userSmsCode = user.getSmsCode();
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_pwd_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("超过最大验证次数,请明天再试");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pwd_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pwd_times", 1);
+//        }
+//        CacheObject smsCodeCache = cacheChannel.get("smsCode", phoneNumber + "_sms_pwd");
+//        String smsCode = (String) smsCodeCache.getValue();
+//        if (StringUtils.isEmpty(smsCode)) {
+//            return new Result<>().error("短信验证码已失效,请重新获取");
+//        }
+//        if (!smsCode.equals(userSmsCode)) {
+//            return new Result<>().error("短信验证码错误,请重新输入");
+//        }
+//        User userEntity = new User();
+//        BeanCopier.create(PwdUser.class, User.class, false).copy(user, userEntity, null);
+//        String pwd = userEntity.getUserPassword();
+//        if (!StringUtils.isEmpty(pwd)) {
+//            String cryptPwd = BCrypt.hashpw(pwd, BCrypt.gensalt());
+//            userEntity.setUserPassword(cryptPwd);
+//        }
+//        QueryWrapper<User> wrapper = new QueryWrapper<>();
+//        wrapper.eq("user_mobile", userEntity.getUserMobile());
+//        boolean result = userService.update(userEntity, wrapper);
+//        if (result) {
+//            return new Result<>().success("密码修改成功,请登录");
+//        } else {
+//            return new Result<>().error("密码修改失败,请重试");
+//        }
+//    }
+//
+//    /**
+//     * 发送修改密码的短信验证码
+//     */
+//    @PostMapping("/sms/personal/pwd")
+//    @RequiresAuthentication
+//    @ApiOperation(value = "登录用户,发送修改密码的短信验证码")
+//    public Result<?> sendPersonalSmsPwd(@ApiIgnore @CurrentUser User userc) {
+//        if (null == userc) {
+//            return new Result<>().error("当前用户未登陆");
+//        }
+//        String phoneNumber = userc.getUserMobile();
+//        if (StringUtils.isEmpty(phoneNumber)) {
+//            return new Result<>().error("未获取到当前登录用户手机号");
+//        }
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_pw_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("验证码发送超过最大次数");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pw_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pw_times", 1);
+//        }
+//        String smsCode = String.valueOf(new Random().nextInt(899999) + 100000);
+//        System.out.println("注册短信:" + smsCode);
+//        iSmsService.sendVcodeSms(phoneNumber, smsCode);
+//        cacheChannel.set("smsCode", phoneNumber + "_sms_pwd_pw", smsCode);
+//        return new Result<>().success("验证码发送成功");
+//    }
+//
+//    /**
+//     * 验证找回密码
+//     */
+//    @GetMapping("/pwd/personal/code/check/{scode}")
+//    @RequiresAuthentication
+//    @ApiOperation(value = "登录用户,判断验证码是否正确")
+//    public Result<?> pwdPersonalCodeCheck(@PathVariable("scode") String scode, @ApiIgnore @CurrentUser User userc) {
+//        if (null == userc) {
+//            return new Result<>().error("当前用户未登陆");
+//        }
+//        String phoneNumber = userc.getUserMobile();
+//        if (StringUtils.isEmpty(phoneNumber)) {
+//            return new Result<>().error("未获取到当前登录用户手机号");
+//        }
+//        String userSmsCode = scode;
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_pw_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("超过最大验证次数,请明天再试");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pw_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pw_times", 1);
+//        }
+//        CacheObject smsCodeCache = cacheChannel.get("smsCode", phoneNumber + "_sms_pwd_pw");
+//        String smsCode = (String) smsCodeCache.getValue();
+//        if (StringUtils.isEmpty(smsCode)) {
+//            return new Result<>().error("短信验证码已失效,请重新获取");
+//        }
+//        if (!smsCode.equals(userSmsCode)) {
+//            return new Result<>().error("短信验证码错误,请重新输入");
+//        }
+//        return new Result<>().success("验证码");
+//    }
+//
+//    /**
+//     * 更新密码
+//     */
+//    @PostMapping("/pwd/personal/update")
+//    @RequiresAuthentication
+//    @ApiOperation(value = "登录用户,更新密码")
+//    public Result<?> changePwdPersonal(@Valid @RequestBody UpdateUser user, @ApiIgnore @CurrentUser User userc) {
+//        String phoneNumber = userc.getUserMobile();
+//        String userSmsCode = user.getSmsCode();
+//        CacheObject smsTimesCache = cacheChannel.get("smsTimes", phoneNumber + "_sms_pwd_times");
+//        Integer vcodeNumbers = (Integer) smsTimesCache.getValue();
+//        if (null != vcodeNumbers) {
+//            int num = vcodeNumbers.intValue();
+//            if (num >= smsTimes) {
+//                return new Result<>().error("超过最大验证次数,请明天再试");
+//            }
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pwd_times", num + 1);
+//        } else {
+//            cacheChannel.set("smsTimes", phoneNumber + "_sms_pwd_times", 1);
+//        }
+//        CacheObject smsCodeCache = cacheChannel.get("smsCode", phoneNumber + "_sms_pwd_pw");
+//        String smsCode = (String) smsCodeCache.getValue();
+//        if (StringUtils.isEmpty(smsCode)) {
+//            return new Result<>().error("短信验证码已失效,请重新获取");
+//        }
+//        if (!smsCode.equals(userSmsCode)) {
+//            return new Result<>().error("短信验证码错误,请重新输入");
+//        }
+//        User userEntity = new User();
+//        userEntity.setUserMobile(userc.getUserMobile());
+//        String pwd = user.getUserPassword();
+//        if (!StringUtils.isEmpty(pwd)) {
+//            String cryptPwd = BCrypt.hashpw(pwd, BCrypt.gensalt());
+//            userEntity.setUserPassword(cryptPwd);
+//        }
+//        QueryWrapper<User> wrapper = new QueryWrapper<>();
+//        wrapper.eq("user_mobile", userEntity.getUserMobile());
+//        boolean result = userService.update(userEntity, wrapper);
+//        if (result) {
+//            return new Result<>().success("密码修改成功,请登录");
+//        } else {
+//            return new Result<>().error("密码修改失败,请重试");
+//        }
+//    }
+
+    @PostMapping("/logout")
+    @NoAuthentication
+    @ApiOperation(value = "退出登录")
+    public Result<?> logOut(HttpServletRequest request) throws Exception {
+        return success();
+    }
+
+    @RequestMapping("401")
+    @NoAuthentication
+    @ApiIgnore
+    public Result<?> unauthorized() {
+        return error(ResponseConstant.USER_NO_PERMITION);
+    }
+
+    @RequestMapping("timeout")
+    @NoAuthentication
+    @ApiIgnore
+    public Result<?> timeOut() {
+        return error(ResponseConstant.UNAUTHORIZED);
+    }
+}

+ 151 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysOrganizationController.java

@@ -0,0 +1,151 @@
+package com.fdkk.sxz.system.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.constant.Constant;
+import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.system.dto.CreateOrganization;
+import com.fdkk.sxz.system.dto.UpdateOrganization;
+import com.fdkk.sxz.entity.system.Organization;
+import com.fdkk.sxz.system.service.IOrganizationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.beans.BeanCopier;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 组织表 前端控制器
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@RestController
+@RequestMapping("/organization")
+@Api(tags = "OrganizationController|组织机构相关的前端控制器")
+public class SysOrganizationController extends BaseController {
+
+    @Autowired
+    private IOrganizationService organizationService;
+
+    /**
+     * 查询组织树
+     *
+     * @param parentId
+     * @return
+     */
+    @GetMapping(value = "/tree")
+    @RequiresAuthentication
+    @ApiOperation(value = "查询组织机构树", notes = "树状展示组织机构信息")
+    @ApiImplicitParam(paramType = "query", name = "parentId", value = "父级ID", required = false, dataType = "Integer")
+    public Result<List<Organization>> queryOrganizationTree(Long parentId) {
+        List<Organization> treeList = organizationService.queryOrganizationByPanentId(parentId);
+        return successPut(treeList);
+    }
+
+    /**
+     * 添加组织
+     */
+    @PostMapping("/create")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "添加组织机构")
+    public Result<Organization> create(@RequestBody CreateOrganization org) {
+        Organization orgEntity = new Organization();
+        BeanCopier.create(CreateOrganization.class, Organization.class, false).copy(org, orgEntity, null);
+        List<String> areas = org.getAreas();
+        if (!CollectionUtils.isEmpty(areas)) {
+            orgEntity.setProvince(areas.get(Constant.Address.PROVINCE));
+            orgEntity.setCity(areas.get(Constant.Address.CITY));
+            orgEntity.setArea(areas.get(Constant.Address.AREA));
+        }
+        boolean result = organizationService.createOrganization(orgEntity);
+        if (result) {
+            return success("修改成功",orgEntity);
+        } else {
+            return  failure("修改失败");
+        }
+    }
+
+    /**
+     * 修改组织
+     */
+    @PostMapping("/update")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "更新组织机构")
+    public Result<Organization> update(@RequestBody UpdateOrganization org) {
+        Organization orgEntity = new Organization();
+        BeanCopier.create(UpdateOrganization.class, Organization.class, false).copy(org, orgEntity, null);
+        List<String> areas = org.getAreas();
+        if (!CollectionUtils.isEmpty(areas)) {
+            orgEntity.setProvince(areas.get(Constant.Address.PROVINCE));
+            orgEntity.setCity(areas.get(Constant.Address.CITY));
+            orgEntity.setArea(areas.get(Constant.Address.AREA));
+        }
+        boolean result = organizationService.updateOrganization(orgEntity);
+        if (result) {
+            return success("修改成功",orgEntity);
+        } else {
+            return  failure("修改失败");
+        }
+    }
+
+    /**
+     * 删除组织
+     */
+    @RequiresRoles("SYSADMIN")
+    @PostMapping("/delete/{orgId}")
+    @ApiOperation(value = "删除组织机构")
+    @ApiImplicitParam(paramType = "path", name = "orgId", value = "组织机构ID", required = true, dataType = "Integer")
+    public Result delete(@PathVariable("orgId") Long orgId) {
+        boolean result = organizationService.deleteOrganization(orgId);
+        if (result) {
+            return success("删除成功");
+        } else {
+            return failure("删除失败");
+        }
+    }
+
+    @PostMapping(value = "/name/check")
+    @RequiresAuthentication
+    @ApiOperation(value = "校验组织名称是否存在", notes = "校验组织名称是否存在")
+    public Result<Boolean> checkRoleName(CreateOrganization organization) {
+        String organizationName = organization.getOrganizationName();
+        QueryWrapper<Organization> organizationQueryWrapper = new QueryWrapper<>();
+        organizationQueryWrapper.eq("organization_name", organizationName);
+        if(null != organization.getId()) {
+            organizationQueryWrapper.ne("id", organization.getId());
+        }
+        int count = organizationService.count(organizationQueryWrapper);
+        if (count == 0){
+            return successPut(true);
+        } else{
+            return errorPut(false);
+        }
+    }
+
+    @PostMapping(value = "/key/check")
+    @RequiresAuthentication
+    @ApiOperation(value = "校验组织标识是否存在", notes = "校验组织标识是否存在")
+    public Result<Boolean> checkRoleKey(CreateOrganization organization) {
+        String organizationKey = organization.getOrganizationKey();
+        QueryWrapper<Organization> organizationQueryWrapper = new QueryWrapper<>();
+        organizationQueryWrapper.eq("organization_key", organizationKey);
+        if(null != organization.getId()) {
+            organizationQueryWrapper.ne("id", organization.getId());
+        }
+        int count = organizationService.count(organizationQueryWrapper);
+        if (count == 0){
+            return successPut(true);
+        } else{
+            return errorPut(false);
+        }
+    }
+}

+ 326 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/controller/SysUserController.java

@@ -0,0 +1,326 @@
+package com.fdkk.sxz.system.controller;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fdkk.sxz.annotation.auth.CurrentUser;
+import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.system.dto.*;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.system.service.IDataPermissionService;
+import com.fdkk.sxz.system.service.IUserService;
+import com.fdkk.sxz.base.PageResult;
+import com.fdkk.sxz.base.Result;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.mindrot.jbcrypt.BCrypt;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @ClassName: UserController
+ * @Description: User前端控制器
+ * @author Xiewj
+ * @date 2018年5月18日 下午4:03:58
+ */
+@RestController
+@RequestMapping("/user")
+@Api(tags = "UserController|用户相关的前端控制器")
+public class SysUserController extends BaseController {
+
+    @Autowired
+    IUserService userService;
+
+    @Autowired
+    IDataPermissionService dataPermissionService;
+
+    @Value("${system.defaultPwd}")
+    private String defaultPwd;
+
+    /**
+     * 查询所有用户
+     */
+    @GetMapping("/list")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "查询用户列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userName", value = "用户名", required = false, dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "userMobile", value = "手机号", required = false, dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "userEmail", value = "邮箱", required = false, dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "roleId", value = "角色", required = false, dataType = "integer", paramType = "query"),
+            @ApiImplicitParam(name = "userStatus", value = "用户状态", required = false, dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "size", value = "每页条数", required = false, dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "current", value = "当前页", required = false, dataType = "Integer", paramType = "query") })
+    public PageResult<UserInfo> list(@ApiIgnore QueryUser user, @ApiIgnore Page<UserInfo> page) {
+
+        PageInfo<UserInfo> pageUser = userService.selectUserList(page, user);
+        PageResult<UserInfo> pageResult = new PageResult<UserInfo>(pageUser.getTotal(), pageUser.getList());
+        return pageResult;
+    }
+
+    /**
+     * 添加用户
+     */
+    @PostMapping("/create")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "添加用户")
+    public Result create(@RequestBody @Valid CreateUser user) {
+        boolean result = userService.createUser(user);
+        if (result) {
+            return success("添加成功");
+        } else {
+            return failure("添加失败,请重试");
+        }
+    }
+
+    /**
+     * 修改用户
+     */
+    @PostMapping("/update")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "更新用户信息")
+    public Result update(@RequestBody UpdateUser user) {
+        boolean result = userService.updateUser(user);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 修改自己密码
+     */
+    @PostMapping("/pwd")
+    @RequiresAuthentication
+    @ApiOperation(value = "用户修改密码")
+    public Result updatePassword(@RequestBody UpdateUser useru, @ApiIgnore @CurrentUser User tempUser) {
+        String newPwd = useru.getNewPwd();
+        String oldPwd = useru.getOldPwd();
+        if (StringUtils.isEmpty(newPwd) || StringUtils.isEmpty(oldPwd)) {
+            return failure("密码不能为空");
+        }
+        if (tempUser == null || !BCrypt.checkpw(tempUser.getUserAccount() + oldPwd, tempUser.getUserPassword())) {
+            return failure("原密码错误");
+        }
+        UpdateUser user = new UpdateUser();
+        user.setId(tempUser.getId());
+        user.setUserPassword(newPwd);
+        boolean result = userService.updateUser(user);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 删除用户
+     */
+    @PostMapping("/delete/{userId}")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "删除用户")
+    @ApiImplicitParam(paramType = "path", name = "userId", value = "用户ID", required = true, dataType = "Integer")
+    public Result delete(@PathVariable("userId") Long userId) {
+        if (null == userId) {
+            return failure("用户ID不能为空");
+        }
+        User user= userService.findById(userId);
+        boolean result=false;
+        if (ObjectUtil.isNotNull(user)){
+            user.setRecStatus("I");
+            result = userService.updateById(user);
+        }
+        if (result) {
+            return success("删除成功");
+        } else {
+            return failure("删除失败");
+        }
+    }
+
+    /**
+     * 批量删除用户
+     */
+    @PostMapping("/batch/delete")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "批量删除用户")
+    @ApiImplicitParam(name = "userIds", value = "用户ID列表", required = true, dataType = "List")
+    public Result batchDelete(@RequestBody List<Long> userIds) {
+        if (CollectionUtils.isEmpty(userIds)) {
+            return failure("用户ID列表不能为空");
+        }
+        boolean result = userService.batchDeleteUser(userIds);
+        if (result) {
+            return success("删除成功");
+        } else {
+            return failure("删除失败");
+        }
+    }
+
+    /**
+     * 重置密码
+     */
+    @RequiresRoles("SYSADMIN")
+    @PostMapping("password/{userId}")
+    @ApiOperation(value = "管理员重置用户密码")
+    @ApiImplicitParam(paramType = "path", name = "userId", value = "用户ID", required = true, dataType = "Integer")
+    public Result resetPassword(@PathVariable("userId") Long userId) {
+        if (null == userId) {
+            return failure("用户ID不能为空");
+        }
+        UpdateUser user = new UpdateUser();
+        user.setId(userId);
+        user.setUserPassword(defaultPwd);
+        boolean result = userService.updateUser(user);
+        if (result) {
+            return success("重置成功");
+        } else {
+            return failure("重置失败");
+        }
+    }
+
+    /**
+     * 修改用户状态
+     */
+    @PostMapping("/status/{userId}/{status}")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "管理员修改用户状态")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "integer", paramType = "path"),
+            @ApiImplicitParam(name = "status", value = "用户状态", required = true, dataType = "String", paramType = "path") })
+    public Result updateStatus(@PathVariable("userId") Long userId, @PathVariable("status") String status) {
+        if (null == userId || StringUtils.isEmpty(status)) {
+            return failure("ID和状态不能为空");
+        }
+        UpdateUser user = new UpdateUser();
+        user.setId(userId);
+        user.setUserStatus(status);
+        boolean result = userService.updateUser(user);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 个人修改用户信息,限制修改字段
+     */
+    @PostMapping("/update/info")
+    @RequiresAuthentication
+    @ApiOperation(value = "用户修改个人信息")
+    public Result updateInfo(@RequestBody UpdateUser user, @ApiIgnore @CurrentUser User tempUser) {
+        UpdateUser upUser = new UpdateUser();
+        upUser.setHeadImgUrl(user.getHeadImgUrl());
+        upUser.setUserName(user.getUserName());
+        upUser.setUserNickName(user.getUserNickName());
+        upUser.setAreas(user.getAreas());
+        upUser.setId(tempUser.getId());
+        boolean result = userService.updateUser(user);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    /**
+     * 修改用户
+     */
+    @PostMapping("/update/data/permission")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "更新用户数据权限")
+    public Result updateUserDataPermission(@RequestBody UpdateDataPermission updateDataPermission) {
+        boolean result = dataPermissionService.updateUserDataPermission(updateDataPermission);
+        if (result) {
+            return success("修改成功");
+        } else {
+            return failure("修改失败");
+        }
+    }
+
+    @PostMapping(value = "/account/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验用户账号是否存在", notes = "校验用户账号是否存在")
+    public Result<Boolean> checkUserAccount(CreateUser user) {
+        String userAccount = user.getUserAccount();
+        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
+        userQueryWrapper.eq("user_account", userAccount);
+        if(null != user.getId()) {
+            userQueryWrapper.ne("id", user.getId());
+        }
+        int count = userService.count(userQueryWrapper);
+
+        if (count == 0) {
+            return successPut(true);
+        } else {
+            return errorPut(false);
+        }
+    }
+
+    @PostMapping(value = "/nickname/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验用户昵称是否存在", notes = "校验用户昵称是否存在")
+    public Result<Boolean> checkUserNickname(CreateUser user) {
+        String userNickName = user.getUserNickName();
+        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
+        userQueryWrapper.eq("user_nick_name", userNickName);
+        if(null != user.getId()) {
+            userQueryWrapper.ne("id", user.getId());
+        }
+        int count = userService.count(userQueryWrapper);
+        if (count == 0) {
+            return successPut(true);
+        } else {
+            return errorPut(false);
+        }
+    }
+
+    @PostMapping(value = "/mobile/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验用户手机号是否存在", notes = "校验用户手机号是否存在")
+    public Result<Boolean> checkUserMobile(CreateUser user) {
+        String userMobile = user.getUserMobile();
+        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
+        userQueryWrapper.eq("user_mobile", userMobile);
+        if(null != user.getId()) {
+            userQueryWrapper.ne("id", user.getId());
+        }
+        int count = userService.count(userQueryWrapper);
+        if (count == 0) {
+            return successPut(true);
+        } else {
+            return errorPut(false);
+        }
+    }
+
+    @PostMapping(value = "/email/check")
+    @RequiresRoles("SYSADMIN")
+    @ApiOperation(value = "校验用户电子邮箱是否存在", notes = "校验用户电子邮箱是否存在")
+    public Result<Boolean> checkUserEmail(CreateUser user) {
+        String userEmail = user.getUserEmail();
+        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
+        userQueryWrapper.eq("user_email", userEmail);
+        if(null != user.getId()) {
+            userQueryWrapper.ne("id", user.getId());
+        }
+        int count = userService.count(userQueryWrapper);
+        if (count == 0) {
+            return successPut(true);
+        } else {
+            return errorPut(false);
+        }
+    }
+}

+ 264 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateOrganization.java

@@ -0,0 +1,264 @@
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 组织表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+public class CreateOrganization implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 父组织id
+     */
+    private Integer parentId;
+    /**
+     * 组织类型:1总公司,2分公司,3事业部
+     */
+    private String organizationType;
+    /**
+     * 组织名称
+     */
+    private String organizationName;
+    /**
+     * 组织编码
+     */
+    private String organizationKey;
+    /**
+     * 组织图标
+     */
+    private String organizationIcon;
+    /**
+     * 组织级别(排序)
+     */
+    private Integer organizationLevel;
+
+    /**
+     * 省
+     */
+    @ApiModelProperty(value = "省")
+    private String province;
+
+    /**
+     * 市
+     */
+    @ApiModelProperty(value = "市")
+    private String city;
+
+    /**
+     * 区
+     */
+    @ApiModelProperty(value = "区")
+    private String area;
+
+    /**
+     * 地区数组
+     */
+    private List<String> areas;
+
+    /**
+     * 街道详细地址
+     */
+    @ApiModelProperty(value = "街道详细地址")
+    private String street;
+
+    /**
+     * 描述
+     */
+    private String description;
+    /**
+     * 创建日期
+     */
+    private Date createTime;
+
+    private Integer creator;
+    /**
+     * 修改日期
+     */
+    private Date updateTime;
+    /**
+     * 操作员
+     */
+    private Integer operator;
+    /**
+     * 1:删除 0:不删除
+     */
+    private String delFlag;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getOrganizationType() {
+        return organizationType;
+    }
+
+    public void setOrganizationType(String organizationType) {
+        this.organizationType = organizationType;
+    }
+
+    public String getOrganizationName() {
+        return organizationName;
+    }
+
+    public void setOrganizationName(String organizationName) {
+        this.organizationName = organizationName;
+    }
+
+    public String getOrganizationKey() {
+        return organizationKey;
+    }
+
+    public void setOrganizationKey(String organizationKey) {
+        this.organizationKey = organizationKey;
+    }
+
+    public String getOrganizationIcon() {
+        return organizationIcon;
+    }
+
+    public void setOrganizationIcon(String organizationIcon) {
+        this.organizationIcon = organizationIcon;
+    }
+
+    public Integer getOrganizationLevel() {
+        return organizationLevel;
+    }
+
+    public void setOrganizationLevel(Integer organizationLevel) {
+        this.organizationLevel = organizationLevel;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public List<String> getAreas() {
+        return areas;
+    }
+
+    public void setAreas(List<String> areas) {
+        this.areas = areas;
+    }
+
+    public String getStreet() {
+        return street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Integer getCreator() {
+        return creator;
+    }
+
+    public void setCreator(Integer creator) {
+        this.creator = creator;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperator() {
+        return operator;
+    }
+
+    public void setOperator(Integer operator) {
+        this.operator = operator;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return "Organization{" +
+        "id=" + id +
+        ", parentId=" + parentId +
+        ", organizationType=" + organizationType +
+        ", organizationName=" + organizationName +
+        ", organizationKey=" + organizationKey +
+        ", organizationIcon=" + organizationIcon +
+        ", organizationLevel=" + organizationLevel +
+        ", description=" + description +
+        ", createTime=" + createTime +
+        ", creator=" + creator +
+        ", updateTime=" + updateTime +
+        ", operator=" + operator +
+        ", delFlag=" + delFlag +
+        "}";
+    }
+}

+ 195 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateResource.java

@@ -0,0 +1,195 @@
+package com.fdkk.sxz.system.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 权限表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+public class CreateResource implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private String resourceName;
+
+    private Integer parentId;
+
+    private String resourceKey;
+
+    private String resourceType;
+
+    private String resourceIcon;
+
+    private String resourcePath;
+
+    private Boolean resourceShow;
+
+    private Boolean resourceCache;
+
+    private String resourceUrl;
+
+    private Integer resourceLevel;
+
+    private String resourcePageName;
+
+    private String description;
+
+    private Date createTime;
+
+    private Integer creator;
+
+    private Date updateTime;
+
+    private Integer operator;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    public void setResourceName(String resourceName) {
+        this.resourceName = resourceName;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getResourceKey() {
+        return resourceKey;
+    }
+
+    public void setResourceKey(String resourceKey) {
+        this.resourceKey = resourceKey;
+    }
+
+    public String getResourceType() {
+        return resourceType;
+    }
+
+    public void setResourceType(String resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    public String getResourceIcon() {
+        return resourceIcon;
+    }
+
+    public void setResourceIcon(String resourceIcon) {
+        this.resourceIcon = resourceIcon;
+    }
+
+    public String getResourceUrl() {
+        return resourceUrl;
+    }
+
+    public void setResourceUrl(String resourceUrl) {
+        this.resourceUrl = resourceUrl;
+    }
+
+    public Integer getResourceLevel() {
+        return resourceLevel;
+    }
+
+    public void setResourceLevel(Integer resourceLevel) {
+        this.resourceLevel = resourceLevel;
+    }
+
+    public String getResourcePageName() {
+        return resourcePageName;
+    }
+
+    public void setResourcePageName(String resourcePageName) {
+        this.resourcePageName = resourcePageName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Integer getCreator() {
+        return creator;
+    }
+
+    public void setCreator(Integer creator) {
+        this.creator = creator;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperator() {
+        return operator;
+    }
+
+    public void setOperator(Integer operator) {
+        this.operator = operator;
+    }
+
+    public String getResourcePath() {
+        return resourcePath;
+    }
+
+    public void setResourcePath(String resourcePath) {
+        this.resourcePath = resourcePath;
+    }
+
+    public Boolean getResourceShow() {
+        return resourceShow;
+    }
+
+    public void setResourceShow(Boolean resourceShow) {
+        this.resourceShow = resourceShow;
+    }
+
+    public Boolean getResourceCache() {
+        return resourceCache;
+    }
+
+    public void setResourceCache(Boolean resourceCache) {
+        this.resourceCache = resourceCache;
+    }
+
+    @Override
+    public String toString() {
+        return "Resource{" + "id=" + id + ", resourceName=" + resourceName + ", parentId=" + parentId + ", resourceKey="
+                + resourceKey + ", resourceType=" + resourceType + ", resourceIcon=" + resourceIcon + ", resourceUrl="
+                + resourceUrl + ", resourceLevel=" + resourceLevel + ", description=" + description + ", createTime="
+                + createTime + ", creator=" + creator + ", updateTime=" + updateTime + ", operator=" + operator + "}";
+    }
+}

+ 154 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateRole.java

@@ -0,0 +1,154 @@
+
+package com.fdkk.sxz.system.dto;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 角色表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+public class CreateRole
+{
+
+    private Integer id;
+
+    private Integer parentId;
+
+    private String roleName;
+
+    private String roleKey;
+
+    private Integer roleLevel;
+
+    private String roleStatus;
+
+    private String description;
+
+    private Date createTime;
+
+    private Integer creator;
+
+    private Date updateTime;
+
+    private Integer operator;
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getParentId()
+    {
+        return parentId;
+    }
+
+    public void setParentId( Integer parentId )
+    {
+        this.parentId = parentId;
+    }
+
+    public String getRoleName()
+    {
+        return roleName;
+    }
+
+    public void setRoleName( String roleName )
+    {
+        this.roleName = roleName;
+    }
+
+    public String getRoleKey()
+    {
+        return roleKey;
+    }
+
+    public void setRoleKey( String roleKey )
+    {
+        this.roleKey = roleKey;
+    }
+
+    public Integer getRoleLevel()
+    {
+        return roleLevel;
+    }
+
+    public void setRoleLevel( Integer roleLevel )
+    {
+        this.roleLevel = roleLevel;
+    }
+
+    public String getRoleStatus() {
+		return roleStatus;
+	}
+
+	public void setRoleStatus(String roleStatus) {
+		this.roleStatus = roleStatus;
+	}
+
+	public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public Date getCreateTime()
+    {
+        return createTime;
+    }
+
+    public void setCreateTime( Date createTime )
+    {
+        this.createTime = createTime;
+    }
+
+    public Integer getCreator()
+    {
+        return creator;
+    }
+
+    public void setCreator( Integer creator )
+    {
+        this.creator = creator;
+    }
+
+    public Date getUpdateTime()
+    {
+        return updateTime;
+    }
+
+    public void setUpdateTime( Date updateTime )
+    {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperator()
+    {
+        return operator;
+    }
+
+    public void setOperator( Integer operator )
+    {
+        this.operator = operator;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Role{" + "id=" + id + ", parentId=" + parentId + ", roleName=" + roleName + ", roleKey=" + roleKey
+                + ", roleStatus=" + roleStatus + ", description=" + description + ", createTime=" + createTime + ", creator="
+                + creator + ", updateTime=" + updateTime + ", operator=" + operator + "}";
+    }
+}

+ 149 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/CreateUser.java

@@ -0,0 +1,149 @@
+
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.hibernate.validator.constraints.Email;
+import org.hibernate.validator.constraints.NotBlank;
+
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 用户表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+@Data
+public class CreateUser implements Serializable
+{
+
+    /**
+      * @Fields serialVersionUID :
+      */
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /**
+     * 账号
+     */
+    @ApiModelProperty(value = "账号")
+    @NotBlank(message="账号不能为空")
+    private String userAccount;
+
+    /**
+     * 昵称
+     */
+    @ApiModelProperty(value = "昵称")
+    @Size(min=2,max=16,message="昵称长度不正确")
+    private String userNickName;
+
+    /**
+     * 姓名
+     */
+    @ApiModelProperty(value = "姓名")
+    @Size(min=2,max=16,message="姓名长度不正确")
+    private String userName;
+
+    /**
+     * 1 : 男,0 : 女
+     */
+    @ApiModelProperty(value = "1 : 男,0 : 女, 2: 未知")
+    private String userSex;
+
+    /**
+     * 邮箱
+     */
+    @ApiModelProperty(value = "邮箱")
+    @NotBlank
+    @Email
+    private String userEmail;
+
+    /**
+     * 电话
+     */
+    @ApiModelProperty(value = "手机号码")
+    @NotBlank(message="手机号码不能为空")
+    @Size(min=11,max=11,message="手机号码长度不正确")
+    private String userMobile;
+
+    /**
+     * 密码
+     */
+    @ApiModelProperty(value = "密码")
+    @Pattern(regexp = "^[a-zA-Z0-9]{6,18}$", message="密码格式不正确")
+    private String userPassword;
+
+    /**
+     * '0'禁用,'1' 启用, '2' 密码过期或初次未修改
+     */
+    @ApiModelProperty(value = "用户状态 '0'禁用,'1' 启用, '2' 密码过期或初次未修改")
+    private String userStatus;
+
+    /**
+     * 头像图片地址
+     */
+    @ApiModelProperty(value = "头像图片地址")
+    @Pattern(regexp = "^([hH][tT]{2}[pP]:/*|[hH][tT]{2}[pP][sS]:/*|[fF][tT][pP]:/*)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+(\\?{0,1}(([A-Za-z0-9-~]+\\={0,1})([A-Za-z0-9-~]*)\\&{0,1})*)$", message="头像图片地址格式不正确")
+    private String headImgUrl;
+
+    /**
+     * 省
+     */
+    @ApiModelProperty(value = "省")
+    private String province;
+
+    /**
+     * 市
+     */
+    @ApiModelProperty(value = "市")
+    private String city;
+
+    /**
+     * 区
+     */
+    @ApiModelProperty(value = "区")
+    private String area;
+
+    /**
+     * 地区数组
+     */
+    @ApiModelProperty(value = "用户地区ID数组")
+    private List<String> areas;
+
+    /**
+     * 街道详细地址
+     */
+    @ApiModelProperty(value = "街道详细地址")
+    private String street;
+
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    @Size(min=0,max=255,message="备注信息长度不正确")
+    private String description;
+
+    private Long roleId;
+
+    @ApiModelProperty(value = "组织机构id")
+    private Long organizationId;
+
+    /**
+     * 角色数组
+     */
+    @ApiModelProperty(value = "用户角色ID数组")
+    private List<Long> roleIds;
+
+}

+ 61 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/LogInfo.java

@@ -0,0 +1,61 @@
+package com.fdkk.sxz.system.dto;
+
+import com.alibaba.fastjson.JSONArray;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author jeebase
+ * @since 2018-10-24
+ */
+@ApiModel(value = "Log对象", description = "")
+@Data
+public class LogInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "序号")
+    private Long id;
+
+    @ApiModelProperty(value = "接口名称")
+    private String methodName;
+
+    @ApiModelProperty(value = "日志类型")
+    private String logType;
+
+    @ApiModelProperty(value = "链路id")
+    private String traceId;
+
+    @ApiModelProperty(value = "请求地址")
+    private String url;
+
+
+    @ApiModelProperty(value = "入参")
+    private String inParams;
+
+    @ApiModelProperty(value = "出参")
+    private String outParams;
+
+    @ApiModelProperty(value = "操作名称")
+    private String operationName;
+
+    @ApiModelProperty(value = "操作的IP")
+    private String operationIp;
+
+    @ApiModelProperty(value = "记录日期")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "操作人")
+    private String creator;
+
+    @ApiModelProperty(value = "详情")
+    private JSONArray details;
+}

+ 63 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/LoginUser.java

@@ -0,0 +1,63 @@
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.NotBlank;
+
+import javax.validation.constraints.Size;
+
+/**
+ * @author Xiewj
+ */
+@ApiModel(value = "LoginUser对象", description = "用户登录信息")
+public class LoginUser {
+
+    @ApiModelProperty(value = "用户账号", required = true, dataType = "String", notes = "账号长度范围应该在2-32位之间。")
+    @NotBlank(message="账号不能为空")
+    @Size(min=2,max=32,message="账号长度不正确")
+    private String userAccount;
+
+    @ApiModelProperty(value = "用户密码", required = true, dataType = "String")
+    @NotBlank(message="密码不能为空")
+    private String userPassword;
+
+    @ApiModelProperty(value = "验证码", required = true, dataType = "String")
+    @NotBlank(message="验证码不能为空")
+    private String vcode;
+
+    @ApiModelProperty(value = "验证码唯一标识", required = true, dataType = "String")
+    @NotBlank(message="验证码唯一标识不能为空")
+    private String verkey;
+
+    public String getUserAccount() {
+        return userAccount;
+    }
+
+    public void setUserAccount(String userAccount) {
+        this.userAccount = userAccount;
+    }
+
+    public String getUserPassword() {
+        return userPassword;
+    }
+
+    public void setUserPassword(String userPassword) {
+        this.userPassword = userPassword;
+    }
+
+    public String getVcode() {
+        return vcode;
+    }
+
+    public void setVcode(String vcode) {
+        this.vcode = vcode;
+    }
+
+    public String getVerkey() {
+        return verkey;
+    }
+
+    public void setVerkey(String verkey) {
+        this.verkey = verkey;
+    }
+}

+ 141 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/PwdUser.java

@@ -0,0 +1,141 @@
+
+package com.fdkk.sxz.system.dto;
+
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.NotBlank;
+
+import javax.validation.constraints.Pattern;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 用户表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+public class PwdUser implements Serializable
+{
+
+    /**
+     * @Fields serialVersionUID :
+     */
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 电话
+     */
+    @NotBlank(message="手机号不能为空")
+    @Pattern(regexp="^[1][1-9][0-9]{9}$", message="请输入正确手机号。")
+    private String userMobile;
+
+    /**
+     * 密码
+     */
+    @NotBlank(message="密码不能为空")
+    @Pattern(regexp="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$", message="请输入6-18位,不含特殊字符密码。")
+    private String userPassword;
+
+    /**
+     * 图片验证码
+     */
+//    @NotBlank(message="图片验证码不能为空")
+//    private String vCode;
+
+    @NotBlank(message="不能为空")
+    private String verkey;
+
+    /**
+     * 短信验证码
+     */
+    @NotBlank(message="短信验证码不能为空")
+    @Length(max=6, min=6, message="请输入6位数短信验证码。")
+    private String smsCode;
+
+    /**
+     * '0'禁用,'1' 启用, '2' 密码过期或初次未修改
+     */
+    private String userStatus;
+
+    private Integer roleId;
+
+    public String getUserMobile()
+    {
+        return userMobile;
+    }
+
+    public void setUserMobile( String userMobile )
+    {
+        this.userMobile = userMobile;
+    }
+
+    public String getUserPassword()
+    {
+        return userPassword;
+    }
+
+    public void setUserPassword( String userPassword )
+    {
+        this.userPassword = userPassword;
+    }
+
+    public String getUserStatus()
+    {
+        return userStatus;
+    }
+
+    public void setUserStatus( String userStatus )
+    {
+        this.userStatus = userStatus;
+    }
+
+    public Integer getRoleId()
+    {
+        return roleId;
+    }
+
+    public void setRoleId( Integer roleId )
+    {
+        this.roleId = roleId;
+    }
+
+//    public String getvCode()
+//    {
+//        return vCode;
+//    }
+//
+//    public void setvCode( String vCode )
+//    {
+//        this.vCode = vCode;
+//    }
+
+    public String getSmsCode()
+    {
+        return smsCode;
+    }
+
+    public void setSmsCode( String smsCode )
+    {
+        this.smsCode = smsCode;
+    }
+
+    public String getVerkey()
+    {
+        return verkey;
+    }
+
+    public void setVerkey( String verkey )
+    {
+        this.verkey = verkey;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "User{" + " userMobile=" + userMobile
+                + ", userPassword=" + userPassword + ", userStatus="
+                + userStatus;
+    }
+}

+ 53 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/QueryLog.java

@@ -0,0 +1,53 @@
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author jeebase
+ * @since 2018-10-24
+ */
+@ApiModel(value = "Log对象", description = "")
+@Data
+public class QueryLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "接口名称")
+    private String methodName;
+
+    @ApiModelProperty(value = "日志类型")
+    private String logType;
+
+    @ApiModelProperty(value = "请求连接")
+    private String url;
+
+    @ApiModelProperty(value = "链路id")
+    private String traceId;
+
+    @ApiModelProperty(value = "操作名称")
+    private String operationName;
+
+    @ApiModelProperty(value = "操作的IP")
+    private String operationIp;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "开始日期")
+    private LocalDateTime startTime;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "结束日期")
+    private LocalDateTime endTime;
+
+    @ApiModelProperty(value = "操作人")
+    private String creator;
+}

+ 262 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/QueryUser.java

@@ -0,0 +1,262 @@
+
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 用户表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+public class QueryUser implements Serializable
+{
+
+    /**
+      * @Fields serialVersionUID :
+      */
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Integer id;
+    /**
+     * 账号
+     */
+    private String userAccount;
+    /**
+     * 昵称
+     */
+    private String userNickName;
+    /**
+     * 姓名
+     */
+    private String userName;
+    /**
+     * 1 : 男,0 : 女
+     */
+    private String userSex;
+    /**
+     * 邮箱
+     */
+    private String userEmail;
+    /**
+     * 电话
+     */
+    private String userMobile;
+
+    /**
+     * '0'禁用,'1' 启用, '2' 密码过期或初次未修改
+     */
+    private String userStatus;
+
+    /**
+     *
+     */
+    private String headImgUrl;
+    /**
+     * 省
+     */
+    private String province;
+    /**
+     * 市
+     */
+    private String city;
+    /**
+     * 区
+     */
+    private String area;
+
+    /**
+     * vue级联选择
+     */
+    private List<String> areas;
+
+    private Integer roleId;
+
+    private String startDate;
+
+    private String endDate;
+
+    @ApiModelProperty(value = "组织机构id")
+    private Integer organizationId;
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public String getUserAccount()
+    {
+        return userAccount;
+    }
+
+    public void setUserAccount( String userAccount )
+    {
+        this.userAccount = userAccount;
+    }
+
+    public String getUserNickName()
+    {
+        return userNickName;
+    }
+
+    public void setUserNickName( String userNickName )
+    {
+        this.userNickName = userNickName;
+    }
+
+    public String getUserName()
+    {
+        return userName;
+    }
+
+    public void setUserName( String userName )
+    {
+        this.userName = userName;
+    }
+
+    public String getUserSex()
+    {
+        return userSex;
+    }
+
+    public void setUserSex( String userSex )
+    {
+        this.userSex = userSex;
+    }
+
+    public String getUserEmail()
+    {
+        return userEmail;
+    }
+
+    public void setUserEmail( String userEmail )
+    {
+        this.userEmail = userEmail;
+    }
+
+    public String getUserMobile()
+    {
+        return userMobile;
+    }
+
+    public void setUserMobile( String userMobile )
+    {
+        this.userMobile = userMobile;
+    }
+
+    public String getUserStatus()
+    {
+        return userStatus;
+    }
+
+    public void setUserStatus( String userStatus )
+    {
+        this.userStatus = userStatus;
+    }
+
+    public String getHeadImgUrl()
+    {
+        return headImgUrl;
+    }
+
+    public void setHeadImgUrl( String headImgUrl )
+    {
+        this.headImgUrl = headImgUrl;
+    }
+
+    public String getProvince()
+    {
+        return province;
+    }
+
+    public void setProvince( String province )
+    {
+        this.province = province;
+    }
+
+    public String getCity()
+    {
+        return city;
+    }
+
+    public void setCity( String city )
+    {
+        this.city = city;
+    }
+
+    public String getArea()
+    {
+        return area;
+    }
+
+    public void setArea( String area )
+    {
+        this.area = area;
+    }
+
+    public Integer getRoleId()
+    {
+        return roleId;
+    }
+
+    public void setRoleId( Integer roleId )
+    {
+        this.roleId = roleId;
+    }
+
+    public Integer getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(Integer organizationId) {
+        this.organizationId = organizationId;
+    }
+
+    public List<String> getAreas() {
+		return areas;
+	}
+
+	public void setAreas(List<String> areas) {
+		this.areas = areas;
+	}
+
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+
+	@Override
+    public String toString()
+    {
+        return "User{" + "id=" + id + ", userAccount=" + userAccount + ", userNickName=" + userNickName + ", userName="
+                + userName + ", userSex=" + userSex + ", userEmail=" + userEmail + ", userMobile=" + userMobile
+                + ", userStatus=" + userStatus + ", headImgUrl=" + headImgUrl
+                + ", province=" + province + ", city=" + city + ", area=" + area + "}";
+    }
+}

+ 147 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/RegisterUser.java

@@ -0,0 +1,147 @@
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.NotBlank;
+
+import javax.validation.constraints.Pattern;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 用户表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+@ApiModel(value = "RegisterUser对象", description = "用户注册信息")
+public class RegisterUser implements Serializable {
+
+    /**
+     * @Fields serialVersionUID :
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 姓名
+     */
+    @NotBlank(message = "姓名不能为空")
+    @Length(max = 8, min = 2, message = "姓名长度范围应该在2-8位之间。")
+    @ApiModelProperty(value = "用户姓名", required = true, dataType = "String", notes = "姓名长度范围应该在2-8位之间。")
+    private String userName;
+
+    /**
+     * 电话
+     */
+    @NotBlank(message = "手机号不能为空")
+    @Pattern(regexp = "^[1][1-9][0-9]{9}$", message = "请输入正确手机号。")
+    @ApiModelProperty(value = "用户姓名", required = true, dataType = "String")
+    private String userMobile;
+
+    /**
+     * 密码
+     */
+    @NotBlank(message = "密码不能为空")
+    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$", message = "请输入6-18位,不含特殊字符密码。")
+    @ApiModelProperty(value = "用户姓名", required = true, dataType = "String", notes = "输入6-18位,不含特殊字符密码。")
+    private String userPassword;
+
+    /**
+     * 图片验证码
+     */
+    // @NotBlank(message="图片验证码不能为空")
+    // private String vCode;
+
+    @NotBlank(message = "不能为空")
+    @ApiModelProperty(value = "图片验证码", required = true, dataType = "String")
+    private String verkey;
+
+    /**
+     * 短信验证码
+     */
+    @NotBlank(message = "短信验证码不能为空")
+    @Length(max = 6, min = 6, message = "请输入6位数短信验证码。")
+    @ApiModelProperty(value = "短信验证码", required = true, dataType = "String", notes = "输入6位数短信验证码。")
+    private String smsCode;
+
+    /**
+     * '0'禁用,'1' 启用, '2' 密码过期或初次未修改
+     */
+    private String userStatus;
+
+    private Integer roleId;
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getUserMobile() {
+        return userMobile;
+    }
+
+    public void setUserMobile(String userMobile) {
+        this.userMobile = userMobile;
+    }
+
+    public String getUserPassword() {
+        return userPassword;
+    }
+
+    public void setUserPassword(String userPassword) {
+        this.userPassword = userPassword;
+    }
+
+    public String getUserStatus() {
+        return userStatus;
+    }
+
+    public void setUserStatus(String userStatus) {
+        this.userStatus = userStatus;
+    }
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    // public String getvCode()
+    // {
+    // return vCode;
+    // }
+    //
+    // public void setvCode( String vCode )
+    // {
+    // this.vCode = vCode;
+    // }
+
+    public String getSmsCode() {
+        return smsCode;
+    }
+
+    public void setSmsCode(String smsCode) {
+        this.smsCode = smsCode;
+    }
+
+    public String getVerkey() {
+        return verkey;
+    }
+
+    public void setVerkey(String verkey) {
+        this.verkey = verkey;
+    }
+
+    @Override
+    public String toString() {
+        return "User{" + "userName=" + userName + ", userMobile=" + userMobile + ", userPassword=" + userPassword
+                + ", userStatus=" + userStatus;
+    }
+}

+ 73 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/SmsDto.java

@@ -0,0 +1,73 @@
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.NotBlank;
+
+import javax.validation.constraints.Pattern;
+
+/**
+ * @author Xiewj
+ */
+@ApiModel(value = "SmsDto对象", description = "发送短信对象")
+public class SmsDto {
+
+    /**
+     * 姓名
+     */
+    @Length(max = 8, min = 2, message = "姓名长度范围应该在2-8位之间。")
+    @ApiModelProperty(value = "姓名", required = false, dataType = "String", notes = "姓名长度范围应该在2-8位之间。")
+    private String userName;
+
+    /**
+     * 电话
+     */
+    @NotBlank(message = "手机号不能为空")
+    @Pattern(regexp = "^[1][1-9][0-9]{9}$", message = "请输入正确手机号。")
+    @ApiModelProperty(value = "手机号", required = true, dataType = "String")
+    private String userMobile;
+
+    /**
+     * 图片验证码
+     */
+    private String verkey;
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getUserMobile() {
+        return userMobile;
+    }
+
+    public void setUserMobile(String userMobile) {
+        this.userMobile = userMobile;
+    }
+
+    // public String getvCode()
+    // {
+    // return vCode;
+    // }
+    //
+    // public void setvCode( String vCode )
+    // {
+    // this.vCode = vCode;
+    // }
+
+    /**
+     * 验证码key
+     * @return
+     */
+    public String getVerkey() {
+        return verkey;
+    }
+
+    public void setVerkey(String verkey) {
+        this.verkey = verkey;
+    }
+}

+ 39 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateDataPermission.java

@@ -0,0 +1,39 @@
+package com.fdkk.sxz.system.dto;
+
+import java.util.List;
+
+/**
+ * @author Xiewj
+ */
+public class UpdateDataPermission {
+
+    private Long userId;
+
+    private List<Long> addDataPermissions;
+
+    private List<Long> removeDataPermissions;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public List<Long> getAddDataPermissions() {
+        return addDataPermissions;
+    }
+
+    public void setAddDataPermissions(List<Long> addDataPermissions) {
+        this.addDataPermissions = addDataPermissions;
+    }
+
+    public List<Long> getRemoveDataPermissions() {
+        return removeDataPermissions;
+    }
+
+    public void setRemoveDataPermissions(List<Long> removeDataPermissions) {
+        this.removeDataPermissions = removeDataPermissions;
+    }
+}

+ 264 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateOrganization.java

@@ -0,0 +1,264 @@
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 组织表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+public class UpdateOrganization implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 父组织id
+     */
+    private Integer parentId;
+    /**
+     * 组织类型:1总公司,2分公司,3事业部
+     */
+    private String organizationType;
+    /**
+     * 组织名称
+     */
+    private String organizationName;
+    /**
+     * 组织编码
+     */
+    private String organizationKey;
+    /**
+     * 组织图标
+     */
+    private String organizationIcon;
+    /**
+     * 组织级别(排序)
+     */
+    private Integer organizationLevel;
+
+    /**
+     * 省
+     */
+    @ApiModelProperty(value = "省")
+    private String province;
+
+    /**
+     * 市
+     */
+    @ApiModelProperty(value = "市")
+    private String city;
+
+    /**
+     * 区
+     */
+    @ApiModelProperty(value = "区")
+    private String area;
+
+    /**
+     * 地区数组
+     */
+    private List<String> areas;
+
+    /**
+     * 街道详细地址
+     */
+    @ApiModelProperty(value = "街道详细地址")
+    private String street;
+
+    /**
+     * 描述
+     */
+    private String description;
+    /**
+     * 创建日期
+     */
+    private Date createTime;
+
+    private Integer creator;
+    /**
+     * 修改日期
+     */
+    private Date updateTime;
+    /**
+     * 操作员
+     */
+    private Integer operator;
+    /**
+     * 1:删除 0:不删除
+     */
+    private String delFlag;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getOrganizationType() {
+        return organizationType;
+    }
+
+    public void setOrganizationType(String organizationType) {
+        this.organizationType = organizationType;
+    }
+
+    public String getOrganizationName() {
+        return organizationName;
+    }
+
+    public void setOrganizationName(String organizationName) {
+        this.organizationName = organizationName;
+    }
+
+    public String getOrganizationKey() {
+        return organizationKey;
+    }
+
+    public void setOrganizationKey(String organizationKey) {
+        this.organizationKey = organizationKey;
+    }
+
+    public String getOrganizationIcon() {
+        return organizationIcon;
+    }
+
+    public void setOrganizationIcon(String organizationIcon) {
+        this.organizationIcon = organizationIcon;
+    }
+
+    public Integer getOrganizationLevel() {
+        return organizationLevel;
+    }
+
+    public void setOrganizationLevel(Integer organizationLevel) {
+        this.organizationLevel = organizationLevel;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public List<String> getAreas() {
+        return areas;
+    }
+
+    public void setAreas(List<String> areas) {
+        this.areas = areas;
+    }
+
+    public String getStreet() {
+        return street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Integer getCreator() {
+        return creator;
+    }
+
+    public void setCreator(Integer creator) {
+        this.creator = creator;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperator() {
+        return operator;
+    }
+
+    public void setOperator(Integer operator) {
+        this.operator = operator;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return "Organization{" +
+        "id=" + id +
+        ", parentId=" + parentId +
+        ", organizationType=" + organizationType +
+        ", organizationName=" + organizationName +
+        ", organizationKey=" + organizationKey +
+        ", organizationIcon=" + organizationIcon +
+        ", organizationLevel=" + organizationLevel +
+        ", description=" + description +
+        ", createTime=" + createTime +
+        ", creator=" + creator +
+        ", updateTime=" + updateTime +
+        ", operator=" + operator +
+        ", delFlag=" + delFlag +
+        "}";
+    }
+}

+ 195 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateResource.java

@@ -0,0 +1,195 @@
+package com.fdkk.sxz.system.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 权限表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+public class UpdateResource implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private String resourceName;
+
+    private Integer parentId;
+
+    private String resourceKey;
+
+    private String resourceType;
+
+    private String resourceIcon;
+
+    private String resourcePath;
+
+    private Boolean resourceShow;
+
+    private Boolean resourceCache;
+
+    private String resourceUrl;
+
+    private Integer resourceLevel;
+
+    private String resourcePageName;
+
+    private String description;
+
+    private Date createTime;
+
+    private Integer creator;
+
+    private Date updateTime;
+
+    private Integer operator;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    public void setResourceName(String resourceName) {
+        this.resourceName = resourceName;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getResourceKey() {
+        return resourceKey;
+    }
+
+    public void setResourceKey(String resourceKey) {
+        this.resourceKey = resourceKey;
+    }
+
+    public String getResourceType() {
+        return resourceType;
+    }
+
+    public void setResourceType(String resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    public String getResourceIcon() {
+        return resourceIcon;
+    }
+
+    public void setResourceIcon(String resourceIcon) {
+        this.resourceIcon = resourceIcon;
+    }
+
+    public String getResourceUrl() {
+        return resourceUrl;
+    }
+
+    public void setResourceUrl(String resourceUrl) {
+        this.resourceUrl = resourceUrl;
+    }
+
+    public Integer getResourceLevel() {
+        return resourceLevel;
+    }
+
+    public void setResourceLevel(Integer resourceLevel) {
+        this.resourceLevel = resourceLevel;
+    }
+
+    public String getResourcePageName() {
+        return resourcePageName;
+    }
+
+    public void setResourcePageName(String resourcePageName) {
+        this.resourcePageName = resourcePageName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Integer getCreator() {
+        return creator;
+    }
+
+    public void setCreator(Integer creator) {
+        this.creator = creator;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperator() {
+        return operator;
+    }
+
+    public void setOperator(Integer operator) {
+        this.operator = operator;
+    }
+
+    public String getResourcePath() {
+        return resourcePath;
+    }
+
+    public void setResourcePath(String resourcePath) {
+        this.resourcePath = resourcePath;
+    }
+
+    public Boolean getResourceShow() {
+        return resourceShow;
+    }
+
+    public void setResourceShow(Boolean resourceShow) {
+        this.resourceShow = resourceShow;
+    }
+
+    public Boolean getResourceCache() {
+        return resourceCache;
+    }
+
+    public void setResourceCache(Boolean resourceCache) {
+        this.resourceCache = resourceCache;
+    }
+
+    @Override
+    public String toString() {
+        return "Resource{" + "id=" + id + ", resourceName=" + resourceName + ", parentId=" + parentId + ", resourceKey="
+                + resourceKey + ", resourceType=" + resourceType + ", resourceIcon=" + resourceIcon + ", resourceUrl="
+                + resourceUrl + ", resourceLevel=" + resourceLevel + ", description=" + description + ", createTime="
+                + createTime + ", creator=" + creator + ", updateTime=" + updateTime + ", operator=" + operator + "}";
+    }
+}

+ 153 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateRole.java

@@ -0,0 +1,153 @@
+
+package com.fdkk.sxz.system.dto;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 角色表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+public class UpdateRole
+{
+    private Integer id;
+
+    private Integer parentId;
+
+    private String roleName;
+
+    private String roleKey;
+
+    private Integer roleLevel;
+
+    private String roleStatus;
+
+    private String description;
+
+    private Date createTime;
+
+    private Integer creator;
+
+    private Date updateTime;
+
+    private Integer operator;
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getParentId()
+    {
+        return parentId;
+    }
+
+    public void setParentId( Integer parentId )
+    {
+        this.parentId = parentId;
+    }
+
+    public String getRoleName()
+    {
+        return roleName;
+    }
+
+    public void setRoleName( String roleName )
+    {
+        this.roleName = roleName;
+    }
+
+    public String getRoleKey()
+    {
+        return roleKey;
+    }
+
+    public void setRoleKey( String roleKey )
+    {
+        this.roleKey = roleKey;
+    }
+
+    public Integer getRoleLevel()
+    {
+        return roleLevel;
+    }
+
+    public void setRoleLevel( Integer roleLevel )
+    {
+        this.roleLevel = roleLevel;
+    }
+
+    public String getRoleStatus() {
+		return roleStatus;
+	}
+
+	public void setRoleStatus(String roleStatus) {
+		this.roleStatus = roleStatus;
+	}
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public Date getCreateTime()
+    {
+        return createTime;
+    }
+
+    public void setCreateTime( Date createTime )
+    {
+        this.createTime = createTime;
+    }
+
+    public Integer getCreator()
+    {
+        return creator;
+    }
+
+    public void setCreator( Integer creator )
+    {
+        this.creator = creator;
+    }
+
+    public Date getUpdateTime()
+    {
+        return updateTime;
+    }
+
+    public void setUpdateTime( Date updateTime )
+    {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getOperator()
+    {
+        return operator;
+    }
+
+    public void setOperator( Integer operator )
+    {
+        this.operator = operator;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Role{" + "id=" + id + ", parentId=" + parentId + ", roleName=" + roleName + ", roleKey=" + roleKey
+                + ", roleStatus=" + roleStatus + ", description=" + description + ", createTime=" + createTime + ", creator="
+                + creator + ", updateTime=" + updateTime + ", operator=" + operator + "}";
+    }
+}

+ 50 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateRoleResource.java

@@ -0,0 +1,50 @@
+package com.fdkk.sxz.system.dto;
+
+import com.fdkk.sxz.entity.system.RoleResource;
+
+import java.util.List;
+
+/**
+ * @author Xiewj
+ */
+public class UpdateRoleResource {
+
+    /**
+     * 需要操作的角色id
+     */
+    private Integer roleId;
+
+    /**
+     * 添加的资源列表
+     */
+    private List<RoleResource> addResources;
+
+    /**
+     * 删除的资源列表
+     */
+    private List<RoleResource> delResources;
+
+    public Integer getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Integer roleId) {
+        this.roleId = roleId;
+    }
+
+    public List<RoleResource> getAddResources() {
+        return addResources;
+    }
+
+    public void setAddResources(List<RoleResource> addResources) {
+        this.addResources = addResources;
+    }
+
+    public List<RoleResource> getDelResources() {
+        return delResources;
+    }
+
+    public void setDelResources(List<RoleResource> delResources) {
+        this.delResources = delResources;
+    }
+}

+ 327 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UpdateUser.java

@@ -0,0 +1,327 @@
+
+package com.fdkk.sxz.system.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 用户表
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-26
+ */
+public class UpdateUser implements Serializable
+{
+
+    /**
+      * @Fields serialVersionUID :
+      */
+
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 账号
+     */
+    private String userAccount;
+    /**
+     * 昵称
+     */
+    private String userNickName;
+    /**
+     * 姓名
+     */
+    private String userName;
+    /**
+     * 1 : 男,0 : 女
+     */
+    private String userSex;
+    /**
+     * 邮箱
+     */
+    private String userEmail;
+    /**
+     * 电话
+     */
+    private String userMobile;
+    /**
+     * 密码
+     */
+    private String userPassword;
+    /**
+     * '0'禁用,'1' 启用, '2' 密码过期或初次未修改
+     */
+    private String userStatus;
+
+    /**
+     *
+     */
+    private String headImgUrl;
+    /**
+     * 省
+     */
+    private String province;
+    /**
+     * 市
+     */
+    private String city;
+    /**
+     * 区
+     */
+    private String area;
+    /**
+     * 街道详细地址
+     */
+    private String street;
+    /**
+     * vue级联选择
+     */
+    private List<String> areas;
+    /**
+     * 备注
+     */
+    private String description;
+
+    private Long roleId;
+
+    @ApiModelProperty(value = "组织机构id")
+    private Long organizationId;
+
+    /**
+     * 角色数组
+     */
+    @ApiModelProperty(value = "用户角色ID数组")
+    private List<Long> roleIds;
+
+    private String newPwd;
+
+    private String oldPwd;
+
+    private String smsCode;
+
+    public Long getId()
+    {
+        return id;
+    }
+
+    public void setId( Long id )
+    {
+        this.id = id;
+    }
+
+    public String getUserAccount()
+    {
+        return userAccount;
+    }
+
+    public void setUserAccount( String userAccount )
+    {
+        this.userAccount = userAccount;
+    }
+
+    public String getUserNickName()
+    {
+        return userNickName;
+    }
+
+    public void setUserNickName( String userNickName )
+    {
+        this.userNickName = userNickName;
+    }
+
+    public String getUserName()
+    {
+        return userName;
+    }
+
+    public void setUserName( String userName )
+    {
+        this.userName = userName;
+    }
+
+    public String getUserSex()
+    {
+        return userSex;
+    }
+
+    public void setUserSex( String userSex )
+    {
+        this.userSex = userSex;
+    }
+
+    public String getUserEmail()
+    {
+        return userEmail;
+    }
+
+    public void setUserEmail( String userEmail )
+    {
+        this.userEmail = userEmail;
+    }
+
+    public String getUserMobile()
+    {
+        return userMobile;
+    }
+
+    public void setUserMobile( String userMobile )
+    {
+        this.userMobile = userMobile;
+    }
+
+    public String getUserPassword()
+    {
+        return userPassword;
+    }
+
+    public void setUserPassword( String userPassword )
+    {
+        this.userPassword = userPassword;
+    }
+
+    public String getUserStatus()
+    {
+        return userStatus;
+    }
+
+    public void setUserStatus( String userStatus )
+    {
+        this.userStatus = userStatus;
+    }
+
+    public String getHeadImgUrl()
+    {
+        return headImgUrl;
+    }
+
+    public void setHeadImgUrl( String headImgUrl )
+    {
+        this.headImgUrl = headImgUrl;
+    }
+
+    public String getProvince()
+    {
+        return province;
+    }
+
+    public void setProvince( String province )
+    {
+        this.province = province;
+    }
+
+    public String getCity()
+    {
+        return city;
+    }
+
+    public void setCity( String city )
+    {
+        this.city = city;
+    }
+
+    public String getArea()
+    {
+        return area;
+    }
+
+    public void setArea( String area )
+    {
+        this.area = area;
+    }
+
+    public String getStreet()
+    {
+        return street;
+    }
+
+    public void setStreet( String street )
+    {
+        this.street = street;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public String getSmsCode() {
+		return smsCode;
+	}
+
+	public void setSmsCode(String smsCode) {
+		this.smsCode = smsCode;
+	}
+
+	public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public Long getRoleId()
+    {
+        return roleId;
+    }
+
+    public void setRoleId( Long roleId )
+    {
+        this.roleId = roleId;
+    }
+
+
+    public Long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(Long organizationId) {
+        this.organizationId = organizationId;
+    }
+
+
+    public List<Long> getRoleIds() {
+        return roleIds;
+    }
+
+    public void setRoleIds(List<Long> roleIds) {
+        this.roleIds = roleIds;
+    }
+
+    public String getNewPwd() {
+		return newPwd;
+	}
+
+	public void setNewPwd(String newPwd) {
+		this.newPwd = newPwd;
+	}
+
+	public String getOldPwd() {
+		return oldPwd;
+	}
+
+	public void setOldPwd(String oldPwd) {
+		this.oldPwd = oldPwd;
+	}
+
+	public List<String> getAreas() {
+		return areas;
+	}
+
+	public void setAreas(List<String> areas) {
+		this.areas = areas;
+	}
+
+	@Override
+    public String toString()
+    {
+        return "User{" + "id=" + id + ", userAccount=" + userAccount + ", userNickName=" + userNickName + ", userName="
+                + userName + ", userSex=" + userSex + ", userEmail=" + userEmail + ", userMobile=" + userMobile
+                + ", userPassword=" + userPassword + ", userStatus=" + userStatus + ", headImgUrl=" + headImgUrl
+                + ", province=" + province + ", city=" + city + ", area=" + area + ", street=" + street
+                + ", description=" + description + "}";
+    }
+}

+ 322 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/dto/UserInfo.java

@@ -0,0 +1,322 @@
+
+package com.fdkk.sxz.system.dto;
+
+
+import com.fdkk.sxz.entity.system.Resource;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author Xiewj
+ */
+public class UserInfo
+{
+    private Integer id;
+    private String token;
+    private String userAccount;
+    private String userNickName;
+    private String userName;
+    private String userEmail;
+    private String userMobile;
+    private String userSex;
+    private String userStatus;
+    private Long time;
+    private Integer roleId;
+    private Integer organizationId;
+    private String organizationName;
+    private String roleIds;
+    private String roleKey;
+    private String roleName;
+    private String dataPermission;
+    private List<String> roles;
+    private List<Resource> resources;
+    private List<String> stringResources;
+    private String headImgUrl;
+    private String province;
+    private String provinceName;
+    private String city;
+    private String cityName;
+    private String area;
+    private String street;
+    private String description;
+    private Date createTime;
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public String getToken()
+    {
+        return token;
+    }
+
+    public void setToken( String token )
+    {
+        this.token = token;
+    }
+
+    public String getUserAccount()
+    {
+        return userAccount;
+    }
+
+    public void setUserAccount( String userAccount )
+    {
+        this.userAccount = userAccount;
+    }
+
+    public String getUserNickName()
+    {
+        return userNickName;
+    }
+
+    public void setUserNickName( String userNickName )
+    {
+        this.userNickName = userNickName;
+    }
+
+    public String getUserName()
+    {
+        return userName;
+    }
+
+    public void setUserName( String userName )
+    {
+        this.userName = userName;
+    }
+
+    public String getUserEmail()
+    {
+        return userEmail;
+    }
+
+    public void setUserEmail( String userEmail )
+    {
+        this.userEmail = userEmail;
+    }
+
+    public String getUserMobile()
+    {
+        return userMobile;
+    }
+
+    public void setUserMobile( String userMobile )
+    {
+        this.userMobile = userMobile;
+    }
+
+    public String getUserSex()
+    {
+        return userSex;
+    }
+
+    public void setUserSex( String userSex )
+    {
+        this.userSex = userSex;
+    }
+
+    public Long getTime()
+    {
+        return time;
+    }
+
+    public void setTime( Long time )
+    {
+        this.time = time;
+    }
+
+    public Integer getRoleId()
+    {
+        return roleId;
+    }
+
+    public void setRoleId( Integer roleId )
+    {
+        this.roleId = roleId;
+    }
+
+
+    public String getDataPermission() {
+        return dataPermission;
+    }
+
+    public void setDataPermission(String dataPermission) {
+        this.dataPermission = dataPermission;
+    }
+
+
+    public Integer getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(Integer organizationId) {
+        this.organizationId = organizationId;
+    }
+
+
+    public String getOrganizationName() {
+        return organizationName;
+    }
+
+    public void setOrganizationName(String organizationName) {
+        this.organizationName = organizationName;
+    }
+
+
+
+    public String getRoleIds() {
+        return roleIds;
+    }
+
+    public void setRoleIds(String roleIds) {
+        this.roleIds = roleIds;
+    }
+
+
+    public String getRoleKey()
+    {
+        return roleKey;
+    }
+
+    public void setRoleKey( String roleKey )
+    {
+        this.roleKey = roleKey;
+    }
+
+    public String getRoleName()
+    {
+        return roleName;
+    }
+
+    public void setRoleName( String roleName )
+    {
+        this.roleName = roleName;
+    }
+
+    public List<String> getRoles() {
+		return roles;
+	}
+
+	public void setRoles(List<String> roles) {
+		this.roles = roles;
+	}
+
+	public List<Resource> getResources() {
+		return resources;
+	}
+
+	public void setResources(List<Resource> resources) {
+		this.resources = resources;
+	}
+
+	public String getHeadImgUrl()
+    {
+        return headImgUrl;
+    }
+
+    public void setHeadImgUrl( String headImgUrl )
+    {
+        this.headImgUrl = headImgUrl;
+    }
+
+    public String getProvince()
+    {
+        return province;
+    }
+
+    public void setProvince( String province )
+    {
+        this.province = province;
+    }
+
+    public String getCity()
+    {
+        return city;
+    }
+
+    public void setCity( String city )
+    {
+        this.city = city;
+    }
+
+    public String getArea()
+    {
+        return area;
+    }
+
+    public void setArea( String area )
+    {
+        this.area = area;
+    }
+
+
+    public String getStreet() {
+        return street;
+    }
+    public void setStreet(String street) {
+        this.street = street;
+    }
+    public String getUserStatus()
+    {
+        return userStatus;
+    }
+
+    public void setUserStatus( String userStatus )
+    {
+        this.userStatus = userStatus;
+    }
+
+    public Date getCreateTime()
+    {
+        return createTime;
+    }
+
+    public void setCreateTime( Date createTime )
+    {
+        this.createTime = createTime;
+    }
+
+    public String getProvinceName()
+    {
+        return provinceName;
+    }
+
+    public void setProvinceName( String provinceName )
+    {
+        this.provinceName = provinceName;
+    }
+
+    public String getCityName()
+    {
+        return cityName;
+    }
+
+    public void setCityName( String cityName )
+    {
+        this.cityName = cityName;
+    }
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+
+    public List<String> getStringResources() {
+        return stringResources;
+    }
+
+    public void setStringResources(List<String> stringResources) {
+        this.stringResources = stringResources;
+    }
+}

+ 20 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/DataPermissionMapper.java

@@ -0,0 +1,20 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.base.IBaseMapper;
+import com.fdkk.sxz.entity.system.DataPermission;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2019-02-27
+ */
+@Mapper
+@Component("DataPermissionMapper")
+public interface DataPermissionMapper extends IBaseMapper<DataPermission> {
+
+}

+ 26 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/LogMapper.java

@@ -0,0 +1,26 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.system.dto.LogInfo;
+import com.fdkk.sxz.system.dto.QueryLog;
+import com.fdkk.sxz.entity.system.Log;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author jeebase
+ * @since 2018-10-24
+ */
+public interface LogMapper extends IBaseMapper<Log> {
+    /**
+     * 分页查询操作日志
+     * @param log
+     * @return logInfo
+     */
+    List<LogInfo> selectLogList(@Param("log") QueryLog log);
+}

+ 28 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/OrganizationMapper.java

@@ -0,0 +1,28 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.Organization;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 组织表 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("OrganizationMapper")
+public interface OrganizationMapper extends IBaseMapper<Organization> {
+
+    /**
+     * 查询组织机构树
+     * @param parentId
+     * @return
+     */
+    List<Organization> queryOrganizationTreeProc(Long parentId);
+}

+ 19 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/OrganizationRoleMapper.java

@@ -0,0 +1,19 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.OrganizationRole;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ * 可以给组织权限,在该组织下的所有用户都有此权限 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("OrganizationRoleMapper")
+public interface OrganizationRoleMapper extends IBaseMapper<OrganizationRole> {
+}

+ 19 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/OrganizationUserMapper.java

@@ -0,0 +1,19 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.OrganizationUser;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("OrganizationUserMapper")
+public interface OrganizationUserMapper extends IBaseMapper<OrganizationUser> {
+}

+ 39 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/ResourceMapper.java

@@ -0,0 +1,39 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.Resource;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 权限表 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("ResourceMapper")
+public interface ResourceMapper extends IBaseMapper<Resource> {
+
+    /**
+     * 查询用户权限资源
+     * @param userId
+     * @return
+     */
+    List<Resource> queryResourceByUserId(@Param("userId")Long userId);
+
+    /**
+     * queryResourceTreeProc
+     *
+     * @Title: queryResourceTreeProc
+     * @Description: 查询登陆用户的许可权限(使用存储过程递归查询所有权限树信息)
+     * @param parentId
+     * @return List<Resource>
+     */
+    List<Resource> queryResourceTreeProc(@Param("parentId")Long parentId);
+}

+ 29 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/RoleMapper.java

@@ -0,0 +1,29 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.Role;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 角色表 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("RoleMapper")
+public interface RoleMapper extends IBaseMapper<Role> {
+
+    /**
+     * 查询角色列表
+     * @param role
+     * @return
+     */
+    List<Role> selectRoleList(@Param("role") Role role);
+}

+ 19 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/RoleResourceMapper.java

@@ -0,0 +1,19 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.RoleResource;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ * 角色和权限关联表 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("RoleResourceMapper")
+public interface RoleResourceMapper extends IBaseMapper<RoleResource> {
+}

+ 31 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/UserMapper.java

@@ -0,0 +1,31 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.system.dto.UserInfo;
+import com.fdkk.sxz.system.dto.QueryUser;
+import com.fdkk.sxz.entity.system.User;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 用户表 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("UserMapper")
+public interface UserMapper extends IBaseMapper<User> {
+
+    /**
+     * 查询用户列表
+     * @param user
+     * @return
+     */
+    List<UserInfo> selectUserList(@Param("user") QueryUser user);
+}

+ 19 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/mapper/UserRoleMapper.java

@@ -0,0 +1,19 @@
+package com.fdkk.sxz.system.mapper;
+
+import com.fdkk.sxz.entity.system.UserRole;
+import com.fdkk.sxz.base.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ * 用户和角色关联表 Mapper 接口
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+@Mapper
+@Component("UserRoleMapper")
+public interface UserRoleMapper extends IBaseMapper<UserRole> {
+}

+ 23 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/service/IDataPermissionService.java

@@ -0,0 +1,23 @@
+package com.fdkk.sxz.system.service;
+
+import com.fdkk.sxz.base.IBaseService;
+import com.fdkk.sxz.system.dto.UpdateDataPermission;
+import com.fdkk.sxz.entity.system.DataPermission;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2019-02-27
+ */
+public interface IDataPermissionService extends IBaseService<DataPermission> {
+
+    /**
+     * 修改用户数据权限
+     * @param updateDataPermission
+     * @return
+     */
+    boolean updateUserDataPermission(UpdateDataPermission updateDataPermission);
+}

+ 27 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/service/ILogService.java

@@ -0,0 +1,27 @@
+package com.fdkk.sxz.system.service;
+
+import com.github.pagehelper.Page;
+import com.fdkk.sxz.system.dto.LogInfo;
+import com.fdkk.sxz.system.dto.QueryLog;
+import com.fdkk.sxz.entity.system.Log;
+import com.fdkk.sxz.base.IBaseService;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author jeebase
+ * @since 2018-10-24
+ */
+public interface ILogService extends IBaseService<Log> {
+
+    /**
+     * 查询日志列表
+     * @param log
+     * @return
+     */
+    PageInfo<LogInfo> selectLogList(Page<LogInfo> page, QueryLog log);
+
+}

+ 15 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/service/IOrganizationRoleService.java

@@ -0,0 +1,15 @@
+package com.fdkk.sxz.system.service;
+
+import com.fdkk.sxz.base.IBaseService;
+import com.fdkk.sxz.entity.system.OrganizationRole;
+
+/**
+ * <p>
+ * 可以给组织权限,在该组织下的所有用户都有此权限 服务类
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+public interface IOrganizationRoleService extends IBaseService<OrganizationRole> {
+}

+ 48 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/service/IOrganizationService.java

@@ -0,0 +1,48 @@
+package com.fdkk.sxz.system.service;
+
+import com.fdkk.sxz.entity.system.Organization;
+import com.fdkk.sxz.base.IBaseService;
+
+import java.util.List;
+
+/**
+ *
+ * @author Xiewj
+ */
+public interface IOrganizationService extends IBaseService<Organization> {
+
+    /**
+     * 查询机构列表
+     * @param parentId
+     * @return
+     */
+    List<Organization> queryOrganizationByPanentId(Long parentId);
+
+    /**
+     * 查询机构列表,不组装父子节点
+     * @param parentId
+     * @return
+     */
+    List<Organization> queryOrgList(Long parentId);
+
+    /**
+     * 创建组织
+     * @param organization
+     * @return
+     */
+    boolean createOrganization(Organization organization);
+
+    /**
+     * 更新组织
+     * @param organization
+     * @return
+     */
+    boolean updateOrganization(Organization organization);
+
+    /**
+     * 删除组织
+     * @param organizationId
+     * @return
+     */
+    boolean deleteOrganization(Long organizationId);
+}

+ 15 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/service/IOrganizationUserService.java

@@ -0,0 +1,15 @@
+package com.fdkk.sxz.system.service;
+
+import com.fdkk.sxz.base.IBaseService;
+import com.fdkk.sxz.entity.system.OrganizationUser;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author Xiewj
+ * @since 2018-05-19
+ */
+public interface IOrganizationUserService extends IBaseService<OrganizationUser> {
+}

+ 0 - 0
sxz-core/src/main/java/com/fdkk/sxz/system/service/IResourceService.java


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