Compare commits
3 Commits
e4d2d5db6d
...
b8ff0aefe2
Author | SHA1 | Date |
---|---|---|
|
b8ff0aefe2 | |
|
b40b5b908a | |
|
5a88b571ae |
|
@ -8,6 +8,7 @@
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
<module name="etl-common" />
|
<module name="etl-common" />
|
||||||
<module name="etl-cleaning" />
|
<module name="etl-cleaning" />
|
||||||
|
<module name="etl-spike" />
|
||||||
<module name="etl-gateway" />
|
<module name="etl-gateway" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
<file url="file://$PROJECT_DIR$/etl-common/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/etl-common/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/etl-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/etl-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/etl-gateway/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/etl-gateway/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/etl-spike/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/etl-spike/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -19,6 +19,11 @@
|
||||||
<spring-boot.version>2.6.13</spring-boot.version>
|
<spring-boot.version>2.6.13</spring-boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>3.0.5</version>
|
||||||
|
</dependency>
|
||||||
<!-- Jedis -->
|
<!-- Jedis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>redis.clients</groupId>
|
<groupId>redis.clients</groupId>
|
||||||
|
@ -30,7 +35,6 @@
|
||||||
<artifactId>spring-boot-starter-captcha</artifactId>
|
<artifactId>spring-boot-starter-captcha</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
|
|
@ -3,12 +3,14 @@ package com.etl.cleaning;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据清洗模块
|
* 数据清洗模块
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.etl.cleaning.mapper")
|
@MapperScan("com.etl.cleaning.mapper")
|
||||||
|
@EnableScheduling
|
||||||
public class EtlCleaningApplication {
|
public class EtlCleaningApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(EtlCleaningApplication.class, args);
|
SpringApplication.run(EtlCleaningApplication.class, args);
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.etl.cleaning.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||||
|
import com.etl.cleaning.service.PlaceService;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入导出规整
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/poi/excel")
|
||||||
|
public class PoiExcelApi {
|
||||||
|
|
||||||
|
private final PlaceService placeService;
|
||||||
|
|
||||||
|
public PoiExcelApi(PlaceService placeService){
|
||||||
|
this.placeService=placeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出到指定路径
|
||||||
|
*/
|
||||||
|
@PostMapping("/outPoi")
|
||||||
|
public void outPoi(){
|
||||||
|
//设置文件导出的路径
|
||||||
|
String path = "D://poi/";
|
||||||
|
File file=new File( path );
|
||||||
|
if(!file.isDirectory()){
|
||||||
|
file.mkdirs();
|
||||||
|
}
|
||||||
|
String fileName = path + "User" + System.currentTimeMillis() + ".xlsx";
|
||||||
|
EasyExcel.write(fileName, DataPlace.class).sheet("数据源管理").doWrite(placeService.list());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.etl.cleaning.domian.pojo;
|
package com.etl.cleaning.domian.pojo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
@ -8,6 +10,7 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,55 +26,70 @@ public class DataPlace {
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源描述
|
* 数据源描述
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("数据源描述")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("备注")
|
||||||
private String bank;
|
private String bank;
|
||||||
/**
|
/**
|
||||||
* 修改时间
|
* 修改时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("修改时间")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
/**
|
/**
|
||||||
* 类型ID
|
* 类型ID
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("类型ID")
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
/**
|
/**
|
||||||
* 链接状态
|
* 链接状态
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("/连接状态")
|
||||||
private Long statue;
|
private Long statue;
|
||||||
/**
|
/**
|
||||||
* 连接类型
|
* 连接类型
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
@ExcelIgnore
|
||||||
private String typeName;
|
private String typeName;
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("用户名")
|
||||||
private String username;
|
private String username;
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("密码")
|
||||||
private String password;
|
private String password;
|
||||||
/**
|
/**
|
||||||
* 端口
|
* 端口
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("端口")
|
||||||
private String port;
|
private String port;
|
||||||
/**
|
/**
|
||||||
* 数据库名称
|
* 数据库名称
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("数据库")
|
||||||
private String dataName;
|
private String dataName;
|
||||||
/**
|
/**
|
||||||
* 额外配置
|
* 额外配置
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("配置")
|
||||||
private String yaml;
|
private String yaml;
|
||||||
/**
|
/**
|
||||||
* 链接路径
|
* 链接路径
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("路径")
|
||||||
private String dataUrl;
|
private String dataUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.etl.cleaning.job;
|
||||||
|
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class Testaa {
|
||||||
|
@Scheduled(fixedRate = 1000)
|
||||||
|
public void test(){
|
||||||
|
System.out.println ("aaaaaaaa");
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,8 +36,6 @@ public class PlaceServiceImpl extends ServiceImpl<PlaceMapper, DataPlace> implem
|
||||||
this.typeService = typeService;
|
this.typeService = typeService;
|
||||||
this.placeMapper = placeMapper;
|
this.placeMapper = placeMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> showPlacePage(PlaceRequest placeRequest) {
|
public Map<String,Object> showPlacePage(PlaceRequest placeRequest) {
|
||||||
LambdaQueryWrapper<DataPlace> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DataPlace> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
#Generated by Maven
|
#Generated by Maven
|
||||||
#Tue Jun 25 19:35:44 CST 2024
|
#Wed Jul 10 15:32:05 CST 2024
|
||||||
groupId=com.bwie
|
groupId=com.bwie
|
||||||
artifactId=etl-common
|
artifactId=etl-common
|
||||||
version=1.0-SNAPSHOT
|
version=1.0-SNAPSHOT
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
|
@ -0,0 +1,151 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.etl</groupId>
|
||||||
|
<artifactId>etl-spike</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>etl-spike</name>
|
||||||
|
<description>etl-spike</description>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>etl-cloud</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<spring-boot.version>2.6.13</spring-boot.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-jdbc</artifactId>
|
||||||
|
<version>5.3.22</version> <!-- 请根据需要选择合适的版本 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.29</version> <!-- 请根据需要选择合适的版本 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
<version>2.1.3.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.58</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>etl-common</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-annotation</artifactId>
|
||||||
|
<version>3.5.7</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!--导出pdf相关-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf</groupId>
|
||||||
|
<artifactId>itextpdf</artifactId>
|
||||||
|
<version>5.5.10</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf</groupId>
|
||||||
|
<artifactId>itext-asian</artifactId>
|
||||||
|
<version>5.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf.tool</groupId>
|
||||||
|
<artifactId>xmlworker</artifactId>
|
||||||
|
<version>5.5.11</version>
|
||||||
|
</dependency>
|
||||||
|
<!--处理html相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jsoup</groupId>
|
||||||
|
<artifactId>jsoup</artifactId>
|
||||||
|
<version>1.11.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.jklasd</groupId>
|
||||||
|
<artifactId>spring-junit-test</artifactId>
|
||||||
|
<version>2.0.1-RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson</artifactId>
|
||||||
|
<version>3.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.etl.spike.EtlSpikeApplication</mainClass>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>repackage</id>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.etl.spike.mapper")
|
||||||
|
@EnableScheduling
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class EtlSpikeApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(EtlSpikeApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.etl.spike.config;
|
||||||
|
|
||||||
|
import org.redisson.Redisson;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.redisson.config.Config;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redisson配置类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RedissonConfig {
|
||||||
|
@Value ("${redisson.address}")
|
||||||
|
private String addressUrl;
|
||||||
|
@Value ("${redisson.password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单机模式配置
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RedissonClient getRedisson(){
|
||||||
|
Config config = new Config ();
|
||||||
|
config.useSingleServer ()
|
||||||
|
.setAddress (addressUrl).setPassword (password)
|
||||||
|
.setReconnectionTimeout (10000)
|
||||||
|
.setRetryInterval (5000)
|
||||||
|
.setTimeout (10000)
|
||||||
|
.setConnectTimeout (10000);
|
||||||
|
return Redisson.create (config);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.etl.spike.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
||||||
|
import com.etl.common.result.Result;
|
||||||
|
import com.etl.spike.entity.Goods;
|
||||||
|
import com.etl.spike.service.IGoodsService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku商品表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/goods")
|
||||||
|
public class GoodsController {
|
||||||
|
private final IGoodsService goodsService;
|
||||||
|
|
||||||
|
public GoodsController(IGoodsService goodsService){
|
||||||
|
this.goodsService = goodsService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SentinelResource
|
||||||
|
@GetMapping("/test")
|
||||||
|
public Result testList(){
|
||||||
|
List<Goods> list = goodsService.list ();
|
||||||
|
return Result.success (list);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.etl.spike.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
|
import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
||||||
|
import com.etl.common.result.Result;
|
||||||
|
import com.etl.spike.entity.request.OrderRequest;
|
||||||
|
import com.etl.spike.enums.EnumMsg;
|
||||||
|
import com.etl.spike.service.IOrderService;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order")
|
||||||
|
public class OrderController {
|
||||||
|
private final StringRedisTemplate redisTemplate;
|
||||||
|
private final IOrderService orderService;
|
||||||
|
public OrderController(StringRedisTemplate redisTemplate , IOrderService orderService){
|
||||||
|
this.redisTemplate = redisTemplate;
|
||||||
|
this.orderService = orderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秒杀
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/orderGoOn")
|
||||||
|
@SentinelResource
|
||||||
|
public Result orderGoOn(@RequestBody @Validated OrderRequest orderRequest){
|
||||||
|
//判断场次是否存在
|
||||||
|
String key = EnumMsg.REDIS_SMALL_KEY.getMessage () +
|
||||||
|
orderRequest.getId ();
|
||||||
|
if ( !redisTemplate.opsForHash ().hasKey (EnumMsg.REDIS_KEY.getMessage () , key) ) {
|
||||||
|
throw new RuntimeException ("您参与的活动场次不存在");
|
||||||
|
}
|
||||||
|
//判断购买数量是否合法
|
||||||
|
if(orderRequest.getNum () != 1) {
|
||||||
|
throw new RuntimeException ("您的购买数量不合法");
|
||||||
|
}
|
||||||
|
//判断商品id是否在缓存中
|
||||||
|
String hashKey = EnumMsg.REDIS_SMALL_KEY.getMessage ()+orderRequest.getGoodsId ();
|
||||||
|
if ( !redisTemplate.opsForHash ().hasKey (EnumMsg.REDIS_KEY.getMessage () , hashKey) ) {
|
||||||
|
throw new RuntimeException ("商品不存在");
|
||||||
|
}
|
||||||
|
//获取当前时间戳()
|
||||||
|
long timeMillis = System.currentTimeMillis ();
|
||||||
|
//转换为分钟级的时间戳
|
||||||
|
long seconds = timeMillis / 1000 / 60;
|
||||||
|
//加密签名是否合法
|
||||||
|
String sign = orderRequest.getId ().toString () + orderRequest.getId ().toString () + "&" + seconds;
|
||||||
|
//生成MD5值
|
||||||
|
String md5Hex = DigestUtil.md5Hex (sign);
|
||||||
|
if ( !md5Hex.equals (orderRequest.getSign ()) ) {
|
||||||
|
throw new RuntimeException ("验签失败");
|
||||||
|
}
|
||||||
|
//检验库存
|
||||||
|
if( !redisTemplate.opsForHash ().hasKey (EnumMsg.REDIS_KEY.getMessage () , orderRequest.getGoodsId ()) ) {
|
||||||
|
throw new RuntimeException ("该商品库存异常");
|
||||||
|
}
|
||||||
|
String num = Objects.requireNonNull (redisTemplate.opsForHash ().get (EnumMsg.REDIS_GOODS_NUM.getMessage () ,
|
||||||
|
orderRequest.getGoodsId ())).toString ();
|
||||||
|
long goodsNum = Long.parseLong (num);
|
||||||
|
if(goodsNum<=0){
|
||||||
|
throw new RuntimeException ("该商品商品不足");
|
||||||
|
}
|
||||||
|
orderService.orderGoOn();
|
||||||
|
return Result.success ();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.etl.spike.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order-item")
|
||||||
|
public class OrderItemController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.etl.spike.controller;
|
||||||
|
|
||||||
|
import com.etl.common.result.Result;
|
||||||
|
import com.etl.spike.pdf.ExportPdfTest;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pdf")
|
||||||
|
public class PdfController {
|
||||||
|
|
||||||
|
private final ExportPdfTest exportPdfTest;
|
||||||
|
|
||||||
|
public PdfController(ExportPdfTest exportPdfTest){
|
||||||
|
this.exportPdfTest = exportPdfTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出为pdf
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@GetMapping("/test")
|
||||||
|
public Result test() throws Exception{
|
||||||
|
exportPdfTest.export ();
|
||||||
|
return Result.success ();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.etl.spike.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀场次表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/times")
|
||||||
|
public class TimesController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.etl.spike.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 场次表和商品表关联 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/times-goods")
|
||||||
|
public class TimesGoodsController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.etl.spike.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku商品表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("goods")
|
||||||
|
public class Goods implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品所属类型名称
|
||||||
|
*/
|
||||||
|
private String typename;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品流出地址
|
||||||
|
*/
|
||||||
|
private String place;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品样式
|
||||||
|
*/
|
||||||
|
private String style;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.etl.spike.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("order")
|
||||||
|
public class Order implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Integer goodId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
|
private Integer flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付方式
|
||||||
|
*/
|
||||||
|
private String payType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货地址
|
||||||
|
*/
|
||||||
|
private String place;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.etl.spike.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单详情表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("order_item")
|
||||||
|
public class OrderItem implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.etl.spike.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀场次表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("times")
|
||||||
|
public class Times implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场次ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1-未开始 2-进行中 3-已结束
|
||||||
|
*/
|
||||||
|
private String flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品售出数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.etl.spike.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 场次表和商品表关联
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("times_goods")
|
||||||
|
public class TimesGoods implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场次ID
|
||||||
|
*/
|
||||||
|
private Integer timesId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Integer goodsId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品库存
|
||||||
|
*/
|
||||||
|
private Integer goodsNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品剩余库存
|
||||||
|
*/
|
||||||
|
private Integer goodsEndNum;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.etl.spike.entity.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class OrderRequest {
|
||||||
|
/**
|
||||||
|
* 场次ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "场次编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "商品编号不能为空")
|
||||||
|
private Long goodsId;
|
||||||
|
/**
|
||||||
|
* 加密签名
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "加密签名不能为空")
|
||||||
|
private String sign;
|
||||||
|
/**
|
||||||
|
* 购买数量
|
||||||
|
*/
|
||||||
|
@NotNull(message = "购买数量不能为空")
|
||||||
|
private Long num;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.etl.spike.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枚举常量类
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum EnumMsg {
|
||||||
|
// 定义一个带有错误码和描述性字符串的枚举常量
|
||||||
|
REDIS_KEY(401, "times:"),
|
||||||
|
REDIS_SMALL_KEY(402, "hashKey:"),
|
||||||
|
REDIS_GOODS_NUM(403,"goodNum:");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
EnumMsg(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.etl.spike.handler;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.etl.common.result.Result;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局异常捕获类
|
||||||
|
*/
|
||||||
|
@RestControllerAdvice
|
||||||
|
@Configuration
|
||||||
|
@Log4j2
|
||||||
|
public class CatchExceptions {
|
||||||
|
@ExceptionHandler(value = RuntimeException.class)
|
||||||
|
public Result<String> catchException(RuntimeException exception) {
|
||||||
|
log.error("请求异常: [{}]",exception.getMessage(),exception);
|
||||||
|
return Result.error(JSONObject.toJSONString(exception.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.etl.spike.job;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.etl.spike.entity.Times;
|
||||||
|
import com.etl.spike.entity.TimesGoods;
|
||||||
|
import com.etl.spike.enums.EnumMsg;
|
||||||
|
import com.etl.spike.service.ITimesGoodsService;
|
||||||
|
import com.etl.spike.service.ITimesService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时同步redis
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class GoodsRedisJob {
|
||||||
|
|
||||||
|
private final StringRedisTemplate redisTemplate;
|
||||||
|
private final ITimesService timesService;
|
||||||
|
private final ITimesGoodsService timesGoodsService;
|
||||||
|
|
||||||
|
public GoodsRedisJob(StringRedisTemplate redisTemplate , ITimesService timesService , ITimesGoodsService timesGoodsService){
|
||||||
|
this.redisTemplate = redisTemplate;
|
||||||
|
this.timesService = timesService;
|
||||||
|
this.timesGoodsService = timesGoodsService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启一个定时任务将mysql中的最近三天的场次,商品信息和库存存入redis
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
public void testJob(){
|
||||||
|
log.info ("定时任务执行(-------------- redis场次信息同步 --------------)");
|
||||||
|
//计算三天前的日期
|
||||||
|
LocalDate localDate = LocalDate.now ().minusDays (3);
|
||||||
|
//转换类型
|
||||||
|
LocalDateTime startTime = localDate.atStartOfDay ();
|
||||||
|
//获取当前时间
|
||||||
|
LocalDateTime endTime = LocalDateTime.now ();
|
||||||
|
//查询最近三天的场次
|
||||||
|
List<Times> timesList = timesService.list (new LambdaQueryWrapper<Times> ().between (Times :: getEndTime ,
|
||||||
|
startTime ,
|
||||||
|
endTime));
|
||||||
|
//校验
|
||||||
|
if( CollectionUtils.isEmpty (timesList) ){
|
||||||
|
throw new RuntimeException ("最近三天暂无任何活动");
|
||||||
|
}
|
||||||
|
//获取全部的id集合
|
||||||
|
List<Integer> integers = timesList.stream ().map (Times :: getId).collect (Collectors.toList ());
|
||||||
|
//查询场次表和商品中间表
|
||||||
|
List<TimesGoods> timesGoods = timesGoodsService.list (new LambdaQueryWrapper<TimesGoods> ().in (TimesGoods::getTimesId, integers));
|
||||||
|
//校验
|
||||||
|
if( CollectionUtils.isEmpty (timesGoods) ){
|
||||||
|
throw new RuntimeException ("最近三天暂无任何活动");
|
||||||
|
}
|
||||||
|
//遍历存入redis
|
||||||
|
timesGoods.forEach (item -> {
|
||||||
|
String redisKey = EnumMsg.REDIS_SMALL_KEY.getMessage ()
|
||||||
|
+ item.getId ();
|
||||||
|
//存入redis的hash结构,键用event前缀拼接时间戳+场次id
|
||||||
|
redisTemplate.opsForHash ().put (EnumMsg.REDIS_KEY.getMessage (), redisKey , JSON.toJSONString (item));
|
||||||
|
//库存存入redis
|
||||||
|
redisTemplate.opsForHash ().put (EnumMsg.REDIS_GOODS_NUM.getMessage () , item.getGoodsId (), item.getGoodsNum ());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.etl.spike.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.spike.entity.Goods;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku商品表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface GoodsMapper extends BaseMapper< Goods > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.spike.entity.OrderItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface OrderItemMapper extends BaseMapper< OrderItem > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.etl.spike.mapper;
|
||||||
|
|
||||||
|
import com.etl.spike.entity.Order;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface OrderMapper extends BaseMapper<Order> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.spike.entity.TimesGoods;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 场次表和商品表关联 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface TimesGoodsMapper extends BaseMapper< TimesGoods > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.etl.spike.mapper;
|
||||||
|
|
||||||
|
import com.etl.spike.entity.Times;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀场次表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface TimesMapper extends BaseMapper<Times> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.etl.spike.pdf;
|
||||||
|
|
||||||
|
import com.itextpdf.text.*;
|
||||||
|
import com.itextpdf.text.pdf.*;
|
||||||
|
import com.itextpdf.tool.xml.XMLWorkerFontProvider;
|
||||||
|
import com.itextpdf.tool.xml.XMLWorkerHelper;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 导出pdf文件
|
||||||
|
* @date 2018/3/16 16:48$
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ExportPdfTest {
|
||||||
|
|
||||||
|
public void export() throws Exception {
|
||||||
|
System.out.println ("开始执行");
|
||||||
|
Document document = new Document(PageSize.A4);
|
||||||
|
//设置要导出的文件名
|
||||||
|
OutputStream outputStream = new FileOutputStream (new File("D:\\abc\\test.pdf"));
|
||||||
|
PdfWriter writer = PdfWriter.getInstance(document, outputStream);
|
||||||
|
document.open();
|
||||||
|
//获取字体文件目录
|
||||||
|
String fontDir = this.getClass().getClassLoader().getResource("font").getFile();
|
||||||
|
//注册字体文件
|
||||||
|
XMLWorkerFontProvider xmlWorkerFontProvider = new XMLWorkerFontProvider(fontDir);
|
||||||
|
//设置中文字体,本文举例使用的是仿宋
|
||||||
|
BaseFont baseFont = BaseFont.createFont("font/SIMFANG.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
|
||||||
|
Font font12 = new Font(baseFont, 12);
|
||||||
|
|
||||||
|
//页眉,是可以双层或更多,取决于放置的坐标
|
||||||
|
PdfContentByte cb = writer.getDirectContent();
|
||||||
|
//页眉左上
|
||||||
|
Phrase leftp1 = new Phrase("页眉左上", font12);
|
||||||
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, leftp1, document.left(), document.top() + 13, 0);
|
||||||
|
//页眉左下
|
||||||
|
Phrase leftp2 = new Phrase("页眉左下:", font12);
|
||||||
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, leftp2, document.left(), document.top(), 0);
|
||||||
|
//页眉右上
|
||||||
|
Phrase rightp1 = new Phrase("页眉右上:", font12);
|
||||||
|
float rightp1WidthPoint = baseFont.getWidthPoint(rightp1.getContent(), 12);
|
||||||
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, rightp1, document.right() - rightp1WidthPoint, document.top() + 13, 0);
|
||||||
|
//页眉右下
|
||||||
|
Phrase rightp2 = new Phrase("页眉右下:", font12);
|
||||||
|
float rightp2WidthPoint = baseFont.getWidthPoint(rightp2.getContent(), 12);
|
||||||
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, rightp2, document.right() - rightp2WidthPoint, document.top(), 0);
|
||||||
|
|
||||||
|
//下划线
|
||||||
|
PdfContentByte canvas = writer.getDirectContent();
|
||||||
|
CMYKColor magentaColor = new CMYKColor(1.f, 1.f, 1.f, 1.f);
|
||||||
|
canvas.setColorStroke(magentaColor);
|
||||||
|
canvas.moveTo(document.left(), document.top() - 4);
|
||||||
|
canvas.lineTo(document.right(), document.top() - 4);
|
||||||
|
canvas.closePathStroke();
|
||||||
|
|
||||||
|
//标题
|
||||||
|
Font h1 = new Font(baseFont, 20, Font.BOLD);//创建全文标题字体,参数分别是字体类别,字号,效果
|
||||||
|
Paragraph paragraphTitle = new Paragraph("标题测试", h1);//设置文本内容和要使用的字体
|
||||||
|
paragraphTitle.setAlignment(Element.ALIGN_CENTER);//设置居中
|
||||||
|
document.add(paragraphTitle);
|
||||||
|
|
||||||
|
//正文标题1
|
||||||
|
Font h3 = new Font(baseFont, 14, Font.BOLD);//创建标题字体
|
||||||
|
Paragraph paragraphH1 = new Paragraph("正文标题1", h3);
|
||||||
|
document.add(paragraphH1);
|
||||||
|
//正文1
|
||||||
|
Paragraph paragraphText1 = new Paragraph("你能做到最好,你能做到最好,你能做到最好,你能做到最好,你能做到最好,你能做到最好,你能做到最好。", font12);
|
||||||
|
document.add(paragraphText1);
|
||||||
|
|
||||||
|
//正文2,html标签内容
|
||||||
|
String content = "<div class=\"overflow-hidden\"><div class=\"editContent\"><p><br>eah, you could be the greatest<br>你会成为最伟大的人<br>You can be the best<br>你能做到最好<br>You can be the King Kong banging on your chest<br>你能像金刚一样自信满满的敲打胸脯<br>You could beat the world<br>你可以征服全世界<br>You could beat the war<br>能够赢得一切战争<br>You could talk to God, go banging on his door<br>甚至能够与神对话 去敲打他的门<br>You can throw your hands up<br>你能自信的举起双手<br>You can be the clock<br>你可以与时间抗争<br>You can move a mountain<br>你有移山之力<br>You can break rocks<br>你能击碎岩石<br>You can be a master<br>你可以成为命运主宰<br>Don't wait for luck<br>无需等待运气垂青<br>Dedicate yourself and you can find yourself<br>放手一搏后你会恍然发现<br>Standing in the hall of fame<br>你已身处名人堂之中</p></div></div>";
|
||||||
|
//html转换成普通文字,方法如下:
|
||||||
|
org.jsoup.nodes.Document contentDoc = Jsoup.parseBodyFragment(content);
|
||||||
|
org.jsoup.nodes.Document.OutputSettings outputSettings = new org.jsoup.nodes.Document.OutputSettings();
|
||||||
|
outputSettings.syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml);
|
||||||
|
contentDoc.outputSettings(outputSettings);
|
||||||
|
String parsedHtml = contentDoc.outerHtml();
|
||||||
|
//这儿的font-family不支持汉字,{font-family:仿宋} 是不可以的。
|
||||||
|
InputStream cssIs = new ByteArrayInputStream ("* {font-family: fangsong;}".getBytes("UTF-8"));
|
||||||
|
//第四个参数是html中的css文件的输入流
|
||||||
|
//第五个参数是字体提供者,使用系统默认支持的字体时,可以不传。
|
||||||
|
XMLWorkerHelper.getInstance().parseXHtml(writer, document, new ByteArrayInputStream(parsedHtml.getBytes()), cssIs, xmlWorkerFontProvider);
|
||||||
|
|
||||||
|
//页脚
|
||||||
|
PdfContentByte cj = writer.getDirectContent();
|
||||||
|
Phrase leftp3 = new Phrase("页脚左侧", font12);
|
||||||
|
ColumnText.showTextAligned(cj, Element.ALIGN_LEFT, leftp3, document.left(), document.bottom(), 0);
|
||||||
|
Phrase rightp3 = new Phrase("页脚右侧", font12);
|
||||||
|
final float rightp3WidthPoint = baseFont.getWidthPoint(rightp3.getContent(), 12);
|
||||||
|
ColumnText.showTextAligned(cj, Element.ALIGN_LEFT, rightp3, document.right() - rightp3WidthPoint, document.bottom(), 0);
|
||||||
|
|
||||||
|
//关闭
|
||||||
|
document.close();
|
||||||
|
}}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.spike.entity.Goods;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku商品表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface IGoodsService extends IService< Goods > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.spike.entity.OrderItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface IOrderItemService extends IService< OrderItem > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.etl.spike.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.spike.entity.Order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单详情服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface IOrderService extends IService< Order > {
|
||||||
|
|
||||||
|
boolean orderGoOn();
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.spike.entity.TimesGoods;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 场次表和商品表关联 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface ITimesGoodsService extends IService< TimesGoods > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.etl.spike.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.spike.entity.Times;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀场次表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
public interface ITimesService extends IService< Times > {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.etl.spike.serviceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.spike.entity.Goods;
|
||||||
|
import com.etl.spike.mapper.GoodsMapper;
|
||||||
|
import com.etl.spike.service.IGoodsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku商品表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class GoodsServiceImpl extends ServiceImpl< GoodsMapper, Goods > implements IGoodsService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.etl.spike.serviceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.spike.entity.OrderItem;
|
||||||
|
import com.etl.spike.mapper.OrderItemMapper;
|
||||||
|
import com.etl.spike.service.IOrderItemService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderItemServiceImpl extends ServiceImpl < OrderItemMapper, OrderItem > implements IOrderItemService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.etl.spike.serviceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.spike.entity.Order;
|
||||||
|
import com.etl.spike.mapper.OrderMapper;
|
||||||
|
import com.etl.spike.service.IOrderService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderServiceImpl extends ServiceImpl< OrderMapper, Order > implements IOrderService {
|
||||||
|
/**
|
||||||
|
* 参数校验无误后推送队列
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean orderGoOn(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.etl.spike.serviceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.spike.entity.TimesGoods;
|
||||||
|
import com.etl.spike.mapper.TimesGoodsMapper;
|
||||||
|
import com.etl.spike.service.ITimesGoodsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 场次表和商品表关联 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TimesGoodsServiceImpl extends ServiceImpl< TimesGoodsMapper, TimesGoods > implements ITimesGoodsService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.etl.spike.serviceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.spike.entity.Times;
|
||||||
|
import com.etl.spike.mapper.TimesMapper;
|
||||||
|
import com.etl.spike.service.ITimesService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀场次表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author test
|
||||||
|
* @since 2024-07-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TimesServiceImpl extends ServiceImpl< TimesMapper, Times > implements ITimesService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
# 应用服务 WEB 访问端口
|
||||||
|
server.port=10002
|
||||||
|
|
||||||
|
spring.redis.host=47.101.130.221
|
||||||
|
spring.redis.port=6379
|
||||||
|
spring.redis.password=123456
|
||||||
|
mybatis-plus.type-aliases-package=com.etl.spike.entity
|
||||||
|
mybatis-plus.mapper-locations=classpath:mapper/*.xml
|
||||||
|
mybatis-plus.configuration.map-underscore-to-camel-case=true
|
||||||
|
logging.level.com.etl.**=debug
|
||||||
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
spring.datasource.url=jdbc:mysql://47.101.130.221:3306/spike?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
|
||||||
|
spring.datasource.username=root
|
||||||
|
spring.datasource.password=ays@123
|
||||||
|
|
||||||
|
spring.cloud.sentinel.transport.dashboard=localhost:8333
|
||||||
|
spring.cloud.sentinel.transport.port=localhost:8719
|
||||||
|
# ??????
|
||||||
|
management.endpoints.web.exposure.include= *
|
||||||
|
spring.main.allow-circular-references=true
|
||||||
|
redisson.addresses=redis://47.101.130.221:6379
|
||||||
|
redisson.password=123456
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h1>hello word!!!</h1>
|
||||||
|
<p>this is a html page</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.etl.spike;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class EtlSpikeApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue