数据初始化
commit
596e1e20d5
|
@ -0,0 +1,35 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -0,0 +1,25 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-property</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-property-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.common.domain
|
||||
* @Project:cloud-integration
|
||||
* @name:Connection
|
||||
* @Date:2024/8/21 1:00
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Connect {
|
||||
|
||||
/**
|
||||
* 连接源
|
||||
*/
|
||||
private String driver;
|
||||
|
||||
//jdbc:mysql://127.0.0.1:3306/test
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* ip地址+端口号
|
||||
*/
|
||||
private String ipAddress;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 客户想要的字段可以进行选择
|
||||
*/
|
||||
private String[] like;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.pojo
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceList
|
||||
* @Date:2024/8/20 18:47
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
//核心数据
|
||||
@TableName(value = "data_source")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CoreDataList {
|
||||
|
||||
/**
|
||||
* 主键/编号
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 征信状态
|
||||
*/
|
||||
private String credit;
|
||||
|
||||
/**
|
||||
* 数据库对象构建为返回结果对象
|
||||
* @param dataSourceLists 数据对象
|
||||
* @return 试图对象
|
||||
*/
|
||||
public static CoreDataList coreDataBuild(CoreDataList dataSourceLists, Supplier<List<CoreDataList>> o) {
|
||||
return CoreDataList.builder()
|
||||
.id(dataSourceLists.getId())
|
||||
.name(dataSourceLists.getName())
|
||||
.gender(dataSourceLists.getGender())
|
||||
.birthday(dataSourceLists.getBirthday())
|
||||
.address(dataSourceLists.getAddress())
|
||||
.mobile(dataSourceLists.getMobile())
|
||||
.idCard(dataSourceLists.getIdCard())
|
||||
.email(dataSourceLists.getEmail())
|
||||
.credit(dataSourceLists.getCredit())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.pojo
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceList
|
||||
* @Date:2024/8/20 18:47
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@TableName(value = "data_source")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DataSourceInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键/编号
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 征信状态
|
||||
*/
|
||||
private String credit;
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.pojo
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceList
|
||||
* @Date:2024/8/20 18:47
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@TableName(value = "data_source")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DataSourceList {
|
||||
|
||||
/**
|
||||
* 主键/编号
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mibile;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 征信状态
|
||||
*/
|
||||
private String credit;
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.common.domain
|
||||
* @Project:cloud-integration
|
||||
* @name:InitialData
|
||||
* @Date:2024/8/21 上午12:43
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("dashuju")
|
||||
public class InitialData {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private String id ;
|
||||
|
||||
private String Name ;
|
||||
private String CardNo ;
|
||||
private String Descriot ;
|
||||
private String CtfTp ;
|
||||
private String CtfId ;
|
||||
private String Gender ;
|
||||
private String Birthday ;
|
||||
private String Address ;
|
||||
private String Zip ;
|
||||
private String Dirty ;
|
||||
private String District1 ;
|
||||
private String District2 ;
|
||||
private String District3 ;
|
||||
private String District4 ;
|
||||
private String District5 ;
|
||||
private String District6 ;
|
||||
private String FirstNm ;
|
||||
private String LastNm ;
|
||||
private String Duty ;
|
||||
private String Mobile ;
|
||||
private String Tel ;
|
||||
private String Fax ;
|
||||
private String EMail ;
|
||||
private String Nation ;
|
||||
private String Taste ;
|
||||
private String Education ;
|
||||
private String Company ;
|
||||
private String CTel ;
|
||||
private String CAddress ;
|
||||
private String CZip ;
|
||||
private String Family ;
|
||||
private String Version ;
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.common.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.common.domain
|
||||
* @Project:cloud-integration
|
||||
* @name:Connection
|
||||
* @Date:2024/8/21 1:00
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectReq {
|
||||
|
||||
/**
|
||||
* 连接源
|
||||
*/
|
||||
private String driver = "com.mysql.cj.jdbc.Driver";
|
||||
|
||||
//jdbc:mysql://127.0.0.1:3306/test
|
||||
/**
|
||||
* 连接地址
|
||||
*/
|
||||
private final String url = "jdbc:mysql://";
|
||||
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tableName = "/";
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.muyu.common.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.pojo
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceList
|
||||
* @Date:2024/8/20 18:47
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@TableName(value = "core_data")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CoreDataListReq {
|
||||
|
||||
/**
|
||||
* 主键/编号
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 征信状态
|
||||
*/
|
||||
private String credit;
|
||||
|
||||
/**
|
||||
* 数据库对象构建为返回结果对象
|
||||
* @param dataSourceLists 数据对象
|
||||
* @return 试图对象
|
||||
*/
|
||||
public static CoreDataListReq coreDataBuild(CoreDataListReq dataSourceLists, Supplier<List<CoreDataListReq>> o) {
|
||||
return CoreDataListReq.builder()
|
||||
.id(dataSourceLists.getId())
|
||||
.name(dataSourceLists.getName())
|
||||
.gender(dataSourceLists.getGender())
|
||||
.birthday(dataSourceLists.getBirthday())
|
||||
.address(dataSourceLists.getAddress())
|
||||
.mobile(dataSourceLists.getMobile())
|
||||
.idCard(dataSourceLists.getIdCard())
|
||||
.email(dataSourceLists.getEmail())
|
||||
.credit(dataSourceLists.getCredit())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-property</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-property-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,111 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-property</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-property-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-rabbit</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 接口模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-property-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>cloud-integration</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.integration
|
||||
* @Project:cloud-integration
|
||||
* @name:Integration
|
||||
* @Date:2024/8/19 下午9:56
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class IntegrationApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(IntegrationApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.muyu.server.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
import com.muyu.server.service.CoreDataListService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.controller
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceController
|
||||
* @Date:2024/8/20 18:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/showDatas")
|
||||
@Tag(name = "查询数据",description = "从核心库中查询数据")
|
||||
@AllArgsConstructor
|
||||
public class CoreDataListController {
|
||||
|
||||
private final CoreDataListService coreDataListService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询核心数据库
|
||||
* @param dataSourceList 客户列表请求参数
|
||||
* @return 核心数据库列表
|
||||
*/
|
||||
@PostMapping("/selectData")
|
||||
@Operation(summary = "查询数据",description = "查询数据")
|
||||
public Result<List<CoreDataList>> extractData(
|
||||
@Validated @RequestBody DataSourceList dataSourceList
|
||||
){
|
||||
return Result.success(coreDataListService.extractData(dataSourceList));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.server.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.Connect;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
import com.muyu.server.service.DataSourceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.controller
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceController
|
||||
* @Date:2024/8/20 18:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/datas")
|
||||
@Tag(name = "抽取数据",description = "从数据源抽取数据")
|
||||
@AllArgsConstructor
|
||||
public class DataSourceController {
|
||||
|
||||
private final DataSourceService dataSourceService;
|
||||
|
||||
|
||||
@PostMapping("/extractData")
|
||||
@Operation(summary = "抽取数据",description = "从数据源中抽取数据")
|
||||
public Result<List<DataSourceList>> extractData(Connect connect){
|
||||
List<DataSourceList> dataSourceLists = dataSourceService.extractData(connect);
|
||||
dataSourceService.detailData(dataSourceLists);
|
||||
return Result.success(null,"您的数据已成功获取");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.server.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.InitialData;
|
||||
import com.muyu.server.service.InitialDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.controller
|
||||
* @Project:cloud-integration
|
||||
* @name:InitialDataController
|
||||
* @Date:2024/8/21 上午1:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/initialData")
|
||||
@Tag(name = "查询源数据",description = "从数据源查询")
|
||||
public class InitialDataController {
|
||||
|
||||
@Autowired private InitialDataService initialDataService;
|
||||
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查询源数据")
|
||||
public Result<List<InitialData>> getInitialDataList() {
|
||||
return Result.success(
|
||||
initialDataService.getInitialDataList()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.server.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.req.CoreDataListReq;
|
||||
import com.muyu.server.service.OperateCoreDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.controller
|
||||
* @Project:cloud-integration
|
||||
* @name:OperateCoreDataListController
|
||||
* @Date:2024/8/21 下午10:13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/operateCoreData")
|
||||
public class OperateCoreDataListController {
|
||||
|
||||
@Autowired private OperateCoreDataService operateCoreDataService;
|
||||
|
||||
/**
|
||||
* 获取清洗转换后数据进行添加核心数据库
|
||||
* @param coreDataReqList 添加数据集合
|
||||
* @return 添加后结果
|
||||
*/
|
||||
@GetMapping
|
||||
@Operation(summary = "添加核心数据",description = "添加处理后的数据")
|
||||
public Result<Object> addCoreData(
|
||||
@Validated @RequestBody List<CoreDataListReq> coreDataReqList
|
||||
){
|
||||
operateCoreDataService.addCoreData(coreDataReqList);
|
||||
return Result.success("","接受的"+coreDataReqList.size()+"条数据已添加核心数据库");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.server.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.server.controller
|
||||
* @Project:cloud-integration
|
||||
* @name:RuleDataClassifyController
|
||||
* @Date:2024/8/21 21:49
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/initialData")
|
||||
@Tag(name = "查询规则类型",description = "从自由数据库查询规则类型")
|
||||
public class RuleDataClassifyController {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.server.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.server.controller
|
||||
* @Project:cloud-integration
|
||||
* @name:RuleDataController
|
||||
* @Date:2024/8/21 20:36
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ruleData")
|
||||
@Tag(name = "查询源规则",description = "从自由数据库查询")
|
||||
public class RuleDataController {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.mapper
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceMapper
|
||||
* @Date:2024/8/20 18:56
|
||||
*/
|
||||
@Mapper
|
||||
public interface CoreDataListMapper extends BaseMapper<CoreDataList> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.mapper
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceMapper
|
||||
* @Date:2024/8/20 18:56
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataMapper extends BaseMapper<CoreDataList> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.mapper
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceMapper
|
||||
* @Date:2024/8/20 18:56
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataSourceMapper extends BaseMapper<DataSourceList> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domain.InitialData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.mapper
|
||||
* @Project:cloud-integration
|
||||
* @name:InitialDataMapper
|
||||
* @Date:2024/8/21 上午12:56
|
||||
*/
|
||||
@Mapper
|
||||
public interface InitialDataMapper extends BaseMapper<InitialData> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domain.req.CoreDataListReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.mapper
|
||||
* @Project:cloud-integration
|
||||
* @name:OperateCoreDataMapper
|
||||
* @Date:2024/8/21 下午10:14
|
||||
*/
|
||||
@Mapper
|
||||
public interface OperateCoreDataMapper extends BaseMapper<CoreDataListReq> {
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.server.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.service
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceService
|
||||
* @Date:2024/8/20 18:56
|
||||
*/
|
||||
public interface CoreDataListService extends IService<CoreDataList> {
|
||||
|
||||
/**
|
||||
* 查询核心数据库
|
||||
* @param dataSourceList 客户列表请求参数
|
||||
* @return 核心数据库列表
|
||||
*/
|
||||
List<CoreDataList> extractData(DataSourceList dataSourceList);
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.server.service
|
||||
* @Project:cloud-integration
|
||||
* @name:dataSerivce
|
||||
* @Date:2024/8/21 0:33
|
||||
*/
|
||||
public interface DataService extends IService<CoreDataList> {
|
||||
|
||||
/**
|
||||
* fenye
|
||||
* @param idCard
|
||||
* @param limit
|
||||
* @return
|
||||
*/
|
||||
List<CoreDataList> selectCoreDataListByAppCodeAndLimit(String idCard, int limit);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.server.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.domain.Connect;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.service
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceService
|
||||
* @Date:2024/8/20 18:56
|
||||
*/
|
||||
public interface DataSourceService extends IService<DataSourceList> {
|
||||
|
||||
List<DataSourceList> extractData(Connect connect);
|
||||
|
||||
void detailData(List<DataSourceList> dataSourceLists);
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.server.service;
|
||||
|
||||
import com.muyu.common.domain.InitialData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.service
|
||||
* @Project:cloud-integration
|
||||
* @name:InitialDataService
|
||||
* @Date:2024/8/21 上午12:56
|
||||
*/
|
||||
public interface InitialDataService {
|
||||
List<InitialData> getInitialDataList();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.domain.req.CoreDataListReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.service
|
||||
* @Project:cloud-integration
|
||||
* @name:OperateCoreDataService
|
||||
* @Date:2024/8/21 下午10:19
|
||||
*/
|
||||
public interface OperateCoreDataService extends IService<CoreDataListReq> {
|
||||
void addCoreData(List<CoreDataListReq> coreDataReqList);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
import com.muyu.server.mapper.CoreDataListMapper;
|
||||
import com.muyu.server.service.CoreDataListService;
|
||||
import com.muyu.server.service.DataService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.service.impl
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceServiceImpl
|
||||
* @Date:2024/8/20 18:57
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CoreDataListServiceImpl
|
||||
extends ServiceImpl<CoreDataListMapper, CoreDataList>
|
||||
implements CoreDataListService {
|
||||
|
||||
private final DataService dataService;
|
||||
|
||||
/**
|
||||
* 查询核心数据库
|
||||
* @param dataSourceList 客户列表请求参数
|
||||
* @return 核心数据库列表
|
||||
*/
|
||||
@Override
|
||||
public List<CoreDataList> extractData(DataSourceList dataSourceList) {
|
||||
|
||||
LambdaQueryWrapper<CoreDataList> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(dataSourceList.getName()),
|
||||
CoreDataList::getName, dataSourceList.getName()
|
||||
);
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(dataSourceList.getAddress()),
|
||||
CoreDataList::getAddress, dataSourceList.getAddress()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(dataSourceList.getMibile()),
|
||||
CoreDataList::getMobile, dataSourceList.getMibile()
|
||||
);
|
||||
List<CoreDataList> dataSourceListList = this.list(queryWrapper);
|
||||
return dataSourceListList.stream()
|
||||
.map(
|
||||
coreDataList -> CoreDataList.coreDataBuild(
|
||||
coreDataList,
|
||||
() -> dataService.selectCoreDataListByAppCodeAndLimit(coreDataList.getIdCard(),5)
|
||||
.stream()
|
||||
.toList()
|
||||
)
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.domain.CoreDataList;
|
||||
import com.muyu.server.mapper.DataMapper;
|
||||
import com.muyu.server.service.DataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.server.service
|
||||
* @Project:cloud-integration
|
||||
* @name:DataServiceImpl
|
||||
* @Date:2024/8/21 0:35
|
||||
*/
|
||||
@Service
|
||||
public class DataServiceImpl
|
||||
extends ServiceImpl<DataMapper, CoreDataList>
|
||||
implements DataService
|
||||
{
|
||||
@Override
|
||||
public List<CoreDataList> selectCoreDataListByAppCodeAndLimit(String idCard, int limit) {
|
||||
LambdaQueryWrapper<CoreDataList> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
|
||||
orderPayInfoQueryWrapper.eq(CoreDataList::getIdCard,idCard);
|
||||
orderPayInfoQueryWrapper.orderBy(true,false,CoreDataList::getBirthday);
|
||||
orderPayInfoQueryWrapper.last("limit " + limit);
|
||||
//
|
||||
return this.list(orderPayInfoQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.domain.Connect;
|
||||
import com.muyu.common.domain.DataSourceList;
|
||||
import com.muyu.server.mapper.DataSourceMapper;
|
||||
import com.muyu.server.service.DataSourceService;
|
||||
import com.muyu.server.util.JdbcHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.service.impl
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceServiceImpl
|
||||
* @Date:2024/8/20 18:57
|
||||
*/
|
||||
@Service
|
||||
public class DataSourceServiceImpl
|
||||
extends ServiceImpl<DataSourceMapper, DataSourceList>
|
||||
implements DataSourceService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<DataSourceList> extractData(Connect connect) {
|
||||
|
||||
if (StringUtils.isEmpty(connect.getIpAddress())){
|
||||
throw new RuntimeException("请输入ip地址+端口号! 格式:127.0.0.1:3306");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(connect.getUserName())){
|
||||
throw new RuntimeException("请输入数据库用户名!");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(connect.getPassword())){
|
||||
throw new RuntimeException("请输入数据库密码");
|
||||
}
|
||||
|
||||
try {
|
||||
String sql = null;
|
||||
Connection conn = JdbcHelper.getConn(connect);
|
||||
String like="";
|
||||
for (String s : connect.getLike()) {
|
||||
like+=","+s;
|
||||
}
|
||||
String substring = like.substring(1);
|
||||
if (StringUtils.isNotEmpty(connect.getTableName())){
|
||||
sql = "select "+substring+" from "+connect.getTableName();
|
||||
}
|
||||
PreparedStatement preparedStatement = conn.prepareStatement(sql);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
ArrayList<DataSourceList> dataSourceLists = new ArrayList<>();
|
||||
while (rs.next()){
|
||||
DataSourceList build = DataSourceList.builder()
|
||||
.id(rs.getInt("id"))
|
||||
.name(rs.getString("name"))
|
||||
.gender(rs.getString("gender"))
|
||||
.birthday(rs.getDate("birthday"))
|
||||
.address(rs.getString("address"))
|
||||
.mibile(rs.getString("mibile"))
|
||||
.idCard(rs.getString("idCard"))
|
||||
.credit(rs.getString("credit"))
|
||||
.build();
|
||||
dataSourceLists.add(build);
|
||||
}
|
||||
JdbcHelper.close(conn,preparedStatement,rs);
|
||||
return dataSourceLists;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detailData(List<DataSourceList> dataSourceLists) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.domain.InitialData;
|
||||
import com.muyu.server.mapper.InitialDataMapper;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.service.impl
|
||||
* @Project:cloud-integration
|
||||
* @name:InitialDataService
|
||||
* @Date:2024/8/21 上午12:57
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class InitialDataService
|
||||
extends ServiceImpl<InitialDataMapper, InitialData>
|
||||
implements com.muyu.server.service.InitialDataService {
|
||||
|
||||
@Autowired private InitialDataMapper initialDataMapper;
|
||||
|
||||
@Override
|
||||
public List<InitialData> getInitialDataList() {
|
||||
int pageNum = 1;
|
||||
long total = initialDataMapper.selectCount(null);
|
||||
long pageSize = (total + 10000 -1) / 10000;
|
||||
|
||||
while (pageNum <= pageSize) {
|
||||
Page<InitialData> page = new Page(pageNum, 10000);
|
||||
List<InitialData> records = initialDataMapper.selectPage(page, null).getRecords();
|
||||
System.out.println(records.size());
|
||||
pageNum++;
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.domain.req.CoreDataListReq;
|
||||
import com.muyu.server.mapper.OperateCoreDataMapper;
|
||||
import com.muyu.server.service.OperateCoreDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.server.service.impl
|
||||
* @Project:cloud-integration
|
||||
* @name:OperateCoreDataServiceImpl
|
||||
* @Date:2024/8/21 下午10:20
|
||||
*/
|
||||
@Service
|
||||
public class OperateCoreDataServiceImpl
|
||||
extends ServiceImpl<OperateCoreDataMapper, CoreDataListReq>
|
||||
implements OperateCoreDataService {
|
||||
|
||||
@Autowired private OperateCoreDataMapper operateCoreDataMapper;
|
||||
|
||||
private final ExecutorService executor = Executors.newFixedThreadPool(1000);
|
||||
|
||||
/**
|
||||
* 使用线程 与 mybatis-plus 进行添加
|
||||
* @param coreDataReqList 参数集合
|
||||
* @return 添加后结果
|
||||
*/
|
||||
@Override
|
||||
public void addCoreData(List<CoreDataListReq> coreDataReqList) {
|
||||
|
||||
int size = 10000;
|
||||
int totalBatches = (coreDataReqList.size() + size - 1) / size;
|
||||
|
||||
List<CompletableFuture<?>> futures = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < totalBatches; i++) {
|
||||
int start = i * size;
|
||||
int end = Math.min(start + size, coreDataReqList.size());
|
||||
List<CoreDataListReq> batchData = coreDataReqList.subList(start, end);
|
||||
|
||||
CompletableFuture<?> future = CompletableFuture.runAsync(() -> {
|
||||
saveBatch(batchData);
|
||||
}, executor);
|
||||
futures.add(future);
|
||||
}
|
||||
executor.shutdown();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.server.util;
|
||||
|
||||
import com.muyu.common.domain.Connect;
|
||||
import com.muyu.common.domain.req.ConnectReq;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.util
|
||||
* @Project:cloud-integration
|
||||
* @name:BaseDao
|
||||
* @Date:2024/8/20 21:45
|
||||
*/
|
||||
@Component
|
||||
public class JdbcHelper {
|
||||
|
||||
|
||||
public static Connection getConn( Connect connect) throws SQLException, ClassNotFoundException {
|
||||
Class.forName(connect.getDriver());
|
||||
return DriverManager.getConnection(new ConnectReq().getUrl()+connect.getIpAddress(),connect.getUserName(),connect.getPassword());
|
||||
}
|
||||
|
||||
public static void close(Connection connection,PreparedStatement preparedStatement,ResultSet resultSet) throws SQLException {
|
||||
|
||||
if (null != connection){
|
||||
connection.close();
|
||||
}
|
||||
|
||||
if (null != preparedStatement){
|
||||
preparedStatement.close();
|
||||
}
|
||||
|
||||
if (null != resultSet){
|
||||
resultSet.close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-server-parent</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-property</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>cloud-property-common</module>
|
||||
<module>cloud-property-remote</module>
|
||||
<module>cloud-property-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.9.1</version>
|
||||
<!-- 确保这是存在的版本 -->
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu
|
||||
* @Project:Default (Template) Project
|
||||
* @name:${NAME}
|
||||
* @Date:2024/8/22 15:14
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue