dev
dunzhida 2023-08-09 17:37:40 +08:00
commit 7e2d0adb86
75 changed files with 2116 additions and 0 deletions

8
.idea/.gitignore vendored 100644
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

15
.idea/compiler.xml 100644
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="etl-task-schdeling-common" />
<module name="etl-task-schdeling-server" />
<module name="etl-task-schdeling-remote" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/etl-task-schdeling-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/etl-task-schdeling-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/etl-task-schdeling-remote/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/etl-task-schdeling-remote/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/etl-task-schdeling-server/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/etl-task-schdeling-server/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,81 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="date" />
</inspection_tool>
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MissingJavadoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="PACKAGE_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="MODULE_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="TOP_LEVEL_CLASS_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="INNER_CLASS_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="METHOD_SETTINGS">
<Options>
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="FIELD_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="public" />
<option name="name" value="aliyun nexus" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://nexus.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

12
.idea/misc.xml 100644
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

10
.idea/modules.xml 100644
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/etl-task-schdeling-common/etl-task-schdeling-common.iml" filepath="$PROJECT_DIR$/etl-task-schdeling-common/etl-task-schdeling-common.iml" />
<module fileurl="file://$PROJECT_DIR$/etl-task-schdeling-remote/etl-task-schdeling-remote.iml" filepath="$PROJECT_DIR$/etl-task-schdeling-remote/etl-task-schdeling-remote.iml" />
<module fileurl="file://$PROJECT_DIR$/etl-task-schdeling-server/etl-task-schdeling-server.iml" filepath="$PROJECT_DIR$/etl-task-schdeling-server/etl-task-schdeling-server.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml 100644
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>

View File

@ -0,0 +1,120 @@
<?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>etl-task-scheduling</artifactId>
<groupId>com.yun</groupId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>etl-task-schdeling-common</artifactId>
<!--系统公共核心服务-->
<dependencies>
<!-- 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>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>com.yun</groupId>
<artifactId>yun-common-core</artifactId>
</dependency>
<!-- bootstrap 启动器 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<!-- 负载均衡-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- SpringCloud Openfeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- JWT -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!-- Alibaba Fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.80</version>
</dependency>
<!-- SpringBoot Boot Redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- Hibernate Validator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Apache Lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- lombok依赖 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- hutool -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.3</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,18 @@
package com.bwie.common.constants;
/**
* @description:
* @author Dzd
*/
public class Constants {
/**
*
*/
public static final Integer SUCCESS = 200;
public static final String SUCCESS_MSG = "操作成功";
/**
*
*/
public static final Integer ERROR = 500;
public static final String ERROR_MSG = "操作异常";
}

View File

@ -0,0 +1,29 @@
package com.bwie.common.constants;
/**
* @author Dzd
* @description: Jwt
*/
public class JwtConstants {
/**
* ID
*/
public static final String DETAILS_USER_ID = "user_id";
/**
*
*/
public static final String DETAILS_USERNAME = "username";
/**
*
*/
public static final String USER_KEY = "user_key";
/**
*
*/
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
}

View File

@ -0,0 +1,24 @@
package com.bwie.common.constants;
/**
* @author Dzd
* @description:
*/
public class TokenConstants {
/**
* 720
*/
public final static long EXPIRATION = 720;
/**
* 120
*/
public final static long REFRESH_TIME = 120;
/**
*
*/
public final static String LOGIN_TOKEN_KEY = "login_tokens:";
/**
* token
*/
public static final String TOKEN = "token";
}

View File

@ -0,0 +1,31 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author Dunzhida
* data 2023/7/30 21:16
* fileName Middle
*/
/*
*
* */
@Data
public class Config {
/*
* Id
* */
private Integer configId;
/*
* Id
* */
private Integer improt1Id;
/*
* Id
* */
private Integer improt2Id;
/*
* Id
* */
private Integer improt3Id;
}

View File

@ -0,0 +1,14 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author Dunzhida
* data 2023/8/4 8:16
* fileName LoadEntity
*/
@Data
public class LoadEntity {
public Integer id;
public String name;
}

View File

@ -0,0 +1,31 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author Dunzhida
* data 2023/7/30 21:19
* fileName Mysql
*/
/*
*
* */
@Data
public class Mysql {
/*
*
* */
private String COLUMNNAME;
/*
*
* */
private String DATATYPE;
/*
*
* */
private String ISNULLABLE;
/*
*
* */
private String COLUMN_COMMENT;
}

View File

@ -0,0 +1,40 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author Dunzhida
* data 2023/7/30 21:12
* fileName NodeOne
*/
/*
*
* */
@Data
public class NodeOne {
/*
* Id
* */
private Integer nodeOneId;
/*
*
* */
private String nodeOneDatabase;
/*
*
* */
private String nodeOneDatatable;
/*
*
* */
private String[] nodeOneFields;
private String nodeOneField;
/*
* Id
* */
private Integer import1Id;
}

View File

@ -0,0 +1,49 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author Dunzhida
* data 2023/7/30 21:14
* fileName NodeThree
*/
/*
*
* */
@Data
public class NodeThree {
/*
* Id
* */
private Integer nodeThreeId;
/*
*
* */
private String nodeOneDatatable;
/*
*
* */
private String nodeOneField;
/*
*
* */
private String nodeThreeWay;
/*
*
* */
private String nodeTwoDatatable;
/*
*
* */
private String nodeTwoField;
/*
* id
* */
private Integer import3Id;
private String[] nodeFieldArr;
private String nodeFields;
}

View File

@ -0,0 +1,36 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @author Dunzhida
* data 2023/7/30 21:13
* fileName NodeTwo
*/
/*
*
* */
@Data
public class NodeTwo {
/*
* Id
* */
private Integer nodeTwoId;
/*
*
* */
private String nodeTwoDatabase;
/*
*
* */
private String nodeTwoDatatable;
/*
*
* */
private String[] nodeTwoFields;
private String nodeTwoField;
/*
* Id
* */
private Integer import2Id;
}

View File

@ -0,0 +1,34 @@
package com.bwie.common.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author dzd
* @description:
*/
@Data
public class PageResult<T> implements Serializable {
/**
*
*/
private long total;
/**
*
*/
private List<T> list;
public PageResult() {
}
public PageResult(long total, List<T> list) {
this.total = total;
this.list = list;
}
public static <T> PageResult<T> toPageResult(long total, List<T> list){
return new PageResult(total , list);
}
public static <T> Result<PageResult<T>> toResult(long total, List<T> list){
return Result.success(PageResult.toPageResult(total,list));
}
}

View File

@ -0,0 +1,76 @@
package com.bwie.common.result;
import com.bwie.common.constants.Constants;
import lombok.Data;
import java.io.Serializable;
/**
* @author Dzd
* @description:
*/
@Data
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
public static final int SUCCESS = Constants.SUCCESS;
/**
*
*/
public static final int FAIL = Constants.ERROR;
/**
*
*/
private int code;
/**
*
*/
private String msg;
/**
*
*/
private T data;
public static <T> Result<T> success() {
return restResult(null, SUCCESS, Constants.SUCCESS_MSG);
}
public static <T> Result<T> success(T data) {
return restResult(data, SUCCESS, Constants.SUCCESS_MSG);
}
public static <T> Result<T> success(T data, String msg) {
return restResult(data, SUCCESS, msg);
}
public static <T> Result<T> error() {
return restResult(null, FAIL, Constants.ERROR_MSG);
}
public static <T> Result<T> error(String msg) {
return restResult(null, FAIL, msg);
}
public static <T> Result<T> error(T data) {
return restResult(data, FAIL, Constants.ERROR_MSG);
}
public static <T> Result<T> error(T data, String msg) {
return restResult(data, FAIL, msg);
}
public static <T> Result<T> error(int code, String msg) {
return restResult(null, code, msg);
}
private static <T> Result<T> restResult(T data, int code, String msg) {
Result<T> apiResult = new Result<>();
apiResult.setCode(code);
apiResult.setData(data);
apiResult.setMsg(msg);
return apiResult;
}
}

View File

@ -0,0 +1,109 @@
package com.bwie.common.utils;
import com.bwie.common.constants.JwtConstants;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.util.Map;
/**
* @description: Jwt
* @author dzd
*/
public class JwtUtils {
/**
*
*/
public static String secret = JwtConstants.SECRET;
/**
*
*
* @param claims
* @return
*/
public static String createToken(Map<String, Object> claims){
String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
return token;
}
/**
*
*
* @param token
* @return
*/
public static Claims parseToken(String token){
return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
}
/**
*
*
* @param token
* @return ID
*/
public static String getUserKey(String token){
Claims claims = parseToken(token);
return getValue(claims, JwtConstants.USER_KEY);
}
/**
*
*
* @param claims
* @return ID
*/
public static String getUserKey(Claims claims){
return getValue(claims, JwtConstants.USER_KEY);
}
/**
* ID
*
* @param token
* @return ID
*/
public static String getUserId(String token){
Claims claims = parseToken(token);
return getValue(claims, JwtConstants.DETAILS_USER_ID);
}
/**
* ID
*
* @param claims
* @return ID
*/
public static String getUserId(Claims claims){
return getValue(claims, JwtConstants.DETAILS_USER_ID);
}
/**
*
*
* @param token
* @return
*/
public static String getUserName(String token){
Claims claims = parseToken(token);
return getValue(claims, JwtConstants.DETAILS_USERNAME);
}
/**
*
*
* @param claims
* @return
*/
public static String getUserName(Claims claims){
return getValue(claims, JwtConstants.DETAILS_USERNAME);
}
/**
*
*
* @param claims
* @param key
* @return
*/
public static String getValue(Claims claims, String key){
Object obj = claims.get(key);
return obj == null ? "" : obj.toString();
}
}

View File

@ -0,0 +1,68 @@
package com.bwie.common.utils;
import org.springframework.util.AntPathMatcher;
import java.util.Collection;
import java.util.List;
/**
* @author dzd
* @description:
*/
public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
* @param object Object
* @return true false
*/
public static boolean isNull(Object object) {
return object == null;
}
/**
* * Collection ListSetQueue
*
* @param coll Collection
* @return true false
*/
public static boolean isEmpty(Collection<?> coll) {
return isNull(coll) || coll.isEmpty();
}
/**
*
*
* @param str
* @param strs
* @return
*/
public static boolean matches(String str, List<String> strs) {
if (isEmpty(str) || isEmpty(strs)) {
return false;
}
for (String pattern : strs) {
if (isMatch(pattern, str))
{
return true;
}
}
return false;
}
/**
* url:
* ? ;
* * ;
* ** ;
*
* @param pattern
* @param url url
* @return
*/
public static boolean isMatch(String pattern, String url) {
AntPathMatcher matcher = new AntPathMatcher();
return matcher.match(pattern, url);
}
}

View File

@ -0,0 +1,5 @@
#Generated by Maven
#Fri Aug 04 10:38:44 CST 2023
version=3.6.3
groupId=com.yun
artifactId=etl-task-schdeling-common

View File

