tuonina 5 years ago
parent
commit
60eb31a0e3
25 changed files with 519 additions and 71 deletions
  1. 5 1
      README.md
  2. 6 12
      build.gradle
  3. 1 0
      envir-config/build.gradle
  4. 7 0
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/Constants.kt
  5. 44 0
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/controller/PropertyLabelController.kt
  6. 19 8
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/controller/PropertyMgrController.kt
  7. 9 0
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/dao/ILabelDao.kt
  8. 22 0
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/model/PropertyLabel.kt
  9. 23 0
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/ILabelService.kt
  10. 1 1
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/impl/ConfigPropService.kt
  11. 83 0
      envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/impl/LabelService.kt
  12. 0 16
      envir-config/src/main/resources/html/config.html
  13. 8 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/SessionUtils.java
  14. 24 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/TuonqCoreConfiguration.java
  15. 36 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/error/GlobalErrorAttributes.java
  16. 50 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/error/ServerException.java
  17. 38 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/filter/GlobalCrosFilter.java
  18. 27 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/filter/GlobalWebCrosFilter.java
  19. 37 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/req/PageReq.java
  20. 36 0
      eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/utils/CrosUtils.java
  21. 1 5
      eureka-web/src/main/java/cn/gygxzc/cloud/tina/eureka/MainApplication.java
  22. 11 21
      eureka-web/src/main/resources/application-dev.yml
  23. 7 1
      eureka-web/src/main/resources/application.yml
  24. 1 6
      eureka-web/src/main/resources/bootstrap.yml
  25. 23 0
      eureka-web/src/test/cn.tonyandmoney.tuonq.registry.test/LabelServiceTest.kt

+ 5 - 1
README.md

@@ -35,4 +35,8 @@
 - 添加docker打包task
 - 添加配置中心
 - 去除多余的依赖
-- 删除原框架的内容
+- 删除原框架的内容
+
+### 2019/8/7
+- 更换为国内的阿里仓库
+- 集成thymeleaf,集成配置页面到后端,不做前后端分离

+ 6 - 12
build.gradle

