lixueqiang 2 سال پیش
والد
کامیت
1b1379571f

+ 53 - 28
docker-compose.yml

@@ -16,7 +16,32 @@ services:
       - ./data/mysql/logs:/logs
       - ./data/mysql/data:/var/lib/mysql
     networks:
-      - kxs_default
+      - kxs_cloud_network
+
+  kxs-register:
+    image: nacos/nacos-server:v2.2.3-slim #mac arm架构 单独版本 x86架构下去除-slim
+    container_name: kxs-register
+    environment:
+      # 容器名称使用hostname,否则使用ip,默认ip
+      - PREFER_HOST_MODE=hostname
+      # 单机模式
+      - MODE=standalone
+      # 数据源平台 支持mysql或不保存empty
+      - SPRING_DATASOURCE_PLATFORM=mysql
+      # mysql配置,容器名称
+      - MYSQL_SERVICE_HOST=kxs-mysql
+      - MYSQL_SERVICE_PORT=3306
+      - MYSQL_SERVICE_USER=root
+      - MYSQL_SERVICE_PASSWORD=root
+      - MYSQL_SERVICE_DB_NAME=kxs_config
+    volumes:
+      - ./logs/nacos:/home/nacos/logs
+    ports:
+      - "8848:8848"
+      - "9848:9848"
+    restart: always
+    networks:
+      - kxs_cloud_network
 
   kxs-redis:
     image: redis:7.0.6
@@ -26,7 +51,7 @@ services:
     container_name: kxs-redis
     hostname: kxs-redis
     networks:
-      - kxs_default
+      - kxs_cloud_network
 
   kxs-gateway:
     build:
@@ -38,7 +63,7 @@ services:
     hostname: kxs-gateway
     image: kxs-gateway
     networks:
-      - kxs_default
+      - kxs_cloud_network
 
   kxs-system:
     build:
@@ -50,11 +75,11 @@ services:
     volumes:
       - ./logs/kxs-system-biz:/kxs-system-biz/logs
     networks:
-      - kxs_default
+      - kxs_cloud_network
 
   kxs-codegen:
     build:
-      context: ./kxs-visual/kxs-codegen
+      context: ./kxs-codegen
     restart: always
     container_name: kxs-codegen
     hostname: kxs-codegen
@@ -62,36 +87,36 @@ services:
     volumes:
       - ./logs/kxs-codegen:/kxs-codegen/logs
     networks:
-      - kxs_default
+      - kxs_cloud_network
 
-  kxs-daemon-quartz:
+  kxs-quartz:
     build:
-      context: ./kxs-visual/kxs-quartz
+      context: ./kxs-quartz
     restart: always
     image: kxs-quartz
     container_name: kxs-quartz
     networks:
-      - kxs_default
-
-#  kxs-rabbitmq:
-#    image: rabbitmq:3.12.8
-#    container_name: kxs-rabbitmq
-#    restart: always
-#    volumes:
-#      - "/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime"        #设置系统时区
-#      - "/usr/share/zoneinfo/Asia/Shanghai:/etc/timezone"  #设置时区
-#      - "./data/rabbit/:/var/lib/rabbitmq/"
-#      - "./logs/rabbit:/var/log/rabbitmq/"
-#    ports:
-#      - 5672:5672
-#      - 15672:15672
-#    environment:
-#      - RABBITMQ_DEFAULT_USER=admin
-#      - RABBITMQ_DEFAULT_PASS=admin
-#    networks:
-#      - kxs_default
+      - kxs_cloud_network
 
+  kxs-rabbitmq:
+    image: rabbitmq:3.12.8
+    container_name: kxs-rabbitmq
+    restart: always
+    volumes:
+      - "/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime"        #设置系统时区
+      - "/usr/share/zoneinfo/Asia/Shanghai:/etc/timezone"  #设置时区
+      - "./data/rabbit/:/var/lib/rabbitmq/"
+      - "./logs/rabbit:/var/log/rabbitmq/"
+    ports:
+      - 5672:5672
+      - 15672:15672
+    environment:
+      - RABBITMQ_DEFAULT_USER=admin
+      - RABBITMQ_DEFAULT_PASS=admin
+    networks:
+      - kxs_cloud_network
 
 networks:
-  kxs_default:
+  kxs_cloud_network:
+    name: kxs_cloud_network
     driver: bridge

+ 0 - 37
kxs-codegen/src/main/resources/application.yml

@@ -1,13 +1,6 @@
 server:
   port: 4002
 
-# 配置文件加密根密码
-jasypt:
-  encryptor:
-    password: pig
-    algorithm: PBEWithMD5AndDES
-    iv-generator-classname: org.jasypt.iv.NoIvGenerator
-
 spring:
   profiles:
     active: dev
@@ -38,21 +31,6 @@ spring:
 
 
 
---- #################### 接口文档配置 ####################
-
-springdoc:
-  api-docs:
-    enabled: true
-    path: /v3/api-docs
-  swagger-ui:
-    enabled: true
-    path: /swagger-ui
-  default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
-
-knife4j:
-  enable: true
-  setting:
-    language: zh_cn
 
 # mybaits-plus配置
 mybatis-plus:
@@ -69,20 +47,5 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     shrink-whitespaces-in-sql: true
 
-spring:
-  freemarker:
-    allow-request-override: false
-    allow-session-override: false
-    cache: true
-    charset: UTF-8
-    check-template-location: true
-    content-type: text/html
-    enabled: true
-    expose-request-attributes: false
-    expose-session-attributes: false
-    expose-spring-macro-helpers: true
-    prefer-file-system-access: true
-    suffix: .ftl
-    template-loader-path: classpath:/templates/
 
 

+ 70 - 0
kxs-common/kxs-common-swagger/pom.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~
+  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
+  ~
+  ~  Redistribution and use in source and binary forms, with or without
+  ~  modification, are permitted provided that the following conditions are met:
+  ~
+  ~ Redistributions of source code must retain the above copyright notice,
+  ~  this list of conditions and the following disclaimer.
+  ~  Redistributions in binary form must reproduce the above copyright
+  ~  notice, this list of conditions and the following disclaimer in the
+  ~  documentation and/or other materials provided with the distribution.
+  ~  Neither the name of the sky4cloud.com developer nor the names of its
+  ~  contributors may be used to endorse or promote products derived from
+  ~  this software without specific prior written permission.
+  ~  Author: lengleng (wangiegie@gmail.com)
+  ~
+  -->
+
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.kxs</groupId>
+        <artifactId>kxs-common</artifactId>
+        <version>1.1.0</version>
+    </parent>
+
+    <artifactId>kxs-common-swagger</artifactId>
+    <packaging>jar</packaging>
+
+    <description>kxs 接口文档</description>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <!--接口文档-->
+        <dependency>
+            <groupId>org.springdoc</groupId>
+            <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
+        </dependency>
+        <!--webflux 相关包-->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webflux</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <!--网关 swagger 聚合依赖-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-gateway-server</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-commons</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>

+ 52 - 0
kxs-common/kxs-common-swagger/src/main/java/com/kxs/common/swagger/annotation/EnableSkyDoc.java

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020 sky4cloud Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.kxs.common.swagger.annotation;
+
+import com.kxs.common.swagger.config.OpenAPIDefinitionImportSelector;
+import com.kxs.common.swagger.support.SwaggerProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Import;
+
+import java.lang.annotation.*;
+
+/**
+ * 开启 sky spring doc
+ *
+ * @author lengleng
+ * @date 2022-03-26
+ */
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+@EnableConfigurationProperties(SwaggerProperties.class)
+@Import(OpenAPIDefinitionImportSelector.class)
+public @interface EnableSkyDoc {
+
+	/**
+	 * 网关路由前缀
+	 * @return String
+	 */
+	String value();
+
+	/**
+	 * 是否是微服务架构
+	 * @return true
+	 */
+	boolean isMicro() default true;
+
+}