@ -0,0 +1,13 @@
com\bwie\common\result\PageResult.class
com\bwie\common\domain\NodeTwo.class
com\bwie\common\utils\JwtUtils.class
com\bwie\common\utils\StringUtils.class
com\bwie\common\constants\JwtConstants.class
com\bwie\common\domain\Mysql.class
com\bwie\common\constants\Constants.class
com\bwie\common\domain\NodeOne.class
com\bwie\common\domain\NodeThree.class
com\bwie\common\constants\TokenConstants.class
com\bwie\common\domain\Config.class
com\bwie\common\result\Result.class
com\bwie\common\domain\LoadEntity.class

View File

@ -0,0 +1,13 @@
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\domain\NodeTwo.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\utils\StringUtils.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\result\PageResult.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\constants\Constants.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\domain\Mysql.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\constants\TokenConstants.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\domain\Config.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\utils\JwtUtils.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\domain\NodeThree.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\constants\JwtConstants.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\result\Result.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\domain\LoadEntity.java
D:\项目\etl-task-scheduling\etl-task-schdeling-common\src\main\java\com\bwie\common\domain\NodeOne.java

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>

View File

@ -0,0 +1,22 @@
<?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>etl-task-scheduling</artifactId>
<groupId>com.yun</groupId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>etl-task-schdeling-remote</artifactId>
<dependencies>
<dependency>
<groupId>com.yun</groupId>
<artifactId>etl-task-schdeling-common</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,5 @@
#Generated by Maven
#Fri Aug 04 10:38:44 CST 2023
version=3.6.3
groupId=com.yun
artifactId=etl-task-schdeling-remote

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
</module>

View File

@ -0,0 +1,49 @@
<?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>etl-task-scheduling</artifactId>
<groupId>com.yun</groupId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>etl-task-schdeling-server</artifactId>
<dependencies>
<!--ETl任务调度公共服务-->
<dependency>
<groupId>com.yun</groupId>
<artifactId>etl-task-schdeling-common</artifactId>
<version>3.6.3</version>
</dependency>
<!-- Yun Common DataSource -->
<dependency>
<groupId>com.yun</groupId>
<artifactId>yun-common-datasource</artifactId>
</dependency>
<!-- Yun Common DataScope -->
<dependency>
<groupId>com.yun</groupId>
<artifactId>yun-common-datascope</artifactId>
</dependency>
<!-- Yun Common Log -->
<dependency>
<groupId>com.yun</groupId>
<artifactId>yun-common-log</artifactId>
</dependency>
<!-- Yun Common Swagger -->
<dependency>
<groupId>com.yun</groupId>
<artifactId>yun-common-swagger</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,66 @@
package com.yun.task;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* @author Dunzhida
* data 2023/8/4 19:40
* fileName Demo
*/
public class Demo {
public static void main(String[] args) throws SQLException {
String a = "name,age,info";
StringBuilder sql = new StringBuilder("insert into t_info(");
// StringBuilder val = new StringBuilder("values(");
StringBuilder resultSql = null;
for (String s : a.split(",")) {
// val.append(s).append(",");
sql.append(s).append(",");
if (sql.toString().endsWith(",")){
StringBuilder substring = new StringBuilder(sql.substring(0, sql.length() - 1));
resultSql=substring.append(")");
}
}
// System.out.println("value:"+val);
System.out.println("result:"+resultSql);
System.out.println("---------------------------------------------------------------");
// Connection connection1 = DriverManager.getConnection("jdbc:mysql://124.221.14.100:3306/six", "root", "dzd123");
//
//
//
//
//
// PreparedStatement preparedStatement1 = connection1.prepareStatement("insert into t_info (name) ");
//
//
// int i =0;
// for (String s : split) {
// preparedStatement1.setString(i+1,s);
// }
String[] split = a.split(",");
String value = "values(";
for (int j = 0; j < split.length; j++) {
// 数据加载到目标系统中
value+=",#{}";
}
// String substring = value.substring(0, value.length() - 2);
// System.out.println(substring+")");
//
// System.out.println("result:"+resultSql+substring+")");
String sqlsql=resultSql+value+")";
System.out.println(sqlsql);
// preparedStatement1.executeUpdate();
}
}

View File

@ -0,0 +1,54 @@
package com.yun.task;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
/**
* @author Dunzhida
* data 2023/8/5 9:28
* fileName Demo2
*/
public class Demo2 {
// 首先定义一个包含元素和对应权重的列表。可以使用自定义的类来表示每个元素和其对应的权重值或者使用Map来存储元素和权重的映射关系。
//
//计算所有元素的权重总和。遍历列表或Map将所有元素的权重值相加得到总和。
//
//生成一个随机数范围在0到权重总和之间。可以使用Java的Random类来生成随机数。
//
//遍历列表或Map累加每个元素的权重值直到累加值大于等于随机数。选中对应的元素作为结果。
public static void main(String[] args) {
// 定义元素和对应的权重
Map<String, Integer> elements = new HashMap<>();
elements.put("A", 8);
elements.put("B", 3);
elements.put("C", 6);
// 计算权重总和
int totalWeight = elements.values().stream().mapToInt(Integer::intValue).sum();
// 生成随机数
Random random = new Random();
int randomNumber = random.nextInt(totalWeight);
// 遍历元素,根据权重选择
int cumulativeWeight = 0;
String selectedElement = null;
for (Map.Entry<String, Integer> entry : elements.entrySet()) {
cumulativeWeight += entry.getValue();
if (randomNumber < cumulativeWeight) {
selectedElement = entry.getKey();
break;
}
}
// 输出结果
System.out.println("Selected element: " + selectedElement);
}
}

View File

