2023-10-11提交

master
RENCHAO 1 year ago
parent f6c4b651ce
commit b5e81e3fbc

@ -14,7 +14,15 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>

@ -0,0 +1,61 @@
package com.renchao.postgresql;
import org.postgresql.copy.CopyManager;
import org.postgresql.core.BaseConnection;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* @author ren_chao
*/
public class PostgreSQLDemo {
public static void main(String[] args) throws SQLException, IOException {
String url = "jdbc:postgresql://172.16.12.105:5432/keliubao";
String user = "postgres";
String password = "postgres";
Connection connection = DriverManager.getConnection(url, user, password);
BaseConnection baseConnection = (BaseConnection) connection;
CopyManager copyAPI = baseConnection.getCopyAPI();
FileReader from = new FileReader("C:\\Users\\RENCHAO\\Desktop\\test\\dws_line_metric_day2023-08-12.csv");
String sql = "COPY tbl_prd_line_metric_day(line_code,line_name,line_status,company_code,company_name,service_type,metric_value,metric_date) FROM STDIN WITH CSV";
long l = System.currentTimeMillis();
long count = copyAPI.copyIn(sql, from);
System.out.println(count);
System.out.println("耗时:" + (System.currentTimeMillis() - l)/1000 + "秒");
connection.close();
// aa("C:\\Users\\RENCHAO\\Desktop\\test\\dws_line_metric_day2023-08-12.csv");
}
private static void aa(String filePath) {
try {
// 创建RandomAccessFile实例
RandomAccessFile randomAccessFile = new RandomAccessFile(new File(filePath), "rw");
// 定位到文件的倒数第二行
long position = randomAccessFile.length() - 2;
while (position >= 0 && (char) randomAccessFile.readByte() != '\n') {
position--;
randomAccessFile.seek(position);
}
// 截断文件
randomAccessFile.setLength(position + 1);
// 关闭RandomAccessFile
randomAccessFile.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -169,4 +169,39 @@ public class RegExDemo {
System.out.println(pattern.matcher(str).matches());
}
@Test
public void test11() {
String str = "INSERT INTO table(c1, c2, c3, c4)values('C1', ?, ?, 'C4')";
Pattern pattern = Pattern.compile("\\(([^)]+)\\)[ ]*VALUES\\(([^)]+)\\)",Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
System.out.println(matcher.group());
System.out.println(matcher.group(0));
System.out.println(matcher.group(1));
System.out.println(matcher.group(2));
}
}
@Test
public void test12() {
// String text = "Some_text_here2023-09-07";
String text = "Some_text_here.csv";
// 创建 Pattern 对象
Pattern pattern = Pattern.compile("([a-zA-Z_]+)(\\d{4}-\\d{2}-\\d{2})?");
// 创建 Matcher 对象
Matcher matcher = pattern.matcher(text);
// 查找匹配的日期字符串
matcher.find();
System.out.println(matcher.group(0));
System.out.println(matcher.group(1));
System.out.println(matcher.group(2));
// if (matcher.find()) {
// }
}
}

@ -4,17 +4,39 @@ import org.junit.Test;
import sun.net.www.http.HttpClient;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringJoiner;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class Test01 {
public static void main(String[] args) {
@ -71,5 +93,272 @@ public class Test01 {
// 在这里您可以解析jsonResponse并提取所需的地理位置信息
}
@Test
public void test07() {
int numRecords = 5000000;
String csvFileName = "C:\\Users\\RENCHAO\\Desktop\\test\\data.csv";
try (FileWriter writer = new FileWriter(csvFileName)) {
// 写入CSV文件的列名
// writer.append("line_code,line_name,line_status,company_code,company_name,service_type,metric_value\n");
// 生成随机数据并写入CSV文件
for (int i = 1; i <= numRecords; i++) {
String lineCode = "Line" + i;
String lineName = "LineName" + i;
String lineStatus = "S" + i;
String companyCode = "Company" + i;
String companyName = "CompanyName" + i;
String serviceType = "T" + i;
int metricValue = new Random().nextInt(1000); // 假设metric_value是0到999之间的整数
writer.append(lineCode + "," + lineName + "," + lineStatus + "," + companyCode + ","
+ companyName + "," + serviceType + "," + metricValue + "\n");
}
writer.append("lineCode" + "," + "lineName" + "," + "SS" + "," + "companyCode" + ","
+ "companyName" + "," + "TT" + "," + "990044");
System.out.println(numRecords + " 条数据已生成并保存到 " + csvFileName + " 文件中。");
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* csv
* StringJoiner
*
*/
@Test
public void test08() throws IOException {
FileWriter writer = new FileWriter("C:\\Users\\RENCHAO\\Desktop\\test\\data22.csv", true);
StringJoiner sj1 = new StringJoiner(",");
sj1.add("sss").add("ccc");
writer.write(sj1 + "\n");
StringJoiner sj2 = new StringJoiner(",");
sj2.add("kk").add("z,zz");
writer.write(sj2 + "\n");
writer.close();
}
/**
* int long
*/
@Test
public void test09() {
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
System.out.println(Long.MAX_VALUE);
System.out.println(Long.MIN_VALUE);
}
@Test
public void test10() throws IOException {
String property = System.getProperty("user.dir");
System.out.println(property);
Path resolve = Paths.get(property, "Desktop", "test03");
System.out.println(resolve);
File file = resolve.toFile();
System.out.println(file.exists());
System.out.println(file.mkdirs());
resolve = resolve.resolve("data33.csv");
FileWriter writer = new FileWriter(resolve.toFile(), true);
writer.write("zzzz");
writer.close();
}
@Test
public void test11() {
String uri = "C:\\Users\\RENCHAO\\Desktop\\test\\data.csv";
// long l = System.currentTimeMillis();
// try {
// long lineCount = Files.lines(Paths.get(uri)).count();
// System.out.println("行数:" + lineCount);
// } catch (IOException e) {
// e.printStackTrace();
// }
// System.out.println("耗时:" + (System.currentTimeMillis() - l));
long l = System.currentTimeMillis();
try (BufferedReader reader = new BufferedReader(new FileReader(uri))) {
long lineCount = 0;
while (reader.readLine() != null) {
lineCount++;
}
System.out.println("行数:" + lineCount);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("耗时:" + (System.currentTimeMillis() - l));
}
@Test
public void test12() {
List<String> list = new ArrayList<>();
list.add("2023-02");
list.add("2023-08");
list.add("2023-05");
list.add("2023-01-22");
list.sort(Comparator.comparing(this::toDate));
System.out.println(list);
}
private Date toDate(String str) {
if (str.length() <= 7) {
return Date.valueOf(str + "-01");
}
return Date.valueOf(str);
}
@Test
public void test13() {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < 100000; i++) {
Map<String, Object> map = new HashMap<>();
map.put("id", i);
map.put("group", "aa");
map.put("name", "aa" + i * 2);
list.add(map);
}
for (int i = 100000; i < 200000; i++) {
Map<String, Object> map = new HashMap<>();
map.put("id", i);
map.put("group", "bb");
map.put("name", "bb" + i * 2);
list.add(map);
}
long l = System.currentTimeMillis();
Map<String, List<Map<String, Object>>> group = list.stream().collect(Collectors.groupingBy(m -> m.get("group").toString()));
System.out.println("耗时:" + (System.currentTimeMillis() - l));
Set<String> strings = group.keySet();
System.out.println(strings);
for (String s : strings) {
System.out.println(group.get(s).size());
}
}
@Test
public void test14() throws IOException {
Path TEMP_PATH = Paths.get("C:\\Users\\RENCHAO\\IdeaProjects\\agile-bacth\\sftp-file");
List<File> fileList = new ArrayList<>();
getFileList(TEMP_PATH.toFile(), fileList);
for (File file : fileList) {
Path path = file.toPath();
Path fileName = path.getParent().getFileName();
System.out.println(fileName);
System.out.println(path.getParent().getName(1));
}
}
/**
*
*
*/
@Test
public void test15() throws IOException {
String path = "C:\\Users\\RENCHAO\\Desktop\\test\\data.csv";
// RandomAccessFile file = new RandomAccessFile(path, "r");
// file.seek(file.length() - 2);
// String theLastLine = file.readLine();
// System.out.println(theLastLine);
long l = System.currentTimeMillis();
System.out.println(readLastLine2(path));
System.out.println("耗时:" + (System.currentTimeMillis() - l));
System.out.println(Integer.parseInt("77"));
}
public static String readLastLine(String filePath) throws IOException {
try (RandomAccessFile file = new RandomAccessFile(filePath, "r")) {
StringBuilder lastLine = new StringBuilder();
for (long pointer = file.length() - 1; pointer >= 0; pointer--) {
file.seek(pointer);
int currentByte = file.read();
if (currentByte == '\n' || currentByte == '\r') {
// Found the end of the last line
break;
}
lastLine.insert(0, (char) currentByte);
}
return lastLine.toString();
}
}
public static String readLastLine2(String filePath) throws IOException {
try (RandomAccessFile file = new RandomAccessFile(filePath, "r")) {
for (long pointer = file.length() - 1; pointer >= 0; pointer--) {
file.seek(pointer);
int currentByte = file.read();
if (currentByte == '\n' || currentByte == '\r') {
break;
}
}
return file.readLine();
}
}
//
private void compression(File file) throws IOException {
FileOutputStream outputStream = new FileOutputStream(file.toString().replace("csv", "zip"));
ZipOutputStream zipOut = new ZipOutputStream(outputStream);
zipOut.putNextEntry(new ZipEntry(file.getName()));
FileInputStream inputStream = new FileInputStream(file);
byte[] bytes = new byte[1024];
int length;
while ((length = inputStream.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
inputStream.close();
zipOut.close();
outputStream.close();
}
/**
*
*
*/
private void getFileList(File dir, List<File> fileList) {
if (!dir.exists()) {
return;
}
File[] files = dir.listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
getFileList(file, fileList);
} else {
fileList.add(file);
}
}
}
}

@ -90,6 +90,24 @@
<artifactId>logstash-logback-encoder</artifactId>
<version>6.4</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.5</version>
</dependency>
<!-- pool 对象池 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
</dependencies>
<build>
@ -106,7 +124,18 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
</plugin>
<plugin>
<groupId>com.github.shalousun</groupId>
<artifactId>smart-doc-maven-plugin</artifactId>
<version>2.6.9</version>
<configuration>
<!--指定生成文档的使用的配置文件,配置文件放在自己的项目中,如果不指定,默认文件名default.json-->
<configFile>./src/main/resources/smart-doc.json</configFile>
<includes>
<include>com.jiuyv.sptcc.agile.batch:agile-batch-dws</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>

@ -4,47 +4,14 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/**
*
* @author ren_chao
*/
@EnableDiscoveryClient
@SpringBootApplication
public class BatchDwsApplication {
public static void main(String[] args) {
SpringApplication.run(BatchDwsApplication.class, args);
// HiveServer2的JDBC连接URL
String hiveServerURL = "jdbc:hive2://172.16.12.101:10000/hive;socketTimeout=12000;";
String hiveUser = "flink";
String hivePassword = "flink";
try {
// 加载Hive JDBC驱动程序
Class.forName("org.apache.hive.jdbc.HiveDriver");
// 连接到HiveServer2
Connection connection = DriverManager.getConnection(hiveServerURL, hiveUser, hivePassword);
// 执行Hive查询
String sql = "select * from student2";
PreparedStatement statement = connection.prepareStatement(sql);
ResultSet resultSet = statement.executeQuery();
// 处理查询结果
while (resultSet.next()) {
System.out.println(resultSet.getInt("id"));
System.out.println(resultSet.getString("name"));
}
// 关闭资源
resultSet.close();
statement.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,29 @@
package com.jiuyv.sptcc.agile.batch.config;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
/**
* C3P0
* @author ren_chao
*/
@Configuration
public class DataSourceConfig {
@Bean(name = "hiveDataSource")
@ConfigurationProperties(prefix = "hive-data-source")
public DataSource hiveDataSource() {
return DataSourceBuilder.create().type(ComboPooledDataSource.class).build();
}
@Bean(name = "pgDataSource")
@ConfigurationProperties(prefix = "pg-data-source")
public DataSource pgDataSource() {
return DataSourceBuilder.create().type(ComboPooledDataSource.class).build();
}
}

@ -0,0 +1,44 @@
package com.jiuyv.sptcc.agile.batch.config;
import com.jiuyv.sptcc.agile.batch.domain.TableInfo;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
*
*
* @author ren_chao
*/
@Component
@ConfigurationProperties(prefix = "sync-table")
public class TableProperties {
/**
*
*/
private List<TableInfo> tables;
/**
*
*/
private Map<String, String> fileTypeMap;
public List<TableInfo> getTables() {
return tables;
}
public void setTables(List<TableInfo> tables) {
this.tables = tables;
}
public Map<String, String> getFileTypeMap() {
return fileTypeMap;
}
public void setFileTypeMap(Map<String, String> fileTypeMap) {
this.fileTypeMap = fileTypeMap;
}
}

@ -0,0 +1,94 @@
package com.jiuyv.sptcc.agile.batch.config.sftp;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import org.apache.commons.pool2.BasePooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.time.Duration;
/**
* JSchSftp
*/
@Configuration
public class JSchSftpConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(JSchSftpConfig.class);
@Bean
public SftpChannelPool sftpChannelPool(SftpProperties sftpProperties, ThreadPoolTaskExecutor taskExecutor) {
GenericObjectPoolConfig<ChannelSftp> poolConfig = new GenericObjectPoolConfig<>();
poolConfig.setMaxIdle(sftpProperties.getMaxIdle());
poolConfig.setMaxTotal(sftpProperties.getMaxTotal());
poolConfig.setMinIdle(sftpProperties.getMinIdle());
// 10分钟清理一次无效连接
poolConfig.setTimeBetweenEvictionRuns(Duration.ofMinutes(10));
// 获取连接前进行连接可用性校验
poolConfig.setTestOnBorrow(true);
GenericObjectPool<ChannelSftp> pool = new GenericObjectPool<>(new SftpChannelFactory(sftpProperties), poolConfig);
// 异步初始化连接池
taskExecutor.execute(() -> {
try {
pool.preparePool();
} catch (Exception e) {
LOGGER.error("Sftp服务器异常ChannelSftp连接池初始化失败", e);
}
});
return new SftpChannelPool(pool);
}
/**
* ChannelSftp
*/
private static class SftpChannelFactory extends BasePooledObjectFactory<ChannelSftp> {
private final SftpProperties sftpProperties;
public SftpChannelFactory(SftpProperties sftpProperties) {
this.sftpProperties = sftpProperties;
}
@Override
public ChannelSftp create() throws Exception {
JSch jSch = new JSch();
Session session = jSch.getSession(sftpProperties.getUsername(), sftpProperties.getHost(), sftpProperties.getPort());
session.setPassword(sftpProperties.getPassword());
session.setConfig("StrictHostKeyChecking", "no"); // 忽略主机密钥检查
session.connect();
ChannelSftp sftpChannel= (ChannelSftp) session.openChannel("sftp");
sftpChannel.connect();
return sftpChannel;
}
@Override
public PooledObject<ChannelSftp> wrap(ChannelSftp channelSftp) {
return new DefaultPooledObject<>(channelSftp);
}
/**
*
*/
@Override
public void destroyObject(PooledObject<ChannelSftp> p) throws Exception {
ChannelSftp channelSftp = p.getObject();
channelSftp.disconnect();
channelSftp.getSession().disconnect();
}
/**
*
*/
@Override
public boolean validateObject(PooledObject<ChannelSftp> p) {
ChannelSftp channelSftp = p.getObject();
return channelSftp.isConnected() && !channelSftp.isClosed();
}
}
}

@ -0,0 +1,32 @@
package com.jiuyv.sptcc.agile.batch.config.sftp;
import com.jcraft.jsch.ChannelSftp;
import com.jiuyv.sptcc.agile.batch.exception.ServiceException;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* SftpChannel
*/
public class SftpChannelPool {
private static final Logger LOGGER = LoggerFactory.getLogger(SftpChannelPool.class);
private final GenericObjectPool<ChannelSftp> genericObjectPool;
public SftpChannelPool(GenericObjectPool<ChannelSftp> genericObjectPool) {
this.genericObjectPool = genericObjectPool;
}
public ChannelSftp getSftpChannel() {
try {
return genericObjectPool.borrowObject();
} catch (Exception e) {
LOGGER.error("系统错误Sftp服务器异常", e);
throw new ServiceException("系统错误Sftp服务器异常");
}
}
public void closeChannel(ChannelSftp channelSftp) {
genericObjectPool.returnObject(channelSftp);
}
}

@ -0,0 +1,95 @@
package com.jiuyv.sptcc.agile.batch.config.sftp;
import com.jiuyv.sptcc.agile.batch.utils.Sm4Util;
import org.apache.commons.codec.DecoderException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.security.GeneralSecurityException;
@Component
@ConfigurationProperties(prefix = "sftp")
public class SftpProperties {
private static final Logger LOGGER = LoggerFactory.getLogger(SftpProperties.class);
private static final String SM4_KEY = "a14751855ccb428d982c33dfa3535a57";
private String host;
private int port = 22;
private String username;
private String password;
/**
*
*/
private int maxTotal = 10;
/**
*
*/
private int maxIdle = 10;
/**
*
*/
private int minIdle = 5;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
try {
return Sm4Util.decryptEcb(SM4_KEY, password);
} catch (GeneralSecurityException | DecoderException e) {
LOGGER.error("密码解密失败", e);
return "";
}
}
public void setPassword(String password) {
this.password = password;
}
public int getMaxTotal() {
return maxTotal;
}
public void setMaxTotal(int maxTotal) {
this.maxTotal = maxTotal;
}
public int getMaxIdle() {
return maxIdle;
}
public void setMaxIdle(int maxIdle) {
this.maxIdle = maxIdle;
}
public int getMinIdle() {
return minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
}

@ -0,0 +1,133 @@
package com.jiuyv.sptcc.agile.batch.controller;
import com.jiuyv.sptcc.agile.batch.domain.AjaxResult;
import com.jiuyv.sptcc.agile.batch.domain.ReqSyncTableDTO;
import com.jiuyv.sptcc.agile.batch.domain.TableInfo;
import com.jiuyv.sptcc.agile.batch.service.BatchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.core.task.TaskExecutor;
import org.springframework.web.bind.annotation.GetMapping;
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.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
*
*
* @author ren_chao
*/
@RestController
@RequestMapping("dwsBatch")
public class BatchController {
private static final Logger LOGGER = LoggerFactory.getLogger(BatchController.class);
private final TaskExecutor executor;
private final BatchService batchService;
public BatchController(TaskExecutor executor, BatchService batchService) {
this.executor = executor;
this.batchService = batchService;
}
/**
*
*
*/
@GetMapping("/syncAll")
public AjaxResult<Void> syncAll() {
executor.execute(() -> {
try {
batchService.syncAll();
} catch (SQLException | IOException | InterruptedException e) {
LOGGER.error("同步时发生异常:{}", e.getMessage(), e);
}
});
return AjaxResult.success("开始同步,稍后通过同步日志查看结果");
}
/**
*
*
*/
@PostMapping("/syncSome")
public AjaxResult<Void> syncSome(@RequestBody List<ReqSyncTableDTO> tableList) {
List<TableInfo> tables = tableList.stream().map(tableDTO -> {
TableInfo tableInfo = new TableInfo();
BeanUtils.copyProperties(tableDTO, tableInfo);
return tableInfo;
}).collect(Collectors.toList());
executor.execute(() -> {
try {
batchService.syncSome(tables);
} catch (SQLException | IOException | InterruptedException e) {
LOGGER.error("同步时发生异常:{}", e.getMessage(), e);
}
});
return AjaxResult.success("开始同步,稍后通过同步日志查看结果");
}
/**
* pg
*
*/
@PostMapping("/clearTable")
public AjaxResult<Void> clearTable(@RequestBody List<String> tables) {
for (String table : tables) {
if (!table.startsWith("tbl_prd_")) {
return AjaxResult.error("非法操作,无权限清空该表:" + table);
}
}
try {
batchService.clearTable(tables);
} catch (SQLException e) {
String message = e.getMessage();
LOGGER.error("清空表时,发生异常{}", message, e);
return AjaxResult.error("清空表时,发生异常{}" + message);
}
return AjaxResult.success();
}
/**
*
*
*/
@GetMapping("/log")
public AjaxResult<String> log() {
File file = getLatestFile(Paths.get(System.getProperty("user.dir"), "sync-logs").toString());
if (file == null) {
return AjaxResult.error("没有查询到日志文件,请先执行同步任务");
}
try {
List<String> lines = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
return AjaxResult.success("操作成功",String.join(System.lineSeparator(), lines));
} catch (IOException e) {
LOGGER.error("日志查询失败:{}", e.getMessage(), e);
return AjaxResult.error("日志查询失败:" + e.getMessage());
}
}
private File getLatestFile(String dirPath){
File dir = new File(dirPath);
File[] files = dir.listFiles();
if(files == null || files.length == 0){
return null;
}
Arrays.sort(files, Comparator.comparingLong(File::lastModified));
return files[0];
}
}

@ -0,0 +1,47 @@
package com.jiuyv.sptcc.agile.batch.dao;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* DAO
*
* @author ren_chao
*/
public abstract class BaseDAO {
protected final DataSource dataSource;
public BaseDAO(DataSource dataSource) {
this.dataSource = dataSource;
}
/**
*
*
*/
public Integer getCountByDate(String table, String whereColumn, String date) throws SQLException {
return getCount(String.format("select count(*) from %s where %s = '%s'", table, whereColumn, date));
}
/**
*
*
*/
public Integer getCountByDate(String table) throws SQLException {
return getCount("select count(*) from " + table);
}
private Integer getCount(String sql) throws SQLException {
try (Connection connection = dataSource.getConnection();
ResultSet resultSet = connection.prepareStatement(sql).executeQuery()) {
resultSet.next();
return resultSet.getInt(1);
}
}
}

@ -0,0 +1,91 @@
package com.jiuyv.sptcc.agile.batch.dao;
import org.springframework.stereotype.Repository;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Hive
* @author ren_chao
*/
@Repository
public class HiveDAO extends BaseDAO {
public HiveDAO(DataSource hiveDataSource) {
super(hiveDataSource);
}
/**
*
*
*/
public List<String> getColumns(String tableName) throws SQLException {
String sql = String.format("select * from %s where 2=1", tableName);
try (Connection connection = dataSource.getConnection()) {
PreparedStatement statement = connection.prepareStatement(sql);
ResultSet resultSet = statement.executeQuery();
ResultSetMetaData metaData = resultSet.getMetaData();
List<String> list = new ArrayList<>();
for (int i = 1; i <= metaData.getColumnCount(); i++) {
String[] split = metaData.getColumnName(i).split("\\.");
list.add(split[split.length - 1]);
}
return list;
}
}
/**
* Hive
*/
public List<String> getDates(String hiveTable) throws SQLException {
String sql = "show partitions " + hiveTable;
try (Connection connection = dataSource.getConnection();
ResultSet resultSet = connection.prepareStatement(sql).executeQuery()) {
List<String> list = new ArrayList<>();
while (resultSet.next()) {
list.add(resultSet.getString(1).split("=")[1]);
}
return list;
}
}
/**
* Hive
*/
public List<Map<String, Object>> selectList(String sql, Object... param)
throws SQLException {
try (Connection connection = dataSource.getConnection()) {
PreparedStatement statement = connection.prepareStatement(sql);
for (int i = 0; i < param.length; i++) {
statement.setObject(i + 1, param[i]);
}
ResultSet resultSet = statement.executeQuery();
ResultSetMetaData metaData = resultSet.getMetaData();
List<Map<String, Object>> list = new ArrayList<>();
while (resultSet.next()) {
Map<String, Object> map = new HashMap<>();
for (int i = 1; i <= metaData.getColumnCount(); i++) {
Object value = resultSet.getObject(i);
String[] split = metaData.getColumnName(i).split("\\.");
map.put(split[split.length - 1], value);
}
list.add(map);
}
return list;
}
}
}

@ -0,0 +1,110 @@
package com.jiuyv.sptcc.agile.batch.dao;
import org.springframework.stereotype.Repository;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Postgre
*
* @author ren_chao
*/
@Repository
public class PostgreDAO extends BaseDAO {
private final Pattern SQL_INSERT_PATTERN = Pattern.compile("\\(([^)]+)\\)[ ]*VALUES\\(([^)]+)\\)", Pattern.CASE_INSENSITIVE);
public PostgreDAO(DataSource pgDataSource) {
super(pgDataSource);
}
/**
*
*/
public void batchInsert(List<Map<String, Object>> list, String sql) throws SQLException {
String[] place = getPlace(sql);
try (Connection connection = dataSource.getConnection()) {
PreparedStatement statement = connection.prepareStatement(sql);
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
for (int k = 0; k < place.length; k++) {
statement.setObject(k + 1, map.get(place[k]));
}
statement.addBatch();
if (i % 1000 == 0) {
statement.executeBatch();
statement.clearBatch();
}
}
statement.executeBatch();
}
}
/**
*
*/
public void insertSyncRecord(String path, String tableName, int count, Date txnDate) throws SQLException {
String sql = "INSERT INTO tbl_prd_sync_record (path,table_name,count,txn_date) VALUES(?,?,?,?)";
try (Connection connection = dataSource.getConnection();
PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, path);
statement.setString(2, tableName);
statement.setInt(3, count);
statement.setDate(4, txnDate);
statement.execute();
}
}
/**
*
*/
public String getLastDate(String column, String table) throws SQLException {
String sql = String.format("SELECT DISTINCT %s FROM %s ORDER BY %s DESC LIMIT 1", column, table, column);
try (Connection connection = dataSource.getConnection();
PreparedStatement statement = connection.prepareStatement(sql);
ResultSet resultSet = statement.executeQuery()) {
if (resultSet.next()) {
return resultSet.getString(1);
}
return null;
}
}
/**
* SQL
*/
private String[] getPlace(String sql) {
Matcher matcher = SQL_INSERT_PATTERN.matcher(sql);
if (!matcher.find()) {
return new String[0];
}
String[] fs = matcher.group(1).split(",");
String[] vs = matcher.group(2).split(",");
List<String> fields = new ArrayList<>();
for (int i = 0; i < vs.length; i++) {
if ("?".equals(vs[i].trim())) {
fields.add(fs[i].trim());
}
}
return fields.toArray(new String[0]);
}
public void clearTable(String table) throws SQLException {
String sql = "TRUNCATE " + table;
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.execute(sql);
}
}
}

@ -0,0 +1,177 @@
package com.jiuyv.sptcc.agile.batch.domain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
/**
*
*
* @author admin
*/
public class AjaxResult<T> implements Serializable {
protected static Logger logger = LoggerFactory.getLogger(AjaxResult.class);
private static final long serialVersionUID = 1L;
/**
*
*/
private int code;
/**
*
*/
private String msg;
/**
*
*/
private T data;
/**
* AjaxResult 使
*/
public AjaxResult() {
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
/**
* AjaxResult
*
* @param code
* @param msg
*/
public AjaxResult(int code, String msg) {
this.code = code;
this.msg = msg;
}
/**
* AjaxResult
*
* @param code
* @param msg
* @param data
*/
public AjaxResult(int code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
/**
*
*
* @return
*/
public static <T> AjaxResult<T> success() {
return AjaxResult.success("操作成功");
}
/**
*
*
* @return
*/
public static <T> AjaxResult<T> success(T data) {
return AjaxResult.success("操作成功", data);
}
/**
*
*
* @param msg
* @return
*/
public static <T> AjaxResult<T> success(String msg) {
return AjaxResult.success(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static <T> AjaxResult<T> success(String msg, T data) {
return new AjaxResult<>(200, msg, data);
}
/**
*
*
* @return
*/
public static <T> AjaxResult<T> error() {
return AjaxResult.error("操作失败");
}
/**
*
*
* @param msg
* @return
*/
public static <T> AjaxResult<T> error(String msg) {
return AjaxResult.error(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static <T> AjaxResult<T> error(String msg, T data) {
logger.error("服务报错:" + msg);
if (msg.contains("Exception")) {
return new AjaxResult<>(500, "系统内部错误", data);
}
if (msg.contains("script")) {
return new AjaxResult<>(500, "系统参数错误", data);
}
return new AjaxResult<>(500, msg, data);
}
/**
*
*
* @param code
* @param msg
* @return
*/
public static <T> AjaxResult<T> error(int code, String msg) {
return new AjaxResult<>(code, msg, null);
}
}

@ -0,0 +1,71 @@
package com.jiuyv.sptcc.agile.batch.domain;
import java.util.List;
import java.util.Map;
/**
*
*
* @author ren_chao
*/
public class DataInfoContainer {
/**
*
*/
private TableInfo tableInfo;
/**
*
*/
private List<Map<String, Object>> dataList;
/**
*
*/
private Integer total;
/**
*
*/
private String date;
public DataInfoContainer(TableInfo tableInfo, List<Map<String, Object>> dataList, Integer total, String date) {
this.tableInfo = tableInfo;
this.dataList = dataList;
this.total = total;
this.date = date;
}
public TableInfo getTableInfo() {
return tableInfo;
}
public void setTableInfo(TableInfo tableInfo) {
this.tableInfo = tableInfo;
}
public List<Map<String, Object>> getDataList() {
return dataList;
}
public void setDataList(List<Map<String, Object>> dataList) {
this.dataList = dataList;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}

@ -0,0 +1,47 @@
package com.jiuyv.sptcc.agile.batch.domain;
/**
*
*
* @author ren_chao
*/
public class ReqSyncTableDTO {
/**
* Hive
*/
private String hiveTable;
/**
* pg
*/
private String pgTable;
/**
* metric_month
*/
private String dateColumn;
public String getHiveTable() {
return hiveTable;
}
public void setHiveTable(String hiveTable) {
this.hiveTable = hiveTable;
}
public String getPgTable() {
return pgTable;
}
public void setPgTable(String pgTable) {
this.pgTable = pgTable;
}
public String getDateColumn() {
return dateColumn;
}
public void setDateColumn(String dateColumn) {
this.dateColumn = dateColumn;
}
}

@ -0,0 +1,89 @@
package com.jiuyv.sptcc.agile.batch.domain;
/**
*
* @author ren_chao
*/
public class TableInfo {
/**
* Hive
*/
private String hiveTable;
/**
* pg
*/
private String pgTable;
/**
*
*/
private String dateColumn;
/**
*
*/
private boolean part = false;
private String hiveSql;
private String pgSql;
private String[] tableHeader;
public String getHiveTable() {
return hiveTable;
}
public void setHiveTable(String hiveTable) {
this.hiveTable = hiveTable;
}
public String getPgTable() {
return pgTable;
}
public void setPgTable(String pgTable) {
this.pgTable = pgTable;
}
public String getDateColumn() {
return dateColumn;
}
public void setDateColumn(String dateColumn) {
this.dateColumn = dateColumn;
}
public boolean isPart() {
return part;
}
public void setPart(boolean part) {
this.part = part;
}
public String getHiveSql() {
return hiveSql;
}
public void setHiveSql(String hiveSql) {
this.hiveSql = hiveSql;
}
public String getPgSql() {
return pgSql;
}
public void setPgSql(String pgSql) {
this.pgSql = pgSql;
}
public String[] getTableHeader() {
return tableHeader;
}
public void setTableHeader(String[] tableHeader) {
this.tableHeader = tableHeader;
}
}

@ -1,12 +1,11 @@
package com.jiuyv.agile.data.common.exception;
package com.jiuyv.sptcc.agile.batch.exception;
/**
*
*
* @author admin
*/
public final class ServiceException extends RuntimeException
{
public final class ServiceException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
@ -22,52 +21,42 @@ public final class ServiceException extends RuntimeException
/**
*
*
* {@link CommonResult#getDetailMessage()}
*/
private String detailMessage;
/**
*
*/
public ServiceException()
{
public ServiceException() {
}
public ServiceException(String message)
{
public ServiceException(String message) {
this.message = message;
}
public ServiceException(String message, Integer code)
{
public ServiceException(String message, Integer code) {
this.message = message;
this.code = code;
}
public String getDetailMessage()
{
public String getDetailMessage() {
return detailMessage;
}
@Override
public String getMessage()
{
public String getMessage() {
return message;
}
public Integer getCode()
{
public Integer getCode() {
return code;
}
public ServiceException setMessage(String message)
{
public ServiceException setMessage(String message) {
this.message = message;
return this;
}
public ServiceException setDetailMessage(String detailMessage)
{
public ServiceException setDetailMessage(String detailMessage) {
this.detailMessage = detailMessage;
return this;
}

@ -0,0 +1,507 @@
package com.jiuyv.sptcc.agile.batch.service;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
import com.jiuyv.sptcc.agile.batch.config.TableProperties;
import com.jiuyv.sptcc.agile.batch.config.sftp.SftpChannelPool;
import com.jiuyv.sptcc.agile.batch.dao.HiveDAO;
import com.jiuyv.sptcc.agile.batch.dao.PostgreDAO;
import com.jiuyv.sptcc.agile.batch.domain.DataInfoContainer;
import com.jiuyv.sptcc.agile.batch.domain.TableInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import java.util.Vector;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
*
*
* @author ren_chao
*/
@Service
public class BatchService {
private static final Logger LOGGER = LoggerFactory.getLogger(BatchService.class);
private static final int BATCH_QUANTITY = 200000;
private static final String HIVE_SQL_TEMPLATE = "select * from %s %s limit ?,?";
private static final String PG_SQL_TEMPLATE = "insert into %s (%s) values(%s)";
private static final Path TEMP_PATH = Paths.get(System.getProperty("user.dir"), "temp");
private static final Pattern FILE_PATTERN = Pattern.compile("([a-zA-Z_]+)(\\d{4}-\\d{2}-\\d{2})?");
private volatile String requestId;
private final LinkedBlockingQueue<DataInfoContainer> dataQueue = new LinkedBlockingQueue<>(2);
private final LinkedBlockingQueue<File> fileQueue = new LinkedBlockingQueue<>(2);
private final HiveDAO hiveDAO;
private final PostgreDAO postgreDAO;
private final TableProperties tableProperties;
private final SftpChannelPool sftpChannelPool;
private final TaskExecutor executor;
private final Thread dataThread;
private final Thread sftpThread;
public BatchService(HiveDAO hiveDAO, PostgreDAO postgreDAO, TableProperties tableProperties,
SftpChannelPool sftpChannelPool, TaskExecutor executor) {
this.hiveDAO = hiveDAO;
this.postgreDAO = postgreDAO;
this.tableProperties = tableProperties;
this.sftpChannelPool = sftpChannelPool;
this.executor = executor;
this.dataThread = new Thread(this::receiveData);
this.sftpThread = new Thread(this::uploadSFTP);
this.dataThread.start();
this.sftpThread.start();
}
/**
*
*
*/
public void syncAll() throws SQLException, IOException, InterruptedException {
List<TableInfo> tables = tableProperties.getTables();
sync(tables);
}
/**
*
*
*/
public void syncSome(List<TableInfo> tables) throws SQLException, IOException, InterruptedException {
sync(tables);
}
/**
* pg
*/
public void clearTable(List<String> tables) throws SQLException {
for (String table : tables) {
postgreDAO.clearTable(table);
}
}
private synchronized void sync(List<TableInfo> tables) throws SQLException, InterruptedException, IOException {
// 清理临时目录
deleteDirectory();
this.requestId = System.currentTimeMillis() + "";
MDC.put("requestId", requestId);
for (TableInfo table : tables) {
String hiveTable = table.getHiveTable();
String pgTable = table.getPgTable();
// 构建pg插入SQL 和 文件表头
List<String> columns = hiveDAO.getColumns(hiveTable);
table.setPgSql(buildPgSql(pgTable, columns));
table.setTableHeader(columns.toArray(new String[0]));
// 处理日期列
handleDateColumn(table);
LOGGER.info("====开始同步表:{}", hiveTable);
if (table.isPart()) {
table.setHiveSql(String.format(HIVE_SQL_TEMPLATE, hiveTable, String.format("where %s = ?", table.getDateColumn())));
syncByPart(table);
} else {
table.setHiveSql(String.format(HIVE_SQL_TEMPLATE, hiveTable, ""));
syncNoPart(table);
}
}
LOGGER.info("====所有Hive表查询完毕等待pg表和SFTP同步完成。");
while (true) {
if (dataThread.getState() == Thread.State.WAITING && sftpThread.getState() == Thread.State.WAITING) {
LOGGER.info("====同步完成。");
MDC.clear();
break;
}
this.wait(1000);
}
}
/**
*
*
*
*/
private void handleDateColumn(TableInfo table) throws SQLException {
// 先查询有没有分区
List<Map<String, Object>> list = hiveDAO.selectList("DESCRIBE " + table.getHiveTable());
int partInfoIndex = 0;
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
String colName = map.get("col_name").toString();
if (colName.contains("#") && colName.contains("Partition")) {
partInfoIndex = i + 2;
break;
}
}
if (partInfoIndex != 0) {
table.setDateColumn(list.get(partInfoIndex).get("col_name").toString());
table.setPart(true);
return;
}
// 没有分区使用用户配置的
if (table.getDateColumn() != null) {
return;
}
// 使用默认metric_month
table.setDateColumn("metric_month");
}
/**
*
*/
private void syncByPart(TableInfo tableInfo) throws SQLException, InterruptedException {
String hiveTable = tableInfo.getHiveTable();
String pgTable = tableInfo.getPgTable();
String dateColumn = tableInfo.getDateColumn();
// 准备同步
List<String> dates = hiveDAO.getDates(tableInfo.getHiveTable());
String pgLastDate = postgreDAO.getLastDate(dateColumn, pgTable);
List<String> syncParts;
if (pgLastDate == null) {
syncParts = dates;
} else {
syncParts = dates.stream().filter(date -> toDate(date).after(toDate(pgLastDate))).collect(Collectors.toList());
// 查询hive最后同步分区总记录数
Integer hiveCount = hiveDAO.getCountByDate(hiveTable, dateColumn, pgLastDate);
Integer pgCount = postgreDAO.getCountByDate(pgTable, dateColumn, pgLastDate);
if (hiveCount > pgCount) {
// 同步该区上次未完成的
selectData(tableInfo, pgLastDate, hiveCount, pgCount);
}
}
// 逐个分区进行同步
syncParts = syncParts.stream().sorted().collect(Collectors.toList());
for (String part : syncParts) {
Integer count = hiveDAO.getCountByDate(hiveTable, dateColumn, part);
selectData(tableInfo, part, count, 0);
}
}
/**
* dataQueue
*
*/
private void receiveData() {
while (true) {
try {
DataInfoContainer dataInfo = dataQueue.take();
MDC.put("requestId", requestId);
List<Map<String, Object>> dataList = dataInfo.getDataList();
String pgSql = dataInfo.getTableInfo().getPgSql();
String pgTable = dataInfo.getTableInfo().getPgTable();
executor.execute(() -> {
MDC.put("requestId", requestId);
try {
postgreDAO.batchInsert(dataList, pgSql);
} catch (SQLException e) {
LOGGER.error("数据插入表[{}]时出错:{}", pgTable, e.getMessage(), e);
}
MDC.clear();
});
executor.execute(() -> {
MDC.put("requestId", requestId);
try {
writeFile(dataInfo);
} catch (InterruptedException | IOException e) {
LOGGER.error("保存表[{}]到文件时出错:{}", pgTable, e.getMessage(), e);
}
MDC.clear();
});
} catch (InterruptedException e) {
LOGGER.error("从队列获取数据出错:{}", e.getMessage(), e);
}
MDC.clear();
}
}
/**
* fileQueueSFTP
*/
private void uploadSFTP() {
while (true) {
File file = null;
try {
file = fileQueue.take();
MDC.put("requestId", requestId);
zipAndUploadSFTP(file);
} catch (InterruptedException | SQLException | SftpException | IOException e) {
LOGGER.error("文件[{}]上传SFTP出错{}", file != null ? file.toString() : "", e.getMessage(), e);
}
MDC.put("requestId", requestId);
}
}
/**
*
*/
private void syncNoPart(TableInfo tableInfo) throws SQLException, InterruptedException {
long hiveCount = hiveDAO.getCountByDate(tableInfo.getHiveTable());
long pgCount = postgreDAO.getCountByDate(tableInfo.getPgTable());
if (hiveCount <= pgCount) {
return;
}
// 未分区一次查出全部【因为带条件查询count和查询日期信息时效率非常慢】
List<Map<String, Object>> list = hiveDAO.selectList(tableInfo.getHiveSql(), pgCount, Integer.MAX_VALUE);
Map<String, List<Map<String, Object>>> dateMap = list.stream()
.collect(Collectors.groupingBy(m -> m.get(tableInfo.getDateColumn()).toString()));
for (Map.Entry<String, List<Map<String, Object>>> entry : dateMap.entrySet()) {
String date = entry.getKey();
List<Map<String, Object>> mapList = entry.getValue();
dataQueue.put(new DataInfoContainer(tableInfo, mapList, mapList.size(), date));
LOGGER.info("====表{}放入队列,总数:{},本次范围:{},分区:{}", tableInfo.getHiveTable(), mapList.size(), "0-" + mapList.size(), date);
}
}
/**
* Date
*
*/
private Date toDate(String str) {
if (str.length() <= 7) {
return Date.valueOf(str + "-01");
}
return Date.valueOf(str);
}
/**
* PgSql
*
*/
private String buildPgSql(String pgTable, List<String> columns) {
StringJoiner joiner = new StringJoiner(",");
for (int i = 0; i < columns.size(); i++) {
joiner.add("?");
}
return String.format(PG_SQL_TEMPLATE, pgTable, String.join(",", columns), joiner);
}
/**
* hive
*
*/
private void selectData(TableInfo tableInfo, String part, Integer count, Integer start) throws SQLException, InterruptedException {
Integer offset = start;
while (offset < count) {
List<Map<String, Object>> list = hiveDAO.selectList(tableInfo.getHiveSql(), part, offset, BATCH_QUANTITY);
DataInfoContainer container = new DataInfoContainer(tableInfo, list, null, part);
offset += BATCH_QUANTITY;
if (offset >= count) {
container.setTotal(count);
}
dataQueue.put(container);
LOGGER.info("====表{}放入队列,总数:{},本次范围:{},分区:{}", tableInfo.getHiveTable(), count, offset - BATCH_QUANTITY + "-" + offset, part);
}
}
/**
*
*/
private void writeFile(DataInfoContainer dataInfo) throws IOException, InterruptedException {
List<Map<String, Object>> list = dataInfo.getDataList();
TableInfo tableInfo = dataInfo.getTableInfo();
String date = dataInfo.getDate();
String[] header = tableInfo.getTableHeader();
String tableName = tableInfo.getHiveTable();
Path path = TEMP_PATH.resolve(date.substring(0, 7));
String fileName = tableName + (date.length() > 7 ? date : "") + ".csv";
File file = path.resolve(fileName).toFile();
try (FileWriter writer = getFileWriter(file, header)) {
for (Map<String, Object> map : list) {
StringJoiner sj = new StringJoiner(",");
for (String s : header) {
Object value = map.get(s);
sj.add(value == null ? "" : value.toString());
}
writer.write("\n" + sj);
}
Integer total = dataInfo.getTotal();
if (total != null) {
writer.write("\ntotal:" + total);
fileQueue.put(file);
LOGGER.info("====文件{}放入队列,总数:{},分区:{}", file.getName(), total, date);
}
}
}
/**
*
*
*/
private FileWriter getFileWriter(File file, String[] header) throws IOException {
File fileDirectory = file.getParentFile();
if (!fileDirectory.exists()) {
//noinspection ResultOfMethodCallIgnored
fileDirectory.mkdirs();
}
boolean fileExist = file.exists();
FileWriter writer = new FileWriter(file, true);
if (fileExist) {
return writer;
}
StringJoiner sj = new StringJoiner(",");
for (String s : header) {
sj.add(s);
}
writer.write(sj.toString());
return writer;
}
/**
* SFTP
*
*/
private void zipAndUploadSFTP(File file) throws IOException, SftpException, SQLException {
// 压缩
String zipPathStr = file.toString().replace("csv", "zip");
Path zipPat = Paths.get(zipPathStr);
try(FileOutputStream outputStream = new FileOutputStream(zipPathStr);
ZipOutputStream zipOut = new ZipOutputStream(outputStream);
FileInputStream inputStream = new FileInputStream(file)) {
zipOut.putNextEntry(new ZipEntry(file.getName()));
byte[] bytes = new byte[1024];
int length;
while ((length = inputStream.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
}
String uploadPath = "/home/flink/dws-file";
String yearMonth = file.toPath().getParent().getFileName().toString();
String targetDirectory = uploadPath + "/" + yearMonth;
String sftpFilePath = targetDirectory + "/" + zipPat.getFileName();
// 上传SFTP
ChannelSftp sftpChannel = sftpChannelPool.getSftpChannel();
try {
// 创建目录
if (!isResourceExist(sftpChannel, uploadPath, yearMonth)) {
sftpChannel.mkdir(targetDirectory);
}
// 文件上传
sftpChannel.put(zipPathStr, sftpFilePath);
} finally {
sftpChannelPool.closeChannel(sftpChannel);
}
// 上传后删除zip
Files.delete(zipPat);
LOGGER.info("====文件{}上传成功", zipPat.getFileName());
// 保存记录
Matcher matcher = FILE_PATTERN.matcher(file.getName());
// noinspection ResultOfMethodCallIgnored
matcher.find();
String tableName = matcher.group(1);
String date = matcher.group(2);
String txnDate = date == null ? yearMonth + "-01" : date;
Map<String, String> fileTypeMap = tableProperties.getFileTypeMap();
postgreDAO.insertSyncRecord(sftpFilePath, fileTypeMap.get(tableName), getTotalByFile(file), Date.valueOf(txnDate));
// 插入后,删除文件
Files.delete(file.toPath());
LOGGER.info("====文件{}记录写入数据库成功", file.getName());
}
/**
*
*
*/
private int getTotalByFile(File file) throws IOException {
try (RandomAccessFile accessFile = new RandomAccessFile(file, "r")) {
for (long pointer = accessFile.length() - 1; pointer >= 0; pointer--) {
accessFile.seek(pointer);
int currentByte = accessFile.read();
if (currentByte == '\n' || currentByte == '\r') {
break;
}
}
String lastLine = accessFile.readLine();
String[] split = lastLine.split(":");
if (!lastLine.contains("total:") || split.length != 2) {
return -1;
}
return Integer.parseInt(split[1]);
}
}
/**
*
*
*/
private void deleteDirectory() throws IOException {
if (!Files.exists(TEMP_PATH)) {
return;
}
Files.walkFileTree(TEMP_PATH, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
// 删除文件
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
// 删除目录
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
/**
*
* @param channel
* @param directory
* @param resources
* @return true false
*/
@SuppressWarnings("unchecked")
private boolean isResourceExist(ChannelSftp channel, String directory, String resources) throws SftpException {
// 获取目录下的文件和子目录列表
Vector<ChannelSftp.LsEntry> entries;
entries = channel.ls(directory);
if (entries == null) {
return false;
}
for (ChannelSftp.LsEntry entry : entries) {
if (entry.getFilename().equals(resources)) {
return true;
}
}
return false;
}
}

@ -0,0 +1,204 @@
package com.jiuyv.sptcc.agile.batch.utils;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.security.Security;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.Mac;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.engines.SM4Engine;
import org.bouncycastle.crypto.macs.CBCBlockCipherMac;
import org.bouncycastle.crypto.macs.GMac;
import org.bouncycastle.crypto.modes.GCMBlockCipher;
import org.bouncycastle.crypto.paddings.BlockCipherPadding;
import org.bouncycastle.crypto.paddings.PKCS7Padding;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
/**
* Created with IntelliJ IDEA.
*
* @author Shawffer
* @description:
* @date: 2022-07-19
* @time: 17:04
*/
public class Sm4Util {
public static final String ALGORITHM_NAME = "SM4";
public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS7Padding";
public static final String ALGORITHM_NAME_ECB_NOPADDING = "SM4/ECB/NoPadding";
public static final String ALGORITHM_NAME_CBC_PADDING = "SM4/CBC/PKCS7Padding";
public static final String ALGORITHM_NAME_CBC_NOPADDING = "SM4/CBC/NoPadding";
/**
* SM412816
*/
public static final int DEFAULT_KEY_SIZE = 128;
static {
Security.addProvider(new BouncyCastleProvider());
}
public static byte[] generateKey() throws GeneralSecurityException {
return generateKey(DEFAULT_KEY_SIZE);
}
public static byte[] generateKey(int keySize) throws GeneralSecurityException {
KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME);
kg.init(keySize, new SecureRandom());
return kg.generateKey().getEncoded();
}
public static byte[] encrypt_ECB_Padding(byte[] key, byte[] data) throws GeneralSecurityException {
Cipher cipher = generateECBCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data);
}
public static byte[] decrypt_ECB_Padding(byte[] key, byte[] cipherText) throws GeneralSecurityException{
Cipher cipher = generateECBCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, key);
return cipher.doFinal(cipherText);
}
public static byte[] encrypt_ECB_NoPadding(byte[] key, byte[] data)
throws GeneralSecurityException {
Cipher cipher = generateECBCipher(ALGORITHM_NAME_ECB_NOPADDING, Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data);
}
public static byte[] decrypt_ECB_NoPadding(byte[] key, byte[] cipherText)
throws GeneralSecurityException {
Cipher cipher = generateECBCipher(ALGORITHM_NAME_ECB_NOPADDING, Cipher.DECRYPT_MODE, key);
return cipher.doFinal(cipherText);
}
public static byte[] encrypt_CBC_Padding(byte[] key, byte[] iv, byte[] data)
throws GeneralSecurityException {
Cipher cipher = generateCBCCipher(ALGORITHM_NAME_CBC_PADDING, Cipher.ENCRYPT_MODE, key, iv);
return cipher.doFinal(data);
}
public static byte[] decrypt_CBC_Padding(byte[] key, byte[] iv, byte[] cipherText)
throws GeneralSecurityException {
Cipher cipher = generateCBCCipher(ALGORITHM_NAME_CBC_PADDING, Cipher.DECRYPT_MODE, key, iv);
return cipher.doFinal(cipherText);
}
public static byte[] encrypt_CBC_NoPadding(byte[] key, byte[] iv, byte[] data)
throws GeneralSecurityException {
Cipher cipher = generateCBCCipher(ALGORITHM_NAME_CBC_NOPADDING, Cipher.ENCRYPT_MODE, key, iv);
return cipher.doFinal(data);
}
public static byte[] decrypt_CBC_NoPadding(byte[] key, byte[] iv, byte[] cipherText)
throws GeneralSecurityException {
Cipher cipher = generateCBCCipher(ALGORITHM_NAME_CBC_NOPADDING, Cipher.DECRYPT_MODE, key, iv);
return cipher.doFinal(cipherText);
}
public static byte[] doCMac(byte[] key, byte[] data) throws GeneralSecurityException {
Key keyObj = new SecretKeySpec(key, ALGORITHM_NAME);
return doMac("SM4-CMAC", keyObj, data);
}
public static byte[] doGMac(byte[] key, byte[] iv, int tagLength, byte[] data) {
org.bouncycastle.crypto.Mac mac = new GMac(new GCMBlockCipher(new SM4Engine()), tagLength * 8);
return doMac(mac, key, iv, data);
}
/**
* 使PKCS7Padding/PKCS5PaddingCBCMAC
*
* @param key
* @param iv
* @param data
* @return
*/
public static byte[] doCBCMac(byte[] key, byte[] iv, byte[] data) {
SM4Engine engine = new SM4Engine();
org.bouncycastle.crypto.Mac mac = new CBCBlockCipherMac(engine, engine.getBlockSize() * 8, new PKCS7Padding());
return doMac(mac, key, iv, data);
}
/**
* @param key
* @param iv
* @param padding nullnullNoPaddingBlockSize
* @param data
* @return
* @throws Exception
*/
public static byte[] doCBCMac(byte[] key, byte[] iv, BlockCipherPadding padding, byte[] data) throws GeneralSecurityException {
SM4Engine engine = new SM4Engine();
if (padding == null) {
if (data.length % engine.getBlockSize() != 0) {
throw new InvalidAlgorithmParameterException("if no padding, data length must be multiple of SM4 BlockSize");
}
}
org.bouncycastle.crypto.Mac mac = new CBCBlockCipherMac(engine, engine.getBlockSize() * 8, padding);
return doMac(mac, key, iv, data);
}
private static byte[] doMac(org.bouncycastle.crypto.Mac mac, byte[] key, byte[] iv, byte[] data) {
CipherParameters cipherParameters = new KeyParameter(key);
mac.init(new ParametersWithIV(cipherParameters, iv));
mac.update(data, 0, data.length);
byte[] result = new byte[mac.getMacSize()];
mac.doFinal(result, 0);
return result;
}
private static byte[] doMac(String algorithmName, Key key, byte[] data) throws GeneralSecurityException{
Mac mac = Mac.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME);
mac.init(key);
mac.update(data);
return mac.doFinal();
}
private static Cipher generateECBCipher(String algorithmName, int mode, byte[] key)
throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException,
InvalidKeyException {
Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME);
Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME);
cipher.init(mode, sm4Key);
return cipher;
}
private static Cipher generateCBCCipher(String algorithmName, int mode, byte[] key, byte[] iv)
throws GeneralSecurityException {
Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME);
Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME);
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
cipher.init(mode, sm4Key, ivParameterSpec);
return cipher;
}
public static String encryptEcb(String key, String text) throws GeneralSecurityException, DecoderException {
return Base64.encodeBase64String(Sm4Util.encrypt_ECB_Padding(Hex.decodeHex(key), text.getBytes(StandardCharsets.UTF_8)));
}
public static String decryptEcb(String key, String text) throws GeneralSecurityException, DecoderException {
return new String(Sm4Util.decrypt_ECB_Padding(Hex.decodeHex(key), Base64.decodeBase64((text))));
}
public static String generateKeyHex() throws Exception {
return Hex.encodeHexString(Sm4Util.generateKey(DEFAULT_KEY_SIZE));
}
}

@ -22,3 +22,96 @@ eureka:
fetchRegistry: true
service-url:
defaultZone: http://172.16.12.107:8761/eureka/
sftp:
host: 172.16.12.108
port: 22
username: flink
password: mIVYkELj5T+4MnD5+V542A==
# 连接池最大实例数
maxTotal: 20
# 连接池最大空闲数
maxIdle: 10
# 连接池最小空闲数
minIdle: 5
hiveDataSource:
jdbcUrl: jdbc:hive2://172.16.12.101:10000/sptcc_agile_test;socketTimeout=12000;
user: flink
password: flink
driverClass: org.apache.hive.jdbc.HiveDriver
initialPoolSize: 15
minPoolSize: 15
maxPoolSize: 25
pgDataSource:
jdbcUrl: jdbc:postgresql://172.16.12.105:5432/keliubao
user: postgres
password: postgres
driverClass: org.postgresql.Driver
initialPoolSize: 15
minPoolSize: 15
maxPoolSize: 25
syncTable:
tables:
- hiveTable: dws_line_metric_day
pgTable: tbl_prd_line_metric_day
- hiveTable: dws_line_metric_hour
pgTable: tbl_prd_line_metric_hour
- hiveTable: dws_line_metric_month
pgTable: tbl_prd_line_metric_month
- hiveTable: dws_line_station_metric_day
pgTable: tbl_prd_line_station_metric_day
- hiveTable: dws_line_station_metric_hour
pgTable: tbl_prd_line_station_metric_hour
- hiveTable: dws_line_station_metric_month
pgTable: tbl_prd_line_station_metric_month
- hiveTable: dws_line_station_trans_day
pgTable: tbl_prd_line_station_trans_day
- hiveTable: dws_line_station_trans_hour
pgTable: tbl_prd_line_station_trans_hour
- hiveTable: dws_line_station_trans_month
pgTable: tbl_prd_line_station_trans_month
- hiveTable: dws_route_metric_day
pgTable: tbl_prd_route_metric_day
- hiveTable: dws_station_freq_metric_day
pgTable: tbl_prd_station_freq_metric_day
- hiveTable: dws_station_freq_metric_month
pgTable: tbl_prd_station_freq_metric_month
- hiveTable: dws_station_freq_trans_day
pgTable: tbl_prd_station_freq_trans_day
- hiveTable: dws_station_freq_trans_month
pgTable: tbl_prd_station_freq_trans_month
fileTypeMap:
dws_line_metric_day: lineDay
dws_line_metric_hour: lineHour
dws_line_metric_month: lineMonth
dws_line_station_metric_day: stationDay
dws_line_station_metric_hour: stationHour
dws_line_station_metric_month: stationMonth
dws_line_station_trans_day: stationTransDay
dws_line_station_trans_hour: stationTransHour
dws_line_station_trans_month: stationTrnasMonth
dws_route_metric_day: routeMetricDay
dws_station_freq_metric_day: stationFreqDay
dws_station_freq_metric_month: stationFreqMonth
dws_station_freq_trans_day: stationFreqTransDay
dws_station_freq_trans_month: stationFreqTransMonth

@ -2,10 +2,8 @@
<configuration debug="false">
<!-- LOG目录 -->
<property name="LOG_HOME" value="logs"/>
<!-- JSON_LOG目录 -->
<property name="JSON_LOG_HOME" value="logs/jsonlog"/>
<!-- spring.application.name 作为参数 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
@ -123,6 +121,29 @@
<logger name="org.apache.http" level="error"/>
<!-- SiftingAppender根据 MDC 属性 sift 日志 -->
<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<!-- 使用 MDC 属性 "requestId" 作为区分标识 -->
<key>requestId</key>
<defaultValue>unknown</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${requestId}" class="ch.qos.logback.core.FileAppender">
<file>sync-logs/${requestId}.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
</sift>
</appender>
<!-- 配置特定类的日志输出 -->
<logger name="com.jiuyv.sptcc.agile.batch.service.BatchService" level="DEBUG">
<appender-ref ref="SIFT" />
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="STDOUT"/>

@ -0,0 +1,51 @@
<?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>agile-data</artifactId>
<groupId>com.jiuyv.sptcc.agile</groupId>
<version>0.1.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>agile-data-api</artifactId>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>com.jiuyv.sptcc.agile</groupId>
<artifactId>agile-common</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,23 @@
package com.jiuyv.sptcc.agile.dataservice.api;
import com.jiuyv.sptcc.agile.dataservice.dto.request.org.OrgAuthReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.org.OrgAuthResp;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @ClassName : OrgAuthApi
* @Description :
* @Author : sky
* @Date: 2023-07-13 11:45
*/
public interface OrgAuthApi {
String PREFIX_PATH = "/public/agile-data/auth";
@PostMapping(PREFIX_PATH + "/info")
R<OrgAuthResp> getOrgAuth(OrgAuthReq req);
}

@ -0,0 +1,28 @@
package com.jiuyv.sptcc.agile.dataservice.api.console;
import com.jiuyv.sptcc.agile.dataservice.dto.request.Api.ApiLogRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.response.Api.ApiLogResponse;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @ClassName : ApiLogApi
* @Description :
* @Author : sky
* @Date: 2023-09-22 10:25
*/
public interface ApiLogApi {
String PREFIX_PATH = "/public/agile-data/apilog";
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<ApiLogResponse>> list(ApiLogRequest request);
@GetMapping(PREFIX_PATH + "/detail")
R<ApiLogResponse> detail(@RequestParam("id") Long id);
}

@ -0,0 +1,145 @@
package com.jiuyv.sptcc.agile.dataservice.api.console;
import com.jiuyv.sptcc.agile.dataservice.dto.request.Api.*;
import com.jiuyv.sptcc.agile.dataservice.dto.response.Api.ApiResponse;
import com.jiuyv.sptcc.agile.dataservice.dto.response.TreeSelect;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import feign.Response;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* API
*
* @author yulei
*/
public interface DataApiFeign {
String PREFIX_PATH = "/public/agile-data/agileApi";
@GetMapping(PREFIX_PATH + "/getPrefixPath")
R<String> getApiPrefixPath();
/**
*
*
* @param id
* @return
*/
@PostMapping(PREFIX_PATH + "/getDate")
R<ApiResponse> getDataApiById(@RequestParam("id") Long id);
/**
* API
*
* @param sourceId
* @return
*/
@GetMapping(PREFIX_PATH + "/sourceList")
R<List<ApiResponse>> getDataApiList(@RequestParam("sourceId") Long sourceId);
/**
*
*
* @param apiQuery
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<ApiResponse>> getDataApiPage(ApiPageRequest apiQuery);
/**
* API
*
* @param dataApi
* @return
*/
@PostMapping(PREFIX_PATH + "/add")
R<Object> saveDataApi(ApiAddRequest dataApi);
/**
* API
*
* @param dataApi
* @return
*/
@PostMapping(PREFIX_PATH + "/update")
R<Object> updateDataApi(ApiUpdateRequest dataApi);
/**
* API
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/delete")
R<Object> deleteDataApiById(@RequestBody @Validated ApiDelRequest request);
/**
* API
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/copy")
R<Object> copyDataApi(ApiCopyRequest request);
/**
* API
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/register")
R<Object> registerDataApi(ApiStatusRequest request);
/**
* API
*
* @param dto
* @return
*/
@PostMapping(PREFIX_PATH + "/release")
R<Object> releaseDataApi(ApiStatusRequest dto);
/**
* API
*
* @param dto
* @return
*/
@PostMapping(PREFIX_PATH + "/cancel")
R<Object> cancelDataApi(ApiStatusRequest dto);
/**
* API
*
* @param dto
* @return
*/
@PostMapping(PREFIX_PATH + "/down")
R<Object> downDataApi(ApiStatusRequest dto);
/**
* api
*
* @return
*/
@PostMapping(PREFIX_PATH + "/tree")
R<List<TreeSelect>> apiTree();
/**
*
*
* @param id
* @return
*/
@GetMapping(PREFIX_PATH + "/word/down")
Response wordDataApi(@RequestParam("id") Long id) throws Exception;
}

@ -0,0 +1,75 @@
package com.jiuyv.sptcc.agile.dataservice.api.console;
import com.jiuyv.sptcc.agile.dataservice.dto.request.org.OrgConfigAddRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.request.org.OrgConfigEditRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.request.org.OrgConfigQueryRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.response.org.OrgConfigResponse;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
*
*
* @ClassName : OrgConfigApi
* @Description :
* @Author : sky
* @Date: 2023-09-07 15:44
*/
public interface OrgCfgConsoleApi {
String PREFIX_PATH = "/public/agile-data/orgConfig";
/**
*
*
* @param query
* @return
*/
@PostMapping(PREFIX_PATH + "/list")
R<PageResult<OrgConfigResponse>> list(OrgConfigQueryRequest query);
/**
*
*
* @param configId
* @return
*/
@GetMapping(PREFIX_PATH + "/detail")
R<OrgConfigResponse> queryDetail(@RequestParam("configId") Long configId);
/**
*
*
* @param dto
* @return
*/
@PostMapping(PREFIX_PATH + "/add")
R<Object> add(OrgConfigAddRequest dto);
/**
*
*
* @param dto
* @return
*/
@PostMapping(PREFIX_PATH + "/edit")
R<Object> edit(OrgConfigEditRequest dto);
/**
*
*
* @param configId
* @return
*/
@PostMapping(PREFIX_PATH + "/delete")
R<Object> delete(@RequestParam("configId") Long configId);
@GetMapping(PREFIX_PATH + "/getOrgCfg")
R<List<OrgConfigResponse>> getConfig(@RequestParam("orgCode") String orgCode);
}

@ -0,0 +1,108 @@
package com.jiuyv.sptcc.agile.dataservice.api.console;
import com.jiuyv.sptcc.agile.dataservice.dto.request.console.OrgApiAuthRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.request.org.*;
import com.jiuyv.sptcc.agile.dataservice.dto.response.console.OrgApiAuthVo;
import com.jiuyv.sptcc.agile.dataservice.dto.response.org.OrgInfoResp;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
*
* @ClassName : OrgInfoApi
* @Description :
* @Author : sky
* @Date: 2023-09-07 15:51
*/
public interface OrgInfoConsoleApi {
String PREFIX_PATH = "/public/agile-data/orgInfo";
/**
*
*
* @param query
* @return
*/
@PostMapping(PREFIX_PATH + "/list")
R<PageResult<OrgInfoResp>> list(OrgInfoQueryReq query);
/**
*
*
* @param orgNo
* @return
*/
@GetMapping(PREFIX_PATH + "/detail")
R<OrgInfoResp> getInfo(@RequestParam("orgNo") String orgNo);
/**
*
*
* @param addReq
* @return
*/
@PostMapping(PREFIX_PATH + "/add")
R<Object> add(OrgInfoAddReq addReq);
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/edit")
R<Object> edit(OrgInfoEditReq request);
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/remove")
R<Object> remove(OrgDelReq request);
/**
*
*/
@PostMapping(PREFIX_PATH + "/run")
R<Object> run(OrgInfoStatusReq request);
/**
*
*/
@PostMapping(PREFIX_PATH + "/stop")
R<Object> stop(OrgInfoStatusReq request);
/**
*
*
* @return
*/
@GetMapping(PREFIX_PATH + "/key")
R<String> getGenerateKeyHex();
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/auth")
R<Object> orgApiAuth(OrgApiAuthRequest request);
/**
*
*
* @param orgNo
* @return
*/
@GetMapping(PREFIX_PATH + "/auth/list")
R<OrgApiAuthVo> orgApiAuthInfo(@RequestParam("orgNo") String orgNo);
}

@ -0,0 +1,33 @@
package com.jiuyv.sptcc.agile.dataservice.api.console;
import com.jiuyv.sptcc.agile.dataservice.dto.request.Api.ApiUserRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.request.org.OrgStatisticsQueryReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.Api.DataApiStatisticsResponse;
import com.jiuyv.sptcc.agile.dataservice.dto.response.console.OrgStatisticsVo;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
*
*
* @ClassName : OrgStcsConsoleApi
* @Author : sky
* @Date: 2023-09-07 16:02
*/
public interface OrgStcsConsoleApi {
String PREFIX_PATH = "/public/agile-data/orgStcs";
@PostMapping(PREFIX_PATH + "/list")
R<PageResult<OrgStatisticsVo>> queryByPage(OrgStatisticsQueryReq request);
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/userApiStatistics")
R<PageResult<DataApiStatisticsResponse>> getUserApiStatistics(ApiUserRequest request);
}

@ -0,0 +1,23 @@
package com.jiuyv.sptcc.agile.dataservice.api.portal;
import com.jiuyv.sptcc.agile.dataservice.dto.request.Api.ApiUserRequest;
import com.jiuyv.sptcc.agile.dataservice.dto.response.Api.DataApiResponse;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
public interface DataApiFeignApi {
String PREFIX_PATH = "/public/agile-data/agileApi";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/userApiList")
R<PageResult<DataApiResponse>> getUserApiList(ApiUserRequest request);
}

@ -0,0 +1,23 @@
package com.jiuyv.sptcc.agile.dataservice.api.portal;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @ClassName : SdkDownload
* @Description :
* @Author : sky
* @Date: 2023-09-21 10:42
*/
public interface SdkDownload {
String PREFIX_PATH = "/public/agile-data/port";
/**
* sdk
*
* @return
*/
@GetMapping(PREFIX_PATH + "/download/sdk")
ResponseEntity<byte[]> download();
}

@ -0,0 +1,23 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.DownLoadRequest;
import feign.Response;
import org.springframework.web.bind.annotation.PostMapping;
/**
* sftp
*
* @ClassName : DownloadApi
* @Description :
* @Author : sky
* @Date: 2023-09-13 13:21
*/
public interface DownloadApi {
String PREFIX_PATH = "/public/agile-data/product";
@PostMapping(PREFIX_PATH + "/download")
Response download(DownLoadRequest request);
}

@ -0,0 +1,68 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.LineInfoReq;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.LineStationInfoReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.LineInfoRes;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.LineStationInfoRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* 线
*
* @ClassName : LineInfoApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 18:51
*/
public interface LineInfoApi {
String PREFIX_PATH = "/public/agile-data/lineInfo";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/list")
R<PageResult<LineInfoRes>> list(LineInfoReq request);
/**
* 线线
*
* @param lineName
* @return
*/
@GetMapping(PREFIX_PATH + "/detail")
R<LineInfoRes> detail(@RequestParam("lineName") String lineName);
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/stationList")
R<List<LineStationInfoRes>> stationList(LineStationInfoReq request);
/**
*
*
* @param lineName
* @return
*/
@GetMapping(PREFIX_PATH + "/stationDetail")
R<LineStationInfoRes> stationDetail(@RequestParam("lineName") String lineName);
}

@ -0,0 +1,29 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.LineDayPageReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.LineDayPageRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : LineMetricDay
* @Description :
* @Author : sky
* @Date: 2023-09-18 15:17
*/
public interface LineMetricDayApi {
String PREFIX_PATH = "/public/agile-data/lineDay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<LineDayPageRes>> list(LineDayPageReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.LineHourPageReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.LineMetricHourRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : LineMetricDay
* @Description :
* @Author : sky
* @Date: 2023-09-18 15:17
*/
public interface LineMetricHourApi {
String PREFIX_PATH = "/public/agile-data/linHour";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<LineMetricHourRes>> list(LineHourPageReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.LineMetricMonthReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.LineMetricMonthRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : LineMetricDay
* @Description :
* @Author : sky
* @Date: 2023-09-18 15:17
*/
public interface LineMetricMonthApi {
String PREFIX_PATH = "/public/agile-data/linMonth";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<LineMetricMonthRes>> list(LineMetricMonthReq request);
}

@ -0,0 +1,40 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.RouteMetricDayReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.RouteMetricDayRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @ClassName : RouteMetricDayApi
* @Description : 线
* @Author : sky
* @Date: 2023-09-19 13:56
*/
public interface RouteMetricDayApi {
String PREFIX_PATH = "/public/agile-data/routeMetricDay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<RouteMetricDayRes>> list(@RequestBody @Validated RouteMetricDayReq request);
/**
*
*
* @param id
* @return
*/
@GetMapping(PREFIX_PATH + "/detail")
R<RouteMetricDayRes> detail(@RequestParam("id") Long id);
}

@ -0,0 +1,31 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationFreqMetricDayReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationFreqMetricDayRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
*
*
* @ClassName : StationFreqMetricDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 14:03
*/
public interface StationFreqMetricDayApi {
String PREFIX_PATH = "/public/agile-data/stationFreqMetricDay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationFreqMetricDayRes>> list(@RequestBody @Validated StationFreqMetricDayReq request);
}

@ -0,0 +1,32 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationFreqMetricMonthReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationFreqMetricMonthRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
*
*
* @ClassName : StationFreqMetricDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 14:03
*/
public interface StationFreqMetricMonthApi {
String PREFIX_PATH = "/public/agile-data/stationFreqMetricMonth";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationFreqMetricMonthRes>> list(@RequestBody @Validated StationFreqMetricMonthReq request);
}

@ -0,0 +1,31 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationFreqTransDayReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationFreqTransDayRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @ClassName : StationFreqTransDay
* @Description :
* @Author : sky
* @Date: 2023-09-19 14:14
*/
public interface StationFreqTransDayApi {
String PREFIX_PATH = "/public/agile-data/stationFreqTransDay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationFreqTransDayRes>> list(@RequestBody @Validated StationFreqTransDayReq request);
}

@ -0,0 +1,31 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationFreqTransMonthReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationFreqTransMonthRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @ClassName : StationFreqTransDay
* @Description :
* @Author : sky
* @Date: 2023-09-19 14:14
*/
public interface StationFreqTransMonthApi {
String PREFIX_PATH = "/public/agile-data/stationFreqTransMonth";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationFreqTransMonthRes>> list(@RequestBody @Validated StationFreqTransMonthReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationMetricDayReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationMetricDayRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : StationMetricDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 13:33
*/
public interface StationMetricDayApi {
String PREFIX_PATH = "/public/agile-data/StationMetricDay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationMetricDayRes>> list(StationMetricDayReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationMetricHourReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationMetricHourRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : StationMetricDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 13:33
*/
public interface StationMetricHourApi {
String PREFIX_PATH = "/public/agile-data/StationMetricHour";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationMetricHourRes>> list(StationMetricHourReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationMetricMonthReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationMetricMonthRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : StationMetricDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 13:33
*/
public interface StationMetricMonthApi {
String PREFIX_PATH = "/public/agile-data/StationMetricMonth";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationMetricMonthRes>> list(StationMetricMonthReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationTransDayReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationTransDayRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : StationTransDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 13:45
*/
public interface StationTransDayApi {
String PREFIX_PATH = "/public/agile-data/StationTransDay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationTransDayRes>> list(StationTransDayReq request);
}

@ -0,0 +1,30 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationMetricHourReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationMetricHourRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : StationTransDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 13:45
*/
public interface StationTransHourApi {
String PREFIX_PATH = "/public/agile-data/StationTransHour";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationMetricHourRes>> list(StationMetricHourReq request);
}

@ -0,0 +1,28 @@
package com.jiuyv.sptcc.agile.dataservice.api.product;
import com.jiuyv.sptcc.agile.dataservice.dto.request.product.StationTransMonthReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.product.StationTransMonthRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : StationTransDayApi
* @Description :
* @Author : sky
* @Date: 2023-09-19 13:45
*/
public interface StationTransMonthApi {
String PREFIX_PATH = "/public/agile-data/StationTransMonth";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationTransMonthRes>> list(StationTransMonthReq request);
}

@ -0,0 +1,27 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.CentimeDelayReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.CentimeDelayRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
*
*
* @Author : sky
* @Date: 2023-09-20 17:35
*/
public interface CentimeDelayApi {
String PREFIX_PATH = "/public/agile-data/quality/centimeDelay";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<CentimeDelayRes>> list(CentimeDelayReq request);
}

@ -0,0 +1,33 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.PosMatchRateReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.PosMatchRateRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* Pos
*
* @ClassName : PosMatchRateApi
* @Description :
* @Author : sky
* @Date: 2023-09-20 17:25
*/
public interface PosMatchRateApi {
String PREFIX_PATH = "/public/agile-data/quality/posMatchRate";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<PosMatchRateRes>> list(PosMatchRateReq request);
}

@ -0,0 +1,29 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.RouteDailyReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.RouteDailyRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 线
*
* @ClassName : RouteDailyCountApi
* @Description : 线
* @Author : sky
* @Date: 2023-09-20 17:19
*/
public interface RouteDailyCountApi {
String PREFIX_PATH = "/public/agile-data/quality/routeDailyCount";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<RouteDailyRes>> list(RouteDailyReq request);
}

@ -0,0 +1,27 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.RouteMissReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.RouteMissRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
*
*
* @Author : sky
* @Date: 2023-09-20 16:58
*/
public interface RouteMissApi {
String PREFIX_PATH = "/public/agile-data/quality/routeMiss";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<RouteMissRes>> list(RouteMissReq request);
}

@ -0,0 +1,29 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.RouteTurnoverReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.RouteTurnoverRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
*
*
* @ClassName : RouteTurnoverTimeApi
* @Description :
* @Author : sky
* @Date: 2023-09-20 16:44
*/
public interface RouteTurnoverTimeApi {
String PREFIX_PATH = "/public/agile-data/quality/routeTurnover";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<RouteTurnoverRes>> list(RouteTurnoverReq request);
}

@ -0,0 +1,42 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.StationMissReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.StationMissRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
*
* @ClassName : StationMissApi
* @Description :
* @Author : sky
* @Date: 2023-09-20 16:33
*/
public interface StationMissApi {
String PREFIX_PATH = "/public/agile-data/quality/stationMiss";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<StationMissRes>> list(StationMissReq request);
/**
*
*
* @param id
* @return
*/
@GetMapping(PREFIX_PATH + "/detail")
R<StationMissRes> detail(@RequestParam("id") Long id);
}

@ -0,0 +1,27 @@
package com.jiuyv.sptcc.agile.dataservice.api.quality;
import com.jiuyv.sptcc.agile.dataservice.dto.request.quailty.VehicleDailyReq;
import com.jiuyv.sptcc.agile.dataservice.dto.response.quailty.VehicleDailyRes;
import com.jiuyv.sptccc.agile.common.core.domain.R;
import com.jiuyv.sptccc.agile.common.core.page.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @ClassName : VehicleDailyApi
* @Description :
* @Author : sky
* @Date: 2023-09-20 15:05
*/
public interface VehicleDailyApi {
String PREFIX_PATH = "/public/agile-data/quality/vehicleDaily";
/**
*
*
* @param request
* @return
*/
@PostMapping(PREFIX_PATH + "/page")
R<PageResult<VehicleDailyRes>> list(VehicleDailyReq request);
}

@ -0,0 +1,47 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public enum AlgorithmCrypto implements IDictEnum {
BASE64("1", "BASE64加密"),
MD5("2", "MD5加密"),
SHA_1("3", "SHA_1加密"),
SHA_256("4", "SHA_256加密"),
AES("5", "AES加密"),
DES("6", "DES加密");
private final String key;
private final String val;
AlgorithmCrypto(String key, String val) {
this.key = key;
this.val = val;
}
public String getKey() {
return key;
}
public String getVal() {
return val;
}
public static AlgorithmCrypto getAlgorithmCrypto(String algorithmCrypt) {
for (AlgorithmCrypto type : AlgorithmCrypto.values()) {
if (type.key.equals(algorithmCrypt)) {
return type;
}
}
return BASE64;
}
@Override
public String getCode() {
return key;
}
@Override
public String getMsg() {
return val;
}
}

@ -0,0 +1,27 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public class ApiCrypto {
public enum ApiState implements IDictEnum{
WAIT("1","待注册"),
REGISTER("2","已注册"),
RELEASE("3","已发布");
ApiState(String code, String msg) {
this.code = code;
this.msg = msg;
}
private final String code;
private final String msg;
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
}

@ -0,0 +1,65 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public class ConfigCrypot {
public enum ConfigStatus implements IDictEnum{
STOP("1","停用"),
NORMAL("0","正常");
ConfigStatus(String code, String msg) {
this.code = code;
this.msg = msg;
}
private String code;
private String msg;
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
*
*
* @ClassName : OrgCfnKeyEnum
* @Description :
* @Author : sky
* @Date: 2023-09-22 17:44
*/
public enum OrgCfnKeyEnum implements IDictEnum {
DATA_BEGIN("data_begin", "数据起始时间"),
DATA_END("data_end", "数据结束时间"),
DOWN_RIGHT("downLoadRigth","文件下载权限")
;
private final String code;
private final String msg;
OrgCfnKeyEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
}

@ -0,0 +1,488 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* @ClassName : DataApiEnum
* @Description :
* @Author : sky
* @Date: 2023-09-04 17:44
*/
public class DataApiEnum {
/**
* API
*/
public enum API_STATUS implements IDictEnum {
WAIT("1", "待注册"),
REGISTER("2", "已注册"),
RELEASE("3", "已发布"),
DOWN("4", "下架");
private final String code;
private final String msg;
API_STATUS(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
* API
*/
public enum API_TYPE implements IDictEnum {
AGILE("1", "敏捷API"),
SYSTEM("2", "系统API");
private final String code;
private final String msg;
API_TYPE(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
public enum ResType implements IDictEnum{
JSON("JSON", "json类型");
private final String code;
private final String msg;
ResType(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
*
*/
public enum CIPHER_TYPE implements IDictEnum {
REGEX("1", "正则替换"),
ALGORITHM("2", "加密算法");
private final String code;
private final String msg;
CIPHER_TYPE(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static CIPHER_TYPE getCipherType(String cipherType) {
for (CIPHER_TYPE type : CIPHER_TYPE.values()) {
if (type.code.equals(cipherType)) {
return type;
}
}
return REGEX;
}
public String getKey() {
return code;
}
public String getVal() {
return msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
*
*/
public enum ALGORITHM_CRYPTO implements IDictEnum {
BASE64("1", "BASE64加密"),
MD5("2", "MD5加密"),
SHA_1("3", "SHA_1加密"),
SHA_256("4", "SHA_256加密"),
AES("5", "AES加密");
private final String code;
private final String msg;
ALGORITHM_CRYPTO(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static ALGORITHM_CRYPTO getAlgorithmCrypto(String algorithmCrypt) {
for (ALGORITHM_CRYPTO type : ALGORITHM_CRYPTO.values()) {
if (type.code.equals(algorithmCrypt)) {
return type;
}
}
return BASE64;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
*
*/
public enum REGEX_CRYPTO implements IDictEnum {
CHINESE_NAME("1", "中文姓名"),
ID_CARD("2", "身份证号"),
FIXED_PHONE("3", "固定电话"),
MOBILE_PHONE("4", "手机号码"),
ADDRESS("5", "地址"),
EMAIL("6", "电子邮箱"),
BANK_CARD("7", "银行卡号"),
CNAPS_CODE("8", "公司开户银行联号");
private final String code;
private final String msg;
REGEX_CRYPTO(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static REGEX_CRYPTO getRegexCrypto(String regexCrypt) {
for (REGEX_CRYPTO type : REGEX_CRYPTO.values()) {
if (type.code.equals(regexCrypt)) {
return type;
}
}
return CHINESE_NAME;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
*
*/
public enum CONFIG_TYPE implements IDictEnum {
FORM("1", "表引导模式"),
SCRIPT("2", "脚本模式");
private final String code;
private final String msg;
CONFIG_TYPE(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
*
*/
public enum ParamType implements IDictEnum {
STRING("String", "字符串"),
INTEGER("Integer", "整型"),
DECIMAL("Number", "浮点型"),
DATE("Date", "时间"),
LIST("List", "集合"),
LONG("Long","长整型");
private final String code;
private final String msg;
ParamType(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static Object parse(ParamType paramType, Object obj) throws ParseException {
if (obj == null) {
return null;
}
switch (paramType) {
case STRING:
return obj.toString();
case DECIMAL:
return new BigDecimal(obj.toString()).doubleValue();
case INTEGER:
return java.lang.Integer.parseInt(obj.toString());
case LIST:
return (java.util.List<?>) obj;
case LONG:
return Long.valueOf(obj.toString());
case DATE:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.parse(obj.toString());
}
return null;
}
public static ParamType getParamType(String paramType) {
for (ParamType type : ParamType.values()) {
if (type.code.equals(paramType)) {
return type;
}
}
return STRING;
}
public static String parse(String paramType){
//Integer
//Long
//number
//Date
//List
//string
return null;
}
@Override
public java.lang.String getCode() {
return code;
}
@Override
public java.lang.String getMsg() {
return msg;
}
}
/**
*
*/
public enum REQ_METHOD implements IDictEnum {
GET("GET", "get請求"),
POST("POST", "post請求");
private final String code;
private final String msg;
REQ_METHOD(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
* SQL
*/
public enum WHERE_TYPE implements IDictEnum{
EQUALS("=", "=", "等于"),
NOT_EQUALS("!=", "!=", "不等于"),
LIKE("LIKE", "LIKE", "全模糊查询"),
LIKE_LEFT("LIKE%", "LIKE", "左模糊查询"),
LIKE_RIGHT("%LIKE", "LIKE", "右模糊查询"),
GREATER_THAN("&gt;", ">", "大于"),
GREATER_THAN_EQUALS("&gt;=", ">=", "大于等于"),
LESS_THAN("&lt;", "<", "小于"),
LESS_THAN_EQUALS("&lt;=", "<=", "小于等于"),
NULL("isNull", "IS NULL", "是否为空"),
NOT_NULL("isNotNull", "IS NOT NULL", "是否不为空"),
IN("in", "IN", "IN");
private final String type;
private final String key;
private final String desc;
WHERE_TYPE(String type, String key, String desc) {
this.type = type;
this.key = key;
this.desc = desc;
}
public static WHERE_TYPE getWhereType(String whereType) {
for (WHERE_TYPE type : WHERE_TYPE.values()) {
if (type.type.equals(whereType)) {
return type;
}
}
return EQUALS;
}
public String getType() {
return type;
}
public String getKey() {
return key;
}
public String getDesc() {
return desc;
}
@Override
public String getCode() {
return type;
}
@Override
public String getMsg() {
return desc;
}
}
/**
*
*/
public enum PARAM_NULL implements IDictEnum {
NULL("1", "可以为空"),
NOT_NULL("0", "不能为空");
private final String code;
private final String msg;
PARAM_NULL(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
public enum CipherType implements IDictEnum {
REGEX("1", "正则替换"),
ALGORITHM("2", "加密算法");
private final String key;
private final String val;
CipherType(String key, String val) {
this.key = key;
this.val = val;
}
public String getKey() {
return key;
}
public String getVal() {
return val;
}
public static CipherType getCipherType(String cipherType) {
for (CipherType type : CipherType.values()) {
if (type.key.equals(cipherType)) {
return type;
}
}
return REGEX;
}
@Override
public String getCode() {
return key;
}
@Override
public String getMsg() {
return val;
}
}
}

@ -0,0 +1,24 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public enum EnableState implements IDictEnum {
DISABLE("1", "失败"),
ENABLE("0", "成功");
private final String code;
private final String msg;
EnableState(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}

@ -0,0 +1,60 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
/**
*
* @ClassName : FileType
* @Author : sky
* @Date: 2023-09-13 13:25
*/
public enum FileTypeEnum implements IDictEnum {
/**
*
*/
LINE_HOUR("lineHour", "获取线路小时客流指标"),
LINE_DAY("lineDay", "获取线路每日客流指标"),
LINE_MONTH("lineMonth", "获取线路每月客流指标"),
STATION_HOUR("stationHour","获取线路站点小时客流指标"),
STATION_DAY("stationDay", "获取线路站点每日客流指标"),
STATION_MONTH("stationMonth", "获取线路站点每月客流指标"),
STATION_TRANS_HOUR("stationTransHour","获取线路站点小时换乘指标"),
STATION_TRANS_DAY("stationTransDay", "获取线路站点每日换乘指标"),
STATION_TRNAS_MONTH("stationTrnasMonth", "站点换乘月指标"),
STATION_FREQ_DAY("stationFreqDay", "站点常乘客日指标"),
STATION_FREQ_MONTH("stationFreqMonth","站点常乘客日指标"),
STATION_FREQ_TRANS_DAY("stationFreqTransDay","站点常乘客换乘月日指标"),
STATION_FREQ_TRANS_MONTH("stationFreqTransMonth", "站点常乘客换乘月指标"),
;
FileTypeEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
private String code;
private String msg;
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
public static FileTypeEnum getEnum(String fileType) {
if (fileType == null) {
return null;
}
FileTypeEnum[] values = FileTypeEnum.values();
for (FileTypeEnum value : values) {
if (value.getCode().equals(fileType)) {
return value;
}
}
return null;
}
}

@ -0,0 +1,14 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
/**
*
* 便
*
* @author zhouliang
*/
public interface IDictEnum {
public String getCode();
public String getMsg();
}

@ -0,0 +1,101 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public class OrgCrypto {
/**
* @ClassName : OrgInfoStatus
* @Description :
* @Author : sky
* @Date: 2023-07-13 17:02
*/
public enum OrgInfoStatusCrypto implements IDictEnum {
DOWN("1", "停用"),
UP("0", "正常"),
DUE("2", "到期");
private final String key;
private final String val;
OrgInfoStatusCrypto(String key, String val) {
this.key = key;
this.val = val;
}
public String getKey() {
return key;
}
@Override
public String getCode() {
return key;
}
@Override
public String getMsg() {
return val;
}
}
/**
* @ClassName : OrgStatus
* @Description :
* @Author : sky
* @Date: 2023-09-07 11:31
*/
public enum OrgStatus implements IDictEnum {
NORMAL("0", "正常"),
STOP("1", "停用"),
END("2", "到期");
private final String code;
private final String msg;
OrgStatus(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
/**
* @ClassName : OrgType
* @Description :
* @Author : sky
* @Date: 2023-09-07 20:51
*/
public enum OrgType implements IDictEnum {
D("1", "类型A"),
H("2", "类型B");
private String code;
private String msg;
OrgType(String code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
}

@ -0,0 +1,49 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public enum RegexCrypto implements IDictEnum {
CHINESE_NAME("1", "中文姓名"),
ID_CARD("2", "身份证号"),
FIXED_PHONE("3", "固定电话"),
MOBILE_PHONE("4", "手机号码"),
ADDRESS("5", "地址"),
EMAIL("6", "电子邮箱"),
BANK_CARD("7", "银行卡号"),
CNAPS_CODE("8", "公司开户银行联号");
private final String key;
private final String val;
RegexCrypto(String key, String val) {
this.key = key;
this.val = val;
}
public String getKey() {
return key;
}
public String getVal() {
return val;
}
public static RegexCrypto getRegexCrypto(String regexCrypt) {
for (RegexCrypto type : RegexCrypto.values()) {
if (type.key.equals(regexCrypt)) {
return type;
}
}
return CHINESE_NAME;
}
@Override
public String getCode() {
return key;
}
@Override
public String getMsg() {
return val;
}
}

@ -0,0 +1,60 @@
package com.jiuyv.sptcc.agile.dataservice.dto.enums;
public enum WhereType implements IDictEnum {
EQUALS("1", "=", "等于"),
NOT_EQUALS("2", "!=", "不等于"),
LIKE("3", "LIKE", "全模糊查询"),
LIKE_LEFT("4", "LIKE", "左模糊查询"),
LIKE_RIGHT("5", "LIKE", "右模糊查询"),
GREATER_THAN("6", ">", "大于"),
GREATER_THAN_EQUALS("7", ">=", "大于等于"),
LESS_THAN("8", "<", "小于"),
LESS_THAN_EQUALS("9", "<=", "小于等于"),
NULL("10", "IS NULL", "是否为空"),
NOT_NULL("11", "IS NOT NULL", "是否不为空"),
IN("12", "IN", "IN");
private final String type;
private final String key;
private final String desc;
WhereType(String type, String key, String desc) {
this.type = type;
this.key = key;
this.desc = desc;
}
public String getType() {
return type;
}
public String getKey() {
return key;
}
public String getDesc() {
return desc;
}
public static WhereType getWhereType(String whereType) {
for (WhereType type : WhereType.values()) {
if (type.type.equals(whereType)) {
return type;
}
}
return EQUALS;
}
@Override
public String getCode() {
return key;
}
@Override
public String getMsg() {
return desc;
}
}

@ -0,0 +1,14 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptcc.agile.dataservice.dto.request.extend.ApiDtoBase;
import java.io.Serializable;
/**
* <p>
* API DTO
* </p>
*/
public class ApiAddRequest extends ApiDtoBase implements Serializable {
}

@ -0,0 +1,26 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @ClassName : ApiCopyRequest
* @Description :
* @Author : sky
* @Date: 2023-09-04 19:05
*/
public class ApiCopyRequest extends User implements Serializable {
@NotNull(message = "apiId不能为空")
private Long apiId;
public Long getApiId() {
return apiId;
}
public void setApiId(Long apiId) {
this.apiId = apiId;
}
}

@ -0,0 +1,38 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @ClassName : ApiCopyRequest
* @Description :
* @Author : sky
* @Date: 2023-09-04 19:05
*/
public class ApiDelRequest extends User implements Serializable {
@NotNull(message = "apiId不能为空")
private Long apiId;
@NotBlank(message = "recToken不能为空")
private String recToken;
public Long getApiId() {
return apiId;
}
public void setApiId(Long apiId) {
this.apiId = apiId;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
}

@ -0,0 +1,26 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
import java.io.Serializable;
/**
* <p>
* api
* </p>
*/
public class ApiLogRequest extends PageSize implements Serializable {
private static final long serialVersionUID = 1L;
private String apiName;
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
}

@ -0,0 +1,61 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.ApiCrypto;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.DataApiEnum;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
import java.io.Serializable;
/**
* <p>
* API
* </p>
*/
public class ApiPageRequest extends PageSize implements Serializable {
private static final long serialVersionUID = 1L;
private String apiName;
@EnumCheckValue(value = ApiCrypto.ApiState.class,isNullable = true)
private String status;
private String sourceId;
@EnumCheckValue(value = DataApiEnum.API_TYPE.class,isNullable = true)
private String apiType = DataApiEnum.API_TYPE.AGILE.getCode();
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSourceId() {
return sourceId;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public String getApiType() {
return apiType;
}
public void setApiType(String apiType) {
this.apiType = apiType;
}
}

@ -0,0 +1,44 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* APIDTO
*
* @author yulei
**/
public class ApiStatusRequest extends User implements Serializable {
/**
* ID
*/
@NotNull(message = "主键ID不能为空")
private Long apiId;
/**
* token
*/
@NotBlank(message = "recToken不能为空")
private String recToken;
public Long getApiId() {
return apiId;
}
public void setApiId(Long apiId) {
this.apiId = apiId;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
}

@ -0,0 +1,53 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptcc.agile.dataservice.dto.request.extend.ApiDtoBase;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
* API DTO
* </p>
*/
public class ApiUpdateRequest extends ApiDtoBase implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "appId不能为空")
private Long apiId;
/**
* token
*/
@NotBlank(message = "recToken不能为空")
private String recToken;
@NotNull(message = "版本号不能为空")
private Long versionNum;
public Long getApiId() {
return apiId;
}
public void setApiId(Long apiId) {
this.apiId = apiId;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
public Long getVersionNum() {
return versionNum;
}
public void setVersionNum(Long versionNum) {
this.versionNum = versionNum;
}
}

@ -0,0 +1,26 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.Api;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
import javax.validation.constraints.NotNull;
/**
* @ClassName : ApiUserRequest
* @Description :
* @Author : sky
* @Date: 2023-09-12 11:42
*/
public class ApiUserRequest extends PageSize {
@NotNull(message = "会员Id不能为空")
private String memberId;
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
}

@ -0,0 +1,96 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* Model
*/
public class DbSchema implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@NotBlank(message = "主机不能为空")
private String host;
/**
*
*/
@NotNull(message = "端口不能为空")
private Integer port;
/**
*
*/
@NotBlank(message = "用户名不能为空")
private String username;
/**
*
*/
@NotBlank(message = "密码不能为空")
private String password;
/**
*
*/
private String dbName;
/**
*
*/
private String sid;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDbName() {
return dbName;
}
public void setDbName(String dbName) {
this.dbName = dbName;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
}

@ -0,0 +1,101 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.DataApiEnum;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* Model
*/
public class ExecuteConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@NotNull(message = "数据源不能为空")
private Long sourceId;
/**
*
*/
@NotBlank(message = "配置方式不能为空")
@EnumCheckValue(value = DataApiEnum.CONFIG_TYPE.class)
private String configType;
/**
*
*/
private Long tableId;
/**
*
*/
private String tableName;
/**
*
*/
@Valid
private List<FieldParam> fieldParams;
/**
* SQL
*/
private String sqlText;
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
public String getConfigType() {
return configType;
}
public void setConfigType(String configType) {
this.configType = configType;
}
public Long getTableId() {
return tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public List<FieldParam> getFieldParams() {
return fieldParams;
}
public void setFieldParams(List<FieldParam> fieldParams) {
this.fieldParams = fieldParams;
}
public String getSqlText() {
return sqlText;
}
public void setSqlText(String sqlText) {
this.sqlText = sqlText;
}
}

@ -0,0 +1,167 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import java.io.Serializable;
/**
* Model
*/
public class FieldParam implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String columnName;
/**
*
*/
private String dataType;
/**
*
*/
private Integer dataLength;
/**
*
*/
private Integer dataPrecision;
/**
*
*/
private Integer dataScale;
/**
*
*/
private String columnKey;
/**
*
*/
private String columnNullable;
/**
*
*/
private Integer columnPosition;
/**
*
*/
private String dataDefault;
/**
*
*/
private String columnComment;
/**
*
*/
private String reqable;
/**
*
*/
private String resable;
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public Integer getDataLength() {
return dataLength;
}
public void setDataLength(Integer dataLength) {
this.dataLength = dataLength;
}
public Integer getDataPrecision() {
return dataPrecision;
}
public void setDataPrecision(Integer dataPrecision) {
this.dataPrecision = dataPrecision;
}
public Integer getDataScale() {
return dataScale;
}
public void setDataScale(Integer dataScale) {
this.dataScale = dataScale;
}
public String getColumnKey() {
return columnKey;
}
public void setColumnKey(String columnKey) {
this.columnKey = columnKey;
}
public String getColumnNullable() {
return columnNullable;
}
public void setColumnNullable(String columnNullable) {
this.columnNullable = columnNullable;
}
public Integer getColumnPosition() {
return columnPosition;
}
public void setColumnPosition(Integer columnPosition) {
this.columnPosition = columnPosition;
}
public String getDataDefault() {
return dataDefault;
}
public void setDataDefault(String dataDefault) {
this.dataDefault = dataDefault;
}
public String getColumnComment() {
return columnComment;
}
public void setColumnComment(String columnComment) {
this.columnComment = columnComment;
}
public String getReqable() {
return reqable;
}
public void setReqable(String reqable) {
this.reqable = reqable;
}
public String getResable() {
return resable;
}
public void setResable(String resable) {
this.resable = resable;
}
}

@ -0,0 +1,53 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* Model
*/
public class FieldRule implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@NotBlank(message = "字段名称不能为空")
private String fieldName;
/**
*
*/
@NotNull(message = "脱敏类型不能为空")
private String cipherType;
/**
*
*/
@NotNull(message = "规则类型不能为空")
private String cryptType;
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public String getCipherType() {
return cipherType;
}
public void setCipherType(String cipherType) {
this.cipherType = cipherType;
}
public String getCryptType() {
return cryptType;
}
public void setCryptType(String cryptType) {
this.cryptType = cryptType;
}
}

@ -0,0 +1,52 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* Model
*/
public class RateLimit implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 0:1
*/
@NotNull(message = "是否限流不能为空")
private String enable;
/**
* 5
*/
private Integer times = 5;
/**
* 60
*/
private Integer seconds = 60;
public String getEnable() {
return enable;
}
public void setEnable(String enable) {
this.enable = enable;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public Integer getSeconds() {
return seconds;
}
public void setSeconds(Integer seconds) {
this.seconds = seconds;
}
}

@ -0,0 +1,116 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.DataApiEnum;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* Model
*/
public class ReqParam implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@NotBlank(message = "参数名称不能为空")
private String paramName;
/**
*
*/
@NotNull(message = "是否为空不能为空")
private String nullable;
/**
*
*/
@NotBlank(message = "描述不能为空")
private String paramComment;
/**
*
*/
@NotNull(message = "操作符不能为空")
@EnumCheckValue(value = DataApiEnum.WHERE_TYPE.class,isNullable = true)
private String whereType;
/**
*
*/
@NotNull(message = "参数类型不能为空")
@EnumCheckValue(DataApiEnum.ParamType.class)
private String paramType;
/**
*
*/
@NotBlank(message = "示例值不能为空")
private String exampleValue;
/**
*
*/
@NotBlank(message = "默认值不能为空")
private String defaultValue;
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getNullable() {
return nullable;
}
public void setNullable(String nullable) {
this.nullable = nullable;
}
public String getParamComment() {
return paramComment;
}
public void setParamComment(String paramComment) {
this.paramComment = paramComment;
}
public String getWhereType() {
return whereType;
}
public void setWhereType(String whereType) {
this.whereType = whereType;
}
public String getParamType() {
return paramType;
}
public void setParamType(String paramType) {
this.paramType = paramType;
}
public String getExampleValue() {
return exampleValue;
}
public void setExampleValue(String exampleValue) {
this.exampleValue = exampleValue;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
}

@ -0,0 +1,38 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request;
import java.io.Serializable;
/**
* API
*
* @author yulei
*/
public class ReqVo implements Serializable {
/**
*
*/
private String body;
/**
*
*/
private String sign;
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
}

@ -0,0 +1,40 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.base;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jiuyv.sptcc.agile.dataservice.web.constant.DateTimeFormatConstant;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
import java.util.Date;
/**
*
*
* @ClassName : Range
* @Description :
* @Author : sky
* @Date: 2023-09-19 16:29
*/
public class Range extends PageSize {
@JsonFormat(pattern = DateTimeFormatConstant.YYYY_MM_DD)
private Date beginDate;
@JsonFormat(pattern = DateTimeFormatConstant.YYYY_MM_DD)
private Date endDate;
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}

@ -0,0 +1,55 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.base;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @ClassName : User
* @Description :
* @Author : sky
* @Date: 2023-09-04 18:27
*/
public class User {
@NotBlank(message = "用户名不能为空")
private String userName;
@NotNull(message = "用户Id不能为空")
private Long userId;
private String deptId;
private String nickName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getDeptId() {
return deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
}

@ -0,0 +1,43 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.console;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* DTO
*
* @author yulei
**/
public class OrgApiAuthRequest extends User implements Serializable {
/**
*
*/
@NotBlank(message = "机构号不能为空")
private String orgNo;
/**
* APIID
*/
@NotNull(message = "APIDS不能为空")
private Long[] apiIds;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public Long[] getApiIds() {
return apiIds;
}
public void setApiIds(Long[] apiIds) {
this.apiIds = apiIds;
}
}

@ -0,0 +1,228 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.extend;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.DataApiEnum;
import com.jiuyv.sptcc.agile.dataservice.dto.request.ExecuteConfig;
import com.jiuyv.sptcc.agile.dataservice.dto.request.RateLimit;
import com.jiuyv.sptcc.agile.dataservice.dto.request.ReqParam;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import com.jiuyv.sptcc.agile.dataservice.dto.response.ResParam;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
/**
* @ClassName : ApiDtoBase
* @Description :
* @Author : sky
* @Date: 2023-09-04 18:41
*/
public class ApiDtoBase extends User implements Serializable {
private static final long serialVersionUID = 1L;
/**
* API
*/
@NotBlank(message = "API名称不能为空")
@Length(max = 100)
private String apiName;
/**
* API
*/
@NotBlank(message = "API版本不能为空")
@Length(max = 10)
private String apiVersion;
/**
* API
*/
@NotBlank(message = "API路径不能为空")
@Length(max = 100)
private String apiUrl;
/**
*
*/
@EnumCheckValue(value = DataApiEnum.REQ_METHOD.class)
private String reqMethod;
/**
*
*/
@NotBlank(message = "返回格式不能为空")
@EnumCheckValue(value = DataApiEnum.ResType.class)
private String resType;
/**
* IP,
*/
private String deny;
/**
*
*/
@Valid
private RateLimit rateLimit;
/**
*
*/
@Valid
private ExecuteConfig executeConfig;
/**
*
*/
@Valid
@NotEmpty(message = "请求参数不能为空")
@Size(min = 1, message = "请求参数长度不能少于{min}位")
private List<ReqParam> reqParams;
/**
*
*/
@Valid
@NotEmpty(message = "返回字段不能为空")
@Size(min = 1, message = "返回字段长度不能少于{min}位")
private List<ResParam> resParams;
/**
*
*/
@EnumCheckValue(value = DataApiEnum.API_STATUS.class,isNullable = true)
private String status = DataApiEnum.API_STATUS.WAIT.getCode();
/**
*
*/
@Length(max = 500)
private String remark;
/**
* apiCode
*/
@NotBlank(message = "apiCode不能为空")
@Length(max = 20)
private String apiCode;
private String apiType = DataApiEnum.API_TYPE.AGILE.getCode();
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getApiVersion() {
return apiVersion;
}
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getReqMethod() {
return reqMethod;
}
public void setReqMethod(String reqMethod) {
this.reqMethod = reqMethod;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getDeny() {
return deny;
}
public void setDeny(String deny) {
this.deny = deny;
}
public RateLimit getRateLimit() {
return rateLimit;
}
public void setRateLimit(RateLimit rateLimit) {
this.rateLimit = rateLimit;
}
public ExecuteConfig getExecuteConfig() {
return executeConfig;
}
public void setExecuteConfig(ExecuteConfig executeConfig) {
this.executeConfig = executeConfig;
}
public List<ReqParam> getReqParams() {
return reqParams;
}
public void setReqParams(List<ReqParam> reqParams) {
this.reqParams = reqParams;
}
public List<ResParam> getResParams() {
return resParams;
}
public void setResParams(List<ResParam> resParams) {
this.resParams = resParams;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getApiCode() {
return apiCode;
}
public void setApiCode(String apiCode) {
this.apiCode = apiCode;
}
public String getApiType() {
return apiType;
}
public void setApiType(String apiType) {
this.apiType = apiType;
}
}

@ -0,0 +1,109 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.extend;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.ConfigCrypot;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
*
*
* @ClassName : OrgConfigBase
* @Author : sky
* @Date: 2023-09-06 16:23
*/
public class OrgConfigBase extends User {
/**
*
*/
@NotBlank(message = "机构号不能为空")
@Length(max = 32)
private String orgNo;
/**
* data:config:start:time
* data:config:end:time
*
*/
@NotBlank(message = "配置key不能为空")
@Length(max = 40)
@EnumCheckValue(value = ConfigCrypot.OrgCfnKeyEnum.class)
private String configKey;
/**
*
*/
@NotBlank(message = "配置说明不能为空")
@Length(max = 100)
private String configDesc;
/**
*
*/
@NotBlank(message = "配置值不能为空")
@Length(max = 40)
private String configValue;
/**
*
*/
private String delFlag;
/**
*
*/
@EnumCheckValue(value = ConfigCrypot.ConfigStatus.class, isNullable = true)
private String status;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getConfigKey() {
return configKey;
}
public void setConfigKey(String configKey) {
this.configKey = configKey;
}
public String getConfigDesc() {
return configDesc;
}
public void setConfigDesc(String configDesc) {
this.configDesc = configDesc;
}
public String getConfigValue() {
return configValue;
}
public void setConfigValue(String configValue) {
this.configValue = configValue;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

@ -0,0 +1,192 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.extend;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.DataApiEnum;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.OrgCrypto;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* VO
*
* @author yulei
**/
public class OrgInfoBase extends User implements Serializable {
/**
*
*/
private String memberId;
/**
*
*/
@NotBlank(message = "机构名称不能为空")
@Length(max = 100)
private String orgName;
/**
*
*/
@NotBlank(message = "机构类型不能为空")
@EnumCheckValue(DataApiEnum.API_STATUS.class)
private String orgType;
/**
*
*/
@Length(max = 150)
private String orgDesc;
/**
*
*/
@NotBlank(message = "加盐不能为空")
@Length(max = 200)
private String salt;
/**
*
*/
@NotBlank(message = "加密不能为空")
@Length(max = 1000)
private String encrypt;
/**
*
*/
@NotNull(message = "生效时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/**
*
*/
@NotNull(message = "到期时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/**
* ip
*/
@Length(max = 32)
private String ip;
/**
*
*/
@NotBlank(message = "联系人电话不能为空")
@Length(max = 20)
private String contractTel;
@EnumCheckValue(value = OrgCrypto.OrgStatus.class,isNullable = true)
private String status;
/**
*
*/
@Length(max = 200)
private String remark;
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getOrgType() {
return orgType;
}
public void setOrgType(String orgType) {
this.orgType = orgType;
}
public String getOrgDesc() {
return orgDesc;
}
public void setOrgDesc(String orgDesc) {
this.orgDesc = orgDesc;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public String getEncrypt() {
return encrypt;
}
public void setEncrypt(String encrypt) {
this.encrypt = encrypt;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getContractTel() {
return contractTel;
}
public void setContractTel(String contractTel) {
this.contractTel = contractTel;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

@ -0,0 +1,78 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jiuyv.sptcc.agile.dataservice.web.constant.DateTimeFormatConstant;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName : AuthReq
* @Description :
* @Author : sky
* @Date: 2023-07-13 13:28
*/
public class OrgAuthReq implements Serializable {
/**
*
*/
private String keyVersion;
/**
*
*/
@NotBlank(message = "机构号不能为空")
@Length(max = 64)
private String orgCode;
private String subOrgCode;
@NotBlank(message = "交易码不能为空")
private String apiCode;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateTimeFormatConstant.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date requsetTime;
public String getKeyVersion() {
return keyVersion;
}
public void setKeyVersion(String keyVersion) {
this.keyVersion = keyVersion;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getSubOrgCode() {
return subOrgCode;
}
public void setSubOrgCode(String subOrgCode) {
this.subOrgCode = subOrgCode;
}
public Date getRequsetTime() {
return requsetTime;
}
public void setRequsetTime(Date requsetTime) {
this.requsetTime = requsetTime;
}
public String getApiCode() {
return apiCode;
}
public void setApiCode(String apiCode) {
this.apiCode = apiCode;
}
}

@ -0,0 +1,14 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptcc.agile.dataservice.dto.request.extend.OrgConfigBase;
import java.io.Serializable;
/**
* DTO
*
* @author yulei
**/
public class OrgConfigAddRequest extends OrgConfigBase implements Serializable {
}

@ -0,0 +1,58 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.OrgCrypto;
import com.jiuyv.sptcc.agile.dataservice.dto.request.extend.OrgConfigBase;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* DTO
*
* @author yulei
**/
public class OrgConfigEditRequest extends OrgConfigBase implements Serializable {
/**
* ID
*/
@NotNull(message = "配置ID不能为空")
private Long configId;
/**
*
*/
@NotBlank(message = "随机码不能为空")
private String recToken;
@EnumCheckValue(value = OrgCrypto.OrgStatus.class)
private String status = OrgCrypto.OrgStatus.STOP.getCode();
public Long getConfigId() {
return configId;
}
public void setConfigId(Long configId) {
this.configId = configId;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
@Override
public String getStatus() {
return status;
}
@Override
public void setStatus(String status) {
this.status = status;
}
}

@ -0,0 +1,26 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
import java.io.Serializable;
/**
*
*
* @author yulei
**/
public class OrgConfigQueryRequest extends PageSize implements Serializable {
/**
*
*/
private String orgNo;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
}

@ -0,0 +1,44 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import javax.validation.constraints.NotBlank;
/**
*
*
* @ClassName : OrgDelReq
* @Description :
* @Author : sky
* @Date: 2023-09-07 14:05
*/
public class OrgDelReq extends User {
/**
*
*/
@NotBlank(message = "机构号不能为空")
private String orgNo;
/**
*
*/
@NotBlank(message = "随机码不能为空")
private String recToken;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
}

@ -0,0 +1,13 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptcc.agile.dataservice.dto.request.extend.OrgInfoBase;
/**
* DTO
*
* @author shu_k
**/
public class OrgInfoAddReq extends OrgInfoBase {
}

@ -0,0 +1,42 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptcc.agile.dataservice.dto.request.extend.OrgInfoBase;
import javax.validation.constraints.NotBlank;
/**
* DTO
*
* @author shu_k
**/
public class OrgInfoEditReq extends OrgInfoBase {
/**
*
*/
@NotBlank(message = "机构号不能为空")
private String orgNo;
/**
*
*/
@NotBlank(message = "随机码不能为空")
private String recToken;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
}

@ -0,0 +1,77 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
/**
*
*
* @author shu_k
**/
public class OrgInfoQueryReq extends PageSize {
/**
*
*/
private String orgNo;
/**
*
*/
private String orgName;
/**
*
*/
private String orgType;
/**
* 0 1 2
*/
private String status;
/**
*
*/
private String mermberId;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getOrgType() {
return orgType;
}
public void setOrgType(String orgType) {
this.orgType = orgType;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMermberId() {
return mermberId;
}
public void setMermberId(String mermberId) {
this.mermberId = mermberId;
}
}

@ -0,0 +1,41 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptcc.agile.dataservice.dto.request.base.User;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* DTO
*
* @author shu_k
**/
public class OrgInfoStatusReq extends User implements Serializable {
@NotBlank(message = "orgNo不能为空")
private String orgNo;
/**
* token
*/
@NotBlank(message = "recToken不能为空")
private String recToken;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getRecToken() {
return recToken;
}
public void setRecToken(String recToken) {
this.recToken = recToken;
}
}

@ -0,0 +1,52 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.org;
import com.jiuyv.sptccc.agile.common.core.base.PageSize;
/**
*
*
* @author shu_k
**/
public class OrgStatisticsQueryReq extends PageSize {
/**
*
*/
private String orgNo;
/**
*
*/
private String orgName;
/**
*
*/
private String apiName;
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
}

@ -0,0 +1,50 @@
package com.jiuyv.sptcc.agile.dataservice.dto.request.product;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jiuyv.sptcc.agile.dataservice.dto.enums.FileTypeEnum;
import com.jiuyv.sptcc.agile.dataservice.web.annotation.EnumCheckValue;
import com.jiuyv.sptcc.agile.dataservice.web.constant.DateTimeFormatConstant;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* @ClassName : downLoadRequest
* @Description :
* @Author : sky
* @Date: 2023-09-13 13:24
*/
public class DownLoadRequest {
@JsonFormat(pattern = DateTimeFormatConstant.YYYY_MM_DD)
private Date date;
@EnumCheckValue(value = FileTypeEnum.class)
private String fileType;
@NotBlank
private String orgNo;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save