+ 93 - 0
kxs-common/kxs-common-swagger/src/main/java/com/kxs/common/swagger/config/OpenAPIDefinition.java

@@ -0,0 +1,93 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the sky4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+package com.kxs.common.swagger.config;
+
+import com.kxs.common.swagger.support.SwaggerProperties;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.security.OAuthFlow;
+import io.swagger.v3.oas.models.security.OAuthFlows;
+import io.swagger.v3.oas.models.security.Scopes;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import io.swagger.v3.oas.models.servers.Server;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import org.springdoc.core.utils.SpringDocUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.http.HttpHeaders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * swagger配置
+ *
+ * <p>
+ * 禁用方法1:使用注解@Profile({"dev","test"})
+ *
+ * 表示在开发或测试环境开启,而在生产关闭。(推荐使用) 禁用方法2:使用注解@ConditionalOnProperty(name = "swagger.enable",
+ *
+ * havingValue = "true") 然后在测试配置或者开发配置中添加swagger.enable=true即可开启,生产环境不填则默认关闭Swagger.
+ * </p>
+ *
+ * @author lengleng
+ */
+@RequiredArgsConstructor
+@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
+public class OpenAPIDefinition extends OpenAPI implements InitializingBean, ApplicationContextAware {
+
+	@Setter
+	private String path;
+
+	private ApplicationContext applicationContext;
+
+	private SecurityScheme securityScheme(SwaggerProperties swaggerProperties) {
+		OAuthFlow clientCredential = new OAuthFlow();
+		clientCredential.setTokenUrl(swaggerProperties.getTokenUrl());
+		clientCredential.setScopes(new Scopes().addString(swaggerProperties.getScope(), swaggerProperties.getScope()));
+		OAuthFlows oauthFlows = new OAuthFlows();
+		oauthFlows.password(clientCredential);
+		SecurityScheme securityScheme = new SecurityScheme();
+		securityScheme.setType(SecurityScheme.Type.OAUTH2);
+		securityScheme.setFlows(oauthFlows);
+		return securityScheme;
+	}
+
+	@Override
+	public void afterPropertiesSet() {
+		SwaggerProperties swaggerProperties = applicationContext.getBean(SwaggerProperties.class);
+		this.info(new Info().title(swaggerProperties.getTitle()));
+		// oauth2.0 password
+		this.schemaRequirement(HttpHeaders.AUTHORIZATION, this.securityScheme(swaggerProperties));
+		// servers
+		List<Server> serverList = new ArrayList<>();
+		serverList.add(new Server().url(swaggerProperties.getGateway() + "/" + path));
+		this.servers(serverList);
+		// 支持参数平铺
+		SpringDocUtils.getConfig().addSimpleTypesForParameterObject(Class.class);
+	}
+
+	@Override
+	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+		this.applicationContext = applicationContext;
+	}
+
+}

+ 49 - 0
kxs-common/kxs-common-swagger/src/main/java/com/kxs/common/swagger/config/OpenAPIDefinitionImportSelector.java

@@ -0,0 +1,49 @@
+package com.kxs.common.swagger.config;
+
+import com.kxs.common.swagger.annotation.EnableSkyDoc;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
+import org.springframework.core.type.AnnotationMetadata;
+
+import java.util.Optional;
+
+/**
+ * openapi 配置类
+ *
+ * @author lengleng
+ * @date 2023/1/1
+ */
+public class OpenAPIDefinitionImportSelector implements ImportBeanDefinitionRegistrar {
+
+	/**
+	 * 注册Bean定义方法
+	 * @param metadata 注解元数据
+	 * @param registry Bean定义注册器
+	 */
+	@Override
+	public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
+		Optional.ofNullable(metadata.getAnnotationAttributes(EnableSkyDoc.class.getName(), true))
+			.map(attrs -> attrs.get("value"))
+			.ifPresent(value -> {
+				//未使用注册中心,注释此bean
+//				createBeanDefinition(registry, "openAPIMetadataRegister", OpenAPIMetadataRegister.class, value);
+				createBeanDefinition(registry, "openAPIDefinition", OpenAPIDefinition.class, value);
+			});
+	}
+
+	/**
+	 * 创建Bean定义
+	 * @param registry Bean定义注册器
+	 * @param beanName Bean名称
+	 * @param beanClass Bean类
+	 * @param value Bean属性值
+	 */
+	private void createBeanDefinition(BeanDefinitionRegistry registry, String beanName, Class<?> beanClass,
+			Object value) {
+		BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(beanClass);
+		beanDefinition.addPropertyValue("path", value);
+		registry.registerBeanDefinition(beanName, beanDefinition.getBeanDefinition());
+	}
+
+}

+ 42 - 0
kxs-common/kxs-common-swagger/src/main/java/com/kxs/common/swagger/config/OpenAPIMetadataRegister.java

@@ -0,0 +1,42 @@
+package com.kxs.common.swagger.config;
+
+import lombok.Setter;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.cloud.client.ServiceInstance;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * @author lengleng
+ * @date 2023/1/4
+ */
+public class OpenAPIMetadataRegister implements InitializingBean, ApplicationContextAware {
+
+	private ApplicationContext applicationContext;
+
+	@Setter
+	private String path;
+
+	/**
+	 * 设置应用程序上下文
+	 * @param applicationContext 应用程序上下文
+	 * @throws BeansException 可能抛出的异常
+	 */
+	@Override
+	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+		this.applicationContext = applicationContext;
+	}
+
+	/**
+	 * 在属性设置后执行的初始化方法
+	 */
+	@Override
+	public void afterPropertiesSet() {
+		// 获取ServiceInstance实例
+		ServiceInstance serviceInstance = applicationContext.getBean(ServiceInstance.class);
+		// 设置元数据
+		serviceInstance.getMetadata().put("spring-doc", path);
+	}
+
+}

+ 86 - 0
kxs-common/kxs-common-swagger/src/main/java/com/kxs/common/swagger/support/SwaggerProperties.java

@@ -0,0 +1,86 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the sky4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+package com.kxs.common.swagger.support;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * SwaggerProperties
+ *
+ * @author lengleng
+ * @date 2018/7/25 14:00
+ */
+@Data
+@ConfigurationProperties("swagger")
+public class SwaggerProperties {
+
+	/**
+	 * 是否开启swagger
+	 */
+	private Boolean enabled = true;
+
+	/**
+	 * swagger会解析的包路径
+	 **/
+	private String basePackage = "";
+
+	/**
+	 * swagger会解析的url规则
+	 **/
+	private List<String> basePath = new ArrayList<>();
+
+	/**
+	 * 在basePath基础上需要排除的url规则
+	 **/
+	private List<String> excludePath = new ArrayList<>();
+
+	/**
+	 * 需要排除的服务
+	 */
+	private List<String> ignoreProviders = new ArrayList<>();
+
+	/**
+	 * 标题
+	 **/
+	private String title = "";
+
+	/**
+	 * 网关
+	 */
+	private String gateway;
+
+	/**
+	 * 获取token
+	 */
+	private String tokenUrl;
+
+	/**
+	 * 作用域
+	 */
+	private String scope;
+
+	/**
+	 * 服务转发配置
+	 */
+	private Map<String, String> services;
+
+}

+ 1 - 0
kxs-common/pom.xml

@@ -22,6 +22,7 @@
         <module>kxs-common-log</module>
         <module>kxs-common-mybatis</module>
         <module>kxs-common-datasource</module>
+        <module>kxs-common-swagger</module>
     </modules>
     <dependencyManagement>
         <dependencies>

+ 22 - 6
kxs-gateway/pom.xml

@@ -18,6 +18,16 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-gateway</artifactId>
         </dependency>
+        <!--注册中心客户端-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <!--配置中心客户端-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
@@ -60,6 +70,12 @@
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
         </dependency>