@ -0,0 +1,167 @@
package com.yun.task;//package com.njupt.recurrence;
/**
* Creat with IntelliJ IDEA
*
* @Auther:
* @Date:2021/07/17/15:15
* @Description:
*/
public class MazePra {
public static void main(String[] args) {
//先创建一个二维数组来管理迷宫
int[][] map = new int[7][8];
int plan1 = 0;
int plan2 = 0;
for (int i = 0; i < 7; i++) {
map[i][0] = 1;
map[i][7] = 1;
}
for (int j = 0; j < 8; j++) {
map[0][j] = 1;
map[6][j] = 1;
}
map[1][6] = 1;
map[2][1] = 1;
map[2][2] = 1;
map[2][4] = 1;
map[3][2] = 1;
map[4][5] = 1;
map[4][3] = 1;
//这里为什么要重新创建一个地图呢为什么用int[][] map1=map,然后用map1调用第二个方法不行呢可以帮我回答一下吗
int[][] map1 = new int[7][8];
for (int i = 0; i < 7; i++) {
map1[i][0] = 1;
map1[i][7] = 1;
}
for (int j = 0; j < 8; j++) {
map1[0][j] = 1;
map1[6][j] = 1;
}
map1[1][6] = 1;
map1[2][1] = 1;
map1[2][2] = 1;
map1[2][4] = 1;
map1[3][2] = 1;
map1[4][5] = 1;
map1[4][3] = 1;
System.out.println("=======map====");
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 8; j++) {
System.out.print(map[i][j] + " ");
}
System.out.println(" ");
}
System.out.println("=======map1====");
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 8; j++) {
System.out.print(map1[i][j] + " ");
}
System.out.println(" ");
}
System.out.println("=====策略1先向右在向下=====");
judgePoint(map, 1, 1);
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 8; j++) {
System.out.print(map[i][j] + " ");
if (map[i][j] == 2) {
plan1++;
}
}
System.out.println(" ");
}
System.out.println("=====策略2先向下在向右=====");
judgePoint2(map1, 1, 1);
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 8; j++) {
System.out.print(map1[i][j] + " ");
if (map1[i][j] == 2) {
plan2++;
}
}
System.out.println(" ");
}
System.out.println("策略1先右后下的策略,共走了" + plan1 + "步");
System.out.println("策略2先下后右的策略,共走了" + plan2 + "步");
if (plan1 < plan2) {
System.out.println("故策略1先右后下的策略好,共走了" + plan1 + "步");
} else {
System.out.println("故策略2先下后右的策略好共走了" + plan2 + "步");
}
}
//开始写判断节点位置的状态的方法
// 策略1向往右在往下在向上在向左
//规定1表示墙2表示节点已经走过3表示此节点不通
public static boolean judgePoint(int[][] map, int i, int j) {
if (map[4][4] == 2) {
return true;
} else {
//最先输入的这个点假设没有走过
if (map[i][j] == 0) {
//先把这个点假设可以走得通
map[i][j] = 2;
//先向右走
if (judgePoint(map, i, j + 1)) {
return true;
//向下走
} else if (judgePoint(map, i + 1, j)) {
return true;
//如果先下走不通,则向向上走
} else if (judgePoint(map, i - 1, j)) {
return true;
//如果向上走不通,则向左走
} else if (judgePoint(map, i, j - 1)) {
return true;
} else {
//都走不通则把这个点设成走不通3
map[i][j] = 3;
return false;
}
} else {
return false;
}
}
}
//策略2先往下后往右在向上在向左
public static boolean judgePoint2(int[][] map, int i, int j) {
if (map[4][4] == 2) {
return true;
} else {
//最先输入的这个点假设没有走过
if (map[i][j] == 0) {
//先把这个点假设可以走得通
map[i][j] = 2;
//先向下走
if (judgePoint2(map, i + 1, j)) {
return true;
//如果先下走不通,则向右走
} else if (judgePoint2(map, i, j + 1)) {
return true;
//如果先右走不通,则向向上走
} else if (judgePoint2(map, i - 1, j)) {
return true;
//如果向上走不通,则向左走
} else if (judgePoint2(map, i, j - 1)) {
return true;
} else {
//都走不通则把这个点设成走不通3
map[i][j] = 3;
return false;
}
} else {
return false;
}
}
}
}

View File

