Pre Merge pull request !184 from haoran1009/auto-9270061-master-9a4010a5-1
commit
1cc6ea4bc4
|
@ -2,6 +2,7 @@
|
||||||
# 查看更多 .gitignore 配置 -> https://help.github.com/articles/ignoring-files/
|
# 查看更多 .gitignore 配置 -> https://help.github.com/articles/ignoring-files/
|
||||||
|
|
||||||
target/
|
target/
|
||||||
|
lib/
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
.flattened-pom.xml
|
.flattened-pom.xml
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -25,6 +25,7 @@
|
||||||
<!-- 友情提示:基于 Spring AI 实现 LLM 大模型的接入,需要使用 JDK17 版本,详细可见 https://doc.iocoder.cn/ai/build/ -->
|
<!-- 友情提示:基于 Spring AI 实现 LLM 大模型的接入,需要使用 JDK17 版本,详细可见 https://doc.iocoder.cn/ai/build/ -->
|
||||||
<!-- <module>yudao-module-ai</module>-->
|
<!-- <module>yudao-module-ai</module>-->
|
||||||
<module>yudao-module-iot</module>
|
<module>yudao-module-iot</module>
|
||||||
|
<module>sk-module-data</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<modules>
|
||||||
|
<module>sk-module-data-api</module>
|
||||||
|
<module>sk-module-data-biz</module>
|
||||||
|
</modules>
|
||||||
|
<artifactId>sk-module-data</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
data 模块下,提供对外的数据,以接口的形式提供
|
||||||
|
</description>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>sk-module-data</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>sk-module-data-api</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
data 模块 API, 暴露给其他模块调用
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-ui</artifactId>
|
||||||
|
<scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 参数校验 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RPC 远程调用相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.sk.module.data.api.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.sk.module.data.api.finance.dto.FinanceRespDTO;
|
||||||
|
import org.sk.module.data.enums.ApiConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME)
|
||||||
|
@Tag(name = "RPC 服务:财务数据")
|
||||||
|
public interface FinanceApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/finance";
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getInfo")
|
||||||
|
@Operation(summary = "获取财务信息")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "creditCode", description = "统一身份认证编码", example = "SEX", required = true),
|
||||||
|
@Parameter(name = "year", description = "年份", example = "2022", required = true)
|
||||||
|
})
|
||||||
|
CommonResult<FinanceRespDTO> getFinanceInfo(@RequestParam("creditCode") String creditCode,
|
||||||
|
@RequestParam("year") String year);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.sk.module.data.api.finance.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "RPC 服务 - 财务数据 Response DTO")
|
||||||
|
@Data
|
||||||
|
public class FinanceRespDTO {
|
||||||
|
|
||||||
|
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "企业")
|
||||||
|
private String comName;
|
||||||
|
|
||||||
|
@Schema(description = "社会统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "008x")
|
||||||
|
private String creditCode;
|
||||||
|
|
||||||
|
@Schema(description = "营收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "23.10")
|
||||||
|
private BigDecimal Income;
|
||||||
|
|
||||||
|
@Schema(description = "税收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||||
|
private BigDecimal tax;
|
||||||
|
|
||||||
|
@Schema(description = "年份", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022")
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.sk.module.data.enums;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 相关的枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class ApiConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务名
|
||||||
|
*
|
||||||
|
* 注意,需要保证和 spring.application.name 保持一致
|
||||||
|
*/
|
||||||
|
public static final String NAME = "data-server";
|
||||||
|
|
||||||
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/data";
|
||||||
|
|
||||||
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.sk.skmoduledataapi;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class SkModuleDataApiApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,243 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>sk-module-data</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>sk-module-data-biz</artifactId>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
data 模块下, 放置自己的业务。
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring Cloud 基础 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-env</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 依赖服务 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>sk-module-data-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-module-infra-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务组件 -->
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- DB 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-redis</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
|
||||||
|
<!-- RPC 远程调用相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Registry 注册中心相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Config 配置中心相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Job 定时任务相关 -->
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-job</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
|
||||||
|
<!-- 消息队列相关 -->
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-mq</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
|
||||||
|
<!-- 服务保障相关 TODO 芋艿:暂时去掉 -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-protection</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<!-- Test 测试相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>cn.iocoder.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>yudao-spring-boot-starter-excel</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-starter-mail</artifactId>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
|
||||||
|
<!-- 监控相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 三方云服务相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xingyuv</groupId>
|
||||||
|
<artifactId>spring-boot-starter-justauth</artifactId> <!-- 社交登陆(例如说,个人微信、企业微信等等) -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.binarywang</groupId>
|
||||||
|
<artifactId>wx-java-mp-spring-boot-starter</artifactId> <!-- 微信登录(公众号) -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.binarywang</groupId>
|
||||||
|
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId> <!-- 微信登录(小程序) -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!-- <groupId>com.xingyuv</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-starter-captcha-plus</artifactId> <!– 验证码,一般用于登录使用 –>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- 设置构建的 jar 包名 -->
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<!-- 打包时去除依赖包 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<includes>
|
||||||
|
<include>
|
||||||
|
<groupId>non-exists</groupId>
|
||||||
|
<artifactId>non-exists</artifactId>
|
||||||
|
</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--不打包资源文件-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.**</exclude>
|
||||||
|
<exclude>*/*.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
<useUniqueVersions>false</useUniqueVersions>
|
||||||
|
<mainClass>org.sk.module.data.SkModuleDataBizApplication</mainClass>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>./resources/</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--
|
||||||
|
复制配置文件、以及拷贝第三方依赖文件到指定目录
|
||||||
|
当依赖包有变化时需使用下面配置,重新生成最新的依赖包
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>*.**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<outputDirectory>${project.build.directory}/resources</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<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>lib</outputDirectory>
|
||||||
|
<excludeTransitive>false</excludeTransitive>
|
||||||
|
<stripVersion>false</stripVersion>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.sk.module.data;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class SkModuleDataBizApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SkModuleDataBizApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.sk.module.data.api.finance;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import org.sk.module.data.api.finance.dto.FinanceRespDTO;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
import org.sk.module.data.service.finance.FinanceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
|
@Validated
|
||||||
|
public class FinanceApiImpl implements FinanceApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FinanceService financeService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<FinanceRespDTO> getFinanceInfo(String creditCode, String deptCode) {
|
||||||
|
FinanceBO result = financeService.getFinanceByCreditCodeAndYear(creditCode, deptCode);
|
||||||
|
return success(BeanUtils.toBean(result, FinanceRespDTO.class));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package org.sk.module.data.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||||
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||||
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class})
|
||||||
|
public class RpcConfiguration {
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.sk.module.data.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System 模块的 Security 配置
|
||||||
|
*/
|
||||||
|
@Configuration(proxyBeanMethods = false, value = "systemSecurityConfiguration")
|
||||||
|
public class SecurityConfiguration {
|
||||||
|
|
||||||
|
@Bean("systemAuthorizeRequestsCustomizer")
|
||||||
|
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||||
|
return new AuthorizeRequestsCustomizer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
|
||||||
|
// TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案
|
||||||
|
// Swagger 接口文档
|
||||||
|
registry.requestMatchers("/v3/api-docs/**").permitAll()
|
||||||
|
.requestMatchers("/webjars/**").permitAll()
|
||||||
|
.requestMatchers("/swagger-ui").permitAll()
|
||||||
|
.requestMatchers("/swagger-ui/**").permitAll();
|
||||||
|
// Druid 监控
|
||||||
|
registry.requestMatchers("/druid/**").permitAll();
|
||||||
|
// Spring Boot Actuator 的安全配置
|
||||||
|
registry.requestMatchers("/actuator").permitAll()
|
||||||
|
.requestMatchers("/actuator/**").permitAll();
|
||||||
|
// RPC 服务的安全配置
|
||||||
|
registry.requestMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
||||||
|
registry.requestMatchers( "/finance/**").permitAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.sk.module.data.controller.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
import org.sk.module.data.dal.param.finance.FinanceParam;
|
||||||
|
import org.sk.module.data.dal.param.finance.IncomeAndTaxParam;
|
||||||
|
import org.sk.module.data.dal.vo.FinanceVO;
|
||||||
|
import org.sk.module.data.service.finance.FinanceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.security.PermitAll;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
@Tag(name = "对外接口 - 财务数据")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/finance")
|
||||||
|
public class FinanceController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FinanceService financeService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
public String get() {
|
||||||
|
return "hello wzc";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取财务信息")
|
||||||
|
@GetMapping("/getFinanceInfo")
|
||||||
|
public CommonResult<FinanceVO> getFinanceInfo(@Valid @RequestBody FinanceParam financeParam) {
|
||||||
|
|
||||||
|
FinanceBO result = financeService.getFinanceByCreditCodeAndYear(financeParam.getCreditCode(),
|
||||||
|
financeParam.getYear());
|
||||||
|
|
||||||
|
return CommonResult.success(BeanUtils.toBean(result, FinanceVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据统一社会信用代码和年份查询企业收入和税收
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Operation(summary = "根据拼接的统一社会信用编码以及年份获取数据")
|
||||||
|
@PostMapping("/getIncomeAndTax")
|
||||||
|
public CommonResult<List<FinanceVO>> getIncomeAndTax(@Valid @RequestBody IncomeAndTaxParam param) {
|
||||||
|
return CommonResult.success(financeService.getIncomeAndTax(param));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.sk.module.data.dal.bo.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FinanceBO {
|
||||||
|
|
||||||
|
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "企业")
|
||||||
|
private String comName;
|
||||||
|
|
||||||
|
@Schema(description = "社会统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "008x")
|
||||||
|
private String creditCode;
|
||||||
|
|
||||||
|
@Schema(description = "营收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "23.10")
|
||||||
|
private BigDecimal Income;
|
||||||
|
|
||||||
|
@Schema(description = "税收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||||
|
private BigDecimal tax;
|
||||||
|
|
||||||
|
@Schema(description = "年份", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022")
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.sk.module.data.dal.mapper.auth;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author haoran
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@DS("master")
|
||||||
|
public interface AuthClientMapper {
|
||||||
|
|
||||||
|
int selectClientByIdAndSecret(@Param("id")String id, @Param("secret")String secret);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.sk.module.data.dal.mapper.finance;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface FinanceMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据社会统一信用代码和年份查下企业营收和税收
|
||||||
|
* @param creditCode 社会统一信用代码
|
||||||
|
* @param year 年份
|
||||||
|
* @return FinanceBO
|
||||||
|
*/
|
||||||
|
FinanceBO getFinanceByCreditCodeAndYear(@Param("creditCode") String creditCode, @Param("year") String year);
|
||||||
|
|
||||||
|
|
||||||
|
List<FinanceBO> getIncomeAndTax(@Param("creditCodes")List<String> creditCodes, @Param("year") String year);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.sk.module.data.dal.param.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Schema(description = "财务数据 Request VO")
|
||||||
|
@Data
|
||||||
|
public class FinanceParam {
|
||||||
|
|
||||||
|
@NotBlank(message = "社会统一代码不能为空")
|
||||||
|
private String creditCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "年份不能为空")
|
||||||
|
private String year;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.sk.module.data.dal.param.finance;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 财务数据入参
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IncomeAndTaxParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社会统一代码
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "社会统一代码不能为空")
|
||||||
|
private String creditCodes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 年份
|
||||||
|
*/
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.sk.module.data.dal.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FinanceVO {
|
||||||
|
|
||||||
|
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "企业")
|
||||||
|
private String comName;
|
||||||
|
|
||||||
|
@Schema(description = "社会统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "008x")
|
||||||
|
private String creditCode;
|
||||||
|
|
||||||
|
@Schema(description = "营收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "23.10")
|
||||||
|
private BigDecimal Income;
|
||||||
|
|
||||||
|
@Schema(description = "税收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||||
|
private BigDecimal tax;
|
||||||
|
|
||||||
|
@Schema(description = "年份", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022")
|
||||||
|
private String year;
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.sk.module.data.filter;
|
||||||
|
|
||||||
|
import org.sk.module.data.dal.mapper.auth.AuthClientMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.method.HandlerMethod;
|
||||||
|
import org.springframework.web.servlet.HandlerExecutionChain;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
|
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AuthFilter implements Filter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("requestMappingHandlerMapping") // 或 "controllerEndpointHandlerMapping"
|
||||||
|
private RequestMappingHandlerMapping handlerMapping;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AuthClientMapper authClientMapper;
|
||||||
|
|
||||||
|
public AuthFilter( RequestMappingHandlerMapping requestMappingHandlerMapping) {
|
||||||
|
this.handlerMapping = requestMappingHandlerMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
|
throws IOException, ServletException {
|
||||||
|
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||||
|
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||||
|
|
||||||
|
// 获取请求头中的密钥和 ID
|
||||||
|
String id = httpRequest.getHeader("X-Id");
|
||||||
|
String secretKey = httpRequest.getHeader("X-Secret-Key");
|
||||||
|
|
||||||
|
// 校验 ID 和密钥是否匹配
|
||||||
|
if (isValid(id, secretKey)) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
} else {
|
||||||
|
httpResponse.setStatus(HttpServletResponse.SC_FORBIDDEN); // 403 Forbidden
|
||||||
|
httpResponse.setContentType("application/json");
|
||||||
|
httpResponse.getWriter().write("{\"error\": \"Invalid ID or Secret Key\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验 ID 和密钥是否匹配
|
||||||
|
*/
|
||||||
|
private boolean isValid(String id, String secretKey) {
|
||||||
|
// 示例逻辑:从数据库中查询 ID 和密钥是否匹配
|
||||||
|
return authClientMapper.selectClientByIdAndSecret(id,secretKey) == 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.sk.module.data.service.finance;
|
||||||
|
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
import org.sk.module.data.dal.param.finance.IncomeAndTaxParam;
|
||||||
|
import org.sk.module.data.dal.vo.FinanceVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface FinanceService {
|
||||||
|
|
||||||
|
|
||||||
|
FinanceBO getFinanceByCreditCodeAndYear(String creditCode, String year);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 creditCode 和 year 查询财务信息
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FinanceVO> getIncomeAndTax(IncomeAndTaxParam param);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.sk.module.data.service.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
import org.sk.module.data.dal.mapper.finance.FinanceMapper;
|
||||||
|
import org.sk.module.data.dal.param.finance.IncomeAndTaxParam;
|
||||||
|
import org.sk.module.data.dal.vo.FinanceVO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@DS("slave1")
|
||||||
|
public class FinanceServiceImpl implements FinanceService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FinanceMapper financeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinanceBO getFinanceByCreditCodeAndYear(String creditCode, String year) {
|
||||||
|
if (StringUtils.isBlank(creditCode) || StringUtils.isBlank(year)) {
|
||||||
|
return new FinanceBO();
|
||||||
|
}
|
||||||
|
return financeMapper.getFinanceByCreditCodeAndYear(creditCode, year);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FinanceVO> getIncomeAndTax(IncomeAndTaxParam param) {
|
||||||
|
String[] split = param.getCreditCodes().split(",");
|
||||||
|
List<FinanceBO> financeBOList = financeMapper.getIncomeAndTax(Arrays.asList(split), param.getYear());
|
||||||
|
return BeanUtils.toBean(financeBOList, FinanceVO.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,184 @@
|
||||||
|
--- #################### 注册中心 + 配置中心相关配置 ####################
|
||||||
|
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||||
|
username: # Nacos 账号
|
||||||
|
password: # Nacos 密码
|
||||||
|
discovery: # 【配置中心】配置项
|
||||||
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
|
metadata:
|
||||||
|
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||||
|
config: # 【注册中心】配置项
|
||||||
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
|
|
||||||
|
--- #################### 数据库相关配置 ####################
|
||||||
|
spring:
|
||||||
|
# 数据源配置项
|
||||||
|
autoconfigure:
|
||||||
|
exclude:
|
||||||
|
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||||
|
datasource:
|
||||||
|
druid: # Druid 【监控】相关的全局配置
|
||||||
|
web-stat-filter:
|
||||||
|
enabled: true
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: true
|
||||||
|
allow: # 设置白名单,不填则允许所有访问
|
||||||
|
url-pattern: /druid/*
|
||||||
|
login-username: # 控制台管理用户名和密码
|
||||||
|
login-password:
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
log-slow-sql: true # 慢 SQL 记录
|
||||||
|
slow-sql-millis: 100
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
||||||
|
dynamic: # 多数据源配置
|
||||||
|
druid: # Druid 【连接池】相关的全局配置
|
||||||
|
initial-size: 5 # 初始连接数
|
||||||
|
min-idle: 10 # 最小连接池数量
|
||||||
|
max-active: 20 # 最大连接池数量
|
||||||
|
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||||
|
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||||
|
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||||
|
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||||
|
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
|
primary: master
|
||||||
|
datasource:
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||||
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
|
redis:
|
||||||
|
host: 400-infra.server.iocoder.cn # 地址
|
||||||
|
port: 6379 # 端口
|
||||||
|
database: 1 # 数据库索引
|
||||||
|
# password: 123456 # 密码,建议生产环境开启
|
||||||
|
|
||||||
|
--- #################### MQ 消息队列相关配置 ####################
|
||||||
|
|
||||||
|
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||||
|
rocketmq:
|
||||||
|
name-server: 127.0.0.1:9876 # RocketMQ Namesrv
|
||||||
|
|
||||||
|
spring:
|
||||||
|
# RabbitMQ 配置项,对应 RabbitProperties 配置类
|
||||||
|
rabbitmq:
|
||||||
|
host: 127.0.0.1 # RabbitMQ 服务的地址
|
||||||
|
port: 5672 # RabbitMQ 服务的端口
|
||||||
|
username: guest # RabbitMQ 服务的账号
|
||||||
|
password: guest # RabbitMQ 服务的密码
|
||||||
|
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||||
|
kafka:
|
||||||
|
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||||
|
|
||||||
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
xxl:
|
||||||
|
job:
|
||||||
|
admin:
|
||||||
|
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||||
|
|
||||||
|
--- #################### 服务保障相关配置 ####################
|
||||||
|
|
||||||
|
# Lock4j 配置项
|
||||||
|
lock4j:
|
||||||
|
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||||
|
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||||
|
|
||||||
|
--- #################### 监控相关配置 ####################
|
||||||
|
|
||||||
|
# Actuator 监控端点的配置项
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||||
|
exposure:
|
||||||
|
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||||
|
|
||||||
|
# Spring Boot Admin 配置项
|
||||||
|
spring:
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
# Spring Boot Admin Client 客户端的相关配置
|
||||||
|
client:
|
||||||
|
instance:
|
||||||
|
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||||
|
# Spring Boot Admin Server 服务端的相关配置
|
||||||
|
context-path: /admin # 配置 Spring
|
||||||
|
|
||||||
|
# 日志文件配置
|
||||||
|
logging:
|
||||||
|
file:
|
||||||
|
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
||||||
|
|
||||||
|
--- #################### 微信公众号、小程序相关配置 ####################
|
||||||
|
wx:
|
||||||
|
mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
|
||||||
|
# app-id: wx041349c6f39b268b
|
||||||
|
# secret: 5abee519483bc9f8cb37ce280e814bd0
|
||||||
|
app-id: wx5b23ba7a5589ecbb # 测试号
|
||||||
|
secret: 2a7b3b20c537e52e74afd395eb85f61f
|
||||||
|
# 存储配置,解决 AccessToken 的跨节点的共享
|
||||||
|
config-storage:
|
||||||
|
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||||
|
key-prefix: wx # Redis Key 的前缀
|
||||||
|
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
|
||||||
|
miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档
|
||||||
|
# appid: wx62056c0d5e8db250
|
||||||
|
# secret: 333ae72f41552af1e998fe1f54e1584a
|
||||||
|
appid: wx63c280fe3248a3e7 # wenhualian的接口测试号
|
||||||
|
secret: 6f270509224a7ae1296bbf1c8cb97aed
|
||||||
|
config-storage:
|
||||||
|
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||||
|
key-prefix: wa # Redis Key 的前缀
|
||||||
|
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
|
||||||
|
|
||||||
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
|
# 芋道配置项,设置当前项目所有自定义的配置
|
||||||
|
yudao:
|
||||||
|
demo: true # 开启演示模式
|
||||||
|
|
||||||
|
justauth:
|
||||||
|
enabled: true
|
||||||
|
type:
|
||||||
|
DINGTALK: # 钉钉
|
||||||
|
client-id: dingvrnreaje3yqvzhxg
|
||||||
|
client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
WECHAT_ENTERPRISE: # 企业微信
|
||||||
|
client-id: wwd411c69a39ad2e54
|
||||||
|
client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw
|
||||||
|
agent-id: 1000004
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
# noinspection SpringBootApplicationYaml
|
||||||
|
WECHAT_MINI_APP: # 微信小程序
|
||||||
|
client-id: ${wx.miniapp.appid}
|
||||||
|
client-secret: ${wx.miniapp.secret}
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验
|
||||||
|
WECHAT_MP: # 微信公众号
|
||||||
|
client-id: ${wx.mp.app-id}
|
||||||
|
client-secret: ${wx.mp.secret}
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
cache:
|
||||||
|
type: REDIS
|
||||||
|
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||||
|
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
|
@ -0,0 +1,215 @@
|
||||||
|
--- #################### 注册中心 + 配置中心相关配置 ####################
|
||||||
|
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
#server-addr: 218.22.24.55:8848 # Nacos 服务器地址
|
||||||
|
server-addr: 10.161.4.102:8848 # Nacos 服务器地址
|
||||||
|
username: #nacos # Nacos 账号
|
||||||
|
password: #Sk&Dc0909 # Nacos 密码
|
||||||
|
discovery: # 【配置中心】配置项
|
||||||
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
|
metadata:
|
||||||
|
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||||
|
config: # 【注册中心】配置项
|
||||||
|
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||||
|
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||||
|
|
||||||
|
--- #################### 数据库相关配置 ####################
|
||||||
|
spring:
|
||||||
|
# 数据源配置项
|
||||||
|
autoconfigure:
|
||||||
|
exclude:
|
||||||
|
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||||
|
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
||||||
|
datasource:
|
||||||
|
druid: # Druid 【监控】相关的全局配置
|
||||||
|
web-stat-filter:
|
||||||
|
enabled: true
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: true
|
||||||
|
allow: # 设置白名单,不填则允许所有访问
|
||||||
|
url-pattern: /druid/*
|
||||||
|
login-username: # 控制台管理用户名和密码
|
||||||
|
login-password:
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
log-slow-sql: true # 慢 SQL 记录
|
||||||
|
slow-sql-millis: 100
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
||||||
|
dynamic: # 多数据源配置
|
||||||
|
druid: # Druid 【连接池】相关的全局配置
|
||||||
|
initial-size: 1 # 初始连接数
|
||||||
|
min-idle: 1 # 最小连接池数量
|
||||||
|
max-active: 20 # 最大连接池数量
|
||||||
|
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||||
|
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||||
|
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||||
|
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||||
|
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
|
primary: master
|
||||||
|
datasource:
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://218.22.24.55:10036/duban?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
|
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例
|
||||||
|
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||||
|
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||||
|
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例
|
||||||
|
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||||
|
username: duban
|
||||||
|
password: Db@wsx25
|
||||||
|
# username: sa # SQL Server 连接的示例
|
||||||
|
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例
|
||||||
|
# username: SYSDBA # DM 连接的示例
|
||||||
|
# password: SYSDBA # DM 连接的示例
|
||||||
|
#slave: # 模拟从库,可根据自己需要修改
|
||||||
|
# lazy: true # 开启懒加载,保证启动速度
|
||||||
|
# url: jdbc:mysql://218.22.24.55:10036/duban?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true
|
||||||
|
# username: duban
|
||||||
|
# password: Db@wsx25
|
||||||
|
|
||||||
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
|
#redis:
|
||||||
|
# host: 127.0.0.1 # 地址
|
||||||
|
# port: 6379 # 端口
|
||||||
|
# database: 0 # 数据库索引
|
||||||
|
# password: 123456 # 密码,建议生产环境开启
|
||||||
|
|
||||||
|
--- #################### MQ 消息队列相关配置 ####################
|
||||||
|
|
||||||
|
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||||
|
#rocketmq:
|
||||||
|
# name-server: 127.0.0.1:9876 # RocketMQ Namesrv
|
||||||
|
|
||||||
|
#spring:
|
||||||
|
# # RabbitMQ 配置项,对应 RabbitProperties 配置类
|
||||||
|
# rabbitmq:
|
||||||
|
# host: 127.0.0.1 # RabbitMQ 服务的地址
|
||||||
|
# port: 5672 # RabbitMQ 服务的端口
|
||||||
|
# username: guest # RabbitMQ 服务的账号
|
||||||
|
# password: guest # RabbitMQ 服务的密码
|
||||||
|
# # Kafka 配置项,对应 KafkaProperties 配置类
|
||||||
|
# kafka:
|
||||||
|
# bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||||
|
|
||||||
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
|
||||||
|
#xxl:
|
||||||
|
# job:
|
||||||
|
# enabled: false # 是否开启调度中心,默认为 true 开启
|
||||||
|
# admin:
|
||||||
|
# addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||||
|
|
||||||
|
--- #################### 服务保障相关配置 ####################
|
||||||
|
|
||||||
|
# Lock4j 配置项
|
||||||
|
lock4j:
|
||||||
|
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||||
|
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||||
|
|
||||||
|
--- #################### 监控相关配置 ####################
|
||||||
|
|
||||||
|
# Actuator 监控端点的配置项
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||||
|
exposure:
|
||||||
|
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||||
|
|
||||||
|
# Spring Boot Admin 配置项
|
||||||
|
spring:
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
# Spring Boot Admin Client 客户端的相关配置
|
||||||
|
client:
|
||||||
|
instance:
|
||||||
|
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||||
|
|
||||||
|
# 日志文件配置
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
# 配置自己写的 MyBatis Mapper 打印日志
|
||||||
|
cn.iocoder.yudao.module.system.dal.mysql: debug
|
||||||
|
cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
|
||||||
|
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示
|
||||||
|
|
||||||
|
--- #################### 微信公众号、小程序相关配置 ####################
|
||||||
|
wx:
|
||||||
|
mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
|
||||||
|
# app-id: wx041349c6f39b268b # 测试号(牛希尧提供的)
|
||||||
|
# secret: 5abee519483bc9f8cb37ce280e814bd0
|
||||||
|
app-id: wx5b23ba7a5589ecbb # 测试号(自己的)
|
||||||
|
secret: 2a7b3b20c537e52e74afd395eb85f61f
|
||||||
|
# app-id: wxa69ab825b163be19 # 测试号(Kongdy 提供的)
|
||||||
|
# secret: bd4f9fab889591b62aeac0d7b8d8b4a0
|
||||||
|
# 存储配置,解决 AccessToken 的跨节点的共享
|
||||||
|
config-storage:
|
||||||
|
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||||
|
key-prefix: wx # Redis Key 的前缀
|
||||||
|
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
|
||||||
|
miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档
|
||||||
|
# appid: wx62056c0d5e8db250 # 测试号(牛希尧提供的)
|
||||||
|
# secret: 333ae72f41552af1e998fe1f54e1584a
|
||||||
|
# appid: wx63c280fe3248a3e7 # wenhualian的接口测试号
|
||||||
|
# secret: 6f270509224a7ae1296bbf1c8cb97aed
|
||||||
|
# appid: wxc4598c446f8a9cb3 # 测试号(Kongdy 提供的)
|
||||||
|
# secret: 4a1a04e07f6a4a0751b39c3064a92c8b
|
||||||
|
appid: wx66186af0759f47c9 # 测试号(puhui 提供的)
|
||||||
|
secret: 3218bcbd112cbc614c7264ceb20144ac
|
||||||
|
config-storage:
|
||||||
|
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||||
|
key-prefix: wa # Redis Key 的前缀
|
||||||
|
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
|
||||||
|
|
||||||
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
|
# 芋道配置项,设置当前项目所有自定义的配置
|
||||||
|
yudao:
|
||||||
|
env: # 多环境的配置项
|
||||||
|
tag: ${HOSTNAME}
|
||||||
|
captcha:
|
||||||
|
enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试
|
||||||
|
security:
|
||||||
|
mock-enable: true
|
||||||
|
access-log: # 访问日志的配置项
|
||||||
|
enable: false
|
||||||
|
wxa-code:
|
||||||
|
env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
|
||||||
|
wxa-subscribe-message:
|
||||||
|
miniprogram-state: developer # 跳转小程序类型:开发版为 “developer”;体验版为 “trial”为;正式版为 “formal”
|
||||||
|
|
||||||
|
justauth:
|
||||||
|
enabled: true
|
||||||
|
type:
|
||||||
|
DINGTALK: # 钉钉
|
||||||
|
client-id: dingvrnreaje3yqvzhxg
|
||||||
|
client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
WECHAT_ENTERPRISE: # 企业微信
|
||||||
|
client-id: wwd411c69a39ad2e54
|
||||||
|
client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw
|
||||||
|
agent-id: 1000004
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
# noinspection SpringBootApplicationYaml
|
||||||
|
WECHAT_MINI_APP: # 微信小程序
|
||||||
|
client-id: ${wx.miniapp.appid}
|
||||||
|
client-secret: ${wx.miniapp.secret}
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验
|
||||||
|
WECHAT_MP: # 微信公众号
|
||||||
|
client-id: ${wx.mp.app-id}
|
||||||
|
client-secret: ${wx.mp.secret}
|
||||||
|
ignore-check-redirect-uri: true
|
||||||
|
cache:
|
||||||
|
type: REDIS
|
||||||
|
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||||
|
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
|
@ -0,0 +1,209 @@
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: data-server
|
||||||
|
|
||||||
|
profiles:
|
||||||
|
active: local
|
||||||
|
|
||||||
|
main:
|
||||||
|
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||||
|
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
|
||||||
|
|
||||||
|
config:
|
||||||
|
import:
|
||||||
|
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
||||||
|
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
||||||
|
|
||||||
|
# Servlet 配置
|
||||||
|
servlet:
|
||||||
|
# 文件上传相关配置项
|
||||||
|
multipart:
|
||||||
|
max-file-size: 16MB # 单个文件大小
|
||||||
|
max-request-size: 32MB # 设置总上传的文件大小
|
||||||
|
|
||||||
|
# Jackson 配置项
|
||||||
|
jackson:
|
||||||
|
serialization:
|
||||||
|
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
|
||||||
|
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
|
||||||
|
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
|
||||||
|
fail-on-empty-beans: false # 允许序列化无属性的 Bean
|
||||||
|
|
||||||
|
# Cache 配置项
|
||||||
|
#cache:
|
||||||
|
# type: REDIS
|
||||||
|
# redis:
|
||||||
|
# time-to-live: 1h # 设置过期时间为 1 小时
|
||||||
|
|
||||||
|
server:
|
||||||
|
port: 58081
|
||||||
|
|
||||||
|
logging:
|
||||||
|
file:
|
||||||
|
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
||||||
|
|
||||||
|
--- #################### 接口文档配置 ####################
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
api-docs:
|
||||||
|
enabled: true # 1. 是否开启 Swagger 接文档的元数据
|
||||||
|
path: /v3/api-docs
|
||||||
|
swagger-ui:
|
||||||
|
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
|
||||||
|
path: /swagger-ui
|
||||||
|
default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
|
||||||
|
|
||||||
|
knife4j:
|
||||||
|
enable: false # TODO 芋艿:需要关闭增强,具体原因见:https://github.com/xiaoymin/knife4j/issues/874
|
||||||
|
setting:
|
||||||
|
language: zh_cn
|
||||||
|
|
||||||
|
# MyBatis Plus 的配置项
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath*:mappers/**/*Mapper.xml
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
||||||
|
# id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库
|
||||||
|
# id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
|
||||||
|
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||||
|
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||||
|
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||||
|
banner: false # 关闭控制台的 Banner 打印
|
||||||
|
type-aliases-package: ${yudao.info.base-package}.dal.mapper
|
||||||
|
encryptor:
|
||||||
|
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||||
|
|
||||||
|
mybatis-plus-join:
|
||||||
|
banner: false # 关闭控制台的 Banner 打印
|
||||||
|
|
||||||
|
# Spring Data Redis 配置
|
||||||
|
#spring:
|
||||||
|
# data:
|
||||||
|
# redis:
|
||||||
|
# repositories:
|
||||||
|
# enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
||||||
|
|
||||||
|
# VO 转换(数据翻译)相关
|
||||||
|
easy-trans:
|
||||||
|
is-enable-global: true # 启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口
|
||||||
|
|
||||||
|
--- #################### RPC 远程调用相关配置 ####################
|
||||||
|
|
||||||
|
--- #################### 消息队列相关 ####################
|
||||||
|
|
||||||
|
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||||
|
#rocketmq:
|
||||||
|
# # Producer 配置项
|
||||||
|
# producer:
|
||||||
|
# group: ${spring.application.name}_PRODUCER # 生产者分组
|
||||||
|
|
||||||
|
#spring:
|
||||||
|
# # Kafka 配置项,对应 KafkaProperties 配置类
|
||||||
|
# kafka:
|
||||||
|
# # Kafka Producer 配置项
|
||||||
|
# producer:
|
||||||
|
# acks: 1 # 0-不应答。1-leader 应答。all-所有 leader 和 follower 应答。
|
||||||
|
# retries: 3 # 发送失败时,重试发送的次数
|
||||||
|
# value-serializer: org.springframework.kafka.support.serializer.JsonSerializer # 消息的 value 的序列化
|
||||||
|
# # Kafka Consumer 配置项
|
||||||
|
# consumer:
|
||||||
|
# auto-offset-reset: earliest # 设置消费者分组最初的消费进度为 earliest 。可参考博客 https://blog.csdn.net/lishuangzhe7047/article/details/74530417 理解
|
||||||
|
# value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
|
||||||
|
# properties:
|
||||||
|
# spring.json.trusted.packages: '*'
|
||||||
|
# # Kafka Consumer Listener 监听器配置
|
||||||
|
# listener:
|
||||||
|
# missing-topics-fatal: false # 消费监听接口监听的主题不存在时,默认会报错。所以通过设置为 false ,解决报错
|
||||||
|
|
||||||
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
|
||||||
|
#xxl:
|
||||||
|
# job:
|
||||||
|
# executor:
|
||||||
|
# appname: ${spring.application.name} # 执行器 AppName
|
||||||
|
# logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
|
||||||
|
# accessToken: default_token # 执行器通讯TOKEN
|
||||||
|
|
||||||
|
--- #################### 验证码相关配置 ####################
|
||||||
|
|
||||||
|
#aj:
|
||||||
|
# captcha:
|
||||||
|
# jigsaw: classpath:images/jigsaw # 滑动验证,底图路径,不配置将使用默认图片;以 classpath: 开头,取 resource 目录下路径
|
||||||
|
# pic-click: classpath:images/pic-click # 滑动验证,底图路径,不配置将使用默认图片;以 classpath: 开头,取 resource 目录下路径
|
||||||
|
# cache-type: redis # 缓存 local/redis...
|
||||||
|
# cache-number: 1000 # local 缓存的阈值,达到这个值,清除缓存
|
||||||
|
# timing-clear: 180 # local定时清除过期缓存(单位秒),设置为0代表不执行
|
||||||
|
# type: blockPuzzle # 验证码类型 default两种都实例化。 blockPuzzle 滑块拼图 clickWord 文字点选
|
||||||
|
# water-mark: 芋道源码 # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 Unicode,Linux 可能需要转 unicode
|
||||||
|
# interference-options: 0 # 滑动干扰项(0/1/2)
|
||||||
|
# req-frequency-limit-enable: false # 接口请求次数一分钟限制是否开启 true|false
|
||||||
|
# req-get-lock-limit: 5 # 验证失败5次,get接口锁定
|
||||||
|
# req-get-lock-seconds: 10 # 验证失败后,锁定时间间隔
|
||||||
|
# req-get-minute-limit: 30 # get 接口一分钟内请求数限制
|
||||||
|
# req-check-minute-limit: 60 # check 接口一分钟内请求数限制
|
||||||
|
# req-verify-minute-limit: 60 # verify 接口一分钟内请求数限制
|
||||||
|
|
||||||
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
|
yudao:
|
||||||
|
info:
|
||||||
|
version: 1.0.0
|
||||||
|
base-package: org.sk.module.data
|
||||||
|
web:
|
||||||
|
admin-ui:
|
||||||
|
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||||
|
xss:
|
||||||
|
enable: false
|
||||||
|
exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系
|
||||||
|
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||||
|
swagger:
|
||||||
|
title: 管理后台
|
||||||
|
description: 提供管理员管理的所有功能
|
||||||
|
version: ${yudao.info.version}
|
||||||
|
tenant: # 多租户相关配置项
|
||||||
|
enable: true
|
||||||
|
ignore-urls:
|
||||||
|
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
|
||||||
|
- /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
|
||||||
|
- /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关
|
||||||
|
- /admin-api/system/captcha/get # 获取图片验证码,和租户无关
|
||||||
|
- /admin-api/system/captcha/check # 校验图片验证码,和租户无关
|
||||||
|
- /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号
|
||||||
|
- /rpc-api/system/tenant/valid # 防止递归。避免调用 /rpc-api/system/tenant/valid 接口时,又去触发 /rpc-api/system/tenant/valid 去校验
|
||||||
|
- /rpc-api/system/tenant/id-list # 获得租户列表的时候,无需传递租户编号
|
||||||
|
- /rpc-api/system/oauth2/token/check # 访问令牌校验时,无需传递租户编号;主要解决上传文件的场景,前端不会传递 tenant-id!
|
||||||
|
ignore-tables:
|
||||||
|
- system_tenant
|
||||||
|
- system_tenant_package
|
||||||
|
- system_dict_data
|
||||||
|
- system_dict_type
|
||||||
|
- system_error_code
|
||||||
|
- system_menu
|
||||||
|
- system_sms_channel
|
||||||
|
- system_sms_template
|
||||||
|
- system_sms_log
|
||||||
|
- system_sensitive_word
|
||||||
|
- system_oauth2_client
|
||||||
|
- system_mail_account
|
||||||
|
- system_mail_template
|
||||||
|
- system_mail_log
|
||||||
|
- system_notify_template
|
||||||
|
ignore-caches:
|
||||||
|
- user_role_ids
|
||||||
|
- permission_menu_ids
|
||||||
|
- oauth_client
|
||||||
|
- notify_template
|
||||||
|
- mail_account
|
||||||
|
- mail_template
|
||||||
|
- sms_template
|
||||||
|
sms-code: # 短信验证码相关的配置项
|
||||||
|
expire-times: 10m
|
||||||
|
send-frequency: 1m
|
||||||
|
send-maximum-quantity-per-day: 10
|
||||||
|
begin-code: 9999 # 这里配置 9999 的原因是,测试方便。
|
||||||
|
end-code: 9999 # 这里配置 9999 的原因是,测试方便。
|
||||||
|
|
||||||
|
debug: true
|
|
@ -0,0 +1,76 @@
|
||||||
|
<configuration>
|
||||||
|
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||||
|
<!-- 变量 yudao.info.base-package,基础业务包 -->
|
||||||
|
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
|
||||||
|
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||||
|
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||||
|
|
||||||
|
<!-- 控制台 Appender -->
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 文件 Appender -->
|
||||||
|
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
<!-- 日志文件名 -->
|
||||||
|
<file>${LOG_FILE}</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!-- 滚动后的日志文件名 -->
|
||||||
|
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||||
|
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||||
|
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||||
|
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||||
|
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||||
|
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||||
|
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||||
|
<!-- 日志文件的保留天数 -->
|
||||||
|
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
</appender>
|
||||||
|
<!-- 异步写入日志,提升性能 -->
|
||||||
|
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
|
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||||
|
<discardingThreshold>0</discardingThreshold>
|
||||||
|
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||||
|
<queueSize>256</queueSize>
|
||||||
|
<appender-ref ref="FILE"/>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||||
|
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 本地环境 -->
|
||||||
|
<springProfile name="local">
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||||
|
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||||
|
</root>
|
||||||
|
</springProfile>
|
||||||
|
<!-- 其它环境 -->
|
||||||
|
<springProfile name="dev,test,stage,prod,default">
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
<appender-ref ref="ASYNC"/>
|
||||||
|
<appender-ref ref="GRPC"/>
|
||||||
|
</root>
|
||||||
|
</springProfile>
|
||||||
|
|
||||||
|
</configuration>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.sk.module.data.dal.mapper.auth.AuthClientMapper">
|
||||||
|
|
||||||
|
<select id="selectClientByIdAndSecret" resultType="java.lang.Integer">
|
||||||
|
select count(0) from system_oauth2_client WHERE client_id =#{id} and secret = #{secret} and deleted = 0
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.sk.module.data.dal.mapper.finance.FinanceMapper">
|
||||||
|
|
||||||
|
<select id="getFinanceByCreditCodeAndYear" resultType="org.sk.module.data.dal.bo.finance.FinanceBO">
|
||||||
|
select a.comName,
|
||||||
|
a.creditCode,
|
||||||
|
a.Income,
|
||||||
|
(b.valueAddTax + b.corporateIncomeTax) / 10000 'tax', a.nd 'year'
|
||||||
|
from com_operate_info_year a
|
||||||
|
left join com_pay_taxs_all b on a.creditCode = b.creditCode and b.mouth = '12' and a.nd = b.year
|
||||||
|
where a.creditCode = #{creditCode}
|
||||||
|
and a.nd = #{year}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getIncomeAndTax" resultType="org.sk.module.data.dal.bo.finance.FinanceBO">
|
||||||
|
WITH
|
||||||
|
income_data AS (
|
||||||
|
SELECT comName, creditCode, nd AS year,income FROM com_operate_info_year
|
||||||
|
where creditCode in
|
||||||
|
<foreach item="code" collection="creditCodes" open="(" separator="," close=")">
|
||||||
|
#{code}
|
||||||
|
</foreach>
|
||||||
|
<if test="year != null and year != ''">
|
||||||
|
AND nd = #{year}
|
||||||
|
</if>
|
||||||
|
),
|
||||||
|
tax_data AS (
|
||||||
|
SELECT entName AS comName, creditCode, `year`,
|
||||||
|
CASE WHEN
|
||||||
|
year < YEAR(CURDATE())
|
||||||
|
THEN
|
||||||
|
(SELECT (valueAddTax + corporateIncomeTax) FROM com_pay_taxs_all WHERE year = t.year AND creditCode = t.creditCode AND mouth = 12)
|
||||||
|
ELSE
|
||||||
|
(SELECT (valueAddTax + corporateIncomeTax) FROM com_pay_taxs_all WHERE year = t.year AND creditCode = t.creditCode ORDER BY mouth DESC LIMIT 1)
|
||||||
|
END AS tax
|
||||||
|
FROM com_pay_taxs_all t
|
||||||
|
where creditCode in
|
||||||
|
<foreach item="code" collection="creditCodes" open="(" separator="," close=")">
|
||||||
|
#{code}
|
||||||
|
</foreach>
|
||||||
|
<if test="year != null and year != ''">
|
||||||
|
AND year = #{year}
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
COALESCE(i.creditCode, t.creditCode) AS creditCode,
|
||||||
|
COALESCE(i.comName, t.comName) AS comName,
|
||||||
|
COALESCE(i.year, t.year) AS year,
|
||||||
|
i.income,
|
||||||
|
t.tax/10000
|
||||||
|
FROM
|
||||||
|
income_data i
|
||||||
|
LEFT JOIN tax_data t
|
||||||
|
ON i.creditCode = t.creditCode AND i.year = t.year
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
COALESCE(t.creditCode, i.creditCode) AS creditCode,
|
||||||
|
COALESCE(t.comName, i.comName) AS comName,
|
||||||
|
COALESCE(t.year, i.year) AS year,
|
||||||
|
i.income,
|
||||||
|
t.tax/10000
|
||||||
|
FROM
|
||||||
|
tax_data t
|
||||||
|
LEFT JOIN income_data i
|
||||||
|
ON t.creditCode = i.creditCode AND t.year = i.year
|
||||||
|
ORDER BY creditCode, year
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.sk.skmoduledatabiz;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class SkModuleDataBizApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -94,6 +94,50 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!--不打包资源文件-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.**</exclude>
|
||||||
|
<exclude>*/*.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
<archive>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>./resources/</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--
|
||||||
|
复制配置文件、以及拷贝第三方依赖文件到指定目录
|
||||||
|
当依赖包有变化时需使用下面配置,重新生成最新的依赖包
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>*.**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<outputDirectory>${project.build.directory}/resources</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,13 @@ spring:
|
||||||
- Path=/admin-api/iot/**
|
- Path=/admin-api/iot/**
|
||||||
filters:
|
filters:
|
||||||
- RewritePath=/admin-api/iot/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
|
- RewritePath=/admin-api/iot/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
|
||||||
|
## data-server 服务
|
||||||
|
- id: data-admin-api # 路由的编号
|
||||||
|
uri: grayLb://data-server
|
||||||
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
||||||
|
- Path=/admin-api/data/**
|
||||||
|
filters:
|
||||||
|
- RewritePath=/admin-api/data/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
|
||||||
x-forwarded:
|
x-forwarded:
|
||||||
prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
|
prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
|
||||||
|
|
||||||
|
@ -234,6 +241,9 @@ knife4j:
|
||||||
- name: iot-server
|
- name: iot-server
|
||||||
service-name: iot-server
|
service-name: iot-server
|
||||||
url: /admin-api/iot/v3/api-docs
|
url: /admin-api/iot/v3/api-docs
|
||||||
|
- name: data-server
|
||||||
|
service-name: data-server
|
||||||
|
url: /admin-api/data/v3/api-docs
|
||||||
|
|
||||||
--- #################### 芋道相关配置 ####################
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
|
|
|
@ -152,19 +152,91 @@
|
||||||
<!-- 设置构建的 jar 包名 -->
|
<!-- 设置构建的 jar 包名 -->
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- 打包 -->
|
<!-- 打包时去除依赖包 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
<version>${spring.boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<includes>
|
||||||
|
<include>
|
||||||
|
<groupId>non-exists</groupId>
|
||||||
|
<artifactId>non-exists</artifactId>
|
||||||
|
</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--不打包资源文件-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.**</exclude>
|
||||||
|
<exclude>*/*.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
<useUniqueVersions>false</useUniqueVersions>
|
||||||
|
<mainClass>cn.iocoder.yudao.module.infra.InfraServerApplication</mainClass>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>./resources/</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--
|
||||||
|
复制配置文件、以及拷贝第三方依赖文件到指定目录
|
||||||
|
当依赖包有变化时需使用下面配置,重新生成最新的依赖包
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>*.**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<outputDirectory>${project.build.directory}/resources</outputDirectory>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!--<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>lib</outputDirectory>
|
||||||
|
<excludeTransitive>false</excludeTransitive>
|
||||||
|
<stripVersion>false</stripVersion>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>-->
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -153,19 +153,91 @@
|
||||||
<!-- 设置构建的 jar 包名 -->
|
<!-- 设置构建的 jar 包名 -->
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- 打包 -->
|
<!-- 打包时去除依赖包 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
<version>${spring.boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
<includes>
|
||||||
|
<include>
|
||||||
|
<groupId>non-exists</groupId>
|
||||||
|
<artifactId>non-exists</artifactId>
|
||||||
|
</include>
|
||||||
|
</includes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--不打包资源文件-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.**</exclude>
|
||||||
|
<exclude>*/*.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
<useUniqueVersions>false</useUniqueVersions>
|
||||||
|
<mainClass>cn.iocoder.yudao.module.system.SystemServerApplication</mainClass>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>./resources/</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--
|
||||||
|
复制配置文件、以及拷贝第三方依赖文件到指定目录
|
||||||
|
当依赖包有变化时需使用下面配置,重新生成最新的依赖包
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>*.**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<outputDirectory>${project.build.directory}/resources</outputDirectory>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!--<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>lib</outputDirectory>
|
||||||
|
<excludeTransitive>false</excludeTransitive>
|
||||||
|
<stripVersion>false</stripVersion>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>-->
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class OAuth2OpenController {
|
public class OAuth2OpenController {
|
||||||
|
|
||||||
|
@Qualifier("GXSKOAuth2GrantServiceImpl")
|
||||||
@Resource
|
@Resource
|
||||||
private OAuth2GrantService oauth2GrantService;
|
private OAuth2GrantService oauth2GrantService;
|
||||||
@Resource
|
@Resource
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
package cn.iocoder.yudao.module.system.service.oauth2;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2CodeDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
|
||||||
|
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth2 授予 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class GXSKOAuth2GrantServiceImpl implements OAuth2GrantService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OAuth2TokenService oauth2TokenService;
|
||||||
|
@Resource
|
||||||
|
private OAuth2CodeService oauth2CodeService;
|
||||||
|
@Resource
|
||||||
|
private AdminAuthService adminAuthService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OAuth2AccessTokenDO grantImplicit(Long userId, Integer userType,
|
||||||
|
String clientId, List<String> scopes) {
|
||||||
|
return oauth2TokenService.createAccessToken(userId, userType, clientId, scopes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String grantAuthorizationCodeForCode(Long userId, Integer userType,
|
||||||
|
String clientId, List<String> scopes,
|
||||||
|
String redirectUri, String state) {
|
||||||
|
return oauth2CodeService.createAuthorizationCode(userId, userType, clientId, scopes,
|
||||||
|
redirectUri, state).getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OAuth2AccessTokenDO grantAuthorizationCodeForAccessToken(String clientId, String code,
|
||||||
|
String redirectUri, String state) {
|
||||||
|
OAuth2CodeDO codeDO = oauth2CodeService.consumeAuthorizationCode(code);
|
||||||
|
Assert.notNull(codeDO, "授权码不能为空"); // 防御性编程
|
||||||
|
// 校验 clientId 是否匹配
|
||||||
|
if (!StrUtil.equals(clientId, codeDO.getClientId())) {
|
||||||
|
throw exception(ErrorCodeConstants.OAUTH2_GRANT_CLIENT_ID_MISMATCH);
|
||||||
|
}
|
||||||
|
// 校验 redirectUri 是否匹配
|
||||||
|
if (!StrUtil.equals(redirectUri, codeDO.getRedirectUri())) {
|
||||||
|
throw exception(ErrorCodeConstants.OAUTH2_GRANT_REDIRECT_URI_MISMATCH);
|
||||||
|
}
|
||||||
|
// 校验 state 是否匹配
|
||||||
|
state = StrUtil.nullToDefault(state, ""); // 数据库 state 为 null 时,会设置为 "" 空串
|
||||||
|
if (!StrUtil.equals(state, codeDO.getState())) {
|
||||||
|
throw exception(ErrorCodeConstants.OAUTH2_GRANT_STATE_MISMATCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建访问令牌
|
||||||
|
return oauth2TokenService.createAccessToken(codeDO.getUserId(), codeDO.getUserType(),
|
||||||
|
codeDO.getClientId(), codeDO.getScopes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OAuth2AccessTokenDO grantPassword(String username, String password, String clientId, List<String> scopes) {
|
||||||
|
// 使用账号 + 密码进行登录
|
||||||
|
AdminUserDO user = adminAuthService.authenticate(username, password);
|
||||||
|
Assert.notNull(user, "用户不能为空!"); // 防御性编程
|
||||||
|
|
||||||
|
// 创建访问令牌
|
||||||
|
return oauth2TokenService.createAccessToken(user.getId(), UserTypeEnum.ADMIN.getValue(), clientId, scopes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OAuth2AccessTokenDO grantRefreshToken(String refreshToken, String clientId) {
|
||||||
|
return oauth2TokenService.refreshAccessToken(refreshToken, clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OAuth2AccessTokenDO grantClientCredentials(String clientId, List<String> scopes) {
|
||||||
|
// TODO 芋艿:项目中使用 OAuth2 解决的是三方应用的授权,内部的 SSO 等问题,所以暂时不考虑 client_credentials 这个场景
|
||||||
|
// throw new UnsupportedOperationException("暂时不支持 client_credentials 授权模式");
|
||||||
|
|
||||||
|
// 创建访问令牌
|
||||||
|
return oauth2TokenService.createAccessToken(IdUtil.getSnowflakeNextId(), UserTypeEnum.MEMBER.getValue(),
|
||||||
|
clientId, scopes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean revokeToken(String clientId, String accessToken) {
|
||||||
|
// 先查询,保证 clientId 时匹配的
|
||||||
|
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.getAccessToken(accessToken);
|
||||||
|
if (accessTokenDO == null || ObjectUtil.notEqual(clientId, accessTokenDO.getClientId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 再删除
|
||||||
|
return oauth2TokenService.removeAccessToken(accessToken) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -165,6 +165,7 @@ yudao:
|
||||||
tenant: # 多租户相关配置项
|
tenant: # 多租户相关配置项
|
||||||
enable: true
|
enable: true
|
||||||
ignore-urls:
|
ignore-urls:
|
||||||
|
- /admin-api/system/oauth2/token #
|
||||||
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
|
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
|
||||||
- /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
|
- /admin-api/system/tenant/get-by-website # 基于域名获取租户,不许带租户编号
|
||||||
- /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关
|
- /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关
|
||||||
|
|
Loading…
Reference in New Issue