一体化平台初始化仓库

This commit is contained in:
xlj
2026-02-09 13:04:45 +08:00
parent dd6040b580
commit daa67be814
48 changed files with 3747 additions and 0 deletions

72
cdaxxt-bootstrap/pom.xml Normal file
View File

@ -0,0 +1,72 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>integration-platform-access</artifactId>
<groupId>com.tobacco.mp</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cdaxxt-bootstrap</artifactId>
<dependencies>
<dependency>
<groupId>com.tobacco.mp</groupId>
<artifactId>cdaxxt-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.tobacco.mp</groupId>
<artifactId>cdaxxt-business</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.tobacco.mp</groupId>
<artifactId>cdaxxt-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
<include>static/**</include>
</includes>
</resource>
</resources>
<plugins>
<!-- 指定启动类将依赖打成外部jar包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<!-- 生成的jar中不要包含pom.xml和pom.properties这两个文件 -->
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<!-- 是否要把第三方jar放到manifest的classpath中 -->
<addClasspath>true</addClasspath>
<!-- 外部依赖jar包的最终位置 -->
<classpathPrefix>lib/</classpathPrefix>
<!-- 项目启动类 -->
<mainClass>com.tobacco.mp.BasisApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,19 @@
package com.tobacco.mp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@EnableFeignClients(basePackages = {"com.tobacco.mp.uc.client.api","com.tobacco.mp.auth.businessdomain.auth.client.api","com.tobacco.mp.mcext.client.api","com.tobacco.mp.ttc.client.api"})
@EnableAsync
@SpringBootApplication(scanBasePackages = {"com.tobacco.mp"})
public class BasisApplication {
public static void main(String[] args) {
SpringApplication.run(BasisApplication.class, args);
}
}

View File

@ -0,0 +1,24 @@
package com.tobacco.mp.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* 阿里云网关包扫描配置
*/
@Slf4j
@Configuration
@ConditionalOnExpression("'ali'.equals('${bizworks-api-gateway.type}') and 'true'.equals('${bizworks-api-gateway.enable}') ")
@ComponentScan("com.bizworks.ubcp.apiclient.feign")
public class BizworksApiGatewayConfiguration {
@Bean
public String init(){
log.info("开启阿里网关模式");
return null;
}
}

View File

@ -0,0 +1,52 @@
package com.tobacco.mp.config;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 跨域处理机制
*/
@Component
public class CorsFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
String origin = request.getHeader("Origin");
String allowHeaders = request.getHeader("Access-Control-Request-Headers");
if (!StringUtils.isEmpty(origin)) {
response.setHeader("Access-Control-Allow-Origin", origin);
} else {
response.setHeader("Access-Control-Allow-Origin", "*");
}
if (!StringUtils.isEmpty(allowHeaders)) {
response.setHeader("Access-Control-Allow-Headers", allowHeaders);
} else {
response.setHeader("Access-Control-Allow-Headers", "*");
}
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
response.setHeader("Access-Control-Max-Age", "3600");
if ("OPTIONS".equals(request.getMethod())) {
response.setStatus(HttpServletResponse.SC_OK);
} else {
chain.doFilter(req, res);
}
}
@Override
public void init(FilterConfig filterConfig) {
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1,107 @@
package com.tobacco.mp.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* redis配置
*/
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport {
/**
* retemplate相关配置
* @param factory
* @return
*/
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
// 配置连接工厂
template.setConnectionFactory(factory);
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值默认使用JDK的序列化方式
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper om = new ObjectMapper();
// 指定要序列化的域field,get和set,以及修饰符范围ANY是都有包括private和public
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// 指定序列化输入的类型类必须是非final修饰的final修饰的类比如String,Integer等会跑出异常
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jacksonSeial.setObjectMapper(om);
// 值采用json序列化
template.setValueSerializer(jacksonSeial);
//使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer());
// 设置hash key 和value序列化模式
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(jacksonSeial);
template.afterPropertiesSet();
return template;
}
/**
* 对hash类型的数据操作
* @param redisTemplate
* @return
*/
@Bean
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForHash();
}
/**
* 对redis字符串类型数据操作
* @param redisTemplate
* @return
*/
@Bean
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForValue();
}
/**
* 对链表类型的数据操作
* @param redisTemplate
* @return
*/
@Bean
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForList();
}
/**
* 对无序集合类型的数据操作
* @param redisTemplate
* @return
*/
@Bean
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForSet();
}
/**
* 对有序集合类型的数据操作
* @param redisTemplate
* @return
*/
@Bean
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForZSet();
}
}

