Bladeren bron

修复bug,修改框架结构,构建war包测试成功

NorthLan 7 jaren geleden
bovenliggende
commit
f2cb6305a6

+ 26 - 2
README.md

@@ -1,2 +1,26 @@
-# Zen
-Zen
+# Zen 集成后端框架
+
+本项目使用Gradle工具搭建
+
+``SpringBoot Mybatis Mybatis-plus``
+
+完美支持多数据源,使用Alibaba Druid作为数据库连接池
+
+- 同时支持按包名切换与注解切换(DynamicDataSource)
+- 分布式统一事务处理(JtaTransactionManager)
+
+``Kisso``
+
+身份验证与权限验证,单点登录 中间件
+
+- 分散式身份验证,核心加密使用JWT算法(kisso)
+- 精确到按钮级别的功能权限管理
+- 分部门的数据权限管理
+- 分布式统一权限验证
+- 权限字符串进行CRUD融合操作,如 `user:crud` 用户具有user的crud所有权限
+
+``RabbitMQ``
+
+``Xxl-Job``
+
+分布式定时任务

+ 17 - 18
build.gradle

@@ -1,26 +1,21 @@
-group 'com.gxzc.zen'
-version '1.0-SNAPSHOT'
+allprojects {
+    group 'com.gxzc.zen'
+    version '1.0-SNAPSHOT'
+}
 
 buildscript {
     ext {
         kotlin_version = '1.2.21'
-
         spring_boot_version = '1.5.10.RELEASE'
-
         junit_version = '4.12'
-
         commons_io_version = '2.5'
         commons_lang3_version = '3.5'
         commons_codec_version = '1.10'
         commons_fileupload_version = '1.3.2'
-
         slf4j_api_version = '1.7.25'
-
         ehcache_version = '3.4.0'
         ehcache_core_version = '2.6.11'
-
         mysql_connector_version = '5.1.45'
-
         alidruid_version = '1.1.6'
         mybatis_plus_version = '2.1.8'
         mybatis_plus_boot_version = '1.0.5'
@@ -30,9 +25,8 @@ buildscript {
         swagger_version = '2.7.0'
         fastjson_version = '1.2.44'
         pinyin4j_version = '2.5.1'
-
         kisso_version = '3.7.0'
-        // caffeine_version = 'a'
+        caffeine_version = '2.6.1'
     }
     repositories {
         mavenCentral()
@@ -44,22 +38,21 @@ buildscript {
     }
 }
 
-allprojects {}
-
-
 subprojects {
     apply plugin: 'java'
     apply plugin: 'kotlin'
     apply plugin: 'kotlin-spring'
     apply plugin: 'org.springframework.boot'
+
     sourceCompatibility = 1.8
     targetCompatibility = 1.8
 
+    [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
+
     repositories {
         mavenCentral()
         jcenter()
     }
-
     dependencies {
         // Kotlin
         compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
@@ -89,13 +82,13 @@ subprojects {
         compile("javax.servlet:servlet-api:2.5")
 
         // cache
-        compile('com.github.ben-manes.caffeine:caffeine')
+        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:1.1.6")
+        compile("com.alibaba:druid-spring-boot-starter:$alidruid_version")
         // compile("io.shardingjdbc:sharding-jdbc-core-spring-boot-starter:2.0.2")
 
         // mybatis-plus
@@ -115,6 +108,7 @@ subprojects {
         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')
 
         // sso
         compile("com.baomidou:kisso:$kisso_version")
@@ -126,6 +120,11 @@ subprojects {
 
         compile("org.apache.velocity:velocity-engine-core:2.0")
 
-        compile('com.github.hotchemi:khronos:0.9.0')
+        ext.jarTree = fileTree(dir: 'libs', include: '**/*.jar')
+        compile jarTree
+    }
+
+    task listJars(description: 'Display all compile jars.') << {
+        configurations.compile.each { File file -> println file.name }
     }
 }

+ 18 - 10
zen-api/build.gradle

@@ -1,17 +1,25 @@
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
+
 dependencies {
 //    compile project(":zen-umps")
     compile project(":zen-orm")
     compile project(":zen-core")
 }
 
-jar{
-    from("src/main/kotlin") {
-        include("**/*.xml")
-    }
-}
-
-processResources {
-    from("src/main/kotlin") {
-        include("**/*.xml")
-    }
+bootRepackage {
+    enabled = false
 }

+ 19 - 0
zen-core/build.gradle

@@ -1,3 +1,22 @@
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
 dependencies {
 
 }
+
+bootRepackage {
+    enabled = false
+}

+ 19 - 0
zen-job/build.gradle

@@ -1,3 +1,22 @@
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
 dependencies {
     compile project(":zen-api")
+}
+
+bootRepackage {
+    enabled = false
 }

+ 19 - 0
zen-mq/build.gradle

@@ -1,2 +1,21 @@
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
 dependencies {
 }
+
+bootRepackage {
+    enabled = false
+}

+ 19 - 0
zen-orm/build.gradle

@@ -1,3 +1,22 @@
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
 dependencies {
     compile project(":zen-core")
+}
+
+bootRepackage {
+    enabled = false
 }

+ 1 - 1
zen-orm/src/main/kotlin/com/gxzc/zen/orm/aop/MultiDataSourceAspect.kt

@@ -42,7 +42,7 @@ class MultiDataSourceAspect {
         if (method.isAnnotationPresent(MultiTransactional::class.java)) {
             val multiTransaction = method.getAnnotation(MultiTransactional::class.java)
             val transactionManager = SpringContextHolder.getBean(JtaTransactionManager::class.java)
-            val userTransaction = transactionManager?.userTransaction
+            val userTransaction = transactionManager.userTransaction
             return try {
                 userTransaction?.begin()
                 val r = joinPoint.proceed()

+ 19 - 0
zen-umps/build.gradle

@@ -1,4 +1,23 @@
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
 dependencies {
     compile project(":zen-core")
     compile project(":zen-api")
 }
+
+bootRepackage {
+    enabled = false
+}

+ 19 - 0
zen-web/build.gradle

@@ -1,5 +1,20 @@
 apply plugin: 'war'
 
+buildscript {
+    ext {
+        kotlin_version = '1.2.21'
+        spring_boot_version = '1.5.10.RELEASE'
+    }
+    repositories {
+        mavenCentral()
+    }
+    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"
+    }
+}
+
 dependencies {
     compile project(":zen-orm")
     compile project(":zen-core")
@@ -7,4 +22,8 @@ dependencies {
     compile project(":zen-umps")
     compile project(":zen-mq")
     compile project(":zen-job")
+}
+
+bootRepackage {
+    enabled = false
 }

+ 1 - 0
zen-web/src/main/kotlin/com/gxzc/zen/controller/ExampleController.kt

@@ -44,6 +44,7 @@ class ExampleController {
         val a = sysPermissionService.getPermissionSetByUserId(1)
 
         println(a)
+        println("增量测试哦")
         val test = cacheManager.getCache("user")["test1"]
     }
 }