+        <!--接口文档-->
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-gateway-spring-boot-starter</artifactId>
+            <version>4.3.0</version>
+        </dependency>
         <dependency>
             <groupId>org.jetbrains</groupId>
             <artifactId>annotations</artifactId>
@@ -70,11 +86,11 @@
 
 
     <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
     </build>
 </project>

+ 13 - 1
kxs-gateway/src/main/resources/application.yml

@@ -5,7 +5,7 @@ spring:
   profiles:
     active: @profiles.active@
   application:
-    name: kxs-gateway
+    name: @artifactId@
   cloud:
     gateway:
       routes:
@@ -58,6 +58,18 @@ spring:
           filters:
             - RewritePath=/v3/api-docs/(?<path>.*), /$\{path}/$\{path}/v3/api-docs
 
+knife4j:
+  gateway:
+    enabled: true
+    tags-sorter: order
+    operations-sorter: order
+    strategy: manual
+    routes:
+      - name: 权限管理
+        url: /v1/kxs/admin/v3/api-docs?group=default
+        service-name: system
+        context-path: /admin
+
 gateway:
   aes:
     encode-key: 'CBTU1dD4Kd5pyiGWTsI10jRQ3SvKusSV'

+ 10 - 0
kxs-quartz/pom.xml

@@ -15,6 +15,16 @@
     <description>基于quartz后台定时任务模块</description>
 
     <dependencies>
+        <!--注册中心客户端-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <!--配置中心客户端-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
         <!--日志处理-->
         <dependency>
             <groupId>com.kxs</groupId>

+ 2 - 6
kxs-quartz/src/main/resources/application.yml

@@ -4,12 +4,8 @@ server:
 spring:
   application:
     name: @artifactId@
-  datasource:
-    type: com.zaxxer.hikari.HikariDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    username: root
-    password: root
-    url: jdbc:mysql://localhost:3306/kxs_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+  profiles:
+    active: @profiles.active@
   quartz:
     #相关属性配置
     properties:

+ 0 - 9
kxs-system/kxs-system-api/pom.xml

@@ -34,14 +34,5 @@
             <groupId>com.kxs</groupId>
             <artifactId>kxs-common-mybatis</artifactId>
         </dependency>
-        <!--swagger 注解-->
-        <dependency>
-            <groupId>com.github.xiaoymin</groupId>
-            <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springdoc</groupId>
-            <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
-        </dependency>
     </dependencies>
 </project>

+ 1 - 1
kxs-system/kxs-system-api/src/main/java/com/kxs/system/api/feign/config/AdminFeignClientConfiguration.java