@ -0,0 +1,36 @@
package com.yun.task;
import com.yun.common.security.annotation.EnableCustomConfig;
import com.yun.common.security.annotation.EnableRyFeignClients;
import com.yun.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Dunzhida
* data 2023/7/27 11:00
* fileName TaskApplication
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class TaskApplication {
public static void main(String[] args) {
SpringApplication.run(TaskApplication.class);
System.out.println("(♥◠‿◠)ノ゙ 数据处理层模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -0,0 +1,211 @@
package com.yun.task.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.*;
import com.bwie.common.result.Result;
import com.yun.task.service.TaskService;
import lombok.Data;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.xml.soap.Node;
import java.util.List;
import java.util.Map;
/**
* @author Dunzhida
* data 2023/7/27 16:08
* fileName TaskController
*/
@RequestMapping("city")
@RestController
@Log4j2
public class TaskController {
@Autowired
private TaskService taskService;
@Autowired
private HttpServletRequest request;
/*
* : findBydatabase
*
* :
* :post
* :string
* */
@PostMapping("/findBydatabase")
public Result<List<String>> findBydatabase(){
log.info("功能名称查询所有数据库请求URI{},请求方式:{}",request.getRequestURI(),request.getMethod());
List<String> list=taskService.findBydatabase();
System.out.println(list);
Result<List<String>> result=Result.success(list);
log.info("功能名称查询所有数据库请求URI{},请求方式:{},响应结果:{}",request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
/*
* : findByTable
*
* : String database
* :post
* :string
* */
@PostMapping("/findByTable/{database}")
public Result<List<String>> findByTable(@PathVariable String database){
log.info("功能名称根据数据库名称查询数据表请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),database);
List<String> list=taskService.findByTable(database);
System.out.println(list);
Result<List<String>> result=Result.success(list);
log.info("功能名称根据数据库名称查询数据表请求URI{},请求方式:{},响应结果:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
return result;
}
/*
*
* : findByField
*
* : String database ()
* String datatable ()
* :post
* :Mysqllist
* */
@PostMapping("/findByField/{database}/{datatable}")
public Result<List<Mysql>> findByField(@PathVariable String datatable, @PathVariable String database){
log.info("功能名称根据数据表名称查询字段请求URI{},请求方式:{},请求参数:{}{}",request.getRequestURI(),request.getMethod(),database,datatable);
List<Mysql> list=taskService.findByField(datatable,database);
System.out.println(list);
Result<List<Mysql>> result=Result.success(list);
log.info("功能名称根据数据表名称查询字段请求URI{},请求方式:{},响应结果:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
return result;
}
/**
* : createMiddle
*
* : RequestBody Config
* :post
*/
@PostMapping("/createMiddle")
public Result createMiddle(@RequestBody Config config){
log.info("功能名称进入配置自动创建配置表请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(config));
taskService.createMiddle(config);
System.out.println(config.getConfigId());
Result result=Result.success(config.getConfigId());
log.info("功能名称进入配置自动创建配置表请求URI{},请求方式:{},响应结果:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
return result;
}
/*
* : addImport
*
* : NodeOne
* :post
* */
@PostMapping("/addImport")
public Result addImport(@RequestBody NodeOne NodeOne){
log.info("功能名称输入表1添加请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(NodeOne));
taskService.addImport(NodeOne);
Result result=Result.success();
log.info("功能名称输入表1添加请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
return result;
}
/*
*
* : nodeTwo
* :post
* */
@PostMapping("/addImport2")
public Result addImport2(@RequestBody NodeTwo nodeTwo){
log.info("功能名称输入表1添加请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(nodeTwo));
taskService.addImport2(nodeTwo);
Result result=Result.success();
log.info("功能名称输入表1添加请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
return result;
}
/*
*
* : NodeTwo
* :post
* */
@PostMapping("/addImport3")
public Result addImport3(@RequestBody NodeThree nodeThree){
log.info("功能名称输入表1添加请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(nodeThree));
taskService.addImport3(nodeThree);
Result result=Result.success();
log.info("功能名称输入表1添加请求URI{},请求方式:{},请求参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
return result;
}
/*
*
* */
@PostMapping("/taskList")
public Result<List<NodeThree>> taskList(){
log.info("功能名称配置列表请求URI{},请求方式:{}",request.getRequestURI(),request.getMethod());
List<NodeThree> list = taskService.taskList();
Result<List<NodeThree>> success = Result.success(list);
log.info("功能名称配置列表请求URI{},请求方式:{},响应参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(success));
return success;
}
/*
* V1
* */
@PostMapping("/JoinList/{nodeOneDatatable}/{nodeTwoDatatable}/{nodeOneField}/{nodeTwoField}/{nodeThreeWay}")
public Result<List<NodeThree>> JoinList(@PathVariable String nodeOneDatatable,@PathVariable String nodeTwoDatatable,@PathVariable String nodeOneField,@PathVariable String nodeTwoField,@PathVariable String nodeThreeWay){
log.info("功能名称配置列表请求URI{},请求方式:{}",request.getRequestURI(),request.getMethod());
List<NodeThree> list = taskService.JoinList(nodeOneDatatable,nodeTwoDatatable,nodeOneField,nodeTwoField,nodeThreeWay);
Result<List<NodeThree>> success = Result.success(list);
log.info("功能名称配置列表请求URI{},请求方式:{},响应参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(success));
return success;
}
/*
* v2
* */
@PostMapping("/FileList/{nodeThreeId}")
public Result FileList(@PathVariable Integer nodeThreeId){
log.info("功能名称联查信息请求URI{},请求方式:{}",request.getRequestURI(),request.getMethod());
NodeThree threes = taskService.FileList(nodeThreeId);
Result result = taskService.FileLists(threes.getNodeOneDatatable(), threes.getNodeTwoDatatable(), threes.getNodeOneField(), threes.getNodeTwoField(), threes.getNodeThreeWay(),threes.getNodeFields());
Result success = Result.success(result);
log.info("功能名称联查信息请求URI{},请求方式:{},响应参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(success));
return success;
}
/*
*
* */
@PostMapping("/loading/{nodeThreeId}")
public Result loading(@PathVariable Integer nodeThreeId ){
log.info("功能名称加载信息请求URI{},请求方式:{}",request.getRequestURI(),request.getMethod());
Result result = taskService.loading(nodeThreeId);
Result<Result> success = Result.success(result);
log.info("功能名称加载信息请求URI{},请求方式:{},响应参数:{}",request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(success));
return success;
}
}

View File

@ -0,0 +1,42 @@
package com.yun.task.mapper;
import com.bwie.common.domain.*;
import com.bwie.common.result.Result;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author Dunzhida
* data 2023/7/27 16:15
* fileName TaskMapper
*/
@Mapper
public interface TaskMapper {
void addImport(NodeOne nodeOne);
void updateMiddle(Integer import1Id);
void addImport2(NodeTwo nodeTwo);
void updateMiddle2(Integer import2Id);
void createMiddle(Config config);
void addImport3(NodeThree nodeThree);
List<NodeThree> taskList();
NodeThree FileList(Integer nodeThreeId);
Integer loading(String nodeFields);
List<Map> FileLists(String nodeOneDatatable, String nodeTwoDatatable, String nodeOneField, String nodeTwoField, String nodeThreeWay, String nodeFields);
}

View File

@ -0,0 +1,46 @@
package com.yun.task.service;
import com.bwie.common.domain.*;
import com.bwie.common.result.Result;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author Dunzhida
* data 2023/7/27 16:14
* fileName TaskService
*/
public interface TaskService {
List<String> findBydatabase();
List<String> findByTable(String database);
List<Mysql> findByField(String datatable, String database);
void addImport(NodeOne nodeOne);
void addImport2(NodeTwo nodeTwo);
void createMiddle(Config config);
void addImport3(NodeThree nodeThree);
List<NodeThree> taskList();
List<NodeThree> JoinList( String nodeOneDatatable, String nodeTwoDatatable, String nodeOneField, String nodeTwoField,String nodeThreeWay);
NodeThree FileList(Integer nodeThreeId);
Result FileLists(@Param("nodeOneDatatable") String nodeOneDatatable, @Param("nodeTwoDatatable") String nodeTwoDatatable, @Param("nodeOneField") String nodeOneField, @Param("nodeTwoField") String nodeTwoField, @Param("nodeThreeWay") String nodeThreeWay,@Param("nodeFields") String nodeFields);
Result loading(Integer nodeThreeId);
}

View File

@ -0,0 +1,312 @@
package com.yun.task.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.*;
import com.bwie.common.result.Result;
import com.yun.common.core.domain.R;
import com.yun.task.mapper.TaskMapper;
import com.yun.task.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.xml.soap.Node;
import java.lang.reflect.Field;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author Dunzhida
* data 2023/7/27 16:15
* fileName TaskServiceImpl
*/
@Service
public class TaskServiceImpl implements TaskService {
@Autowired
private TaskMapper taskMapper;
// jdbcTemplate是Spring框架中的一个核心类用于简化在Java应用程序中执行SQL操作的过程。
// 提供了一种方便、灵活和安全的方式来访问数据库,并处理与数据库交互相关的细节
@Autowired
private JdbcTemplate jdbcTemplate;
/*
*
*
* daedadawpdjawiofhnoaffdmafmgmpmg
*
*
* */
/*
*
* */
@Override
public List<String> findBydatabase() {
String sql = "SELECT schema_name FROM information_schema.schemata";
return jdbcTemplate.queryForList(sql,String.class);
}
/*
*
* */
@Override
public List<String> findByTable(String database) {
String sql = "show tables from `"+database+"`";
return jdbcTemplate.queryForList(sql, String.class);
}
/*
*
* */
@Override
public List<Mysql> findByField(String datatable, String database) {
// 选择要查询的列,包括列名、数据类型、是否可为空和列注释。
String sql = "SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_COMMENT "+
// 所有列的相关信息
"FROM INFORMATION_SCHEMA.COLUMNS "+
// 通过指定的表模式和表名来筛选出特定的表。
"WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?";
// 来执行SQL查询并返回结果 执行的SQL语句 数据库名 表名
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, database, datatable);
List<Mysql> resultList = new ArrayList<>();
// 以循环的方式将查出来的字段属性存入对象中
// 列名 字段类型 是否为null 字段描述
for (Map<String, Object> row : rows) {
Mysql mysql = new Mysql();
mysql.setCOLUMNNAME((String) row.get("COLUMN_NAME"));
mysql.setDATATYPE((String) row.get("DATA_TYPE"));
mysql.setISNULLABLE((String) row.get("IS_NULLABLE"));
mysql.setCOLUMN_COMMENT((String) row.get("COLUMN_COMMENT"));
resultList.add(mysql);
}
return resultList;
}
/*
*
* */
@Override
public void addImport(NodeOne nodeOne) {
//获取输入的多个字段进行join切割 成string类型
String firstFieldsString = String.join(",", nodeOne.getNodeOneFields());
nodeOne.setNodeOneField(firstFieldsString);
taskMapper.addImport(nodeOne);
taskMapper.updateMiddle(nodeOne.getImport1Id());
}
/*
*
* */
@Override
public void addImport2(NodeTwo nodeTwo) {
//获取输入的多个字段进行join切割 成string类型
String firstFieldsString = String.join(",", nodeTwo.getNodeTwoFields());
nodeTwo.setNodeTwoField(firstFieldsString);
taskMapper.addImport2(nodeTwo);
taskMapper.updateMiddle2(nodeTwo.getImport2Id());
}
/*
* id
* */
@Override
public void createMiddle(Config config) {
taskMapper.createMiddle(config);
}
@Override
public void addImport3(NodeThree nodeThree) {
// String join = String.join(",", nodeThree.getNodeFieldArr());
// nodeThree.setNodeFields(join);
taskMapper.addImport3(nodeThree);
}
@Override
public List<NodeThree> taskList() {
List<NodeThree> threes = taskMapper.taskList();
return threes;
}
@Override
public List<NodeThree> JoinList(String nodeOneDatatable, String nodeTwoDatatable, String nodeOneField, String nodeTwoField,String nodeThreeWay) {
String substring = nodeThreeWay.substring(0 , 4);
String substring1 = nodeThreeWay.substring(4, 8);
String sql =" select * FROM "+nodeOneDatatable +" "+ substring +" "+substring1 +" "+ nodeTwoDatatable+" ON "+nodeOneDatatable+"."+nodeOneField+" = "+nodeTwoDatatable+"."+nodeTwoField;
List<NodeThree> nodeThrees = jdbcTemplate.queryForList(sql, NodeThree.class);
return nodeThrees;
}
@Override
public NodeThree FileList(Integer nodeThreeId) {
// 通过Id查询对象
NodeThree nodeThree = taskMapper.FileList(nodeThreeId);
// 获取对象内容 在进行查询返回集合
return nodeThree;
}
// String substring = nodeThreeWay.substring(0 , 4);
// String substring1 = nodeThreeWay.substring(5, 9);
// String sql =" select * FROM "+nodeOneDatatable +" "+ substring +" "+substring1 +" "+ nodeTwoDatatable+" ON "+nodeOneDatatable+"."+nodeOneField+" = "+nodeTwoDatatable+"."+nodeTwoField;
//// String sql=" SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE (TABLE_NAME = '"+nodeOneDatatable+"' OR TABLE_NAME = '"+nodeTwoDatatable+"') ORDER BY TABLE_NAME, ORDINAL_POSITION;";
// List<Map> maps = jdbcTemplate.queryForList(sql, Map.class);
//
//
//// List<Mysql> resultList = new ArrayList<>();
//// for (Map<String, Object> row : rows) {
//// Mysql mysql = new Mysql();
//// mysql.setCOLUMNNAME((String) row.get("COLUMN_NAME"));
//// mysql.setDATATYPE((String) row.get("DATA_TYPE"));
//// mysql.setISNULLABLE((String) row.get("IS_NULLABLE"));
//// mysql.setCOLUMN_COMMENT((String) row.get("COLUMN_COMMENT"));
//// resultList.add(mysql);
//// }
// return maps;
//
@Override
public Result FileLists(String nodeOneDatatable, String nodeTwoDatatable, String nodeOneField, String nodeTwoField, String nodeThreeWay,String nodeFields) {
String substring =null;
String substring1=null;
// 判断联查方式
if (nodeThreeWay.equals("left join")){
substring = nodeThreeWay.substring(0 , 4);
substring1 = nodeThreeWay.substring(5, 9);
}else if (nodeThreeWay.equals("right join")){
substring = nodeThreeWay.substring(0,5);
substring1 = nodeThreeWay.substring(6,10);
}
// 进行对源数据查询
// String sql1 =" select * FROM "+nodeOneDatatable +" "+ substring +" "+substring1 +" "+ nodeTwoDatatable+" ON "+nodeOneDatatable+"."+nodeOneField+" = "+nodeTwoDatatable+"."+nodeTwoField;
// List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql1);
//
// List<Map> maps1 = taskMapper.FileLists(nodeOneDatatable, nodeTwoDatatable, nodeOneField, nodeTwoField, nodeThreeWay, nodeFields);
//
// StringBuilder sql = new StringBuilder("insert into t_info(");
// StringBuilder resultSql = null;
// for (String s : nodeFields.split(",")) {
// sql.append(s).append(",");
// if (sql.toString().endsWith(",")){
// StringBuilder stringBuilder = new StringBuilder(sql.substring(0, sql.length() - 1));
// resultSql=stringBuilder.append(")");
// }
// }
// System.out.println("result:"+resultSql);
// System.out.println("---------------------------------------------------------------");
//
// String[] split = nodeFields.split(",");
// String value = "values(";
// for (int j = 0; j < split.length; j++) {
// value+=",#{}";
// }
// String sqlsql=resultSql+value+")";
// System.out.println(sqlsql);
Connection connection=null;
ResultSet resultSet=null;
try {
// 连接源数据
connection = DriverManager.getConnection("jdbc:mysql://124.221.14.100:3306/six", "root", "dzd123");
// 进行对源数据查询
String sql1 =" select * FROM "+nodeOneDatatable +" "+ substring +" "+substring1 +" "+ nodeTwoDatatable+" ON "+nodeOneDatatable+"."+nodeOneField+" = "+nodeTwoDatatable+"."+nodeTwoField;
PreparedStatement preparedStatement = connection.prepareStatement(sql1);
resultSet = preparedStatement.executeQuery();
// 选取需要得字段
while (resultSet.next()){
String name = resultSet.getString("name");
int age = resultSet.getInt("age");
String phone = resultSet.getString("phone");
String password = resultSet.getString("password");
String email = resultSet.getString("email");
// 连接目标系统
Connection connection1 = DriverManager.getConnection("jdbc:mysql://124.221.14.100:3306/six", "root", "dzd123");
// 数据加载到目标系统中
PreparedStatement preparedStatement1 = connection1.prepareStatement("insert into t_info (name,age,phone,password,email) values (?,?,?,?,?)");
preparedStatement1.setString(1,name);
preparedStatement1.setInt(2,age);
preparedStatement1.setString(3,phone);
preparedStatement1.setString(4,password);
preparedStatement1.setString(5,email);
preparedStatement1.executeUpdate();
preparedStatement1.close();
connection1.close();
}
preparedStatement.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}finally {
try {
if (resultSet!=null){
resultSet.close();
}
if (connection!=null){
connection.close();
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
return Result.success("完成");
}
@Override
public Result loading(Integer nodeThreeId) {
// String sql="insert into "+nodeThree.getNodeOneDatatable() +" VALUES ( "+nodeThree.getNodeOneField()+" )";
// String nodeFields = String.join(",", nodeThree.getNodeFieldArr());
NodeThree nodeThree = taskMapper.FileList(nodeThreeId);
Integer integer= taskMapper.loading(nodeThree.getNodeFields());
return Result.success(integer);
}
}

View File

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9636
# Spring
spring:
application:
# 应用名称
name: etl-task
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 10.21.21.4:8848
config:
# 配置中心地址
server-addr: 10.21.21.4:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yun.task.mapper.TaskMapper">
<insert id="addImport">
INSERT INTO `shengshixian`.`t_node_one` ( `node_one_id`, `node_one_database`, `node_one_datatable`, `node_one_field`, `import1_id` )
VALUES
( 0,#{nodeOneDatabase},#{nodeOneDatatable},#{nodeOneField},#{import1Id} );;
</insert>
<insert id="addImport2">
INSERT INTO `shengshixian`.`t_node_two` (`node_two_id`, `node_two_database`, `node_two_datatable`, `node_two_field`, `import2_id`)
VALUES (0,#{nodeTwoDatabase},#{nodeTwoDatatable},#{nodeTwoField},#{import2Id});
</insert>
<insert id="createMiddle" keyProperty="configId" useGeneratedKeys="true">
INSERT INTO `shengshixian`.`t_config` (`config_id`, `improt1_id`, `improt2_id`, `improt3_id`)
VALUES (0,0,0,0);
</insert>
<insert id="addImport3">
INSERT INTO `shengshixian`.`t_node_three` (`node_three_id`, `node_one_datatable`, `node_one_field`, `node_three_way`, `node_two_datatable`, `node_two_field`, `import3_id`,`node_fields`)
VALUES (0,#{nodeOneDatatable},#{nodeOneField},#{nodeThreeWay},#{nodeTwoDatatable},#{nodeTwoField},1,#{nodeFields});
</insert>
<insert id="loading">
INSERT INTO `six`.`t_info` (`id`, `name`) VALUES (0, #{nodeFields});
</insert>
<update id="updateMiddle">
update t_config set improt1_id=#{improt1Id} where config_id=#{import1Id}
</update>
<update id="updateMiddle2">
update t_config set improt2_id=#{improt2Id} where config_id=#{import2Id}
</update>
<select id="taskList" resultType="com.bwie.common.domain.NodeThree">
select * from t_node_three
</select>
<select id="FileList" resultType="com.bwie.common.domain.NodeThree">
select *from t_node_three where node_three_id=#{nodeThreeId}
</select>
</mapper>

View File

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9636
# Spring
spring:
application:
# 应用名称
name: etl-task
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 10.21.21.4:8848
config:
# 配置中心地址
server-addr: 10.21.21.4:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yun.task.mapper.TaskMapper">
<insert id="addImport">
INSERT INTO `shengshixian`.`t_node_one` ( `node_one_id`, `node_one_database`, `node_one_datatable`, `node_one_field`, `import1_id` )
VALUES
( 0,#{nodeOneDatabase},#{nodeOneDatatable},#{nodeOneField},#{import1Id} );;
</insert>
<insert id="addImport2">
INSERT INTO `shengshixian`.`t_node_two` (`node_two_id`, `node_two_database`, `node_two_datatable`, `node_two_field`, `import2_id`)
VALUES (0,#{nodeTwoDatabase},#{nodeTwoDatatable},#{nodeTwoField},#{import2Id});
</insert>
<insert id="createMiddle" keyProperty="configId" useGeneratedKeys="true">
INSERT INTO `shengshixian`.`t_config` (`config_id`, `improt1_id`, `improt2_id`, `improt3_id`)
VALUES (0,0,0,0);
</insert>
<insert id="addImport3">
INSERT INTO `shengshixian`.`t_node_three` (`node_three_id`, `node_one_datatable`, `node_one_field`, `node_three_way`, `node_two_datatable`, `node_two_field`, `import3_id`,`node_fields`)
VALUES (0,#{nodeOneDatatable},#{nodeOneField},#{nodeThreeWay},#{nodeTwoDatatable},#{nodeTwoField},1,#{nodeFields});
</insert>
<insert id="loading">
INSERT INTO `six`.`t_info` (`id`, `name`) VALUES (0, #{nodeFields});
</insert>
<update id="updateMiddle">
update t_config set improt1_id=#{improt1Id} where config_id=#{import1Id}
</update>
<update id="updateMiddle2">
update t_config set improt2_id=#{improt2Id} where config_id=#{import2Id}
</update>
<select id="taskList" resultType="com.bwie.common.domain.NodeThree">
select * from t_node_three
</select>
<select id="FileList" resultType="com.bwie.common.domain.NodeThree">
select *from t_node_three where node_three_id=#{nodeThreeId}
</select>
</mapper>

View File

@ -0,0 +1,5 @@
#Generated by Maven
#Fri Aug 04 10:38:46 CST 2023
version=3.6.3
groupId=com.yun
artifactId=etl-task-schdeling-server

View File

@ -0,0 +1,8 @@
com\yun\task\Demo.class
com\yun\task\controller\TaskController.class
com\yun\task\MazePra.class
com\yun\task\Demo2.class
com\yun\task\mapper\TaskMapper.class
com\yun\task\service\TaskService.class
com\yun\task\service\impl\TaskServiceImpl.class
com\yun\task\TaskApplication.class

View File

@ -0,0 +1,8 @@
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\test.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\service\TaskService.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\service\impl\TaskServiceImpl.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\Demo.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\controller\TaskController.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\mapper\TaskMapper.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\Demo2.java
D:\项目\etl-task-scheduling\etl-task-schdeling-server\src\main\java\com\yun\task\TaskApplication.java

35
pom.xml 100644
View File

@ -0,0 +1,35 @@
<?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.yun</groupId>
<artifactId>yun-parent</artifactId>
<version>3.6.3</version>
</parent>
<modules>
<module>etl-task-schdeling-common</module>
<module>etl-task-schdeling-remote</module>
<module>etl-task-schdeling-server</module>
</modules>
<artifactId>etl-task-scheduling</artifactId>
<version>3.6.3</version>
<packaging>pom</packaging>
<description>
etl-task-scheduling任务调度
</description>
<distributionManagement>
<repository>
<id>21-releases</id>
<name>21-releases</name>
<url>http://10.21.21.3/repository/maven-releases/</url>
</repository>
</distributionManagement>
</project>