git init
commit
7e2d0adb86
|
@ -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/
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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 = "操作异常";
|
||||
}
|
|
@ -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";
|
||||
|
||||
}
|
|
@ -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";
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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是否为空, 包含List,Set,Queue
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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>
|
|
@ -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>
|
Binary file not shown.
|
@ -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
|
|
@ -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>
|
|
@ -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>
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
* 返回结果:Mysql对象list集合
|
||||
* */
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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}
|
|
@ -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>
|
|
@ -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}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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>
|
Binary file not shown.
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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>
|
Loading…
Reference in New Issue