tuonina 6 yıl önce
ebeveyn
işleme
e3515d636c
76 değiştirilmiş dosya ile 390 ekleme ve 2208 silme
  1. 27 49
      build.gradle
  2. 1 5
      zen-api/build.gradle
  3. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDept.kt
  4. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDeptUser.kt
  5. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDictType.kt
  6. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDictValue.kt
  7. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysEventLogin.kt
  8. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysEventOper.kt
  9. 2 2
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysNotice.kt
  10. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysParam.kt
  11. 2 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysRole.kt
  12. 3 3
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysUploadInfo.kt
  13. 2 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysUser.kt
  14. 2 1
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysUserRole.kt
  15. 83 82
      zen-api/src/main/kotlin/com/gxzc/zen/api/sys/service/impl/PermissionServiceImpl.kt
  16. 0 114
      zen-api/src/main/kotlin/com/gxzc/zen/api/util/FileSystemUtil.kt
  17. 0 57
      zen-api/src/main/kotlin/com/gxzc/zen/api/util/SysDictUtil.kt
  18. 0 26
      zen-api/src/main/kotlin/com/gxzc/zen/api/util/SysParamUtil.kt
  19. 0 44
      zen-api/src/main/kotlin/com/gxzc/zen/logging/MQLogHelper.kt
  20. 0 173
      zen-api/src/main/kotlin/com/gxzc/zen/logging/aop/LogDBInterceptor.kt
  21. 0 127
      zen-api/src/main/kotlin/com/gxzc/zen/logging/aop/LogRequestAspect.kt
  22. 0 26
      zen-api/src/main/kotlin/com/gxzc/zen/logging/constants/LogConstants.kt
  23. 0 120
      zen-api/src/main/kotlin/com/gxzc/zen/logging/util/MQLogUtil.kt
  24. 0 17
      zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/MQConfiguration.kt
  25. 0 19
      zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/MQProducerUtil.kt
  26. 0 16
      zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/ZenMQProducer.kt
  27. 0 31
      zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/constants/MQConstants.kt
  28. 5 9
      zen-api/src/main/kotlin/com/gxzc/zen/orm/Generator.kt
  29. 2 3
      zen-api/src/main/kotlin/com/gxzc/zen/orm/config/CustomMetaObjectHandler.kt
  30. 7 9
      zen-api/src/main/kotlin/com/gxzc/zen/orm/config/MybatisPlusConfig.kt
  31. 0 107
      zen-api/src/main/kotlin/com/gxzc/zen/orm/config/ZenSqlInjector.kt
  32. 0 148
      zen-api/src/main/kotlin/com/gxzc/zen/orm/data/authority/interceptor/ZenDataAuthorityInterceptor.kt
  33. 0 13
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/TestRpcService.kt
  34. 0 36
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RDictService.kt
  35. 0 19
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RParamService.kt
  36. 0 21
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RPermissionService.kt
  37. 0 17
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RRoleService.kt
  38. 0 45
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RUploadService.kt
  39. 0 26
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RUserService.kt
  40. 0 19
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/model/sys/RUploadInfo.kt
  41. 0 19
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/model/sys/RUserInfo.kt
  42. 0 28
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/provider/TestRpcServiceImpl.kt
  43. 0 26
      zen-api/src/main/kotlin/com/gxzc/zen/rpc/util/RpcUtil.kt
  44. 4 2
      zen-api/src/main/kotlin/com/gxzc/zen/umps/config/ShiroConfig.kt
  45. 1 1
      zen-api/src/main/kotlin/com/gxzc/zen/umps/config/ShiroRedisCache.kt
  46. 2 2
      zen-api/src/main/kotlin/com/gxzc/zen/umps/config/ShiroRedisSessionDAO.kt
  47. 4 4
      zen-core/build.gradle
  48. 33 0
      zen-core/src/main/kotlin/cn/gygxzc/tina/cache/redis/RedisConfig.kt
  49. 1 1
      zen-core/src/main/kotlin/cn/gygxzc/tina/cache/redis/RedisKeyGenerator.kt
  50. 61 0
      zen-core/src/main/kotlin/cn/gygxzc/tina/cache/redis/TinaJedisConnectionConfiguration.kt
  51. 1 5
      zen-core/src/main/kotlin/com/gxzc/zen/common/base/BaseModel.kt
  52. 4 4
      zen-core/src/main/kotlin/com/gxzc/zen/common/base/IBaseMapper.kt
  53. 2 2
      zen-core/src/main/kotlin/com/gxzc/zen/common/base/IBaseService.kt
  54. 5 9
      zen-core/src/main/kotlin/com/gxzc/zen/common/config/SwaggerConfig.kt
  55. 0 275
      zen-core/src/main/kotlin/com/gxzc/zen/common/config/cache/redis/RedisConfig.kt
  56. 13 13
      zen-core/src/main/kotlin/com/gxzc/zen/common/util/PaginationUtil.kt
  57. 1 1
      zen-core/src/main/kotlin/com/gxzc/zen/common/util/RedisCacheUtil.kt
  58. 4 4
      zen-job/build.gradle
  59. 1 7
      zen-web/build.gradle
  60. 12 0
      zen-web/src/main/kotlin/cn/gygxzc/envir/web/config/EnvirWebMvcConfiguration.kt
  61. 9 10
      zen-web/src/main/kotlin/com/gxzc/zen/MainApplication.kt
  62. 3 45
      zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/AuthController.kt
  63. 3 3
      zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/TestController.kt
  64. 1 63
      zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/UploadController.kt
  65. 2 6
      zen-web/src/main/kotlin/com/gxzc/zen/ws/sys/controller/WebSocketTestController.kt
  66. 16 17
      zen-web/src/main/resources/application-cache.yml
  67. 0 67
      zen-web/src/main/resources/application-fs.yml
  68. 1 1
      zen-web/src/main/resources/application-msg.yml
  69. 29 37
      zen-web/src/main/resources/application-orm.yml
  70. 0 10
      zen-web/src/main/resources/application-platform.yml
  71. 0 46
      zen-web/src/main/resources/application-rpc.yml
  72. 1 1
      zen-web/src/main/resources/application-umps.yml
  73. 32 25
      zen-web/src/main/resources/application.yml
  74. 0 12
      zen-web/src/main/resources/dubbo/dubbo-consumer.xml
  75. 0 54
      zen-web/src/test/kotlin/com/gxzc/zen/FileSystemUtilTest.kt
  76. 1 15
      zen-web/src/test/kotlin/com/gxzc/zen/Test.kt

+ 27 - 49
build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     ext {
-        kotlin_version = '1.2.51'
-        spring_boot_version = '1.5.10.RELEASE'
+        kotlin_version = '1.2.61'
+        springBootVersion = '2.0.1.RELEASE'
+        springCloudVersion = 'Finchley.SR1'
+        mybatisPlusVersion = '3.0.3'
         junit_version = '4.12'
         commons_io_version = '2.5'
         commons_lang3_version = '3.5'
@@ -34,10 +36,9 @@ buildscript {
         maven { url = 'http://repo.spring.io/plugins-release' }
     }
     dependencies {
-        classpath 'io.spring.gradle:propdeps-plugin:0.0.9.RELEASE'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
-        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
+        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
     }
 }
 