@@ -26,7 +26,7 @@ import org.springframework.web.service.invoker.HttpServiceProxyFactory;
 @RequiredArgsConstructor
 public class AdminFeignClientConfiguration {
 
-	private static final String ADMIN_SERVICE = "http://localhost:8080";
+	private static final String ADMIN_SERVICE = "http://localhost:8888";
 
 	@Bean
 	public WebClient oauthRequestInterceptor() {

+ 5 - 76
kxs-system/kxs-system-biz/pom.xml

@@ -57,89 +57,18 @@
             <groupId>com.mysql</groupId>
             <artifactId>mysql-connector-j</artifactId>
         </dependency>
+        <!--接口文档-->
+        <dependency>
+            <groupId>com.kxs</groupId>
+            <artifactId>kxs-common-swagger</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
         <plugins>
-            <!--该插件的作用是打包spring-boot的jar包-->
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <!--不排除的话,systemScope的依赖包会自动被此插件打包进xxx.jar\BOOT-INF\lib,和外部依赖产生冲突 -->
-                    <includeSystemScope>false</includeSystemScope>
-                    <skip>false</skip>
-                    <!--分离Jar包-->
-                    <layout>ZIP</layout>
-                    <includes>
-                        <include>
-                            <groupId>nothing</groupId>
-                            <artifactId>nothing</artifactId>
-                        </include>
-                    </includes>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <!-- 该插件的作用是复制依赖的jar包到指定的文件夹里 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-dependencies</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}/lib/</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <!-- 该插件的作用是复制指定的文件 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <!-- 复制配置文件 -->
-                    <execution>
-                        <id>copy-resources</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <resources>
-                                <!--复制资源文件到外部,注意这里先不做filtering处理,防止某些静态文件损坏-->
-                                <resource>
-                                    <filtering>false</filtering>
-                                    <directory>src/main/resources</directory>
-                                    <includes>
-                                        <include>**/*</include>
-                                    </includes>
-                                </resource>
-                                <!--仅针对配置文件filtering处理(占位符@@等)-->
-                                <resource>
-                                    <directory>src/main/resources</directory>
-                                    <filtering>true</filtering>
-                                    <includes>
-                                        <include>*.xml</include>
-                                        <include>*.yml</include>
-                                        <include>*.properties</include>
-                                    </includes>
-                                </resource>
-                            </resources>
-                            <outputDirectory>${project.build.directory}/config</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
             </plugin>
         </plugins>
     </build>

+ 2 - 0
kxs-system/kxs-system-biz/src/main/java/com/kxs/system/biz/KxsAdminApplication.java

@@ -2,6 +2,7 @@ package com.kxs.system.biz;
 
 import com.kxs.common.security.annotation.EnableAuthResourceServer;
 import com.kxs.common.security.annotation.EnableLoginResourceServer;
+import com.kxs.common.swagger.annotation.EnableSkyDoc;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
@@ -14,6 +15,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @SpringBootApplication
 @EnableLoginResourceServer
 @EnableAuthResourceServer
+@EnableSkyDoc(value = "admin")
 public class KxsAdminApplication {
 
 	public static void main(String[] args) {

+ 11 - 16
kxs-system/kxs-system-biz/src/main/resources/application.yml

@@ -5,7 +5,7 @@ spring:
   profiles:
     active: @profiles.active@
   application:
-    name: kxs-admin
+    name: @artifactId@
   cache:
     type: redis
   # Servlet 配置
@@ -15,21 +15,16 @@ spring:
       max-file-size: 16MB # 单个文件大小
       max-request-size: 32MB # 设置总上传的文件大小
 
---- #################### 接口文档配置 ####################
-
-springdoc:
-  api-docs:
-    enabled: true
-    path: /v3/api-docs
-  swagger-ui:
-    enabled: true
-    path: /swagger-ui
-  default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
-
-knife4j:
-  enable: true
-  setting:
-    language: zh_cn
+# swagger 配置
+swagger:
+  enabled: true
+  title: 客小爽API
+  gateway: http://${GATEWAY_HOST:localhost}:${GATEWAY-PORT:9999}
+  token-url: ${swagger.gateway}/v1/kxs/admin/oauth2/token
+  scope: server
+  services:
+    kxs-system-biz: admin
+    sky-codegen: gen
 
 # mybaits-plus配置
 mybatis-plus:

+ 39 - 0
pom.xml

@@ -208,6 +208,12 @@
                 <artifactId>kxs-common-security</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <!-- API文档 -->
+            <dependency>
+                <groupId>com.kxs</groupId>
+                <artifactId>kxs-common-swagger</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.kxs</groupId>
                 <artifactId>kxs-common-mybatis</artifactId>
@@ -238,7 +244,40 @@
                 <filtering>true</filtering>
             </resource>
         </resources>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-maven-plugin</artifactId>
+                    <version>${spring-boot.version}</version>
+                    <configuration>
+                        <finalName>${project.build.finalName}</finalName>
+                        <layers>
+                            <enabled>true</enabled>
+                        </layers>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>repackage</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${maven-compiler-plugin.version}</version>
+                <configuration>
+                    <debug>false</debug>
+                    <compilerArgs>
+                        <arg>-parameters</arg>
+                    </compilerArgs>
+                </configuration>
+            </plugin>
             <!--打包jar 与git commit 关联插件-->
             <plugin>
                 <groupId>io.github.git-commit-id</groupId>