tuonina 5 years ago
parent
commit
dd3082bc4a

+ 16 - 41
build.gradle

@@ -1,8 +1,7 @@
 buildscript {
     ext {
-        kotlin_version = '1.2.61'
-        springBootVersion = '2.0.1.RELEASE'
-        springCloudVersion = 'Finchley.SR1'
+        kotlin_version = '1.3.21'
+        springBootVersion = '2.1.7.RELEASE'
         mybatisPlusVersion = '3.0.3'
         junit_version = '4.12'
         commons_io_version = '2.5'
@@ -21,9 +20,9 @@ buildscript {
         authVersion='1.2.3'
     }
     repositories {
-        maven { url 'https://maven.aliyun.com/repository/public' }
-        mavenCentral()
+        maven { url 'https://maven.aliyun.com/repository/central' }
         maven { url = 'http://repo.spring.io/plugins-release' }
+        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
     }
     dependencies {
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@@ -33,8 +32,8 @@ buildscript {
 }
 
 allprojects {
-    group = "cn.gygxzc.cloud"
-    version = "1.1"
+    group = "cn.tonyandmoney.tuon"
+    version = "1.1" 
 }
 
 subprojects {
@@ -54,33 +53,21 @@ subprojects {
     compileJava.dependsOn(processResources)
 
     ext{
+        set('springCloudVersion', 'Greenwich.SR2')
         set('springBootAdminVersion', '2.1.4')
     }
 
 
     repositories {
         maven { url 'https://maven.aliyun.com/repository/public' }
-        mavenCentral()
-        jcenter()
-        maven {
-            url("https://repo.rdc.aliyun.com/repository/37165-release-a3lssL")
-            credentials {
-                username 'Dz38pq'
-                password 'U1oB2RJOJa'
-            }
-        }
-        maven {
-            credentials {
-                username 'TbLzWL'
-                password 'mCl1FI5SVB'
-            }
-            url 'https://repo.rdc.aliyun.com/repository/33224-snapshot-okrj8B/'
-        }
+        maven { url 'https://maven.aliyun.com/repository/central' }
+        maven { url 'https://maven.aliyun.com/repository/jcenter' }
     }
 
     dependencyManagement {
         imports {
-            mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Finchley.SR1'
+            mavenBom "de.codecentric:spring-boot-admin-dependencies:${springBootAdminVersion}"
+            mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
         }
     }
 
@@ -89,6 +76,7 @@ subprojects {
     }
 
     dependencies {
+        annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
         // Kotlin
         compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
         compile("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
@@ -105,15 +93,11 @@ subprojects {
         compile('org.springframework.boot:spring-boot-starter-jdbc')
         compile('org.springframework.boot:spring-boot-starter-actuator')
         compile("de.codecentric:spring-boot-admin-starter-client:${springBootAdminVersion}")
-
-        compile('org.springframework.boot:spring-boot-starter-jta-atomikos')
-        compile('org.springframework.boot:spring-boot-starter-jetty')
+        compile('org.springframework.boot:spring-boot-starter-undertow')
 
 //        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')
-
+     
 
         compile('org.springframework.cloud:spring-cloud-starter-config')
 
@@ -121,20 +105,14 @@ subprojects {
         // mq
         compile('com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6')
         compile("io.reactivex.rxjava2:rxjava:$rxJavaVersion")
-
-
-        //只因用shiro核心包
-        compile("org.apache.shiro:shiro-spring:$shiro_version")
-
+        
         compile("com.belerweb:pinyin4j:$pinyin4j_version")
 
         // commons
         compile("commons-io:commons-io:$commons_io_version")
         compile("org.apache.commons:commons-lang3:$commons_lang3_version")
         compile("commons-codec:commons-codec:$commons_codec_version")
-        compile("javax.servlet:javax.servlet-api:3.1.0")
-        compile("javax.servlet:servlet-api:2.5")
-
+        compile("javax.servlet:javax.servlet-api:4.0.1")
         // cache
         compile("com.github.ben-manes.caffeine:caffeine:$caffeine_version")
         // db
@@ -144,9 +122,6 @@ subprojects {
         compile("io.springfox:springfox-swagger2:$swagger_version")
         compile("io.springfox:springfox-swagger-ui:$swagger_version")
 
-        compile("cn.gygxzc.cloud:jwt-session:$jwtVersion")
-        compile("cn.gygxzc.cloud:tina-auth:$authVersion")
-
         ext.jarTree = fileTree(dir: 'libs', include: '**/*.jar')
         compile jarTree
     }

+ 8 - 0
c-docs/设计文档.md

@@ -0,0 +1,8 @@
+# 设计文档
+
+## tuon-core
+### 功能列表
+- Redis
+- jdbc,mybatis
+- MongoDB
+- Spring Data Stream 集成rabbit

+ 1 - 1
cloud-bus/build.gradle

@@ -9,6 +9,6 @@ repositories {
 }
 
 dependencies {
-    compile 'org.springframework.cloud:spring-cloud-starter-bus-amqp'
+    compile 'org.springframework.cloud:spring-cloud-starter-stream-rabbit'
     compile project(":zen-core")
 }

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

+ 4 - 1
settings.gradle

@@ -1,7 +1,10 @@
-rootProject.name = 'Zen-Framework'
+rootProject.name = 'tuon-framework'
 include 'zen-core'
 include 'zen-api'
 include 'zen-web'
 include 'cloud-bus'
 include 'fastdfs-client'
+include 'tuon-sign'
+include 'tuon-core'
+include 'tuon-web'
 

+ 15 - 0
tuon-core/build.gradle

@@ -0,0 +1,15 @@
+group 'cn.tonyandmoney.tuon'
+version '1.1'
+
+sourceCompatibility = 1.8
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    testCompile group: 'junit', name: 'junit', version: '4.12'
+    compile 'org.springframework.boot:spring-boot-starter-data-redis-reactive'
+    compile('org.springframework.boot:spring-boot-starter-webflux')
+//    compile 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
+}

+ 8 - 0
tuon-core/src/main/java/cn/tonyandmoney/tuon/core/CoreProperties.java

@@ -0,0 +1,8 @@
+package cn.tonyandmoney.tuon.core;
+
+/**
+ * 集成核心功能,基础功能
+ */
+public class CoreProperties {
+
+}

+ 14 - 0
tuon-core/src/main/java/cn/tonyandmoney/tuon/core/redis/RedisSentinelConfiguration.java

@@ -0,0 +1,14 @@
+package cn.tonyandmoney.tuon.core.redis;
+
+import io.lettuce.core.RedisClient;
+import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class RedisSentinelConfiguration {
+
+
+    public RedisSentinelConfiguration(){
+        RedisClient redisClient =null;
+    }
+}

+ 5 - 0
tuon-core/src/main/resources/application.yml

@@ -0,0 +1,5 @@
+spring:
+  redis:
+    sentinel:
+      master: tuonq
+      nodes: 192.168.42.1:26379

+ 12 - 0
tuon-sign/build.gradle

@@ -0,0 +1,12 @@
+group 'cn.tonyandmoney.tuon'
+version '0.0.1'
+
+sourceCompatibility = 1.8
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    testCompile group: 'junit', name: 'junit', version: '4.12'
+}

+ 8 - 0
tuon-sign/src/main/java/cn/tonyandmoney/sign/SignProperties.java

@@ -0,0 +1,8 @@
+package cn.tonyandmoney.sign;
+
+/**
+ * 主要用于数据签名。
+ * 暂时不考虑数据签名
+ */
+public class SignProperties {
+}

+ 9 - 0
tuon-web/build.gradle

@@ -0,0 +1,9 @@
+group 'cn.tonyandmoney.tuon'
+version '0.0.1'
+
+
+
+
+dependencies {
+   compile project(':tuon-core')
+}

+ 26 - 0
tuon-web/src/main/kotlin/cn/tonyandmoney/tuon/web/MainApplication.kt

@@ -0,0 +1,26 @@
+package cn.tonyandmoney.tuon.web
+
+import org.springframework.boot.SpringApplication
+import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.builder.SpringApplicationBuilder
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient
+
+/**
+ * 所以这个
+ */
+@EnableEurekaClient
+@EnableDiscoveryClient
+@SpringBootApplication(scanBasePackages = ["cn.tonyandmoney.tuon"])
+class MainApplication : SpringBootServletInitializer() {
+    override fun configure(builder: SpringApplicationBuilder): SpringApplicationBuilder {
+        return builder.sources(MainApplication::class.java)
+    }
+
+}
+
+
+fun main() {
+    SpringApplication.run(MainApplication::class.java)
+}

+ 7 - 0
tuon-web/src/main/resources/application.yml

@@ -0,0 +1,7 @@
+spring:
+  datasource:
+    password: tuonq520
+    username: root
+    type: com.zaxxer.hikari.HikariDataSource
+    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://192.168.42.1:5201/tuonq_fw?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull

+ 10 - 0
tuon-web/src/main/resources/banner.txt

@@ -0,0 +1,10 @@
+|~) _    _  _ _|  |~)  .
+|~ (_)VV(/_| (_|  |_)\/.
+                     /${AnsiColor.BRIGHT_YELLOW}
+                        _______   __            ___________ ______
+                        _____  | / /______________  /___  /____  / ______ _______
+                        ____   |/ /_  __ \_  ___/  __/_  __ \_  /  _  __ `/_  __ \
+                        ___  /|  / / /_/ /  /   / /_ _  / / /  /___/ /_/ /_  / / /
+                        __/_/ |_/  \____//_/    \__/ /_/ /_//_____/\__,_/ /_/ /_/${AnsiColor.CYAN}
+Application Version: ${application.version}${application.formatted-version}
+Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}

+ 51 - 0
tuon-web/src/main/resources/bootstrap.yml

@@ -0,0 +1,51 @@
+# 服务端口号
+server:
+  port: 11000
+  servlet:
+    context-path: /
+
+spring:
+  application:
+    name: tuon
+  profiles:
+    active: dev
+    include: orm,cache,msg
+  cloud:
+    config:
+      profile: ${spring.profiles.active}
+      discovery:
+        enabled: true
+        service-id: config
+      allow-override: true
+
+---
+spring:
+  profiles: dev
+
+eureka:
+  instance:
+    prefer-ip-address: true
+  client:
+    service-url:
+      defaultZone: http://config.tonyandmoney.cn/eureka/
+
+---
+spring:
+  profiles: prod
+eureka:
+  client:
+    service-url:
+      defaultZone: http://config.tonyandmoney.cn/eureka/
+  instance:
+    prefer-ip-address: true
+
+
+---
+spring:
+  profiles: sit
+eureka:
+  client:
+    service-url:
+      defaultZone: http://config.tonyandmoney.cn/eureka/
+  instance:
+    prefer-ip-address: true

+ 0 - 23
zen-core/src/main/kotlin/cn/gygxzc/envir/core/CoreConfiguration.kt

@@ -1,23 +0,0 @@
-package cn.gygxzc.envir.core
-
-import cn.gygxzc.cloud.tina.auth.AUTH_REDIS_TEMPLATE
-import cn.gygxzc.cloud.tina.auth.shiro.cache.ShiroCacheManager
-import org.apache.shiro.cache.CacheManager
-import org.springframework.beans.factory.annotation.Qualifier
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.data.redis.core.RedisTemplate
-
-/**
- * Created by niantuo on 2018/11/1.
- */
-@Configuration
-class CoreConfiguration {
-
-    @Bean
-    @ConditionalOnMissingBean(CacheManager::class)
-    fun shiroRedisCacheManager(@Qualifier(AUTH_REDIS_TEMPLATE) redisTemplate: RedisTemplate<String, Any>):CacheManager{
-        return ShiroCacheManager(redisTemplate)
-    }
-}

+ 20 - 22
zen-core/src/main/kotlin/cn/gygxzc/envir/core/orm/handler/CustomMetaObjectHandler.kt

@@ -1,10 +1,8 @@
 package cn.gygxzc.envir.core.orm.handler
 
-import cn.gygxzc.tina.cloud.jwt.session.utils.SessionUtils
 import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
 import org.apache.ibatis.reflection.MetaObject
 import org.slf4j.LoggerFactory
-import java.util.*
 
 /**
  * 公共字段自动填充
@@ -22,28 +20,28 @@ class CustomMetaObjectHandler : MetaObjectHandler {
      * 公告字段插入的时候填充数据
      */
     override fun insertFill(metaObject: MetaObject?) {
-        try {
-            if (getFieldValByName("createBy", metaObject) == null) {
-                val curUser = SessionUtils.getUser()?.account
-                setFieldValByName("createBy", curUser, metaObject)
-            }
-            if (getFieldValByName("createTime", metaObject) == null) {
-                setFieldValByName("createTime", Date(), metaObject)
-            }
-        } catch (e: Throwable) {
-            logger.warn("insertFill error, cause: ", e)
-        }
+//        try {
+//            if (getFieldValByName("createBy", metaObject) == null) {
+//                val curUser = SessionUtils.getUser()?.account
+//                setFieldValByName("createBy", curUser, metaObject)
+//            }
+//            if (getFieldValByName("createTime", metaObject) == null) {
+//                setFieldValByName("createTime", Date(), metaObject)
+//            }
+//        } catch (e: Throwable) {
+//            logger.warn("insertFill error, cause: ", e)
+//        }
     }
 
     override fun updateFill(metaObject: MetaObject?) {
-        try {
-            if (getFieldValByName("updateBy", metaObject) == null) {
-                val curUser = SessionUtils.getUser()?.account
-                setFieldValByName("updateBy", curUser, metaObject)
-            }
-            setFieldValByName("updateTime", Date(), metaObject)
-        } catch (e: Throwable) {
-            logger.warn("updateFill error, cause: ", e)
-        }
+//        try {
+//            if (getFieldValByName("updateBy", metaObject) == null) {
+//                val curUser = SessionUtils.getUser()?.account
+//                setFieldValByName("updateBy", curUser, metaObject)
+//            }
+//            setFieldValByName("updateTime", Date(), metaObject)
+//        } catch (e: Throwable) {
+//            logger.warn("updateFill error, cause: ", e)
+//        }
     }
 }

+ 1 - 0
zen-web/build.gradle

@@ -14,6 +14,7 @@ dependencies {
     compile project(":zen-api")
     compile project(':cloud-bus')
     compile project(':fastdfs-client')
+    compile project(':tuon-core')
 }
 
 docker{

+ 0 - 5
zen-web/src/main/kotlin/cn/gygxzc/envir/MainApplication.kt

@@ -1,8 +1,6 @@
 package cn.gygxzc.envir
 
-import cn.gygxzc.cloud.tina.auth.EnableTinaAuth
 import cn.gygxzc.cloud.tina.fastdfs.client.EnableFastDFSClient
-import cn.gygxzc.tina.cloud.jwt.session.EnableJwtRedisSession
 import org.mybatis.spring.annotation.MapperScan
 import org.springframework.boot.SpringApplication
 import org.springframework.boot.autoconfigure.SpringBootApplication
@@ -12,17 +10,14 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient
 import org.springframework.cloud.openfeign.EnableFeignClients
 import org.springframework.scheduling.annotation.EnableAsync
-import org.springframework.web.servlet.DispatcherServlet
 
 /**
  * 注解配置
  */
 @EnableAsync
-@EnableTinaAuth
 @EnableFeignClients
 @EnableFastDFSClient
 @EnableDiscoveryClient
-@EnableJwtRedisSession
 @SpringBootApplication(scanBasePackages = ["cn.gygxzc.envir", "com.gxzc"], exclude = [RedisAutoConfiguration::class])
 @MapperScan(basePackages = ["cn.gygxzc.**.dao", "cn.gygxzc.**.mapper"])
 class MainApplication : SpringBootServletInitializer() {