@@ -48,15 +49,13 @@ allprojects {
 
 subprojects {
     apply plugin: 'java'
+    apply plugin: 'eclipse'
+    apply plugin: 'org.springframework.boot'
+    apply plugin: 'io.spring.dependency-management'
+
     apply plugin: 'kotlin'
     apply plugin: 'kotlin-kapt'
     apply plugin: 'kotlin-spring'
-    apply plugin: 'org.springframework.boot'
-
-    apply plugin: 'propdeps'
-    apply plugin: 'propdeps-maven'
-    apply plugin: 'propdeps-idea'
-    apply plugin: 'propdeps-eclipse'
 
     sourceCompatibility = 1.8
     targetCompatibility = 1.8
@@ -69,34 +68,39 @@ subprojects {
         jcenter()
     }
 
+    dependencyManagement {
+        imports {
+            mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Finchley.SR1'
+        }
+    }
+
+
     dependencies {
         // Kotlin
         compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
         compile("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
 
         kapt("org.springframework.boot:spring-boot-configuration-processor")
-        optional("org.springframework.boot:spring-boot-configuration-processor")
         // SpringBoot Starter
+
+        compile('org.springframework.cloud:spring-cloud-config-server')
+        compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-server')
+//
         compile('org.springframework.boot:spring-boot-starter')
         compile('org.springframework.boot:spring-boot-starter-web')
         compile('org.springframework.boot:spring-boot-starter-aop')
         compile('org.springframework.boot:spring-boot-starter-actuator')
         compile('org.springframework.boot:spring-boot-starter-websocket')
-//        compile('org.springframework.boot:spring-boot-starter-amqp')
-//        compile('org.springframework.boot:spring-boot-starter-jta-atomikos')
+        compile('org.springframework.boot:spring-boot-starter-jta-atomikos')
+
+//        cache
         compile('org.springframework.boot:spring-boot-starter-cache')
         compile('org.springframework.boot:spring-boot-starter-data-redis')
+        compile('redis.clients:jedis:2.9.0')
 
-        testCompile('org.springframework.boot:spring-boot-starter-test')
-//        testCompile("junit:junit:$junit_version")
-
-        // session
-//        compile('org.springframework.session:spring-session-data-redis')
 
+        testCompile('org.springframework.boot:spring-boot-starter-test')
         // mq
-//        compile("org.apache.rocketmq:rocketmq-client:$rocketmq_version")
-//        compile("com.qianmi:spring-boot-starter-rocketmq:$rocketmq_starter_version")
-        compile("com.maihaoche:spring-boot-starter-rocketmq:$rocketmq_starter_version")
 
         // shiro
         compile("org.apache.shiro:shiro-spring:$shiro_version")
@@ -115,18 +119,9 @@ subprojects {
 
         // cache
         compile("com.github.ben-manes.caffeine:caffeine:$caffeine_version")
-//        compile("org.ehcache:ehcache:$ehcache_version")
-//        compile("net.sf.ehcache:ehcache-core:$ehcache_core_version")
-
         // db
         compile("mysql:mysql-connector-java:$mysql_connector_version")
-        compile("com.alibaba:druid-spring-boot-starter:$alidruid_version")
-        // compile("io.shardingjdbc:sharding-jdbc-core-spring-boot-starter:2.0.2")
-
-        // mybatis-plus
-        compile("com.baomidou:mybatis-plus:$mybatis_plus_version")
-        compile("com.baomidou:mybatisplus-spring-boot-starter:$mybatis_plus_boot_version")
-
+        compile("com.baomidou:mybatis-plus-boot-starter:$mybatisPlusVersion")
         // job
         compile("com.xuxueli:xxl-job-core:$xxljob_version")
 
@@ -136,33 +131,16 @@ subprojects {
 
         // utils
         compile("org.projectlombok:lombok:1.18.2")
-//        compile("com.google.guava:guava:23.6-jre")
-//        compile("com.github.penggle:kaptcha:2.3.2")
         compile("com.alibaba:fastjson:$fastjson_version")
         compile("com.belerweb:pinyin4j:$pinyin4j_version")
-//        compile('com.github.hotchemi:khronos:0.9.0')
-        compile('com.github.shihyuho:jackson-dynamic-filter:1.0')
-
-        // rpc
-        compile("com.alibaba.boot:dubbo-spring-boot-starter:$dubbo_starter_version")
-                {
-                    exclude group: "com.alibaba", module: "dubbo"
-                }
-        compile("com.alibaba:dubbo:$dubbo_version")
 
-        // activiti
-//        compile("org.activiti:activiti-spring-boot-starter-basic:$activiti_starter_version")
-//        compile("org.activiti:activiti-spring-boot-starter-rest-api:$activiti_starter_version")
-//        compile("org.activiti:activiti-spring-boot-starter-actuator:$activiti_starter_version")
 
         compile("org.apache.velocity:velocity-engine-core:2.0")
-
         // sql parser
         compile("com.github.jsqlparser:jsqlparser:$jsqlparser_version")
-
         // fastdfs
         compile("com.github.tobato:fastdfs-client:$fastdfs_client_version")
-        
+
         ext.jarTree = fileTree(dir: 'libs', include: '**/*.jar')
         compile jarTree
     }

+ 1 - 5
zen-api/build.gradle

@@ -5,7 +5,7 @@ buildscript {
     dependencies {
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
-        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
+        classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
     }
 }
 
@@ -13,7 +13,3 @@ buildscript {
 dependencies {
     compile project(":zen-core")
 }
-
-bootRepackage {
-    enabled = false
-}

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDept.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDeptUser.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDictType.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysDictValue.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysEventLogin.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysEventOper.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 2 - 2
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysNotice.kt

@@ -1,9 +1,9 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.fasterxml.jackson.annotation.JsonFormat
-import java.util.Date
 import com.gxzc.zen.common.base.BaseModel
+import java.util.*
 
 /**
  * <p>

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysParam.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**

+ 2 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysRole.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**
@@ -16,6 +16,7 @@ open class SysRole : BaseModel() {
     companion object {
         private const val serialVersionUID = 1000000000000000003L
     }
+
     /**
      * 父级节点
      */

+ 3 - 3
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysUploadInfo.kt

@@ -1,9 +1,9 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableField
-import com.baomidou.mybatisplus.annotations.TableName
-import java.util.Date
+import com.baomidou.mybatisplus.annotation.TableField
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
+import java.util.*
 
 /**
  * <p>

+ 2 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysUser.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**
@@ -16,6 +16,7 @@ open class SysUser : BaseModel() {
     companion object {
         private const val serialVersionUID = 1000000000000000002L
     }
+
     /**
      * 登陆帐户
      */

+ 2 - 1
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/model/SysUserRole.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.api.sys.model
 
-import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotation.TableName
 import com.gxzc.zen.common.base.BaseModel
 
 /**
@@ -16,6 +16,7 @@ open class SysUserRole : BaseModel() {
     companion object {
         private const val serialVersionUID = 1000000000000000005L
     }
+
     /**
      * 角色ID
      */

+ 83 - 82
zen-api/src/main/kotlin/com/gxzc/zen/api/sys/service/impl/PermissionServiceImpl.kt

@@ -1,82 +1,83 @@
-package com.gxzc.zen.api.sys.service.impl
-
-import com.alibaba.dubbo.config.annotation.Reference
-import com.gxzc.zen.api.sys.model.SysRole
-import com.gxzc.zen.api.sys.service.IPermissionService
-import com.gxzc.zen.common.contants.ZenConstants
-import com.gxzc.zen.common.util.RedisCacheUtil
-import com.gxzc.zen.rpc.api.sys.RPermissionService
-import com.gxzc.zen.rpc.api.sys.RRoleService
-import com.gxzc.zen.umps.common.ZenPermission
-import com.gxzc.zen.umps.constant.ZenHttpSession
-import com.gxzc.zen.umps.util.SSOUtil
-import com.gxzc.zen.umps.util.ShiroRedisUtil
-import org.apache.shiro.session.Session
-import org.springframework.stereotype.Service
-
-/**
- * <p>
- * 权限 服务实现类
- * </p>
- *
- * @author NorthLan123
- * @since 2018-02-06
- */
-@Service
-@Suppress("UNCHECKED_CAST")
-class PermissionServiceImpl : IPermissionService {
-
-    @Reference(version = "1.0")
-    private val rPermissionService: RPermissionService? = null
-
-    @Reference(version = "1.0")
-    private val roleService: RRoleService? = null
-
-    override fun getAllSysPermission(): MutableList<ZenPermission> {
-        // 获取权限
-        var ret = rPermissionService?.getAllPermission()
-        if (ret == null) {
-            ret = mutableListOf()
-        }
-        return ret
-    }
-
-    override fun getSubjectPermission(): MutableList<ZenPermission> {
-        val session = SSOUtil.getSession() ?: return mutableListOf()
-        var result = session.getAttribute(ZenHttpSession.SESSION_KEY_USER_PERMS) as? MutableList<ZenPermission>
-        if (result == null || result.isEmpty()) {
-            result = mutableListOf()
-            val roles = getSubjectRoles(session)
-            val roleIds = roles.map { it.id!! }
-
-            val perms = rPermissionService?.getPermissionByRoleIds(roleIds)
-            if (perms != null && perms.isNotEmpty()) {
-                result.addAll(perms)
-            }
-        }
-        if (result.isNotEmpty()) {
-            session.setAttribute(ZenHttpSession.SESSION_KEY_USER_PERMS, result)
-        }
-
-        return result
-    }
-
-    override fun getSubjectRoles(session: Session): MutableList<SysRole> {
-        var roles = session.getAttribute(ZenHttpSession.SESSION_KEY_USER_ROLES) as? MutableList<SysRole>
-        // session中没有怎么办?
-        if (roles == null || roles.isEmpty()) {
-            // DB中取出来
-            roles = roleService!!.getRoleListByUserId(session.getAttribute(ZenHttpSession.SESSION_KEY_USER_ID) as? Long)
-            session.setAttribute(ZenHttpSession.SESSION_KEY_USER_ROLES, roles)
-        }
-        return roles
-    }
-
-    override fun updateAllSysPermission() {
-        RedisCacheUtil.evict(ZenConstants.CACHE_KEY_SYS, "allPerms")
-    }
-
-    override fun updateAllSessionPermission() {
-        ShiroRedisUtil.removeAllSessionsAttributeKey(ZenHttpSession.SESSION_KEY_USER_PERMS)
-    }
-}
+//package com.gxzc.zen.api.sys.service.impl
+//
+//import com.alibaba.dubbo.config.annotation.Reference
+//import com.gxzc.zen.api.sys.model.SysRole
+//import com.gxzc.zen.api.sys.service.IPermissionService
+//import com.gxzc.zen.common.contants.ZenConstants
+//import com.gxzc.zen.common.util.RedisCacheUtil
+//import com.gxzc.zen.rpc.api.sys.RPermissionService
+//import com.gxzc.zen.rpc.api.sys.RRoleService
+//import com.gxzc.zen.umps.common.ZenPermission
+//import com.gxzc.zen.umps.constant.ZenHttpSession
+//import com.gxzc.zen.umps.util.SSOUtil
+//import com.gxzc.zen.umps.util.ShiroRedisUtil
+//import org.apache.shiro.session.Session
+//import org.springframework.data.annotation.Reference
+//import org.springframework.stereotype.Service
+//
+///**
+// * <p>
+// * 权限 服务实现类
+// * </p>
+// *
+// * @author NorthLan123
+// * @since 2018-02-06
+// */
+//@Service
+//@Suppress("UNCHECKED_CAST")
+//class PermissionServiceImpl : IPermissionService {
+//
+//    @Reference(version = "1.0")
+//    private val rPermissionService: RPermissionService? = null
+//
+//    @Reference(version = "1.0")
+//    private val roleService: RRoleService? = null
+//
+//    override fun getAllSysPermission(): MutableList<ZenPermission> {
+//        // 获取权限
+//        var ret = rPermissionService?.getAllPermission()
+//        if (ret == null) {
+//            ret = mutableListOf()
+//        }
+//        return ret
+//    }
+//
+//    override fun getSubjectPermission(): MutableList<ZenPermission> {
+//        val session = SSOUtil.getSession() ?: return mutableListOf()
+//        var result = session.getAttribute(ZenHttpSession.SESSION_KEY_USER_PERMS) as? MutableList<ZenPermission>
+//        if (result == null || result.isEmpty()) {
+//            result = mutableListOf()
+//            val roles = getSubjectRoles(session)
+//            val roleIds = roles.map { it.id!! }
+//
+//            val perms = rPermissionService?.getPermissionByRoleIds(roleIds)
+//            if (perms != null && perms.isNotEmpty()) {
+//                result.addAll(perms)
+//            }
+//        }
+//        if (result.isNotEmpty()) {
+//            session.setAttribute(ZenHttpSession.SESSION_KEY_USER_PERMS, result)
+//        }
+//
+//        return result
+//    }
+//
+//    override fun getSubjectRoles(session: Session): MutableList<SysRole> {
+//        var roles = session.getAttribute(ZenHttpSession.SESSION_KEY_USER_ROLES) as? MutableList<SysRole>
+//        // session中没有怎么办?
+//        if (roles == null || roles.isEmpty()) {
+//            // DB中取出来
+//            roles = roleService!!.getRoleListByUserId(session.getAttribute(ZenHttpSession.SESSION_KEY_USER_ID) as? Long)
+//            session.setAttribute(ZenHttpSession.SESSION_KEY_USER_ROLES, roles)
+//        }
+//        return roles
+//    }
+//
+//    override fun updateAllSysPermission() {
+//        RedisCacheUtil.evict(ZenConstants.CACHE_KEY_SYS, "allPerms")
+//    }
+//
+//    override fun updateAllSessionPermission() {
+//        ShiroRedisUtil.removeAllSessionsAttributeKey(ZenHttpSession.SESSION_KEY_USER_PERMS)
+//    }
+//}

+ 0 - 114
zen-api/src/main/kotlin/com/gxzc/zen/api/util/FileSystemUtil.kt

@@ -1,114 +0,0 @@
-package com.gxzc.zen.api.util
-
-import com.github.tobato.fastdfs.domain.FileInfo
-import com.github.tobato.fastdfs.domain.StorePath
-import com.github.tobato.fastdfs.exception.FdfsServerException
-import com.github.tobato.fastdfs.service.AppendFileStorageClient
-import com.github.tobato.fastdfs.service.FastFileStorageClient
-import com.gxzc.zen.api.sys.model.SysUploadInfo
-import com.gxzc.zen.common.util.FileUtil
-import com.gxzc.zen.common.util.SpringContextHolder
-import com.gxzc.zen.common.util.upload.FdfsFile
-import com.gxzc.zen.rpc.api.sys.RUploadService
-import org.apache.commons.io.FilenameUtils
-import org.slf4j.LoggerFactory
-import java.io.File
-
-/**
- * FastDFS 工具类 <br>
- * 后端上传文件到 分布式文件服务器
- * @author NorthLan
- * @date 2018/9/1
- * @url https://noahlan.com
- */
-object FileSystemUtil {
-    private val logger = LoggerFactory.getLogger(FileSystemUtil::class.java)
-
-    private val appendFileStorageClient: AppendFileStorageClient by lazy { SpringContextHolder.getBean(AppendFileStorageClient::class.java)!! }
-    private val fastFileStorageClient: FastFileStorageClient by lazy { SpringContextHolder.getBean(FastFileStorageClient::class.java)!! }
-    private val rUploadService: RUploadService by lazy { SpringContextHolder.getBean(RUploadService::class.java)!! }
-
-    /**
-     * 上传文件 <br>
-     * 若文件已存在则不会再次上传,且返回新的路径(软链接)
-     * @param path 文件路径
-     * @param groupName 上传到指定组,默认自动分配
-     */
-    fun uploadFile(path: String, groupName: String? = null): StorePath {
-        return uploadFile(File(path), groupName)
-    }
-
-    /**
-     * 上传文件 <br>
-     * 若文件已存在则不会再次上传,且返回新的路径(软链接)
-     * @param path 文件路径
-     * @param groupName 上传到指定组,默认自动分配
-     */
-    fun uploadFile(file: File, groupName: String? = null): StorePath {
-        file.inputStream().use {
-            return appendFileStorageClient.uploadAppenderFile(groupName, it, file.length(), FilenameUtils.getExtension(file.name))
-        }
-    }
-
-    /**
-     * 上传文件并入库 <br>
-     * 若文件已存在则不会再次上传,且返回原有信息
-     * @param path 文件路径
-     * @param groupName 上传到指定组,默认自动分配
-     * @return 数据信息
-     */
-    fun uploadFileDB(path: String, groupName: String? = null): SysUploadInfo? {
-        return uploadFileDB(File(path), groupName)
-    }
-
-    /**
-     * 上传文件并入库 <br>
-     * 若文件已存在则不会再次上传,且返回原有信息
-     * @param path 文件路径
-     * @param groupName 上传到指定组,默认自动分配
-     * @return 数据信息
-     */
-    fun uploadFileDB(file: File, groupName: String? = null): SysUploadInfo? {
-        val md5 = FileUtil.md5HeadTail(file)
-        val fileInfo = rUploadService.getUploadInfoByMd5(md5)
-        if (fileInfo != null) {
-            return fileInfo
-        }
-        val storePath = uploadFile(file, groupName)
-        return rUploadService.addFileInfo(file.name, md5, file.length(), file.lastModified(), file.path, FdfsFile(storePath.group, storePath.path))
-    }
-
-    /**
-     * 查询文件信息
-     * @param groupName 组名
-     * @param path 名
-     * @return 若文件服务器上无此文件,则返回null
-     */
-    fun queryFileInfo(groupName: String, path: String): FileInfo? {
-        return try {
-            fastFileStorageClient.queryFileInfo(groupName, path)
-        } catch (e: FdfsServerException) {
-            null
-        }
-    }
-
-    /**
-     * 下载并保存到指定位置
-     * @param groupName 组名
-     * @param path path
-     * @param outputPath 指定位置(包括文件名,建议使用绝对路径)
-     */
-    fun downloadFile(groupName: String, path: String, outputPath: String): File {
-        return fastFileStorageClient.downloadFile(groupName, path) {
-            FileUtil.writeFile(it, outputPath)
-        }
-    }
-
-    /**
-     * 删除文件
-     * 删除失败抛出异常
-     */
-    fun deleteFile(groupName: String, path: String) {
-        fastFileStorageClient.deleteFile(groupName, path)
-    }
-}

+ 0 - 57
zen-api/src/main/kotlin/com/gxzc/zen/api/util/SysDictUtil.kt

@@ -1,57 +0,0 @@
-package com.gxzc.zen.api.util
-
-import com.gxzc.zen.api.sys.model.SysDictValue
-import com.gxzc.zen.common.util.SpringContextHolder
-import com.gxzc.zen.rpc.api.sys.RDictService
-
-/**
- * 字典工具类
- * @author NorthLan
- * @date 2018/5/7
- * @url https://noahlan.com
- */
-object SysDictUtil {
-//    private var dictValueService: RDictService? = null
-//        get() {
-//            if (field == null) {
-//                field = RpcUtil.getReference(RDictService::class.java,  "1.0")
-//            }
-//            return field
-//        }
-
-    private var dictValueService: RDictService? = null
-        get() {
-            if (field == null) {
-                field = SpringContextHolder.getBean(RDictService::class.java)
-            }
-            return field
-        }
-
-    /**
-     * 获取所有字典值列表
-     */
-    fun getAll(): MutableList<SysDictValue> {
-        return dictValueService!!.getListCacheable()
-    }
-
-    /**
-     * 根据code前缀获取字典值列表
-     */
-    fun getListByPrefix(prefix: String): MutableList<SysDictValue> {
-        return dictValueService!!.getDictValueListByTypeCode(prefix)
-    }
-
-    /**
-     * 根据code和value直接获取字典值
-     */
-    fun getValueByCV(code: String, value: String): SysDictValue? {
-        return dictValueService!!.getDictValueByCodeAndValue(code, value)
-    }
-
-    /**
-     * 根据prefix和value直接获取字典值
-     */
-    fun getValueByPV(prefix: String, value: String): SysDictValue? {
-        return dictValueService!!.getDictValueByPrefixAndValue(prefix, value)
-    }
-}

+ 0 - 26
zen-api/src/main/kotlin/com/gxzc/zen/api/util/SysParamUtil.kt

@@ -1,26 +0,0 @@
-package com.gxzc.zen.api.util
-
-import com.gxzc.zen.api.sys.model.SysParam
-import com.gxzc.zen.common.util.SpringContextHolder
-import com.gxzc.zen.rpc.api.sys.RParamService
-
-/**
- * 系统参数工具类
- * 缓存中获取
- * @author NorthLan
- * @date 2018/3/19
- * @url https://noahlan.com
- */
-object SysParamUtil {
-    private var sysParamService: RParamService? = null
-        get() {
-            if (field == null) {
-                field = SpringContextHolder.getBean(RParamService::class.java)
-            }
-            return field
-        }
-
-    fun getByKey(key: String): SysParam? {
-        return sysParamService!!.getByKey(key)
-    }
-}

+ 0 - 44
zen-api/src/main/kotlin/com/gxzc/zen/logging/MQLogHelper.kt

@@ -1,44 +0,0 @@
-package com.gxzc.zen.logging
-
-import com.gxzc.zen.logging.model.MQLog
-
-/**
- * MQLog 帮助类 (即时性) <br>
- * 实现手动配置Ignore,remark等
- * @author NorthLan
- * @date 2018/9/2
- * @url https://noahlan.com
- */
-object MQLogHelper {
-    private val LOCAL_LOG = ThreadLocal<MQLog>()
-
-    private fun setLocalLog(log: MQLog) {
-        LOCAL_LOG.set(log)
-    }
-
-    /**
-     * 获取MQLog参数
-     */
-    fun getLocalLog(): MQLog? {
-        return LOCAL_LOG.get()
-    }
-
-    /**
-     * 清除本地变量(线程局部变量)
-     */
-    fun clearLog() {
-        LOCAL_LOG.remove()
-    }
-
-    /**
-     * 开始配置Log信息
-     */
-    fun configLog(ignore: Boolean = false, remark: String? = null) {
-        val log = MQLog(ignore, remark)
-        setLocalLog(log)
-    }
-
-    fun isConfigurable(): Boolean {
-        return getLocalLog() != null
-    }
-}

+ 0 - 173
zen-api/src/main/kotlin/com/gxzc/zen/logging/aop/LogDBInterceptor.kt

@@ -1,173 +0,0 @@
-package com.gxzc.zen.logging.aop
-
-import com.alibaba.dubbo.common.logger.LoggerFactory
-import com.baomidou.mybatisplus.toolkit.PluginUtils
-import com.gxzc.zen.logging.MQLogHelper
-import com.gxzc.zen.logging.constants.LogConstants
-import com.gxzc.zen.logging.util.MQLogUtil
-import net.sf.jsqlparser.parser.CCJSqlParserUtil
-import net.sf.jsqlparser.schema.Table
-import net.sf.jsqlparser.statement.delete.Delete
-import net.sf.jsqlparser.statement.insert.Insert
-import net.sf.jsqlparser.statement.select.PlainSelect
-import net.sf.jsqlparser.statement.select.Select
-import net.sf.jsqlparser.statement.update.Update
-import org.apache.ibatis.executor.statement.StatementHandler
-import org.apache.ibatis.mapping.BoundSql
-import org.apache.ibatis.mapping.MappedStatement
-import org.apache.ibatis.mapping.SqlCommandType
-import org.apache.ibatis.plugin.*
-import org.apache.ibatis.reflection.SystemMetaObject
-import org.springframework.stereotype.Component
-import java.sql.Connection
-import java.util.*
-import java.util.concurrent.ConcurrentHashMap
-
-
-/**
- * DB日志拦截器 SQLParse 拦截
- * @author NorthLan
- * @date 2018/8/24
- * @url https://noahlan.com
- */
-@Intercepts(Signature(type = StatementHandler::class, method = "prepare", args = [Connection::class, Integer::class]))
-@Component
-class LogDBInterceptor : Interceptor {
-    companion object {
-        private val logger = LoggerFactory.getLogger(LogDBInterceptor::class.java)
-
-        // 缓存表名信息,提高性能
-        private val tableNameMapping = ConcurrentHashMap<String, String>()
-    }
-
-    override fun intercept(invocation: Invocation): Any {
-        // 判定是否需要执行Log记录
-        try {
-            var needLog = true
-            if (MQLogHelper.isConfigurable()) {
-                val mqLog = MQLogHelper.getLocalLog()!!
-                needLog = !mqLog.ignore
-            }
-            // 若不需要记录Log信息则直接返回
-            if (!needLog) {
-                return invocation.proceed()
-            }
-            logger.debug("操作数据库日志记录开始...")
-            val startTime = Date()
-            val statementHandler = PluginUtils.realTarget(invocation.target) as StatementHandler
-            val metaObject = SystemMetaObject.forObject(statementHandler)
-            // 获取SQL操作类型
-            val mappedStatement = metaObject.getValue("delegate.mappedStatement") as MappedStatement
-            val boundSql = metaObject.getValue("delegate.boundSql") as BoundSql
-            if (boundSql.sql.startsWith("show table")) {
-                return invocation.proceed()
-            }
-            // 消息构造
-            val type: Int
-            val sql = boundSql.sql
-
-            val statement = try {
-                CCJSqlParserUtil.parse(sql)
-            } catch (e: Throwable) {
-                // 解析出错直接交给后续处理,不再记录Log了
-                logger.error("sql解析出错,不再发送记录Log消息. cause ", e)
-                return invocation.proceed()
-            }
-
-            var dbName: String? = null
-            var tableName: String? = null
-            val table: Table?
-
-            try {
-                // 操作类型
-                when (mappedStatement.sqlCommandType) {
-                    SqlCommandType.SELECT -> {
-                        val plainSelect = (statement as Select).selectBody as PlainSelect
-                        table = (plainSelect.fromItem as Table)
-                        type = LogConstants.DB_TYPE_SELECT
-                    }
-                    SqlCommandType.DELETE -> {
-                        table = (statement as Delete).table
-                        type = LogConstants.DB_TYPE_DELETE
-                    }
-                    SqlCommandType.INSERT -> {
-                        table = (statement as Insert).table
-                        type = LogConstants.DB_TYPE_INSERT
-                    }
-                    SqlCommandType.UPDATE -> {
-                        table = (statement as Update).tables[0]
-                        type = LogConstants.DB_TYPE_UPDATE
-                    }
-                    else -> {
-                        // 直接跳过
-                        return invocation.proceed()
-                    }
-                }
-            } catch (e: Throwable) {
-                return invocation.proceed()
-            }
-
-            if (table != null) {
-                val tableArr = table.name.split("\\.")
-                if (tableArr.size == 1) {
-                    tableName = tableArr[0]
-                } else {
-                    dbName = tableArr[0]
-                    tableName = tableArr[1]
-                }
-            }
-            // 执行
-            val result = invocation.proceed()
-
-            // 发消息
-            MQLogUtil.logDB(
-                    type,
-                    sql,
-                    tableName,
-                    getTableNameCN(tableName, invocation.args[0] as Connection, dbName),
-                    if (MQLogHelper.isConfigurable()) {
-                        MQLogHelper.getLocalLog()!!.remark
-                    } else {
-                        null
-                    },
-                    startTime)
-            return result
-        } finally {
-            MQLogHelper.clearLog()
-        }
-
-    }
-
-    override fun plugin(target: Any): Any {
-        return if (target is StatementHandler) {
-            Plugin.wrap(target, this)
-        } else {
-            target
-        }
-    }
-
-    override fun setProperties(properties: Properties?) {
-    }
-
-    private fun getTableNameCN(tableName: String?, conn: Connection, dbName: String? = null): String? {
-        if (tableNameMapping.containsKey(tableName)) {
-            return tableNameMapping[tableName]!!
-        }
-        // 读取表信息并存入缓存中
-        val metaData = conn.metaData
-        val rs = metaData.getTables(dbName, dbName, null, null)
-        while (rs.next()) {
-            val tName = rs.getString("TABLE_NAME")
-            val remarks = rs.getString("REMARKS")
-            if (tName != null && remarks != null) {
-                tableNameMapping[tName] = remarks
-            }
-        }
-        // 再次读取缓存信息
-        return if (tableNameMapping.containsKey(tableName)) {
-            tableNameMapping[tableName]!!
-        } else {
-            null
-        }
-    }
-}

+ 0 - 127
zen-api/src/main/kotlin/com/gxzc/zen/logging/aop/LogRequestAspect.kt

@@ -1,127 +0,0 @@
-package com.gxzc.zen.logging.aop
-
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.gxzc.zen.logging.annotation.LogAnnotation
-import com.gxzc.zen.logging.model.LogRequest
-import com.gxzc.zen.logging.util.MQLogUtil
-import org.aspectj.lang.ProceedingJoinPoint
-import org.aspectj.lang.annotation.Around
-import org.aspectj.lang.annotation.Aspect
-import org.aspectj.lang.annotation.Pointcut
-import org.aspectj.lang.reflect.MethodSignature
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.core.annotation.Order
-import org.springframework.stereotype.Component
-import org.springframework.web.bind.annotation.RequestBody
-import org.springframework.web.context.request.RequestContextHolder
-import org.springframework.web.context.request.ServletRequestAttributes
-import java.util.*
-
-/**
- *
- * @author NorthLan
- * @date 2018/8/23
- * @url https://noahlan.com
- */
-@Suppress("unused")
-@Aspect
-@Order(1)
-@Component
-class LogRequestAspect {
-    companion object {
-        private val logger = LoggerFactory.getLogger(LogRequestAspect::class.java)
-    }
-
-    @Autowired
-    private lateinit var mapper: ObjectMapper
-
-    /**
-     * 拦截所有 Controller结尾 的所有方法
-     */
-    @Pointcut("execution(* com.gxzc.zen..*Controller.*(..)))")
-    fun controllerCut() {
-    }
-
-    @Around("controllerCut()")
-    fun after(joinPoint: ProceedingJoinPoint): Any? {
-        val method = (joinPoint.signature as MethodSignature).method
-        val logAnnotation = method.getAnnotation(LogAnnotation::class.java)
-        var remark: String? = null
-        if (logAnnotation != null) {
-            if (logAnnotation.ignore) {
-                return joinPoint.proceed()
-            }
-            remark = logAnnotation.remark
-        }
-        val fullMethodName = method.declaringClass.name + "." + method.name
-        var requestBody: Any? = null
-
-        var i = -1
-        method.parameterAnnotations.forEach { annotations ->
-            ++i
-            annotations.forEach {
-                if (it is RequestBody) {
-                    requestBody = joinPoint.args[i]
-                }
-            }
-        }
-
-        val attr = RequestContextHolder.getRequestAttributes() as? ServletRequestAttributes
-                ?: return joinPoint.proceed()
-        val request = attr.request
-
-        val requestUri = request.requestURI
-        val remoteHost = request.remoteHost
-
-        val requestMethod = request.method
-        val requestParam = request.queryString
-
-        val data = LogRequest().apply {
-            this.requestUri = requestUri
-            this.requestMethod = requestMethod
-            this.requestParam = requestParam
-            this.requestBody = mapper.writeValueAsString(requestBody)
-            //            this.responseBody = mapper.writeValueAsString(result)
-            this.remoteHost = remoteHost
-            this.method = fullMethodName
-            //            this.exMsg = exMsg
-            this.remark = remark
-        }
-        val startTime = Date()
-        return try {
-
-            val result = joinPoint.proceed()
-
-            data.apply {
-                this.responseBody = mapper.writeValueAsString(result)
-                this.operatorStartTime = startTime
-                this.operatorEndTime = Date()
-            }
-            MQLogUtil.logRequest(data)
-            result
-        } catch (e: Throwable) {
-            // 运行时异常(保留5最近异常栈)
-            var exMsg = e.javaClass.name + " : " + e.message + "\r\n"
-            run breaking@{
-                e.stackTrace.forEachIndexed { index, it ->
-                    if (index > 4) {
-                        return@breaking
-                    }
-                    exMsg += it
-                    exMsg += "\r\n"
-                }
-            }
-            exMsg += "......"
-
-            data.apply {
-                this.exMsg = exMsg
-                this.operatorStartTime = startTime
-                this.operatorEndTime = Date()
-            }
-
-            MQLogUtil.logRequest(data)
-            throw e
-        }
-    }
-}

+ 0 - 26
zen-api/src/main/kotlin/com/gxzc/zen/logging/constants/LogConstants.kt

@@ -1,26 +0,0 @@
-package com.gxzc.zen.logging.constants
-
-/**
- * 日志各种常量
- * @author NorthLan
- * @date 2018/8/23
- * @url https://noahlan.com
- */
-object LogConstants {
-    /*-------------------------------------------
-    |              登 录 日 志 常 量              |
-    ============================================*/
-    const val AUTH_TYPE_LOGIN = 1 // 登录
-    const val AUTH_TYPE_LOGOUT = 2 // 登出
-
-    const val AUTH_METHOD_ACCOUNT_PASSWORD = 1 // 账号密码登录
-    const val AUTH_METHOD_USBKEY = 2 // 通过 USBKEY 登陆
-
-    /*-------------------------------------------
-    |               D B 日 志 常 量              |
-    ============================================*/
-    const val DB_TYPE_INSERT = 1 // 新增
-    const val DB_TYPE_UPDATE = 2 // 修改
-    const val DB_TYPE_DELETE = 3 // 删除
-    const val DB_TYPE_SELECT = 4 // 查询
-}

+ 0 - 120
zen-api/src/main/kotlin/com/gxzc/zen/logging/util/MQLogUtil.kt

@@ -1,120 +0,0 @@
-package com.gxzc.zen.logging.util
-
-import com.gxzc.zen.common.util.PlatformUtil
-import com.gxzc.zen.logging.model.LogAuth
-import com.gxzc.zen.logging.model.LogBiz
-import com.gxzc.zen.logging.model.LogDB
-import com.gxzc.zen.logging.model.LogRequest
-import com.gxzc.zen.msg.mq.MQProducerUtil
-import com.gxzc.zen.msg.mq.constants.MQConstants
-import com.gxzc.zen.umps.util.SSOUtil
-import com.maihaoche.starter.mq.base.MessageBuilder
-import org.apache.rocketmq.client.producer.SendCallback
-import org.apache.rocketmq.client.producer.SendResult
-import org.slf4j.LoggerFactory
-import java.util.*
-
-/**
- * 基于消息队列MQ的日志工具类
- * @author NorthLan
- * @date 2018/8/23
- * @url https://noahlan.com
- */
-object MQLogUtil {
-    private val logger = LoggerFactory.getLogger(MQLogUtil::class.java)
-    private val mqProducer = MQProducerUtil.producer!!
-
-    /**
-     * 发送登陆日志消息
-     */
-    fun logAuth(logAuth: LogAuth) {
-        mqProducer.asyncSend(MessageBuilder.of(logAuth).topic(MQConstants.TOPIC_LOGS).tag(MQConstants.TAGS_LOGS_AUTH).build(),
-                object : SendCallback {
-                    override fun onException(e: Throwable) {
-                        logger.error("Send logAuth error, cause ", e)
-                    }
-
-                    override fun onSuccess(sendResult: SendResult) {
-                        logger.debug("Send logAuth success! {0}", sendResult.sendStatus)
-                    }
-                })
-    }
-
-    /**
-     * 发送请求日志消息
-     */
-    fun logRequest(logRequest: LogRequest) {
-        logRequest.apply {
-            this.platformId = PlatformUtil.getPlatformId()
-            this.operatorAccount = SSOUtil.getCurAccount()
-            this.operatorName = SSOUtil.getCurUserName()
-        }
-        mqProducer.asyncSend(MessageBuilder.of(logRequest).topic(MQConstants.TOPIC_LOGS).tag(MQConstants.TAGS_LOGS_REQUEST).build(),
-                object : SendCallback {
-                    override fun onException(e: Throwable) {
-                        logger.error("Send logRequest error, cause ", e)
-                    }
-
-                    override fun onSuccess(sendResult: SendResult) {
-                        logger.debug("Send logRequest success! " + sendResult.sendStatus)
-                    }
-                })
-    }
-
-    /**
-     * 发送DB日志消息
-     */
-    fun logDB(type: Int, sql: String?, tableId: String?, tableName: String?, remark: String?, startTime: Date, endTime: Date = Date()) {
-        val logDB = LogDB().apply {
-            this.platformId = PlatformUtil.getPlatformId()
-            this.operatorStartTime = startTime
-            this.operatorEndTime = endTime
-            this.operatorAccount = SSOUtil.getCurAccount()
-            this.operatorName = SSOUtil.getCurUserName()
-            this.type = type
-            this.sql = sql
-            this.tableId = tableId
-            this.tableName = tableName
-            this.remark = remark
-        }
-        mqProducer.asyncSend(MessageBuilder.of(logDB).topic(MQConstants.TOPIC_LOGS).tag(MQConstants.TAGS_LOGS_DB).build(),
-                object : SendCallback {
-                    override fun onException(e: Throwable) {
-                        logger.error("Send logDB error, cause ", e)
-                    }
-
-                    override fun onSuccess(sendResult: SendResult) {
-                        logger.debug("Send logDB success! {0}", sendResult.sendStatus)
-                    }
-                })
-    }
-
-    /**
-     * 发送业务日志消息
-     */
-    fun logBiz(bizCode: String, bizContent: String, remark: String?, startTime: Date, endTime: Date = Date()) {
-        MQLogUtil.logBizInner(LogBiz().apply {
-            this.bizCode = bizCode
-            this.bizContent = bizContent
-            this.platformId = PlatformUtil.getPlatformId()
-            this.operatorAccount = SSOUtil.getCurAccount()
-            this.operatorName = SSOUtil.getCurUserName()
-            this.operatorStartTime = startTime
-            this.operatorEndTime = endTime
-            this.remark = remark
-        })
-    }
-
-    private fun logBizInner(logBiz: LogBiz) {
-        mqProducer.asyncSend(MessageBuilder.of(logBiz).topic(MQConstants.TOPIC_LOGS).tag(MQConstants.TAGS_LOGS_BIZ).build(),
-                object : SendCallback {
-                    override fun onException(e: Throwable) {
-                        logger.error("Send logBiz error, cause ", e)
-                    }
-
-                    override fun onSuccess(sendResult: SendResult) {
-                        logger.debug("Send logBiz success! {0}", sendResult.sendStatus)
-                    }
-                })
-    }
-}

+ 0 - 17
zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/MQConfiguration.kt

@@ -1,17 +0,0 @@
-package com.gxzc.zen.msg.mq
-
-import com.maihaoche.starter.mq.annotation.EnableMQConfiguration
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
-import org.springframework.context.annotation.Configuration
-
-/**
- *
- * @author NorthLan
- * @date 2018/8/23
- * @url https://noahlan.com
- */
-@Configuration
-@ConditionalOnProperty(prefix = "spring.rocketmq", name = ["enabled"], havingValue = "true")
-@EnableMQConfiguration
-class MQConfiguration {
-}

+ 0 - 19
zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/MQProducerUtil.kt

@@ -1,19 +0,0 @@
-package com.gxzc.zen.msg.mq
-
-import com.gxzc.zen.common.util.SpringContextHolder
-
-/**
- * MQ生产者工具类
- * @author NorthLan
- * @date 2018/8/23
- * @url https://noahlan.com
- */
-object MQProducerUtil {
-    var producer: ZenMQProducer? = null
-        get() {
-            if (field == null) {
-                field = SpringContextHolder.getBean(ZenMQProducer::class.java)
-            }
-            return field
-        }
-}

+ 0 - 16
zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/ZenMQProducer.kt

@@ -1,16 +0,0 @@
-package com.gxzc.zen.msg.mq
-
-import com.maihaoche.starter.mq.annotation.EnableMQConfiguration
-import com.maihaoche.starter.mq.annotation.MQProducer
-import com.maihaoche.starter.mq.base.AbstractMQProducer
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
-
-/**
- * MQ 消息生产者
- * @author NorthLan
- * @date 2018/8/21
- * @url https://noahlan.com
- */
-@MQProducer
-@ConditionalOnBean(annotation = [EnableMQConfiguration::class])
-class ZenMQProducer : AbstractMQProducer()

+ 0 - 31
zen-api/src/main/kotlin/com/gxzc/zen/msg/mq/constants/MQConstants.kt

@@ -1,31 +0,0 @@
-package com.gxzc.zen.msg.mq.constants
-
-/**
- * MQ 各种常量
- * @author NorthLan
- * @date 2018/8/23
- * @url https://noahlan.com
- */
-object MQConstants {
-    /*-------------------------------------------
-    |                Topic 常 量                |
-    ============================================*/
-    const val TOPIC_LOGS = "topic_logs" // logs系统的topic
-
-    /*-------------------------------------------
-    |                TAGS 常 量                 |
-    ============================================*/
-    const val TAGS_LOGS_AUTH = "auth" // 登录
-    const val TAGS_LOGS_REQUEST = "request" // 请求
-    const val TAGS_LOGS_DB = "db" // 数据库操作
-    const val TAGS_LOGS_BIZ = "biz" // 业务
-
-
-    /*-------------------------------------------
-    |            Consumer Group 常 量            |
-    ============================================*/
-    const val CONSUMER_GROUP_LOGS_AUTH = "group_logs_auth" // 登录TAG-消费组
-    const val CONSUMER_GROUP_LOGS_REQUEST = "group_logs_request" // 请求TAG-消费组
-    const val CONSUMER_GROUP_LOGS_DB = "group_logs_db" // 数据库操作TAG-消费组
-    const val CONSUMER_GROUP_LOGS_BIZ = "group_logs_biz" // 业务TAG-消费组
-}

+ 5 - 9
zen-api/src/main/kotlin/com/gxzc/zen/orm/Generator.kt

@@ -1,12 +1,13 @@
 package com.gxzc.zen.orm
 
+import com.baomidou.mybatisplus.annotation.DbType
 import com.baomidou.mybatisplus.generator.AutoGenerator
 import com.baomidou.mybatisplus.generator.InjectionConfig
 import com.baomidou.mybatisplus.generator.config.*
 import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert
 import com.baomidou.mybatisplus.generator.config.po.TableInfo
 import com.baomidou.mybatisplus.generator.config.rules.DbColumnType
-import com.baomidou.mybatisplus.generator.config.rules.DbType
+import com.baomidou.mybatisplus.generator.config.rules.IColumnType
 import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy
 import java.io.File
 
@@ -19,11 +20,7 @@ import java.io.File
 fun main(args: Array<String>) {
     generate(true, "NorthLan", "test", DataSourceConfig().also {
         it.dbType = DbType.MYSQL
-        it.typeConvert = object : MySqlTypeConvert() {
-            override fun processTypeConvert(fieldType: String?): DbColumnType {
-                return super.processTypeConvert(fieldType)
-            }
-        }
+        it.typeConvert = MySqlTypeConvert()
         it.driverName = "com.mysql.jdbc.Driver"
         it.username = "archives"
         it.password = "archives"
@@ -72,7 +69,6 @@ fun generate(isKotlin: Boolean, author: String, pkgType: String, dataSourceConfi
 
     // 策略配置
     mpg.strategy = StrategyConfig().also {
-        it.setDbColumnUnderline(true)
         it.isEntityLombokModel = true
         it.isEntityLombokModel = true
         it.isCapitalMode = false
@@ -80,8 +76,8 @@ fun generate(isKotlin: Boolean, author: String, pkgType: String, dataSourceConfi
 //        it.setTablePrefix("t")
         it.superEntityClass = "com.gxzc.zen.common.base.BaseModel"
         it.setSuperEntityColumns("id", "create_by", "create_time", "update_by", "update_time", "remark", "enable")
-        it.superMapperClass = "com.gxzc.zen.common.base.BaseMapper"
-        it.superServiceClass = "com.gxzc.zen.common.base.BaseService"
+        it.superMapperClass = "com.gxzc.zen.common.base.IBaseMapper"
+        it.superServiceClass = "com.gxzc.zen.common.base.IBaseService"
         it.superServiceImplClass = "com.baomidou.mybatisplus.service.impl.ServiceImpl"
 //            superControllerClass = ""
         it.setInclude("sys_upload_info")

+ 2 - 3
zen-api/src/main/kotlin/com/gxzc/zen/orm/config/CustomMetaObjectHandler.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.orm.config
 
-import com.baomidou.mybatisplus.mapper.MetaObjectHandler
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
 import com.gxzc.zen.umps.util.SSOUtil
 import org.apache.ibatis.reflection.MetaObject
 import org.slf4j.LoggerFactory
@@ -14,8 +14,7 @@ import java.util.*
  * @date 2018/1/31
  * @url https://noahlan.com
  */
-@Component
-class CustomMetaObjectHandler : MetaObjectHandler() {
+class CustomMetaObjectHandler : MetaObjectHandler {
     companion object {
         val logger = LoggerFactory.getLogger(CustomMetaObjectHandler::class.java)!!
     }

+ 7 - 9
zen-api/src/main/kotlin/com/gxzc/zen/orm/config/MybatisPlusConfig.kt

@@ -1,7 +1,7 @@
 package com.gxzc.zen.orm.config
 
-import com.baomidou.mybatisplus.plugins.PaginationInterceptor
-import com.gxzc.zen.orm.data.authority.interceptor.ZenDataAuthorityInterceptor
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
 import org.mybatis.spring.annotation.MapperScan
 import org.springframework.context.annotation.Bean
 import org.springframework.context.annotation.Configuration
@@ -31,11 +31,9 @@ class MybatisPlusConfig {
         return PaginationInterceptor()
     }
 
-//    /**
-//     * 数据权限插件
-//     */
-//    @Bean
-//    fun zenDataAuthorityInterceptor(): ZenDataAuthorityInterceptor {
-//        return ZenDataAuthorityInterceptor()
-//    }
+    @Bean
+    fun metaObjectHandler(): MetaObjectHandler {
+        return CustomMetaObjectHandler()
+    }
+
 }

+ 0 - 107
zen-api/src/main/kotlin/com/gxzc/zen/orm/config/ZenSqlInjector.kt

@@ -1,107 +0,0 @@
-package com.gxzc.zen.orm.config
-
-import com.baomidou.mybatisplus.entity.TableInfo
-import com.baomidou.mybatisplus.enums.FieldFill
-import com.baomidou.mybatisplus.enums.IdType
-import com.baomidou.mybatisplus.mapper.LogicSqlInjector
-import com.baomidou.mybatisplus.toolkit.StringUtils
-import com.baomidou.mybatisplus.toolkit.TableInfoHelper
-import org.apache.ibatis.builder.MapperBuilderAssistant
-import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator
-import org.apache.ibatis.executor.keygen.KeyGenerator
-import org.apache.ibatis.executor.keygen.NoKeyGenerator
-import org.apache.ibatis.session.Configuration
-import org.springframework.stereotype.Component
-
-
-/**
- * 自定义 injector 继承自 LogicSqlInjector 同时实现逻辑删注入
- * 为几个公共自定义方法提供 sql 构建
- *
- * updateWOLogic
- * physicalDelete
- *
- * @author NorthLan
- * @date 2018/3/30
- * @url https://noahlan.com
- */
-@Component
-class ZenSqlInjector : LogicSqlInjector() {
-
-    override fun inject(configuration: Configuration, builderAssistant: MapperBuilderAssistant, mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-        super.inject(configuration, builderAssistant, mapperClass, modelClass, table)
-//        this.testSelect(mapperClass, modelClass, table)
-        this.updateWOLogic(mapperClass, modelClass, table)
-        this.physicalDeleteById(mapperClass, modelClass, table)
-        this.physicalDelete(mapperClass, modelClass, table)
-        this.selectWOLogic(mapperClass, modelClass, table)
-        this.selectWOLogicPage(mapperClass, modelClass, table)
-    }
-
-//    fun testSelect(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-//        val sqlMethod = "testSelect"
-//        val sql = "<script>SELECT ${sqlSelectColumns(table, true)} FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
-//        val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
-//        this.addSelectMappedStatement(mapperClass, sqlMethod, sqlSource, modelClass, table)
-//    }
-
-    fun updateWOLogic(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-        val sqlMethod = "updateWOLogic"
-        val sql = "<script>UPDATE ${table.tableName} ${sqlSet(true, table, "et.")} ${zenSqlWhereEntityWrapper(table)}</script>"
-        val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
-        this.addUpdateMappedStatement(mapperClass, modelClass, sqlMethod, sqlSource)
-    }
-
-    fun physicalDeleteById(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-        val sqlMethod = "physicalDeleteById"
-        val sql = "<script>DELETE FROM ${table.tableName} WHERE ${table.keyColumn} = #{${table.keyProperty}}</script>"
-        val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
-        this.addDeleteMappedStatement(mapperClass, sqlMethod, sqlSource)
-    }
-
-    fun physicalDelete(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-        val sqlMethod = "physicalDelete"
-        val sql = "<script>DELETE FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
-        val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
-        this.addDeleteMappedStatement(mapperClass, sqlMethod, sqlSource)
-    }
-
-    fun selectWOLogic(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-        val sqlMethod = "selectWOLogic"
-        val sql = "<script>SELECT ${sqlSelectColumns(table, true)} FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
-        val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
-        this.addSelectMappedStatement(mapperClass, sqlMethod, sqlSource, modelClass, table)
-    }
-
-    fun selectWOLogicPage(mapperClass: Class<*>, modelClass: Class<*>, table: TableInfo) {
-        val sqlMethod = "selectWOLogicPage"
-        val sql = "<script>SELECT ${sqlSelectColumns(table, true)} FROM ${table.tableName} ${zenSqlWhereEntityWrapper(table)}</script>"
-        val sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass)
-        this.addSelectMappedStatement(mapperClass, sqlMethod, sqlSource, modelClass, table)
-    }
-
-    fun zenSqlWhereEntityWrapper(table: TableInfo): String {
-        val where = StringBuilder(128)
-        where.append("\n<where>")
-        where.append("\n<if test=\"ew!=null\">")
-        where.append("\n<if test=\"ew.entity!=null\">")
-        if (StringUtils.isNotEmpty(table.keyProperty)) {
-            where.append("\n<if test=\"ew.entity.").append(table.keyProperty).append("!=null\">\n")
-            where.append(table.keyColumn).append("=#{ew.entity.").append(table.keyProperty).append("}")
-            where.append("\n</if>")
-        }
-        val fieldList = table.fieldList
-        for (fieldInfo in fieldList) {
-            where.append(convertIfTag(fieldInfo, "ew.entity.", false))
-            where.append(" AND ").append(this.sqlCondition(fieldInfo.condition,
-                    fieldInfo.column, "ew.entity." + fieldInfo.el))
-            where.append(convertIfTag(fieldInfo, true))
-        }
-        where.append("\n</if>")
-        where.append("\n<if test=\"ew!=null and ew.sqlSegment!=null and ew.notEmptyOfWhere\">\n\${ew.sqlSegment}\n</if>")
-        where.append("\n</if>")
-        where.append("\n</where>")
-        where.append("\n<if test=\"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere\">\n\${ew.sqlSegment}\n</if>")
-        return where.toString()
-    }
-}

+ 0 - 148
zen-api/src/main/kotlin/com/gxzc/zen/orm/data/authority/interceptor/ZenDataAuthorityInterceptor.kt

@@ -1,148 +0,0 @@
-package com.gxzc.zen.orm.data.authority.interceptor
-
-import com.baomidou.mybatisplus.plugins.SqlParserHandler
-import com.baomidou.mybatisplus.toolkit.PluginUtils
-import com.gxzc.zen.api.util.SysParamUtil
-import com.gxzc.zen.common.contants.ZenConstants
-import com.gxzc.zen.orm.data.authority.DAHelper
-import com.gxzc.zen.orm.data.authority.visitor.DataAuthoritySelectVisitor
-import com.gxzc.zen.umps.util.SSOUtil
-import net.sf.jsqlparser.parser.CCJSqlParserManager
-import net.sf.jsqlparser.statement.select.Select
-import org.apache.ibatis.executor.statement.StatementHandler
-import org.apache.ibatis.mapping.BoundSql
-import org.apache.ibatis.mapping.MappedStatement
-import org.apache.ibatis.mapping.SqlCommandType
-import org.apache.ibatis.plugin.*
-import org.apache.ibatis.reflection.SystemMetaObject
-import org.slf4j.LoggerFactory
-import java.io.StringReader
-import java.sql.Connection
-import java.util.*
-
-/**
- * 数据权限 <br>
- * Sql拦截器 <br>
- *     拦截 SELECT <br>
- *     注入查询条件
- * @author NorthLan
- * @date 2018/7/6
- * @url https://noahlan.com
- */
-@Intercepts(Signature(type = StatementHandler::class, method = "prepare", args = [Connection::class, java.lang.Integer::class]))
-open class ZenDataAuthorityInterceptor : SqlParserHandler(), Interceptor {
-    companion object {
-        private val log = LoggerFactory.getLogger(ZenDataAuthorityInterceptor::class.java)
-    }
-
-    private val parserManager = CCJSqlParserManager()
-
-    override fun intercept(invocation: Invocation): Any {
-        if (!validate()) {
-            return invocation.proceed()
-        }
-
-
-        // 未登录,不执行数权拦截
-        if (!SSOUtil.isLogin()) {
-            return invocation.proceed()
-        }
-
-        // 当前账户名
-        val currentAccount = SSOUtil.getCurAccount()
-        if (currentAccount.isNullOrEmpty()) {
-            return invocation.proceed()
-        }
-
-        // 权限总开关
-        if (ZenConstants.FALSE == SysParamUtil.getByKey(ZenConstants.PARAMKEY_SYS_DA_ENABLED)?.value) {
-            return invocation.proceed()
-        }
-
-        // 超级管理员
-        val superAccountList = SysParamUtil.getByKey(ZenConstants.PARAMKEY_SUPER_ACCOUNT)?.value
-                ?: return invocation.proceed()
-        if (currentAccount!! in superAccountList) {
-            return invocation.proceed()
-        }
-
-        // ThreadLocal 先序判定是否启用 系统 数据权限
-        val da = DAHelper.getDA()
-        if (da != null) {
-            if (!da.sysDAEnabled) {
-
-            }
-        }
-
-
-        // 当前操作员的数据权限(人员+部门+角色)(业务数权交由后续链处理)
-
-        val statementHandler = PluginUtils.realTarget(invocation.target) as StatementHandler
-        val metaObject = SystemMetaObject.forObject(statementHandler)
-        this.sqlParser(metaObject)
-        // 获取SQL操作类型
-        val mappedStatement = metaObject.getValue("delegate.mappedStatement") as MappedStatement
-
-        val boundSql = metaObject.getValue("delegate.boundSql") as BoundSql
-        val originalSql = boundSql.sql
-
-        when (mappedStatement.sqlCommandType) {
-            SqlCommandType.SELECT -> {
-                // 仅查询 本部门+子部门 + 特殊 人员创建的数据
-                val select = parserManager.parse(StringReader(originalSql)) as Select
-                select.selectBody.accept(DataAuthoritySelectVisitor())
-                metaObject.setValue("delegate.boundSql.sql", select.toString())
-            }
-            SqlCommandType.DELETE,
-            SqlCommandType.INSERT,
-            SqlCommandType.UPDATE -> {
-                // 判断权限是否足够
-            }
-            else -> {
-                return invocation.proceed()
-            }
-        }
-        return invocation.proceed()
-    }
-
-    /**
-     * 数据权限 断言验证
-     */
-    private fun validate(): Boolean {
-        // 未登录,不执行数权拦截
-        if (!SSOUtil.isLogin()) {
-            return false
-        }
-
-        // 当前账户名
-        val currentAccount = SSOUtil.getCurAccount()
-        if (currentAccount.isNullOrEmpty()) {
-            return false
-        }
-
-        // 权限总开关
-        if (ZenConstants.FALSE == SysParamUtil.getByKey(ZenConstants.PARAMKEY_SYS_DA_ENABLED)?.value) {
-            return false
-        }
-
-        // 超级管理员
-        val superAccountList = SysParamUtil.getByKey(ZenConstants.PARAMKEY_SUPER_ACCOUNT)?.value
-                ?: return false
-        if (currentAccount!! in superAccountList) {
-            return false
-        }
-
-        return true
-    }
-
-    override fun plugin(target: Any): Any {
-        return if (target is StatementHandler) {
-            Plugin.wrap(target, this)
-        } else {
-            target
-        }
-    }
-
-    override fun setProperties(properties: Properties) {
-    }
-}

+ 0 - 13
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/TestRpcService.kt

@@ -1,13 +0,0 @@
-//package com.gxzc.zen.rpc.api
-//
-///**
-// * 示例代码(接口)
-// * A/B 业务系统定义一个统一的接口,此接口需按照实际实现的业务系统进行划分
-// * A/B 业务系统间要定义一个统一的数据模型以便进行交互(不建议直接使用string)
-// * @author NorthLan
-// * @date 2018/5/7
-// * @url https://noahlan.com
-// */
-//interface TestRpcService {
-//    fun sayHello(name: String): String
-//}

+ 0 - 36
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RDictService.kt

@@ -1,36 +0,0 @@
-package com.gxzc.zen.rpc.api.sys
-
-import com.gxzc.zen.api.sys.model.SysDictValue
-
-/**
- *
- * @author NorthLan
- * @date 2018/6/20
- * @url https://noahlan.com
- */
-interface RDictService {
-    /**
-     * 获取缓存中所有的 字典值
-     */
-    fun getListCacheable(): MutableList<SysDictValue>
-
-    /**
-     * 根据type_code(code前缀)获取字典值列表
-     */
-    fun getDictValueListByTypeCode(typeCode: String): MutableList<SysDictValue>
-
-    /**
-     * 根据code值与value获取指定字典值
-     */
-    fun getDictValueByCodeAndValue(code: String, value: String): SysDictValue?
-
-    /**
-     * 根据code前缀与value获取指定字典值
-     */
-    fun getDictValueByPrefixAndValue(prefix: String, value: String): SysDictValue?
-
-    /**
-     * 根据code值取出指定字典值
-     */
-    fun getDictValueByCode(code: String): SysDictValue?
-}

+ 0 - 19
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RParamService.kt

@@ -1,19 +0,0 @@
-package com.gxzc.zen.rpc.api.sys
-
-import com.gxzc.zen.api.sys.model.SysParam
-
-/**
- * 系统参数 RPC 接口
- * @author NorthLan
- * @date 2018/7/10
- * @url https://noahlan.com
- */
-interface RParamService {
-
-    /**
-     * 通过Key获取SysParam
-     * @param key key
-     * @param enabled 是否启用(逻辑删)
-     */
-    fun getByKey(key: String, enabled: Boolean = true): SysParam?
-}

+ 0 - 21
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RPermissionService.kt

@@ -1,21 +0,0 @@
-package com.gxzc.zen.rpc.api.sys
-
-import com.gxzc.zen.umps.common.ZenPermission
-
-/**
- * RPC 权限服务
- * @author NorthLan
- * @date 2018/8/11
- * @url https://noahlan.com
- */
-interface RPermissionService {
-    /**
-     * 获取所有系统定义的权限
-     */
-    fun getAllPermission(): MutableList<ZenPermission>
-
-    /**
-     * 通过角色id获取相应的权限
-     */
-    fun getPermissionByRoleIds(roleIds: List<Long>): MutableList<ZenPermission>
-}

+ 0 - 17
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RRoleService.kt

@@ -1,17 +0,0 @@
-package com.gxzc.zen.rpc.api.sys
-
-import com.gxzc.zen.api.sys.model.SysRole
-
-/**
- *
- * @author NorthLan
- * @date 2018/6/20
- * @url https://noahlan.com
- */
-interface RRoleService {
-
-    /**
-     * 通过用户ID获取RoleList
-     */
-    fun getRoleListByUserId(userId: Long?): MutableList<SysRole>
-}

+ 0 - 45
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RUploadService.kt

@@ -1,45 +0,0 @@
-package com.gxzc.zen.rpc.api.sys
-
-import com.gxzc.zen.api.sys.model.SysUploadInfo
-import com.gxzc.zen.common.util.upload.FdfsFile
-import com.gxzc.zen.rpc.model.sys.RUploadInfo
-
-/**
- *
- * @author NorthLan
- * @date 2018/6/20
- * @url https://noahlan.com
- */
-interface RUploadService {
-
-    /**
-     * 添加文件数据
-     */
-    fun addFileInfo(fileName: String, md5: String, fileSize: Long, lastModified: Long?, relativePath: String?, fdfsFile: FdfsFile): SysUploadInfo
-
-    /**
-     * 通过文件md5值获取 文件数据
-     * @param md5 需要用 FileUtils 计算
-     */
-    fun getUploadInfoByMd5(md5: String): SysUploadInfo?
-
-    /**
-     * 通过id获取单条 文件数据
-     */
-    fun getUploadInfoById(id: Long): SysUploadInfo?
-
-    /**
-     * 通过ids获取 文件数据 列表
-     */
-    fun getUploadInfoListByIdList(ids: Collection<Long>): MutableList<SysUploadInfo>
-
-    /**
-     * 通过id修改文件信息
-     */
-    fun modifyFileInfo(entity: RUploadInfo): SysUploadInfo
-
-    /**
-     * 通过id批量修改文件信息
-     */
-    fun modifyBatchFileInfo(entityList: MutableList<RUploadInfo>): MutableList<SysUploadInfo>
-}

+ 0 - 26
zen-api/src/main/kotlin/com/gxzc/zen/rpc/api/sys/RUserService.kt

@@ -1,26 +0,0 @@
-package com.gxzc.zen.rpc.api.sys
-
-import com.gxzc.zen.api.sys.model.SysUser
-import com.gxzc.zen.rpc.model.sys.RUserInfo
-
-/**
- *
- * @author NorthLan
- * @date 2018/7/12
- * @url https://noahlan.com
- */
-interface RUserService {
-
-    /**
-     * 获取指定角色的所有用户信息列表
-     * 通过 角色代码 获取用户列表
-     * @param code 角色代码
-     */
-    fun getUserListByRoleCode(code: String): MutableList<RUserInfo>
-
-    /**
-     * 通过RoleID获取用户列表
-     * TODO 未完成
-     */
-    fun getUserListByRoleId(id: Long): MutableList<SysUser>
-}

+ 0 - 19
zen-api/src/main/kotlin/com/gxzc/zen/rpc/model/sys/RUploadInfo.kt

@@ -1,19 +0,0 @@
-package com.gxzc.zen.rpc.model.sys
-
-import java.io.Serializable
-
-/**
- * 文件信息 RPC
- * @author NorthLan
- * @date 2018/6/27
- * @url https://noahlan.com
- */
-open class RUploadInfo : Serializable {
-    companion object {
-        private const val serialVersionUID = 1L
-    }
-
-    var id: Long? = null
-    var newFilename: String? = null
-    var newPath: String? = null
-}

+ 0 - 19
zen-api/src/main/kotlin/com/gxzc/zen/rpc/model/sys/RUserInfo.kt

@@ -1,19 +0,0 @@
-package com.gxzc.zen.rpc.model.sys
-
-import java.io.Serializable
-
-/**
- *
- * @author NorthLan
- * @date 2018/7/12
- * @url https://noahlan.com
- */
-open class RUserInfo : Serializable {
-    companion object {
-        private val serialVersionUID = 10000000000002L
-    }
-
-    private var id: Long? = null
-    private var account: String? = null
-    private var username: String? = null
-}

+ 0 - 28
zen-api/src/main/kotlin/com/gxzc/zen/rpc/provider/TestRpcServiceImpl.kt

@@ -1,28 +0,0 @@
-//package com.gxzc.zen.rpc.provider
-//
-//import com.alibaba.dubbo.config.annotation.Service
-//import com.gxzc.zen.rpc.api.TestRpcService
-//
-///**
-// * 示例代码(接口实现,服务提供者或生产者)
-// * 服务提供者(生产者)实现接口供消费者使用
-// * 例:
-// * A/B 业务系统定义了接口TestRpcService且由B业务系统来实现 此时B为生产者 A为消费者
-// * 消费者无需关心接口如何实现(只需要定义接口然后调用即可)
-// * B:
-// *  Service实现类需加入注解@Service并指定版本号(默认1.0) [com.alibaba.dubbo.config.annotation.Service] 请注意包名
-// * A:
-// *  使用@Reference(version = "1.0", application = "\${dubbo.application.id}") 注入 [com.alibaba.dubbo.config.annotation.Reference] 请注意包名
-// *  注: java: @Reference(version = "1.0", application = "${dubbo.application.id}")
-// * @author NorthLan
-// * @date 2018/5/7
-// * @url https://noahlan.com
-// */
-//@Service(version = "1.0",
-//        application = "\${dubbo.application.id}")
-//class TestRpcServiceImpl : TestRpcService {
-//    override fun sayHello(name: String): String {
-//        println("say hello: $name")
-//        return name
-//    }
-//}

+ 0 - 26
zen-api/src/main/kotlin/com/gxzc/zen/rpc/util/RpcUtil.kt

@@ -1,26 +0,0 @@
-package com.gxzc.zen.rpc.util
-
-import com.alibaba.dubbo.config.spring.ReferenceBean
-import org.slf4j.LoggerFactory
-
-/**
- *
- * @author NorthLan
- * @date 2018/6/22
- * @url https://noahlan.com
- */
-object RpcUtil {
-    private val logger = LoggerFactory.getLogger(RpcUtil::class.java)
-
-    fun <T> getReference(interfaceClass: Class<T>, version: String): T? {
-        return try {
-            ReferenceBean<T>().apply {
-                setInterface(interfaceClass)
-                setVersion(version)
-            }.get()
-        } catch (e: Throwable) {
-            logger.warn("getReferenceBean [$interfaceClass] error: ${e.message}")
-            null
-        }
-    }
-}

+ 4 - 2
zen-api/src/main/kotlin/com/gxzc/zen/umps/config/ShiroConfig.kt

@@ -44,8 +44,8 @@ class ShiroConfig {
 
     @Bean("shiroFilterRegistrationBean")
     @DependsOn("shiroFilter")
-    fun filterRegistrationBean(): FilterRegistrationBean {
-        return FilterRegistrationBean().apply {
+    fun filterRegistrationBean(): FilterRegistrationBean<DelegatingFilterProxy> {
+        return FilterRegistrationBean<DelegatingFilterProxy>().apply {
             filter = DelegatingFilterProxy("shiroFilter")
             isEnabled = true
             addUrlPatterns("/*")
@@ -91,6 +91,7 @@ class ShiroConfig {
                     "/fdfsupload/**" to "canon", // 上传免登录
                     "/api/**" to "canon", // api 免登陆
                     "/ws/**" to "canon", // websocket 免登陆
+                    "/" to "canon",
                     ////////////////////// 静态资源 /////////////////////
                     "/v2/api-docs" to "canon",
                     "/swagger-resources/**" to "anon",
@@ -100,6 +101,7 @@ class ShiroConfig {
                     "/druid/**" to "anon",
                     "/druid/sql.json" to "anon",
                     "/**/favicon.*" to "anon",
+                    "/eureka/**" to "anon",
                     ////////////////////// 静态资源 /////////////////////
                     "/**" to "cors,authc,perms" // 对于其他未配置的所有url 先设置cors头 再进行登陆判定 最后判定权限
             )

+ 1 - 1
zen-api/src/main/kotlin/com/gxzc/zen/umps/config/ShiroRedisCache.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.umps.config
 
-import com.gxzc.zen.common.config.cache.redis.RedisKeyGenerator
+import cn.gygxzc.tina.cache.redis.RedisKeyGenerator
 import com.gxzc.zen.umps.util.SerializeUtils
 import org.apache.shiro.cache.Cache
 import org.apache.shiro.cache.CacheException

+ 2 - 2
zen-api/src/main/kotlin/com/gxzc/zen/umps/config/ShiroRedisSessionDAO.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.umps.config
 
-import com.gxzc.zen.common.config.cache.redis.RedisKeyGenerator
+import cn.gygxzc.tina.cache.redis.RedisKeyGenerator
 import org.apache.shiro.session.Session
 import org.apache.shiro.session.mgt.eis.AbstractSessionDAO
 import org.slf4j.LoggerFactory
@@ -47,7 +47,7 @@ class ShiroRedisSessionDAO : AbstractSessionDAO {
         logger.debug("Get Active Sessions")
         val result = mutableListOf<Session>()
         val keys = redisTemplate.keys(getKey("*"))
-        if (keys != null && keys.isNotEmpty()) {
+        if (keys.isNotEmpty()) {
             keys.forEach {
                 val session = redisTemplate.opsForValue().get(it) as? Session
                 if (session != null) {

+ 4 - 4
zen-core/build.gradle

@@ -5,13 +5,13 @@ buildscript {
     dependencies {
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
-        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
+        classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
     }
 }
 
 dependencies {
 }
 
-bootRepackage {
-    enabled = false
-}
+//bootRepackage {
+//    enabled = false
+//}

+ 33 - 0
zen-core/src/main/kotlin/cn/gygxzc/tina/cache/redis/RedisConfig.kt

@@ -0,0 +1,33 @@
+package cn.gygxzc.tina.cache.redis
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.cache.CacheManager
+import org.springframework.cache.annotation.EnableCaching
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Primary
+import org.springframework.data.redis.cache.RedisCacheManager
+import org.springframework.data.redis.connection.RedisConnectionFactory
+
+/**
+ * Redis 缓存配置
+ * 缓存管理器
+ * @author NorthLan
+ * @date 2018/3/29
+ * @url https://noahlan.com
+ */
+@Configuration
+@EnableCaching
+@ConditionalOnProperty(prefix = "spring.cache", name = ["type"], havingValue = "redis")
+@EnableConfigurationProperties(RedisProperties::class)
+class RedisConfig {
+
+    @Bean("redisCacheManager")
+    @Primary
+    fun cacheManager(redisConnectionFactory: RedisConnectionFactory): CacheManager {
+        return RedisCacheManager.create(redisConnectionFactory)
+    }
+
+}

+ 1 - 1
zen-core/src/main/kotlin/com/gxzc/zen/common/config/cache/redis/RedisKeyGenerator.kt → zen-core/src/main/kotlin/cn/gygxzc/tina/cache/redis/RedisKeyGenerator.kt

@@ -1,4 +1,4 @@
-package com.gxzc.zen.common.config.cache.redis
+package cn.gygxzc.tina.cache.redis
 
 /**
  * Redis key 生成器

+ 61 - 0
zen-core/src/main/kotlin/cn/gygxzc/tina/cache/redis/TinaJedisConnectionConfiguration.kt

@@ -0,0 +1,61 @@
+package cn.gygxzc.tina.cache.redis
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.springframework.beans.factory.annotation.Qualifier
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
+import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.data.redis.connection.RedisConnectionFactory
+import org.springframework.data.redis.core.RedisOperations
+import org.springframework.data.redis.core.RedisTemplate
+import org.springframework.data.redis.core.StringRedisTemplate
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
+import org.springframework.data.redis.serializer.StringRedisSerializer
+import org.springframework.util.StringUtils
+import java.text.SimpleDateFormat
+
+
+/**
+ * Created by niantuo on 2018/9/20.
+ */
+@Configuration
+@ConditionalOnClass(RedisOperations::class)
+@EnableConfigurationProperties(RedisProperties::class)
+class TinaJedisConnectionConfiguration {
+
+
+    @Bean
+    @ConditionalOnMissingBean(name = ["redisTemplate"])
+    fun redisTemplate(redisConnectionFactory: RedisConnectionFactory): RedisTemplate<Any, Any> {
+        val template = RedisTemplate<Any, Any>()
+        val stringRedisSerializer = StringRedisSerializer()
+        template.keySerializer = stringRedisSerializer
+        template.hashKeySerializer = stringRedisSerializer
+        // mapper
+        val classPropertyTypeName: String? = null
+        template.valueSerializer = GenericJackson2JsonRedisSerializer(ObjectMapper().apply {
+            dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
+            if (StringUtils.hasText(classPropertyTypeName)) {
+                enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, classPropertyTypeName)
+            } else {
+                enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY)
+            }
+        })
+        template.connectionFactory = redisConnectionFactory
+        return template
+    }
+
+    @Bean
+    @ConditionalOnMissingBean(StringRedisTemplate::class)
+    fun stringRedisTemplate(redisConnectionFactory: RedisConnectionFactory): StringRedisTemplate {
+        val template = StringRedisTemplate()
+        template.connectionFactory = redisConnectionFactory
+        return template
+    }
+
+}

+ 1 - 5
zen-core/src/main/kotlin/com/gxzc/zen/common/base/BaseModel.kt

@@ -1,10 +1,6 @@
 package com.gxzc.zen.common.base
 
-import com.baomidou.mybatisplus.annotations.TableField
-import com.baomidou.mybatisplus.annotations.TableId
-import com.baomidou.mybatisplus.annotations.TableLogic
-import com.baomidou.mybatisplus.enums.FieldFill
-import com.baomidou.mybatisplus.enums.IdType
+import com.baomidou.mybatisplus.annotation.*
 import com.fasterxml.jackson.annotation.JsonInclude
 import io.swagger.annotations.ApiModelProperty
 import java.io.Serializable

+ 4 - 4
zen-core/src/main/kotlin/com/gxzc/zen/common/base/BaseMapper.kt → zen-core/src/main/kotlin/com/gxzc/zen/common/base/IBaseMapper.kt

@@ -1,7 +1,7 @@
 package com.gxzc.zen.common.base
 
-import com.baomidou.mybatisplus.mapper.BaseMapper
-import com.baomidou.mybatisplus.mapper.Wrapper
+import com.baomidou.mybatisplus.core.conditions.Wrapper
+import com.baomidou.mybatisplus.core.mapper.BaseMapper
 import org.apache.ibatis.annotations.Param
 import org.apache.ibatis.session.RowBounds
 import java.io.Serializable
@@ -13,8 +13,8 @@ import java.io.Serializable
  * @date 2018/1/24
  * @url https://noahlan.com
  */
-interface BaseMapper<T> : BaseMapper<T> {
-//    fun testSelect(@Param("ew") wrapper: Wrapper<T>): MutableList<T>
+interface IBaseMapper<T> : BaseMapper<T> {
+
 
     /**
      * 通过自定义SQL查询

+ 2 - 2
zen-core/src/main/kotlin/com/gxzc/zen/common/base/BaseService.kt → zen-core/src/main/kotlin/com/gxzc/zen/common/base/IBaseService.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.common.base
 
-import com.baomidou.mybatisplus.service.IService
+import com.baomidou.mybatisplus.extension.service.IService
 
 /**
  * 通用Service
@@ -10,4 +10,4 @@ import com.baomidou.mybatisplus.service.IService
  * @date 2018/1/24
  * @url https://noahlan.com
  */
-interface BaseService<T> : IService<T>
+interface IBaseService<T> : IService<T>

+ 5 - 9
zen-core/src/main/kotlin/com/gxzc/zen/common/config/SwaggerConfig.kt

@@ -1,19 +1,15 @@
 package com.gxzc.zen.common.config
 
-import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
 import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
 import springfox.documentation.builders.ApiInfoBuilder
 import springfox.documentation.builders.RequestHandlerSelectors
 import springfox.documentation.service.ApiInfo
 import springfox.documentation.service.Contact
 import springfox.documentation.spi.DocumentationType
 import springfox.documentation.spring.web.plugins.Docket
-import springfox.documentation.swagger2.annotations.EnableSwagger2
 
 
 /**
@@ -22,10 +18,10 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2
  * @date 2018/2/10
  * @url https://noahlan.com
  */
-@Configuration
-@EnableSwagger2
-@ConditionalOnProperty(prefix = "zen", name = ["swagger-open"], havingValue = "true")
-class SwaggerConfig : WebMvcConfigurerAdapter() {
+//@Configuration
+//@EnableSwagger2
+//@ConditionalOnProperty(prefix = "zen", name = ["swagger-open"], havingValue = "true")
+class SwaggerConfig : WebMvcConfigurationSupport() {
 
     override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
         registry.let {

+ 0 - 275
zen-core/src/main/kotlin/com/gxzc/zen/common/config/cache/redis/RedisConfig.kt

@@ -1,275 +0,0 @@
-package com.gxzc.zen.common.config.cache.redis
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo
-import com.fasterxml.jackson.core.JsonGenerator
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.SerializerProvider
-import com.fasterxml.jackson.databind.module.SimpleModule
-import com.fasterxml.jackson.databind.ser.std.StdSerializer
-import org.apache.commons.pool2.impl.GenericObjectPool
-import org.springframework.beans.factory.ObjectProvider
-import org.springframework.beans.factory.annotation.Qualifier
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
-import org.springframework.boot.autoconfigure.data.redis.RedisProperties
-import org.springframework.boot.context.properties.EnableConfigurationProperties
-import org.springframework.cache.CacheManager
-import org.springframework.cache.annotation.EnableCaching
-import org.springframework.cache.support.NullValue
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.context.annotation.Primary
-import org.springframework.data.redis.cache.RedisCacheManager
-import org.springframework.data.redis.connection.RedisClusterConfiguration
-import org.springframework.data.redis.connection.RedisConnectionFactory
-import org.springframework.data.redis.connection.RedisNode
-import org.springframework.data.redis.connection.RedisSentinelConfiguration
-import org.springframework.data.redis.connection.jedis.JedisConnectionFactory
-import org.springframework.data.redis.core.RedisTemplate
-import org.springframework.data.redis.core.StringRedisTemplate
-import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer
-import org.springframework.data.redis.serializer.StringRedisSerializer
-import org.springframework.util.Assert
-import org.springframework.util.StringUtils
-import redis.clients.jedis.JedisPoolConfig
-import java.io.IOException
-import java.net.URI
-import java.net.URISyntaxException
-import java.text.SimpleDateFormat
-import java.util.*
-
-/**
- * Redis 缓存配置
- * 缓存管理器
- * @author NorthLan
- * @date 2018/3/29
- * @url https://noahlan.com
- */
-@Configuration
-@EnableCaching
-@ConditionalOnProperty(prefix = "spring.cache", name = ["type"], havingValue = "redis")
-@EnableConfigurationProperties(RedisProperties::class)
-class RedisConfig {
-
-    @Bean("redisCacheManager")
-    @Primary
-    fun cacheManager(@Qualifier("redisTemplate") redisTemplate: RedisTemplate<Any, Any>): CacheManager {
-        return RedisCacheManager(redisTemplate.apply {
-            val stringRedisSerializer = StringRedisSerializer()
-            keySerializer = stringRedisSerializer
-            hashKeySerializer = stringRedisSerializer
-            // mapper
-            val classPropertyTypeName: String? = null
-            valueSerializer = GenericJackson2JsonRedisSerializer(ObjectMapper().apply {
-                dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
-                registerModule(SimpleModule().addSerializer(NullValueSerializer(classPropertyTypeName)))
-                if (StringUtils.hasText(classPropertyTypeName)) {
-                    enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, classPropertyTypeName)
-                } else {
-                    enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY)
-                }
-            })
-        })
-    }
-
-    /**
-     * [StdSerializer] adding class information required by default typing. This allows de-/serialization of
-     * [NullValue].
-     *
-     * @author Christoph Strobl
-     * @since 1.8
-     */
-    private class NullValueSerializer : StdSerializer<NullValue> {
-        companion object {
-            private const val serialVersionUID = 1999052150548658809L
-        }
-
-        private val classIdentifier: String
-
-        /**
-         * @param classIdentifier can be null and will be defaulted to `@class`.
-         */
-        constructor(classIdentifier: String?) : super(NullValue::class.java) {
-            this.classIdentifier = if (StringUtils.hasText(classIdentifier)) classIdentifier!! else "@class"
-        }
-
-        /*
-		 * (non-Javadoc)
-		 * @see com.fasterxml.jackson.databind.ser.std.StdSerializer#serialize(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)
-		 */
-        @Throws(IOException::class)
-        override fun serialize(value: NullValue, jgen: JsonGenerator, provider: SerializerProvider) {
-            jgen.writeStartObject()
-            jgen.writeStringField(classIdentifier, NullValue::class.java.name)
-            jgen.writeEndObject()
-        }
-    }
-
-    /**
-     * Redis connection configuration.
-     */
-    @Configuration
-    @ConditionalOnClass(GenericObjectPool::class)
-    protected class RedisConnectionConfiguration(private val properties: RedisProperties,
-                                                 sentinelConfiguration: ObjectProvider<RedisSentinelConfiguration>,
-                                                 clusterConfiguration: ObjectProvider<RedisClusterConfiguration>) {
-
-        private val sentinelConfiguration: RedisSentinelConfiguration? = sentinelConfiguration.ifAvailable
-
-        private val clusterConfiguration: RedisClusterConfiguration? = clusterConfiguration.ifAvailable
-
-        protected val sentinelConfig: RedisSentinelConfiguration?
-            get() {
-                if (this.sentinelConfiguration != null) {
-                    return this.sentinelConfiguration
-                }
-                val sentinelProperties = this.properties.sentinel
-                if (sentinelProperties != null) {
-                    val config = RedisSentinelConfiguration()
-                    config.master(sentinelProperties.master)
-                    config.setSentinels(createSentinels(sentinelProperties))
-                    return config
-                }
-                return null
-            }
-
-        @Bean("redisConnectionFactory")
-        @Primary
-//        @ConditionalOnMissingBean(RedisConnectionFactory::class)
-        fun redisConnectionFactory(): JedisConnectionFactory {
-            return applyProperties(createJedisConnectionFactory())
-        }
-
-        protected fun applyProperties(
-                factory: JedisConnectionFactory): JedisConnectionFactory {
-            configureConnection(factory)
-            if (this.properties.isSsl) {
-                factory.isUseSsl = true
-            }
-            factory.database = this.properties.database
-            if (this.properties.timeout > 0) {
-                factory.timeout = this.properties.timeout
-            }
-            return factory
-        }
-
-        private fun configureConnection(factory: JedisConnectionFactory) {
-            if (StringUtils.hasText(this.properties.url)) {
-                configureConnectionFromUrl(factory)
-            } else {
-                factory.hostName = this.properties.host
-                factory.port = this.properties.port
-                if (this.properties.password != null) {
-                    factory.password = this.properties.password
-                }
-            }
-        }
-
-        private fun configureConnectionFromUrl(factory: JedisConnectionFactory) {
-            val url = this.properties.url
-            if (url.startsWith("rediss://")) {
-                factory.isUseSsl = true
-            }
-            try {
-                val uri = URI(url)
-                factory.hostName = uri.host
-                factory.port = uri.port
-                if (uri.userInfo != null) {
-                    var password = uri.userInfo
-                    val index = password.indexOf(":")
-                    if (index >= 0) {
-                        password = password.substring(index + 1)
-                    }
-                    factory.password = password
-                }
-            } catch (ex: URISyntaxException) {
-                throw IllegalArgumentException("Malformed 'spring.redis.url' $url",
-                        ex)
-            }
-
-        }
-
-        /**
-         * Create a [RedisClusterConfiguration] if necessary.
-         * @return null if no cluster settings are set.
-         */
-        protected fun getClusterConfiguration(): RedisClusterConfiguration? {
-            if (this.clusterConfiguration != null) {
-                return this.clusterConfiguration
-            }
-            if (this.properties.cluster == null) {
-                return null
-            }
-            val clusterProperties = this.properties.cluster
-            val config = RedisClusterConfiguration(
-                    clusterProperties.nodes)
-
-            if (clusterProperties.maxRedirects != null) {
-                config.maxRedirects = clusterProperties.maxRedirects!!
-            }
-            return config
-        }
-
-        private fun createSentinels(sentinel: RedisProperties.Sentinel): List<RedisNode> {
-            val nodes = ArrayList<RedisNode>()
-            for (node in StringUtils
-                    .commaDelimitedListToStringArray(sentinel.nodes)) {
-                try {
-                    val parts = StringUtils.split(node, ":")
-                    Assert.state(parts.size == 2, "Must be defined as 'host:port'")
-                    nodes.add(RedisNode(parts[0], Integer.valueOf(parts[1])))
-                } catch (ex: RuntimeException) {
-                    throw IllegalStateException(
-                            "Invalid redis sentinel property '$node'", ex)
-                }
-
-            }
-            return nodes
-        }
-
-        private fun createJedisConnectionFactory(): JedisConnectionFactory {
-            val poolConfig = if (this.properties.pool != null)
-                jedisPoolConfig()
-            else
-                JedisPoolConfig()
-
-            if (sentinelConfig != null) {
-                return JedisConnectionFactory(sentinelConfig, poolConfig)
-            }
-            return if (getClusterConfiguration() != null) {
-                JedisConnectionFactory(getClusterConfiguration(), poolConfig)
-            } else JedisConnectionFactory(poolConfig)
-        }
-
-        private fun jedisPoolConfig(): JedisPoolConfig {
-            val config = JedisPoolConfig()
-            val props = this.properties.pool
-            config.maxTotal = props.maxActive
-            config.maxIdle = props.maxIdle
-            config.minIdle = props.minIdle
-            config.maxWaitMillis = props.maxWait.toLong()
-            return config
-        }
-
-    }
-
-    @Configuration
-    class RedisConfiguration {
-        @Bean
-        @ConditionalOnMissingBean(name = ["redisTemplate"])
-        fun redisTemplate(@Qualifier("redisConnectionFactory") redisConnectionFactory: RedisConnectionFactory): RedisTemplate<Any, Any> {
-            val template = RedisTemplate<Any, Any>()
-            template.connectionFactory = redisConnectionFactory
-            return template
-        }
-
-        @Bean
-        @ConditionalOnMissingBean(StringRedisTemplate::class)
-        fun stringRedisTemplate(@Qualifier("redisConnectionFactory") redisConnectionFactory: RedisConnectionFactory): StringRedisTemplate {
-            val template = StringRedisTemplate()
-            template.connectionFactory = redisConnectionFactory
-            return template
-        }
-    }
-}

+ 13 - 13
zen-core/src/main/kotlin/com/gxzc/zen/common/util/PaginationUtil.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.common.util
 
-import com.baomidou.mybatisplus.plugins.Page
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page
 import javax.servlet.http.HttpServletRequest
 
 /**
@@ -13,12 +13,12 @@ object PaginationUtil {
     const val KEY_CURRENT = "current"
     const val KEY_PAGESIZE = "pageSize"
 
-    fun getCurrent(request: HttpServletRequest): Int? {
-        return request.getParameter(KEY_CURRENT)?.toInt()
+    private fun getCurrent(request: HttpServletRequest): Long? {
+        return request.getParameter(KEY_CURRENT).toLong()
     }
 
-    fun getPageSize(request: HttpServletRequest): Int? {
-        return request.getParameter(KEY_PAGESIZE)?.toInt()
+    private fun getPageSize(request: HttpServletRequest): Long? {
+        return request.getParameter(KEY_PAGESIZE)?.toLong()
     }
 
     fun <T> getRequestPage(request: HttpServletRequest): Page<T>? {
@@ -36,16 +36,16 @@ object PaginationUtil {
      * @param current 当前页码
      * @param size 每页容量
      */
-    fun <T> logicPagingList(data: MutableList<T>, current: Int, size: Int): MutableList<T> {
+    fun <T> logicPagingList(data: MutableList<T>, current: Long, size: Long): MutableList<T> {
         var fromIndex = (current - 1) * size
         if (fromIndex > data.size) {
-            fromIndex = data.size
+            fromIndex = data.size.toLong()
         }
         var toIndex = current * size
         if (toIndex > data.size) {
-            toIndex = data.size
+            toIndex = data.size.toLong()
         }
-        return data.subList(fromIndex, toIndex)
+        return data.subList(fromIndex.toInt(), toIndex.toInt())
     }
 
     /**
@@ -70,15 +70,15 @@ object PaginationUtil {
      *   ]
      * }
      */
-    fun <T> logicPaging(data: MutableList<T>, current: Int?, size: Int?): Page<T> {
-        return Page<T>(current!!, size!!).apply {
+    fun <T> logicPaging(data: MutableList<T>, current: Long, size: Long): Page<T> {
+        return Page<T>(current, size).apply {
             records = logicPagingList(data, current, size)
             setTotal(data.size.toLong())
         }
     }
 
     fun <T> logicPaging(data: MutableList<T>, request: HttpServletRequest): Page<T> {
-        return logicPaging(data, getCurrent(request), getPageSize(request))
+        return logicPaging(data, getCurrent(request) ?: 1, getPageSize(request) ?: 20)
     }
 
     /**
@@ -92,6 +92,6 @@ object PaginationUtil {
      * 分页参数是否合法
      */
     fun paginable(request: HttpServletRequest): Boolean {
-        return paginable(getCurrent(request), getPageSize(request))
+        return paginable(getCurrent(request)?.toInt(), getPageSize(request)?.toInt())
     }
 }

+ 1 - 1
zen-core/src/main/kotlin/com/gxzc/zen/common/util/RedisCacheUtil.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.common.util
 
-import com.gxzc.zen.common.config.cache.redis.RedisKeyGenerator
+import cn.gygxzc.tina.cache.redis.RedisKeyGenerator
 import org.springframework.cache.Cache
 import org.springframework.cache.CacheManager
 import kotlin.reflect.KClass

+ 4 - 4
zen-job/build.gradle

@@ -5,7 +5,7 @@ buildscript {
     dependencies {
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
-        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
+        classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
     }
 }
 
@@ -13,6 +13,6 @@ dependencies {
     compile project(":zen-api")
 }
 
-bootRepackage {
-    enabled = false
-}
+//bootRepackage {
+//    enabled = false
+//}

+ 1 - 7
zen-web/build.gradle

@@ -8,16 +8,10 @@ buildscript {
     dependencies {
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
-        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
+        classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
     }
 }
 
 dependencies {
-    compile project(":zen-core")
     compile project(":zen-api")
-    compile project(":zen-job")
-}
-
-bootRepackage {
-    enabled = true
 }

+ 12 - 0
zen-web/src/main/kotlin/cn/gygxzc/envir/web/config/EnvirWebMvcConfiguration.kt

@@ -0,0 +1,12 @@
+package cn.gygxzc.envir.web.config
+
+import org.springframework.context.annotation.Configuration
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
+
+/**
+ * Created by niantuo on 2018/9/20.
+ *
+ */
+@Configuration
+class EnvirWebMvcConfiguration:WebMvcConfigurationSupport() {
+}

+ 9 - 10
zen-web/src/main/kotlin/com/gxzc/zen/MainApplication.kt

@@ -2,18 +2,17 @@ package com.gxzc.zen
 
 import org.springframework.boot.SpringApplication
 import org.springframework.boot.autoconfigure.SpringBootApplication
-import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
 import org.springframework.boot.builder.SpringApplicationBuilder
-import org.springframework.boot.web.support.SpringBootServletInitializer
-import org.springframework.context.annotation.ImportResource
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient
+import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer
 
-
-@SpringBootApplication(exclude = [RedisAutoConfiguration::class])
-//@EnableDubboConfiguration
-//@ImportResource(locations = ["classpath:application-shiro.xml"])
-@ImportResource(locations = ["classpath:dubbo/*.xml"])
-//@EnableRedisHttpSession
-//@EnableMQConfiguration
+/**
+ * 注解配置
+ */
+@SpringBootApplication(scanBasePackages = ["com.gxzc","cn.gygxzc"])
+@EnableEurekaServer  //表示该服务为注册中心
+//@EnableDiscoveryClient
 class MainApplication : SpringBootServletInitializer() {
     override fun configure(builder: SpringApplicationBuilder?): SpringApplicationBuilder? {
         return builder?.sources(MainApplication::class.java)

+ 3 - 45
zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/AuthController.kt

@@ -1,15 +1,8 @@
 package com.gxzc.zen.web.sys.controller
 
-import com.gxzc.zen.common.base.BaseController
-import com.gxzc.zen.common.dto.RequestDto
-import com.gxzc.zen.common.dto.ResponseDto
-import com.gxzc.zen.logging.annotation.LogAnnotation
-import io.swagger.annotations.ApiOperation
-import org.apache.shiro.SecurityUtils
 import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.*
-import javax.servlet.http.Cookie
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
 
 /**
  * 身份验证相关控制器
@@ -19,45 +12,10 @@ import javax.servlet.http.Cookie
  */
 @RestController
 @RequestMapping("auth")
-class AuthController : BaseController() {
+class AuthController {
     companion object {
         private val logger = LoggerFactory.getLogger(AuthController::class.java)
     }
 
-    @ApiOperation("设置cookie")
-    @PostMapping("/setcookie")
-    @LogAnnotation(ignore = true)
-    fun token(@RequestBody cookies: List<RequestDto>): ResponseEntity<*> {
-        cookies.forEach {
-            getResponse().addCookie(Cookie(it["name"]?.toString(), it["value"]?.toString()).apply {
-                path = "/"
-//                secure = it["secure"] as Boolean
-//                isHttpOnly = it["httpOnly"] as Boolean
-            })
-        }
-        return ResponseEntity.ok(ResponseDto())
-    }
-
-    @ApiOperation(value = "登出")
-    @DeleteMapping("/logout")
-    @LogAnnotation(ignore = true)
-    fun logout(): ResponseEntity<*> {
-        SecurityUtils.getSubject().logout()
-//        SSOHelper.clearLogin(getRequest(), getResponse())
-        return ResponseEntity.ok(ResponseDto())
-    }
 
-    @ApiOperation(value = "验证登录状态")
-    @GetMapping("/check")
-    @LogAnnotation(ignore = true)
-    fun check(): ResponseEntity<*> {
-        val subject = SecurityUtils.getSubject()
-        return if (subject != null && subject.isAuthenticated) {
-            ResponseEntity.ok(ResponseDto())
-        } else {
-            ResponseEntity.ok(ResponseDto().apply {
-                code = 401
-            })
-        }
-    }
 }

+ 3 - 3
zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/TestController.kt

@@ -1,6 +1,5 @@
 package com.gxzc.zen.web.sys.controller
 
-import com.gxzc.zen.common.base.BaseController
 import org.springframework.web.bind.annotation.GetMapping
 import org.springframework.web.bind.annotation.RequestMapping
 import org.springframework.web.bind.annotation.RestController
@@ -14,9 +13,10 @@ import org.springframework.web.bind.annotation.RestController
  */
 @RestController
 @RequestMapping("test")
-class TestController : BaseController() {
+class TestController {
 
     @GetMapping("a")
-    fun a() {
+    fun a(): Any {
+        return "hello !!"
     }
 }

+ 1 - 63
zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/UploadController.kt

@@ -1,21 +1,8 @@
 package com.gxzc.zen.web.sys.controller
 
-import com.gxzc.zen.common.base.BaseController
-import com.gxzc.zen.common.exception.ZenException
-import com.gxzc.zen.common.util.upload.UploadUtil
-import com.gxzc.zen.common.util.upload.ZenFileMetadata
-import com.gxzc.zen.common.util.upload.constants.CheckStatus
-import com.gxzc.zen.common.util.upload.constants.UploadStatus
-import com.gxzc.zen.logging.annotation.LogAnnotation
-import io.swagger.annotations.ApiOperation
 import org.slf4j.LoggerFactory
-import org.springframework.http.HttpStatus
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.GetMapping
-import org.springframework.web.bind.annotation.PostMapping
 import org.springframework.web.bind.annotation.RequestMapping
 import org.springframework.web.bind.annotation.RestController
-import org.springframework.web.multipart.MultipartFile
 
 /**
  * 上传文件 控制器
@@ -25,59 +12,10 @@ import org.springframework.web.multipart.MultipartFile
  */
 @RestController
 @RequestMapping("/upload")
-class UploadController : BaseController() {
+class UploadController {
     companion object {
         private val logger = LoggerFactory.getLogger(UploadController::class.java)
     }
 
-    @ApiOperation("获取已上传分片列表")
-    @LogAnnotation(ignore = true)
-    @GetMapping
-    fun checkChunk(fileMetadata: ZenFileMetadata): ResponseEntity<*> {
-        // 检查已上传文件分片
-        val ret = UploadUtil.checkUpload(fileMetadata)
-        return if (ret.uploadedChunks != null) {
-            when (ret.checkStatus) {
-            // 不入库
-                CheckStatus.FILE_EXISTS,
-                CheckStatus.NO_FILE_FULL_CHUNK -> {
-                    // 文件存在
-                    fileMetadata.filename = ret.file?.name
-                    ret.info = fileMetadata
-                }
-                CheckStatus.NO_FILE_FRAG_CHUNK -> {
-                }
-            }
-            ResponseEntity.ok(ret)
-        } else {
-            ResponseEntity.status(204).body(ret)
-        }
-    }
-
-    @ApiOperation("上传", notes = "支持小文件上传,大文件分片上传(统一分片)")
-    @LogAnnotation(ignore = true)
-    @PostMapping
-    fun upload(fileMetadata: ZenFileMetadata, file: MultipartFile?): ResponseEntity<*> {
-        if (file == null) {
-            return ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE.value()).body(null)
-        }
-        val uploadResult = try {
-            UploadUtil.upload(fileMetadata, file)
-        } catch (e: ZenException) {
-            null
-        }
 
-        return if (uploadResult != null) {
-            when (uploadResult.status) {
-            // 单文件完成,插入数据库
-                UploadStatus.UPLOADED -> {
-                    fileMetadata.filename = uploadResult.file?.name
-                    uploadResult.info = fileMetadata
-                }
-            }
-            ResponseEntity.ok(uploadResult)
-        } else {
-            ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE.value()).body(null)
-        }
-    }
 }

+ 2 - 6
zen-web/src/main/kotlin/com/gxzc/zen/ws/sys/controller/WebSocketTestController.kt

@@ -1,6 +1,5 @@
 package com.gxzc.zen.ws.sys.controller
 
-import com.gxzc.zen.api.sys.model.SysUser
 import org.springframework.messaging.handler.annotation.DestinationVariable
 import org.springframework.messaging.handler.annotation.MessageMapping
 import org.springframework.messaging.handler.annotation.SendTo
@@ -21,10 +20,7 @@ class WebSocketTestController {
     @MessageMapping("/test1/{id}")
     @SendTo("/topic/test")
     @ResponseBody
-    fun test(@DestinationVariable id: Int): SysUser {
-        return SysUser().apply {
-            this.id = id.toLong()
-            this.username = "2333"
-        }
+    fun test(@DestinationVariable id: Int): Any {
+        return "test"
     }
 }

+ 16 - 17
zen-web/src/main/resources/application-cache.yml

@@ -32,20 +32,18 @@ spring:
   profiles: dev
   cache:
     type: redis # 使用什么作为缓存框架
-    # type: caffeine
-    caffeine:
-      spec:
   redis:
     database: 0 # redis数据库索引
-    host: 192.168.1.10
+    host: 192.168.1.206
     port: 6379
     password:
-    timeout: 5000 # 连接超时时间(毫秒)
-    pool:
-      min-idle: 1 # 连接池中的最小空闲连接
-      max-idle: 20 # 连接池中的最大空闲连接
-      max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
-      max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+    timeout: 5s # 连接超时时间(毫秒)
+    jedis:
+      pool:
+        min-idle: 5  # 连接池中的最小空闲连接
+        max-idle: 20  # 连接池中的最大空闲连接
+        max-active: 20  # 连接池最大连接数(使用负值表示没有限制)
+        max-wait: -1s  # 连接池最大阻塞等待时间(使用负值表示没有限制)
 
 ---
 spring:
@@ -57,12 +55,13 @@ spring:
       spec:
   redis:
     database: 0 # redis数据库索引
-    host: 192.168.1.10
+    host: 192.168.1.206
     port: 6379
     password:
-    timeout: 5000 # 连接超时时间(毫秒)
-    pool:
-      min-idle: 1 # 连接池中的最小空闲连接
-      max-idle: 20 # 连接池中的最大空闲连接
-      max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
-      max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+    timeout: 5s # 连接超时时间(毫秒)
+    jedis:
+      pool:
+        min-idle: 5  # 连接池中的最小空闲连接
+        max-idle: 20  # 连接池中的最大空闲连接
+        max-active: 20  # 连接池最大连接数(使用负值表示没有限制)
+        max-wait: -1s  # 连接池最大阻塞等待时间(使用负值表示没有限制)

+ 0 - 67
zen-web/src/main/resources/application-fs.yml

@@ -1,67 +0,0 @@
-spring:
-  profiles: dev
-  http:
-    multipart:
-      enabled: true
-      max-request-size: 50MB #最大请求大小
-      max-file-size: 25MB #最大文件大小
-      location: ${java.io.tmpdir}
-      file-size-threshold: 5MB
-fs:
-  maxFileSize: 4294967296 # 单位 byte 为0表示无限制
-  chunkSize: 10485760 # 10*1024*1024 = 10MB
-
-# 自定义配置
-upload:
-  tmpPath: D:\\tmp # D:\\tmp # 临时文件存放位置 默认 /tmp/zen
-  dataPath: D:\\data # D:\\data
-
-fdfs:
-  enabled: true
-  tmpPath: /tmp/archives # # 临时文件存放位置 默认 /tmp/archives
-  connect-timeout: 3000
-  so-timeout: 3000
-  tracker-list:
-  - 192.168.1.10:22122
-  - 192.168.1.11:22122
-  pool:
-    max-total: 256
-    max-wait-millis: 15000
-    test-on-borrow: true
-    min-idle-per-key: 60
-    max-idle-per-key: 120
-
----
-spring:
-  profiles: prod
-  http:
-    multipart:
-      enabled: true
-      max-request-size: 50MB #最大请求大小
-      max-file-size: 25MB #最大文件大小
-      location: ${java.io.tmpdir}
-      file-size-threshold: 5MB
-
-fs:
-  maxFileSize: 4294967296 # 单位 byte 为0表示无限制
-  chunkSize: 10485760 # 10*1024*1024 = 10MB
-
-# 自定义配置
-upload:
-  tmpPath: /tmp # D:\\tmp # 临时文件存放位置 默认 /tmp/zen
-  dataPath: /archives/upload # D:\\data
-
-fdfs:
-  enabled: true
-  tmpPath: /tmp/archives # # 临时文件存放位置 默认 /tmp/archives
-  connect-timeout: 3000
-  so-timeout: 3000
-  tracker-list:
-  - 192.168.1.10:22122
-  - 192.168.1.11:22122
-  pool:
-    max-total: 256
-    max-wait-millis: 15000
-    test-on-borrow: true
-    min-idle-per-key: 60
-    max-idle-per-key: 120

+ 1 - 1
zen-web/src/main/resources/application-msg.yml

@@ -1,7 +1,7 @@
 spring:
   profiles: dev
   rocketmq:
-    enabled: true
+    enabled: false
     name-server-address: 192.168.1.10:9876;192.168.1.11:9876
     producer-group: zen-archives-group
     send-msg-timeout: 5000

+ 29 - 37
zen-web/src/main/resources/application-orm.yml

@@ -3,57 +3,49 @@ mybatis-plus:
   mapper-locations: classpath*:mapping/**/*.xml
   type-aliases-package: com.gxzc.zen.api.sys.mapper
   global-config:
-    id-type: 0  #0:数据库ID自增   1:用户输入id  2:全局唯一id(IdWorker)  3:全局唯一ID(uuid)
-    db-column-underline: true
-    refresh-mapper: true
-    logic-delete-value: 0
-    logic-not-delete-value: 1
-    sql-injector: com.gxzc.zen.orm.config.ZenSqlInjector # 自定义injector
-    meta-object-handler: com.gxzc.zen.orm.config.CustomMetaObjectHandler
+    db-config:
+      id-type: auto
+      table-underline: true
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      column-like: true
+    refresh: true
+
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: true #配置的缓存的全局开关
     lazyLoadingEnabled: true #延时加载的开关
     multipleResultSetsEnabled: true #延时加载一个属性时会加载该对象全部属性,否则按需加载属性
-    interceptors: com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor, com.baomidou.mybatisplus.plugins.PaginationInterceptor,com.gxzc.zen.logging.aop.LogDBInterceptor #, com.gxzc.zen.orm.data.authority.interceptor.ZenDataAuthorityInterceptor
-    # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql语句,调试用
+
+spring:
+  datasource:
+    type: com.zaxxer.hikari.HikariDataSource
+    driver-class-name: com.mysql.jdbc.Driver
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: select 1
 
 ---
 spring:
   profiles: dev
   datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      stat-view-servlet:
-        enabled: true
-        login-username: root
-        login-password: root
-        reset-enable: false
-      test-on-borrow: true
-      test-on-return: false
-      test-while-idle: true
-    driver-class-name: com.mysql.jdbc.Driver
-    username: archives
-    password: archives2331qaz@WSX
-    url: jdbc:mysql://192.168.1.10:3306/archives_sys?useInformationSchema=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull
+    username: root
+    password: tuonina
+    url: jdbc:mysql://192.168.1.206:3307/archives_sys?useInformationSchema=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull
 # &useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
 
+
 ---
 spring:
   profiles: prod
   datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      stat-view-servlet:
-        enabled: true
-        login-username: root
-        login-password: root
-        reset-enable: false
-      test-on-borrow: true
-      test-on-return: false
-      test-while-idle: true
-    driver-class-name: com.mysql.jdbc.Driver
-    username: archives
-    password: archives2331qaz@WSX
-    url: jdbc:mysql://192.168.1.10:3306/archives_sys?useInformationSchema=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull
+    username: root
+    password: tuonina
+    url: jdbc:mysql://192.168.1.206:3307/archives_sys?useInformationSchema=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull
 # &useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

+ 0 - 10
zen-web/src/main/resources/application-platform.yml

@@ -1,10 +0,0 @@
-spring:
-  profiles: dev
-platform:
-  id: 1 # 平台ID (0:通用,1:系统,2:接收,3:保存,4:管理,5:利用,6:库存,7:日志,8:检索)
-
----
-spring:
-  profiles: prod
-platform:
-  id: 1 # 平台ID (0:通用,1:系统,2:接收,3:保存,4:管理,5:利用,6:库存,7:日志,8:检索)

+ 0 - 46
zen-web/src/main/resources/application-rpc.yml

@@ -1,46 +0,0 @@
-spring:
-  profiles: dev
-dubbo:
-  enabled: true
-  application:
-    name: zen-sys
-    id: zen-sys
-  scan:
-    base-packages: com.gxzc.zen.rpc.provider
-  protocol:
-    id: dubbo
-    name: dubbo
-    port: -1
-  registry:
-    address: 192.168.1.10:2181
-    protocol: zookeeper
-    client: curator
-    id: zen-reg
-  consumer:
-    check: false
-    lazy: true
-    timeout: 300000
-
----
-spring:
-  profiles: prod
-dubbo:
-  enabled: true
-  application:
-    name: zen-sys
-    id: zen-sys
-  scan:
-    base-packages: com.gxzc.zen.rpc.provider
-  protocol:
-    id: dubbo
-    name: dubbo
-    port: -1
-  registry:
-    address: 192.168.1.10:2181
-    protocol: zookeeper
-    client: curator
-    id: zen-reg
-  consumer:
-    check: false
-    lazy: true
-    timeout: 300000

+ 1 - 1
zen-web/src/main/resources/application-umps.yml

@@ -5,7 +5,7 @@ spring:
 shiro:
   redis:
     database: 1 # redis数据库索引
-    host: 192.168.1.10
+    host: 192.168.1.206
     port: 6379
     password:
     timeout: 5000 # 连接超时时间(毫秒)

+ 32 - 25
zen-web/src/main/resources/application.yml

@@ -1,29 +1,47 @@
+
+server:
+  port: 11000
+
 spring:
   profiles:
     active: dev
-    include: orm,rpc,msg,cache,umps,platform,job,fs
-
----
-spring:
-  profiles: dev
+    include: orm,cache,msg,job.umps
+  application:
+    name: registry   # 服务名称,改成自己的,名称固定不变,不要随便更改
   http:
     converters:
-      preferred-json-mapper: fastjson
-  aop:
-    proxy-target-class: true #false为启用jdk默认动态代理,true为cglib动态代理
-    auto: true
+      preferred-json-mapper: jackson
   jackson:
+    date-format: yyyy-MM-hh HH:mm
     deserialization:
       fail-on-unknown-properties: false # 多余字段反序列化过滤
-  application:
-    name: Zen-Framework
+  aop:
+    auto: true
+    proxy-target-class: true #false为启用jdk默认动态代理,true为cglib动态代理
 
-server:
-  port: 10000
+  freemarker:
+    prefer-file-system-access: false
 
 zen:
   swagger-open: true # swagger-ui是否开启
 
+
+#服务注册于发现配置
+eureka:
+  instance:
+    hostname: localhost
+  client:
+    allow-redirects: false
+    register-with-eureka: false
+    fetch-registry: false
+    service-url:
+      registry1: http://${eureka.instance.hostname}:${server.port}/eureka/
+
+---
+spring:
+  profiles: dev
+
+
 logging:
   level:
     root: info
@@ -41,17 +59,6 @@ logging:
 ---
 spring:
   profiles: prod
-  http:
-    converters:
-      preferred-json-mapper: fastjson
-  aop:
-    proxy-target-class: true #false为启用jdk默认动态代理,true为cglib动态代理
-    auto: true
-  jackson:
-    deserialization:
-      fail-on-unknown-properties: false # 多余字段反序列化过滤
-  application:
-    name: Zen-Framework
 
 server:
   port: 10000 # 生产环境端口号
@@ -69,4 +76,4 @@ logging:
     com.atomikos: warn
     com.maihaoche: warn
     RocketmqRemoting: warn
-  file: logs/zen.log
+  file: logs/zen.log

+ 0 - 12
zen-web/src/main/resources/dubbo/dubbo-consumer.xml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-    http://www.springframework.org/schema/beans/spring-beans.xsd
-    http://code.alibabatech.com/schema/dubbo
-    http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
-    <dubbo:reference id="rDictService" interface="com.gxzc.zen.rpc.api.sys.RDictService" version="1.0"/>
-    <dubbo:reference id="rParamService" interface="com.gxzc.zen.rpc.api.sys.RParamService" version="1.0"/>
-</beans>

+ 0 - 54
zen-web/src/test/kotlin/com/gxzc/zen/FileSystemUtilTest.kt

@@ -1,54 +0,0 @@
-package com.gxzc.zen
-
-import com.github.tobato.fastdfs.exception.FdfsServerException
-import com.gxzc.zen.api.util.FileSystemUtil
-import org.junit.Assert
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.test.context.junit4.SpringRunner
-
-/**
- *
- * @author NorthLan
- * @date 2018/9/1
- * @url https://noahlan.com
- */
-@RunWith(SpringRunner::class)
-@SpringBootTest(classes = [MainApplication::class])
-class FileSystemUtilTest {
-
-    @Test
-    fun testFileUpload() {
-        println("测试上传文件: D:\\settings.jar")
-        val storePath = try {
-            FileSystemUtil.uploadFile("D:\\settings.jar")
-        } catch (e: FdfsServerException) {
-            null
-        }
-        Assert.assertTrue("上传失败!", storePath != null)
-        println("上传成功: ${storePath!!.group}/${storePath.path}")
-
-        println("测试删除文件: ${storePath.group}/${storePath.path}")
-        val success = try {
-            FileSystemUtil.deleteFile(storePath.group, storePath.path)
-            true
-        } catch (e: Throwable) {
-            false
-        }
-        Assert.assertTrue("删除失败!", success)
-        println("删除成功!")
-    }
-
-    @Test
-    fun testFileDownload() {
-        println("测试下载文件: group1/M00/00/20/wKhvBFuJV2qEBn45AAAAADwYXv4544.pdf -> D:\\test.pdf")
-        val file = try {
-            FileSystemUtil.downloadFile("group1", "M00/00/20/wKhvBFuJV2qEBn45AAAAADwYXv4544.pdf", "D:\\test.pdf")
-        } catch (e: FdfsServerException) {
-            null
-        }
-        Assert.assertTrue("下载失败!", file != null)
-        println("下载成功")
-    }
-}

+ 1 - 15
zen-web/src/test/kotlin/com/gxzc/zen/Test.kt

@@ -1,25 +1,11 @@
 package com.gxzc.zen
 
-import org.junit.Test
-
 /**
  *
  * @author NorthLan
  * @date 2018/9/9
  * @url https://noahlan.com
  */
-class Test{
-    @Test
-    fun testIndexOf() {
-        val filenameList = arrayOf("34-离婚-2002-1.pdf", "34-离婚-2002-15.pdf")
-        val volumeList = arrayOf("34-离婚-2002-1", "34-离婚-2002-15")
-
-        val testFilename = "34-离婚-2002-15.pdf"
-        val testVolumeCode = "34-离婚-2002-1"
-        val testVolumeCode2 = "34-离婚-2002-15"
-
+class Test {
 
-        println(testFilename.matches(Regex("^($testVolumeCode2)(\\D+.)")))
-        println(testFilename.indexOf(testVolumeCode2))
-    }
 }