@@ -15,6 +15,7 @@ buildscript {
         authVersion = '1.2'
         shiro_version = '1.4.0'
         swagger_version = '2.7.0'
+        nacosVersion='2.1.0.RELEASE'
     }
     repositories {
         maven { url 'https://maven.aliyun.com/repository/central' }
@@ -74,6 +75,8 @@ subprojects {
 
 
     dependencies {
+
+        testCompile('org.springframework.boot:spring-boot-starter-test')
         // Kotlin
         compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
         compile("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
@@ -81,7 +84,8 @@ subprojects {
         kapt("org.springframework.boot:spring-boot-configuration-processor")
         // SpringBoot Starter
         compile 'org.springframework.cloud:spring-cloud-starter-bus-amqp'
-        compile('org.springframework.boot:spring-boot-starter-web')
+        compile('org.springframework.boot:spring-boot-starter-webflux')
+     
         compile('org.springframework.boot:spring-boot-starter-thymeleaf')
 
         compile('org.springframework.cloud:spring-cloud-config-server')
@@ -101,16 +105,11 @@ subprojects {
         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("cn.gygxzc.cloud:jwt-session:$jwtVersion")
-        compile("cn.gygxzc.cloud:tina-auth:$authVersion")
+        
         compile("io.reactivex.rxjava2:rxjava:$rxJavaVersion")
-        compile("org.apache.shiro:shiro-spring:$shiro_version")
 
         // logger
         compile("org.slf4j:slf4j-api:$slf4j_api_version")
-        compile("javax.servlet:javax.servlet-api:3.1.0")
-        compile("javax.servlet:servlet-api:2.5")
 
         compile("mysql:mysql-connector-java:$mysql_connector_version")
         compile("com.baomidou:mybatis-plus-boot-starter:$mybatisPlusVersion")
@@ -119,11 +118,6 @@ subprojects {
         compile("io.springfox:springfox-swagger2:$swagger_version")
         compile("io.springfox:springfox-swagger-ui:$swagger_version")
 
-        compile 'io.jsonwebtoken:jjwt-api:0.10.5'
-        runtime 'io.jsonwebtoken:jjwt-impl:0.10.5',
-                'io.jsonwebtoken:jjwt-jackson:0.10.5'
-
-
         ext.jarTree = fileTree(dir: 'libs', include: '**/*.jar')
         compile jarTree
     }

+ 1 - 0
envir-config/build.gradle

@@ -13,4 +13,5 @@ repositories {
 
 dependencies {
     testCompile group: 'junit', name: 'junit', version: '4.12'
+    compile project(':eureka-core')
 }

+ 7 - 0
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/Constants.kt

@@ -0,0 +1,7 @@
+package cn.gygxzc.cloud.config
+
+
+/**
+ * 配置中心分割点
+ */
+const val SEP_DOT="."

+ 44 - 0
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/controller/PropertyLabelController.kt

@@ -0,0 +1,44 @@
+package cn.gygxzc.cloud.config.controller
+
+import cn.gygxzc.cloud.config.model.PropertyLabel
+import cn.gygxzc.cloud.config.service.ILabelService
+import cn.tonyandmoney.tuonq.core.req.PageReq
+import com.baomidou.mybatisplus.core.metadata.IPage
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.web.bind.annotation.*
+import reactor.core.publisher.Mono
+
+
+@RestController
+@RequestMapping("/v1/property/label")
+class PropertyLabelController {
+
+
+    @Autowired
+    private lateinit var labelService: ILabelService
+
+    /**
+     * 根据条件查询
+     */
+    @GetMapping
+    fun findAll(@RequestParam("keywords") keywords: String?,
+                page: PageReq): Mono<IPage<PropertyLabel>> {
+        return labelService.findAll(page, keywords)
+    }
+
+    @PostMapping
+    fun labelAdd(@RequestBody label: PropertyLabel): Mono<Void> {
+        return labelService.addLabel(label)
+    }
+
+    @PutMapping
+    fun labelEdit(@RequestBody label: PropertyLabel): Mono<Void> {
+        return labelService.editLabel(label)
+    }
+
+    @DeleteMapping("/{id}")
+    fun labelDel(@PathVariable("id") id: Int): Mono<Void> {
+        return labelService.delLabel(id)
+    }
+
+}

+ 19 - 8
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/controller/PropertyMgrController.kt

@@ -7,6 +7,7 @@ import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.web.bind.annotation.*
+import reactor.core.publisher.Mono
 
 /**
  * @author tuonina
@@ -16,7 +17,7 @@ import org.springframework.web.bind.annotation.*
  */
 @RestController
 @Api("管理系统的属性")
-@RequestMapping("/v1/mgr/config/property")
+@RequestMapping("/v1/property/config")
 class PropertyMgrController {
 
     @Autowired
@@ -31,22 +32,32 @@ class PropertyMgrController {
     @PutMapping("/{id}")
     @ApiOperation("更新系统配置信息")
     fun updateProps(@RequestBody prop: ConfigProperty,
-                    @PathVariable("id") id: Int) {
-        prop.id = id
-        propService.updateById(prop)
+                    @PathVariable("id") id: Int): Mono<Void> {
+        return Mono.create {
+            prop.id = id
+            propService.updateById(prop)
+            it.success()
+        }
+
     }
 
     @DeleteMapping("/{id}")
     @ApiOperation("删除系统配置信息")
-    fun delete(@PathVariable("id") id: Int) {
-        propService.deleteById(id)
+    fun delete(@PathVariable("id") id: Int): Mono<Void> {
+        return Mono.create {
+            propService.deleteById(id)
+            it.success()
+        }
+
     }
 
     @GetMapping
     @ApiOperation("条件查询系统配置信息")
     fun query(cond: ConfigProperty,
               @RequestParam("current") page: Long,
-              @RequestParam("pageSize") pageSize: Long): IPage<ConfigProperty> {
-        return propService.query(cond, page, pageSize)
+              @RequestParam("pageSize") pageSize: Long): Mono<IPage<ConfigProperty>> {
+        return Mono.create {
+            it.success(propService.query(cond, page, pageSize))
+        }
     }
 }

+ 9 - 0
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/dao/ILabelDao.kt

@@ -0,0 +1,9 @@
+package cn.gygxzc.cloud.config.dao
+
+import cn.gygxzc.cloud.config.model.PropertyLabel
+import com.baomidou.mybatisplus.core.mapper.BaseMapper
+import org.springframework.stereotype.Repository
+
+@Repository
+interface ILabelDao : BaseMapper<PropertyLabel> {
+}

+ 22 - 0
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/model/PropertyLabel.kt

@@ -0,0 +1,22 @@
+package cn.gygxzc.cloud.config.model
+
+import com.baomidou.mybatisplus.annotation.IdType
+import com.baomidou.mybatisplus.annotation.TableId
+import com.baomidou.mybatisplus.annotation.TableName
+import java.util.*
+
+/**
+ * 属性的标签
+ */
+@TableName("property_label")
+data class PropertyLabel(@TableId(type = IdType.AUTO)
+                         var id: Int = 0,
+                         var pId: Int? = null,
+                         var label: String? = null,
+                         var path: String? = null,
+                         var description: String? = null,
+                         var title: String? = null,
+                         var remark: String? = null,
+                         var createBy: String? = null,
+                         var createTime: Date? = null) {
+}

+ 23 - 0
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/ILabelService.kt

@@ -0,0 +1,23 @@
+package cn.gygxzc.cloud.config.service
+
+import cn.gygxzc.cloud.config.model.PropertyLabel
+import cn.tonyandmoney.tuonq.core.req.PageReq
+import com.baomidou.mybatisplus.core.metadata.IPage
+import reactor.core.publisher.Mono
+
+/**
+ * 标签属性服务
+ */
+interface ILabelService {
+
+    /**
+     * 查询
+     */
+    fun findAll(req: PageReq, keywords: String?): Mono<IPage<PropertyLabel>>
+
+    fun addLabel(label: PropertyLabel):Mono<Void>
+
+    fun editLabel(label: PropertyLabel):Mono<Void>
+
+    fun delLabel(id: Int):Mono<Void>
+}

+ 1 - 1
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/impl/ConfigPropService.kt

@@ -3,7 +3,7 @@ package cn.gygxzc.cloud.config.service.impl
 import cn.gygxzc.cloud.config.dao.IPropertyDao
 import cn.gygxzc.cloud.config.model.ConfigProperty
 import cn.gygxzc.cloud.config.service.IConfigPropService
-import cn.gygxzc.tina.cloud.jwt.session.utils.SessionUtils
+import cn.tonyandmoney.tuonq.core.SessionUtils
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
 import com.baomidou.mybatisplus.core.metadata.IPage
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page

+ 83 - 0
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/impl/LabelService.kt

@@ -0,0 +1,83 @@
+package cn.gygxzc.cloud.config.service.impl
+
+import cn.gygxzc.cloud.config.SEP_DOT
+import cn.gygxzc.cloud.config.dao.ILabelDao
+import cn.gygxzc.cloud.config.model.PropertyLabel
+import cn.gygxzc.cloud.config.service.ILabelService
+import cn.tonyandmoney.tuonq.core.req.PageReq
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
+import com.baomidou.mybatisplus.core.metadata.IPage
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+import reactor.core.publisher.Mono
+
+@Service
+class LabelService : ILabelService {
+
+    @Autowired
+    private lateinit var labelDao: ILabelDao
+
+    /**
+     * 根据给定的条件分页查询数据
+     */
+    override fun findAll(req: PageReq, keywords: String?): Mono<IPage<PropertyLabel>> {
+        return Mono.create {
+            val page = req.page<PropertyLabel>()
+            labelDao.selectPage(page, QueryWrapper<PropertyLabel>().apply {
+                if (!keywords.isNullOrBlank()) {
+                    likeRight("path", keywords)
+                    or().like("label", keywords)
+                }
+            })
+            it.success(page)
+        }
+    }
+
+    override fun addLabel(label: PropertyLabel): Mono<Void> {
+        return Mono.create {
+            val pId = label.pId ?: 0
+            if (pId > 0) {
+                val pLabel = labelDao.selectOne(QueryWrapper<PropertyLabel>().apply {
+                    eq("id", pId)
+                    select("path", "id")
+                })
+                label.path = "${pLabel.path}$SEP_DOT${label.label}"
+            } else {
+                label.path = label.label
+            }
+
+            labelDao.insert(label)
+            it.success()
+        }
+    }
+
+    override fun editLabel(label: PropertyLabel): Mono<Void> {
+        return Mono.create {
+            label.path = null
+            label.pId = null
+            label.label = null
+            labelDao.updateById(label)
+            it.success()
+        }
+    }
+
+    override fun delLabel(id: Int): Mono<Void> {
+        return Mono.create {
+            val label = labelDao.selectById(id)
+            if (label == null) {
+                it.success()
+                return@create
+            }
+            val count = labelDao.selectCount(QueryWrapper<PropertyLabel>().apply {
+                likeRight("path", label.path)
+            })
+            if (count > 1) {
+                it.error(RuntimeException("该标签有子级,请先删除。"))
+            } else {
+                labelDao.deleteById(id)
+                it.success()
+            }
+        }
+    }
+
+}

+ 0 - 16
envir-config/src/main/resources/html/config.html

@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>配置管理</title>
-    <!-- 引入样式 -->
-    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.0/lib/index.css">
-
-    <!-- 引入组件 -->
-    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
-    <script src="https://cdn.jsdelivr.net/npm/vant@2.0/lib/vant.min.js"></script>
-</head>
-<body>
-
-</body>
-</html>

+ 8 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/SessionUtils.java

@@ -0,0 +1,8 @@
+package cn.tonyandmoney.tuonq.core;
+
+public class SessionUtils {
+
+    public static String getAccount(){
+        return "";
+    }
+}

+ 24 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/TuonqCoreConfiguration.java

@@ -0,0 +1,24 @@
+package cn.tonyandmoney.tuonq.core;
+
+import cn.tonyandmoney.tuonq.core.filter.GlobalCrosFilter;
+import cn.tonyandmoney.tuonq.core.filter.GlobalWebCrosFilter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.server.WebFilter;
+
+import javax.servlet.Filter;
+
+@Configuration
+public class TuonqCoreConfiguration {
+
+
+    @Bean
+    public WebFilter crosFilter(){
+        return new GlobalCrosFilter();
+    }
+
+    @Bean
+    public Filter webCrosFilter(){
+        return new GlobalWebCrosFilter();
+    }
+}

+ 36 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/error/GlobalErrorAttributes.java

@@ -0,0 +1,36 @@
+package cn.tonyandmoney.tuonq.core.error;
+
+
+import org.springframework.boot.web.reactive.error.DefaultErrorAttributes;
+import org.springframework.stereotype.Component;
+import org.springframework.web.reactive.function.server.ServerRequest;
+
+import java.util.Map;
+
+@Component
+public class GlobalErrorAttributes extends DefaultErrorAttributes {
+
+    /**
+     * 自定义返回的错误字段
+     *
+     * @param request        请求
+     * @param includeStackTrace 是否包含跟踪信息
+     * @return
+     */
+    @Override
+    public Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
+        Map<String, Object> errorAttributes = super.getErrorAttributes(request, includeStackTrace);
+        Throwable error = getError(request);
+        if (error instanceof ServerException) {
+            errorAttributes.put("code", ((ServerException) error).getCode());
+            errorAttributes.put("message", ((ServerException) error).getMsg());
+            errorAttributes.put("next", ((ServerException) error).getNext());
+        } else {
+            errorAttributes.put("message", error.getMessage());
+        }
+        errorAttributes.remove("error");
+        return errorAttributes;
+    }
+
+
+}

+ 50 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/error/ServerException.java

@@ -0,0 +1,50 @@
+package cn.tonyandmoney.tuonq.core.error;
+
+import org.springframework.http.HttpStatus;
+
+public class ServerException extends RuntimeException {
+
+
+    private int code;
+    private String msg;
+    private String next;
+
+    public ServerException(String msg){
+        this(HttpStatus.INTERNAL_SERVER_ERROR.value(),msg);
+    }
+
+    public ServerException(int code,String msg){
+        this(code,msg,"");
+    }
+
+    public ServerException(int code,String msg,String next){
+        super(msg);
+        this.code =code;
+        this.msg =msg;
+        this.next =next;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public String getNext() {
+        return next;
+    }
+
+    public void setNext(String next) {
+        this.next = next;
+    }
+}

+ 38 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/filter/GlobalCrosFilter.java

@@ -0,0 +1,38 @@
+package cn.tonyandmoney.tuonq.core.filter;
+
+import cn.tonyandmoney.tuonq.core.utils.CrosUtils;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.core.Ordered;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+import org.springframework.web.server.ServerWebExchange;
+import org.springframework.web.server.WebFilter;
+import org.springframework.web.server.WebFilterChain;
+import reactor.core.publisher.Mono;
+import reactor.core.publisher.MonoSink;
+
+import java.util.function.Consumer;
+
+public class GlobalCrosFilter implements WebFilter, Ordered {
+    @NotNull
+    @Override
+    public Mono<Void> filter(@NotNull ServerWebExchange exchange, @NotNull WebFilterChain chain) {
+        return Mono.create((Consumer<MonoSink<HttpMethod>>) voidMonoSink -> {
+            ServerHttpRequest httpRequest = exchange.getRequest();
+            ServerHttpResponse httpResponse = exchange.getResponse();
+            CrosUtils.allow(httpRequest, httpResponse);
+            voidMonoSink.success(httpRequest.getMethod());
+        }).flatMap(httpMethod -> {
+            if (httpMethod == HttpMethod.OPTIONS) {
+                return exchange.getResponse().setComplete();
+            }
+            return chain.filter(exchange);
+        });
+    }
+
+    @Override
+    public int getOrder() {
+        return -2;
+    }
+}

+ 27 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/filter/GlobalWebCrosFilter.java

@@ -0,0 +1,27 @@
+package cn.tonyandmoney.tuonq.core.filter;
+
+import cn.tonyandmoney.tuonq.core.utils.CrosUtils;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class GlobalWebCrosFilter extends OncePerRequestFilter {
+    @Override
+    protected void doFilterInternal(HttpServletRequest request,
+                                    HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
+
+        CrosUtils.allow(request, response);
+        if (request.getMethod().equals(HttpMethod.OPTIONS.name())){
+            response.setStatus(HttpStatus.OK.value());
+            response.flushBuffer();
+        }else {
+            filterChain.doFilter(request,response);
+        }
+    }
+}

+ 37 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/req/PageReq.java

@@ -0,0 +1,37 @@
+package cn.tonyandmoney.tuonq.core.req;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+public class PageReq {
+
+    private long pageSize;
+    private long page;
+
+    public PageReq() {
+        page = 1;
+        pageSize = 20;
+    }
+
+    /**
+     * 返回分页数据
+     */
+    public <T> Page<T> page() {
+        return new Page<>(page, pageSize);
+    }
+
+    public long getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(long pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public long getPage() {
+        return page;
+    }
+
+    public void setPage(long page) {
+        this.page = page;
+    }
+}

+ 36 - 0
eureka-core/src/main/java/cn/tonyandmoney/tuonq/core/utils/CrosUtils.java

@@ -0,0 +1,36 @@
+package cn.tonyandmoney.tuonq.core.utils;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public class CrosUtils {
+
+    public static void allow(ServerHttpRequest request, ServerHttpResponse response) {
+        HttpHeaders headers = response.getHeaders();
+        List<String> origins = headers.get("Origin");
+        if (origins != null && !origins.isEmpty()) {
+            headers.set("Access-control-Allow-Origin", origins.get(0));
+        }
+        headers.set("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH");
+        headers.set("Access-Control-Allow-Credentials", "true");
+        headers.set("Access-Control-Allow-Headers", StringUtils.join(headers.get("Access-Control-Request-Headers"), ","));
+    }
+
+    public static void allow(HttpServletRequest request, HttpServletResponse response) {
+
+        String origin = request.getHeader("Origin");
+        if (!StringUtils.isEmpty(origin)) {
+            response.setHeader("Access-control-Allow-Origin", origin);
+        }
+        response.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH");
+        response.setHeader("Access-Control-Allow-Credentials", "true");
+        response.setHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers"));
+    }
+
+}

+ 1 - 5
eureka-web/src/main/java/cn/gygxzc/cloud/tina/eureka/MainApplication.java

@@ -1,7 +1,5 @@
 package cn.gygxzc.cloud.tina.eureka;
 
-import cn.gygxzc.cloud.tina.auth.EnableTinaAuth;
-import cn.gygxzc.tina.cloud.jwt.session.EnableJwtRedisSession;
 import de.codecentric.boot.admin.server.config.EnableAdminServer;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.amqp.rabbit.annotation.EnableRabbit;
@@ -17,14 +15,12 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  * 注册中心服务
  */
 @EnableRabbit
-@EnableTinaAuth
 @EnableEurekaServer
 @EnableAdminServer
 @EnableConfigServer
 @EnableFeignClients
-@EnableJwtRedisSession
 @MapperScan("cn.gygxzc.**.dao")
-@SpringBootApplication(scanBasePackages = {"cn.gygxzc.cloud"}, exclude = {RedisAutoConfiguration.class})
+@SpringBootApplication(scanBasePackages = {"cn.gygxzc.cloud", "cn.tonyandmoney.tuonq"}, exclude = {RedisAutoConfiguration.class})
 public class MainApplication {
 
     public static void main(String[] args) {

+ 11 - 21
eureka-web/src/main/resources/application-dev.yml

@@ -1,38 +1,28 @@
 spring:
   datasource:
-    password: envir
-    username: envir
-    url: jdbc:mysql://192.168.1.202:3307/sys_config?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull
+    username: root
+    password: tuonq520
+    url: jdbc:mysql://192.168.42.1:5201/tuonq_config?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull
 
   session:
     store-type: redis
     redis:
-      host: 192.168.1.202
+      host: 192.168.42.1
       port: 6379
       database: 0
       password:
 
   rabbitmq:
-    username: client
-    password: client
-    host: 192.168.1.202
+    username: tuonq
+    password: tuonq520
+    host: 192.168.42.1
     port: 5672
+  redis:
+    host: 192.168.42.1
+    port: 6379
+    database: 0
 
-auth:
-  client:
-    key: b3fe84b1ddbf4c3c9b064882de9bed56
-    secret: 545f586c61a640f18c6feb9839f8b121
 
 
 
 
-security:
-  cros: true
-  shiro: false
-  scan: false
-  redis:
-    database: 1 # redis数据库索引
-    hostName: 192.168.1.202
-    port: 6379
-    password:
-    timeout: 5000 # 连接超时时间(毫秒)

+ 7 - 1
eureka-web/src/main/resources/application.yml

@@ -16,6 +16,12 @@ spring:
       context-path: /admin
   main:
     allow-bean-definition-overriding: true
+  thymeleaf:
+    prefix: classpath:/html/
+    cache: false
+    encoding: utf-8
+    servlet:
+      content-type: text/html
 
 
 mybatis-plus:
@@ -42,7 +48,7 @@ eureka:
     prefer-ip-address: true
     lease-renewal-interval-in-seconds: 15
     lease-expiration-duration-in-seconds: 32
-    ip-address: 192.168.42.12
+    ip-address: 192.168.42.11
     metadata-map:
       startup: ${random.int}
       tags: config

+ 1 - 6
eureka-web/src/main/resources/bootstrap.yml

@@ -6,7 +6,7 @@ spring:
   application:
     name: config
   profiles:
-    active: prod
+    active: dev,jdbc
   cloud:
     refresh:
       refreshable: none   # 解决循环依赖的问题
@@ -16,11 +16,6 @@ spring:
         prefix: /config
         jdbc:
           sql: SELECT `key`, `value` from properties where application=? and profile=? and label=?
-        git:
-          basedir: ./config
-          username: tn
-          password: 123456
-          uri: https://git.gygxzc.cn/Envir_Group/Config_Resp.git
       label: master
     bus:
       trace:

+ 23 - 0
eureka-web/src/test/cn.tonyandmoney.tuonq.registry.test/LabelServiceTest.kt

@@ -0,0 +1,23 @@
+package cn.tonyandmoney.tuonq.registy.test
+
+import cn.gygxzc.cloud.config.service.ILabelService
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.test.context.junit4.SpringRunner
+
+
+@SpringBootTest()
+@RunWith(SpringRunner::class)
+class LabelServiceTest {
+
+    @Autowired
+    private lateinit var labelService: ILabelService
+
+    @Test
+    fun addLabel(){
+        println("println ")
+    }
+
+}