View File

@ -0,0 +1,19 @@
package com.tobacco.mp.config;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 请求拦截器处理
*/
public class RequestInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 请求拦截处理
return true;
}
}

View File

@ -0,0 +1,20 @@
package com.tobacco.mp.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class ServerRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
// 服务器成功启动加载其他
}
}

View File

@ -0,0 +1,43 @@
package com.tobacco.mp.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @Author XiongLiJian
* @Date 2021/12/28 15:36
* @Description 资源管理配置
* @Version 1.0
**/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
/**
* 声明需要放行的swagger资源路径
*/
private String[] newPassPath = new String[]{"/login", "/swagger-ui.html/**", "/v2/**","/files/**", "/webjars/**", "/swagger-resources/**",
"/**.js", "/static/**", "/images/**", "/index.html", "/css/**", "/js/**", "/file/**"};
/**
* 添加资源站点
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
}
/**
* 注册拦截器
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 注册拦截器
registry.addInterceptor(new RequestInterceptor()).addPathPatterns("/**").excludePathPatterns(newPassPath);
}
}

View File

@ -0,0 +1,106 @@
server:
host: 0.0.0.0
port: 8049
compression:
enabled: true
servlet:
context-path: /mosty-platform
spring:
aop:
auto: true
application:
name: integration-platform-access
jackson:
date-format: yyyy-MM-dd HH:mm:ss
resources:
static-locations: classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/, classpath:/templates/
servlet:
multipart:
max-file-size: 20MB
max-request-size: 20MB
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://47.108.232.77:4407/mosty_jcgl_gs?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
username: root
password: Mosty@888
druid: # 以下参数针对每个库可以重新设置druid参数
# 使用druid数据源
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
redis:
host: 47.108.232.77
port: 6379
password: sczy@2022
timeout: 10000
max-active: 100
min-idle: 0
max-idle: 20
max-wait: 30000
sxExpire: 1800
database: 12
thymeleaf:
prefix: classpath:/templates/
mode: HTML5
suffix: .html
encoding: UTF-8
cache: false
servlet:
content-type: text/html
enabled: true
# mybatis
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
map-underscore-to-camel-case: true
cache-enabled: false
global-config:
db-config:
logic-delete-field: actived
logic-delete-value: 0
logic-not-delete-value: 1
table-underline: true
update-strategy: ignored
banner: false
logging:
file:
name: ${user.dir}/logs/${spring.application.name}/${spring.application.name}.log
level:
org.springframework.cloud.openfeign: DEBUG
feign: DEBUG
#feign:
# client:
# config:
# default:
# contract: org.springframework.cloud.openfeign.support.SpringMvcContract
bizworks:
clientId: 6f938da0e22911f0bc71bc16950a55fb
bizworks-api-gateway:
enable: true
type: ali
disSignService:
signature:
- host: api.gansu-ywzt.zgs.yun
appKey: 1762305806807768
appSecret: 5e1385488c054e9980bf0bf8e68c10a5
bizId:
service: tobacco-mp-uc-client

View File

@ -0,0 +1,212 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="application/msword; charset=utf-8"/>
<title>toWord</title>
<style type="text/css">
.bg {
font-size: 14.5px;
font-weight: bold;
color: #000;
background-color: #559e68;
}
table {
border-width: 1px;
border-style: solid;
border-color: black;
table-layout: fixed;
}
tr {
height: 32px;
font-size: 12px;
}
td {
padding-left: 10px;
border-width: 1px;
border-style: solid;
border-color: black;
height: 32px;
overflow: hidden;
word-break: break-all;
word-wrap: break-word;
font-size: 14.5px;
}
.bg td {
font-size: 14.5px;
}
tr td {
font-size: 14.5px;
}
.specialHeight {
height: 40px;
}
.first_title {
height: 60px;
line-height: 60px;
margin: 0;
font-weight: bold;
font-size: 21px;
}
.second_title {
height: 40px;
line-height: 40px;
margin: 0;
font-size: 18.5px;
}
.doc_title {
font-size: 42.5px;
text-align: center;
}
.download_btn {
float: right;
}
body {
font-family: Normal;
}
</style>
</head>
<body>
<div style="width:1000px; margin: 0 auto">
<div>
<p class="doc_title" th:text="${info.title +''+ info.version +''}"></p>
<a class="download_btn" th:if="${download == 1}" th:href="${'/downloadWord?url='+ url}">下载文档</a>
<br>
</div>
<div th:each="tableMap:${tableMap}" style="margin-bottom:20px;">
<!--这个是类的说明-->
<h4 class="first_title" th:text="${tableMap.key}"></h4>
<div th:each="table,tableStat:${tableMap.value}">
<!--这个是每个请求的说明,方便生成文档后进行整理-->
<h5 class="second_title" th:text="${tableStat.count} + '' + ${table.tag}"></h5>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tr class="bg">
<td colspan="5" th:text="${table.tag}"></td>
</tr>
<tr>
<td width="25%">接口描述</td>
<td colspan="4" th:text="${table.description}"></td>
</tr>
<tr>
<td>URL</td>
<td colspan="4" th:text="${table.url}"></td>
</tr>
<tr>
<td>请求方式</td>
<td colspan="4" th:text="${table.requestType}"></td>
</tr>
<tr>
<td>请求类型</td>
<td colspan="4" th:text="${table.requestForm}"></td>
</tr>
<tr>
<td>返回类型</td>
<td colspan="4" th:text="${table.responseForm}"></td>
</tr>
<tr class="bg">
<td>参数名</td>
<td width="15%">数据类型</td>
<td width="15%">参数类型</td>
<td width="15%">是否必填</td>
<td width="29%">说明</td>
</tr>
<th:block th:each="request, c:${table.requestList}">
<tr>
<td align="left" th:text="${c.count} + '.' + ${request.name}"></td>
<td th:text="${request.type}"></td>
<td th:text="${request.paramType}"></td>
<td th:if="${request.require}" th:text="Y"></td>
<td th:if="${!request.require}" th:text="N"></td>
<td th:text="${request.remark}"></td>
<!-- <td th:if="${request.modelAttr}" th:text="asdfagadfg"></td>-->
</tr>
<th:block th:if="${request.modelAttr}">
<tbody th:include="this::request(${request.modelAttr.properties},${c.count} + '.', 1)"/>
</th:block>
</th:block>
<tr class="bg">
<td>状态码</td>
<td colspan="2">描述</td>
<td colspan="2">说明</td>
</tr>
<tr th:each="response:${table.responseList}">
<td th:text="${response.name}"></td>
<td colspan="2" th:text="${response.description}"></td>
<td colspan="2" th:text="${response.remark}"></td>
</tr>
<tr class="bg">
<td>返回属性名</td>
<td colspan="2">类型</td>
<td colspan="2">说明</td>
</tr>
<!-- 对返回参数 递归生成行-->
<tbody th:include="this::response(${table.modelAttr.properties},'', 1)"/>
<tr class="bg">
<td colspan="5">示例</td>
</tr>
<tr class="specialHeight">
<td class="bg">请求参数</td>
<td colspan="4" th:text="${table.requestParam}"></td>
</tr>
<tr class="specialHeight">
<td class="bg">返回值</td>
<td colspan="4" th:text="${table.responseParam}"></td>
</tr>
</table>
</div>
</div>
</div>
<th:block th:fragment="request(properties,count, lv)">
<th:block th:each="p,c : ${properties}">
<tr>
<td align="left" th:text="${count} + '' + ${c.count} + '.' + ${p.name}"
th:style="|padding-left:${10*lv}px|"></td>
<td th:text="${p.type}"></td>
<td></td>
<td th:if="${p.require}" th:text="Y"></td>
<td th:if="${!p.require}" th:text="N"></td>
<td th:text="${p.description}"></td>
</tr>
<th:block th:unless="${#lists.isEmpty(p.properties)}"
th:include="this::request(${p.properties},${count} + '' + ${c.count} + '.',${lv+1})"/>
</th:block>
</th:block>
<th:block th:fragment="response(properties,count, lv)">
<th:block th:each="p,c : ${properties}">
<tr>
<td align="left" th:text="${count} + '' + ${c.count} + '.' + ${p.name}"
th:style="|padding-left:${10*lv}px|"></td>
<td colspan="2" th:text="${p.type}"></td>
<td colspan="2" th:text="${p.description}"></td>
</tr>
<th:block th:unless="${#lists.isEmpty(p.properties)}"
th:include="this::response(${p.properties},${count} + '' + ${c.count} + '.',${lv+1})"/>
</th:block>
</th:block>
</body>
</html>