正在显示
53 个修改的文件
包含
2673 行增加
和
0 行删除
.gitignore
0 → 100644
1 | +HELP.md | ||
2 | +target/ | ||
3 | +!.mvn/wrapper/maven-wrapper.jar | ||
4 | +!**/src/main/**/target/ | ||
5 | +!**/src/test/**/target/ | ||
6 | + | ||
7 | +### STS ### | ||
8 | +.apt_generated | ||
9 | +.classpath | ||
10 | +.factorypath | ||
11 | +.project | ||
12 | +.settings | ||
13 | +.springBeans | ||
14 | +.sts4-cache | ||
15 | + | ||
16 | +### IntelliJ IDEA ### | ||
17 | +.idea | ||
18 | +*.iws | ||
19 | +*.iml | ||
20 | +*.ipr | ||
21 | + | ||
22 | +### NetBeans ### | ||
23 | +/nbproject/private/ | ||
24 | +/nbbuild/ | ||
25 | +/dist/ | ||
26 | +/nbdist/ | ||
27 | +/.nb-gradle/ | ||
28 | +build/ | ||
29 | +!**/src/main/**/build/ | ||
30 | +!**/src/test/**/build/ | ||
31 | + | ||
32 | +### VS Code ### | ||
33 | +.vscode/ |
.metadata/.lock
0 → 100644
.metadata/.log
0 → 100644
1 | +!SESSION 2024-08-30 12:48:33.221 ----------------------------------------------- | ||
2 | +eclipse.buildId=4.12.0.202109130635 | ||
3 | +java.version=16.0.2 | ||
4 | +java.vendor=Oracle Corporation | ||
5 | +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN | ||
6 | +Framework arguments: -product org.springframework.boot.ide.branding.sts4 | ||
7 | +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.springframework.boot.ide.branding.sts4 | ||
8 | + | ||
9 | +!ENTRY org.eclipse.jface 2 0 2024-08-30 12:49:00.733 | ||
10 | +!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation. | ||
11 | +!SUBENTRY 1 org.eclipse.jface 2 0 2024-08-30 12:49:00.733 | ||
12 | +!MESSAGE A conflict occurred for CTRL+SHIFT+T: | ||
13 | +Binding(CTRL+SHIFT+T, | ||
14 | + ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type, | ||
15 | + Open a type in a Java editor, | ||
16 | + Category(org.eclipse.ui.category.navigate,Navigate,null,true), | ||
17 | + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@169d1f92, | ||
18 | + ,,true),null), | ||
19 | + org.eclipse.ui.defaultAcceleratorConfiguration, | ||
20 | + org.eclipse.ui.contexts.window,,,system) | ||
21 | +Binding(CTRL+SHIFT+T, | ||
22 | + ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace, | ||
23 | + , | ||
24 | + Category(org.eclipse.lsp4e.category,Language Servers,null,true), | ||
25 | + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@7fcbc336, | ||
26 | + ,,true),null), | ||
27 | + org.eclipse.ui.defaultAcceleratorConfiguration, | ||
28 | + org.eclipse.ui.contexts.window,,,system) | ||
29 | + | ||
30 | +!ENTRY org.eclipse.egit.ui 2 0 2024-08-30 12:49:03.524 | ||
31 | +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git | ||
32 | +user global configuration and to define the default location to store repositories: 'C:\Users\woshiyedai'. If this is | ||
33 | +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and | ||
34 | +EGit might behave differently since they see different configuration options. | ||
35 | +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. | ||
36 | + | ||
37 | +!ENTRY org.eclipse.ui 2 2 2024-08-30 12:50:50.298 | ||
38 | +!MESSAGE Invalid property category path: org.springframework.ide.eclipse.beans.ui.properties.ProjectPropertyPage (bundle: org.springframework.ide.eclipse.xml.namespaces, propertyPage: org.springframework.ide.eclipse.beans.ui.namespaces.projectPropertyPage) | ||
39 | +!SESSION 2024-08-30 12:50:51.729 ----------------------------------------------- | ||
40 | +eclipse.buildId=4.12.0.202109130635 | ||
41 | +java.version=16.0.2 | ||
42 | +java.vendor=Oracle Corporation | ||
43 | +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN | ||
44 | +Framework arguments: -product org.springframework.boot.ide.branding.sts4 | ||
45 | +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.springframework.boot.ide.branding.sts4 | ||
46 | + | ||
47 | +!ENTRY org.eclipse.jface 2 0 2024-08-30 12:50:56.452 | ||
48 | +!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation. | ||
49 | +!SUBENTRY 1 org.eclipse.jface 2 0 2024-08-30 12:50:56.452 | ||
50 | +!MESSAGE A conflict occurred for CTRL+SHIFT+T: | ||
51 | +Binding(CTRL+SHIFT+T, | ||
52 | + ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type, | ||
53 | + Open a type in a Java editor, | ||
54 | + Category(org.eclipse.ui.category.navigate,Navigate,null,true), | ||
55 | + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@742dbac8, | ||
56 | + ,,true),null), | ||
57 | + org.eclipse.ui.defaultAcceleratorConfiguration, | ||
58 | + org.eclipse.ui.contexts.window,,,system) | ||
59 | +Binding(CTRL+SHIFT+T, | ||
60 | + ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace, | ||
61 | + , | ||
62 | + Category(org.eclipse.lsp4e.category,Language Servers,null,true), | ||
63 | + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@2ce62e27, | ||
64 | + ,,true),null), | ||
65 | + org.eclipse.ui.defaultAcceleratorConfiguration, | ||
66 | + org.eclipse.ui.contexts.window,,,system) | ||
67 | + | ||
68 | +!ENTRY org.eclipse.egit.ui 2 0 2024-08-30 12:50:58.875 | ||
69 | +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git | ||
70 | +user global configuration and to define the default location to store repositories: 'C:\Users\woshiyedai'. If this is | ||
71 | +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and | ||
72 | +EGit might behave differently since they see different configuration options. | ||
73 | +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. | ||
74 | + | ||
75 | +!ENTRY org.eclipse.ui 2 2 2024-08-30 12:51:16.694 | ||
76 | +!MESSAGE Invalid property category path: org.springframework.ide.eclipse.beans.ui.properties.ProjectPropertyPage (bundle: org.springframework.ide.eclipse.xml.namespaces, propertyPage: org.springframework.ide.eclipse.beans.ui.namespaces.projectPropertyPage) |
.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location
0 → 100644
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
此 diff 太大无法显示。
不能预览此文件类型
不能预览此文件类型
1 | +java |
不能预览此文件类型
不能预览此文件类型
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<section name="Workbench"> | ||
3 | + <section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart"> | ||
4 | + <item key="group_libraries" value="true"/> | ||
5 | + <item key="layout" value="2"/> | ||
6 | + <item key="rootMode" value="1"/> | ||
7 | + <item key="linkWithEditor" value="false"/> | ||
8 | + <item key="memento" value="<?xml version="1.0" encoding="UTF-8"?>
<packageExplorer group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="">
<customFilters userDefinedPatternsEnabled="false">
<xmlDefinedFilters>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.StaticsFilter" isEnabled="false"/>
<child filterId="org.eclipse.buildship.ui.packageexplorer.filter.gradle.buildfolder" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter" isEnabled="true"/>
<child filterId="org.eclipse.m2e.MavenModuleFilter" isEnabled="false"/>
<child filterId="org.eclipse.buildship.ui.packageexplorer.filter.gradle.subProject" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.pde.ui.BinaryProjectFilter1" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter" isEnabled="false"/>
<child filterId="org.eclipse.pde.ui.ExternalPluginLibrariesFilter1" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.FieldsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.DeprecatedMembersFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter" isEnabled="false"/>
</xmlDefinedFilters>
</customFilters>
</packageExplorer>"/> | ||
9 | + </section> | ||
10 | +</section> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<section name="Workbench"> | ||
3 | + <section name="MavenProjectImportWizardPage"> | ||
4 | + <list key="rootDirectory"> | ||
5 | + <item value="D:\workspace\syncData"/> | ||
6 | + </list> | ||
7 | + <list key="projectNameTemplate"> | ||
8 | + <item value="[artifactId]"/> | ||
9 | + <item value="[artifactId]-TRUNK"/> | ||
10 | + <item value="[artifactId]-[version]"/> | ||
11 | + <item value="[groupId].[artifactId]"/> | ||
12 | + <item value="[groupId].[artifactId]-[version]"/> | ||
13 | + <item value="[name]"/> | ||
14 | + </list> | ||
15 | + </section> | ||
16 | +</section> |
不能预览此文件类型
1 | +2024-08-30 12:49:03,505 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update. | ||
2 | +2024-08-30 12:50:58,854 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. |
.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.16.1.20210603-1006.xml
0 → 100644
1 | +<configuration scan="true"> | ||
2 | + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
3 | + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
4 | + <pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern> | ||
5 | + </encoder> | ||
6 | + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
7 | + <level>OFF</level> <!-- change to DEBUG to mimic '-consolelog' behaviour --> | ||
8 | + </filter> | ||
9 | + </appender> | ||
10 | + | ||
11 | + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
12 | + <File>${org.eclipse.m2e.log.dir}/0.log</File> | ||
13 | + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> | ||
14 | + <FileNamePattern>${org.eclipse.m2e.log.dir}/%i.log</FileNamePattern> | ||
15 | + <MinIndex>1</MinIndex> | ||
16 | + <MaxIndex>10</MaxIndex> | ||
17 | + </rollingPolicy> | ||
18 | + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> | ||
19 | + <MaxFileSize>100MB</MaxFileSize> | ||
20 | + </triggeringPolicy> | ||
21 | + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
22 | + <pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern> | ||
23 | + </encoder> | ||
24 | + </appender> | ||
25 | + | ||
26 | + <appender name="EclipseLog" class="org.eclipse.m2e.logback.appender.EclipseLogAppender"> | ||
27 | + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||
28 | + <level>WARN</level> | ||
29 | + </filter> | ||
30 | + </appender> | ||
31 | + | ||
32 | + <appender name="MavenConsoleLog" class="org.eclipse.m2e.logback.appender.MavenConsoleAppender"> | ||
33 | + </appender> | ||
34 | + | ||
35 | + <root level="INFO"> | ||
36 | + <appender-ref ref="FILE" /> | ||
37 | + <appender-ref ref="STDOUT" /> | ||
38 | + <appender-ref ref="EclipseLog" /> | ||
39 | + <appender-ref ref="MavenConsoleLog" /> | ||
40 | + </root> | ||
41 | + | ||
42 | + <logger name="com.ning.http.client" level="INFO" /> | ||
43 | +<logger name="net.schmizz" level="OFF" /> | ||
44 | +</configuration> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<section name="Workbench"> | ||
3 | + <list key="installedFeatures"> | ||
4 | + <item value="com.ianbrandt.tools.m2e.mdp.feature:0.0.4.201409291703"/> | ||
5 | + <item value="net.mihai-nita.ansicon:1.4.4.202102080044"/> | ||
6 | + <item value="org.eclipse.buildship:3.1.5.v20210113-0929"/> | ||
7 | + <item value="org.eclipse.egit.gitflow.feature:5.13.0.202109080827-r"/> | ||
8 | + <item value="org.eclipse.egit:5.13.0.202109080827-r"/> | ||
9 | + <item value="org.eclipse.emf.common:2.31.0.v20240314-0928"/> | ||
10 | + <item value="org.eclipse.emf.ecore:2.37.0.v20240203-0859"/> | ||
11 | + <item value="org.eclipse.epp.mpc:1.9.1.v20210204-1408"/> | ||
12 | + <item value="org.eclipse.help:2.3.700.v20210906-0500"/> | ||
13 | + <item value="org.eclipse.jdt:3.18.900.v20210906-0500"/> | ||
14 | + <item value="org.eclipse.jgit.gpg.bc:6.10.0.202406032230-r"/> | ||
15 | + <item value="org.eclipse.jgit.http.apache:5.13.0.202109080827-r"/> | ||
16 | + <item value="org.eclipse.jgit.lfs:5.13.0.202109080827-r"/> | ||
17 | + <item value="org.eclipse.jgit.ssh.apache:5.13.0.202109080827-r"/> | ||
18 | + <item value="org.eclipse.jgit:5.13.0.202109080827-r"/> | ||
19 | + <item value="org.eclipse.jst.common.fproj.enablement.jdt:3.23.0.v202108200205"/> | ||
20 | + <item value="org.eclipse.justj.openjdk.hotspot.jre.full:16.0.2.v20210721-1149"/> | ||
21 | + <item value="org.eclipse.m2e.feature:1.18.1.20210618-2246"/> | ||
22 | + <item value="org.eclipse.m2e.logback.feature:1.17.1.20210603-1006"/> | ||
23 | + <item value="org.eclipse.m2e.wtp.feature:1.4.4.20201128-1705"/> | ||
24 | + <item value="org.eclipse.mylyn.wikitext.editors_feature:3.0.39.202102270010"/> | ||
25 | + <item value="org.eclipse.pde:3.14.900.v20210906-0500"/> | ||
26 | + <item value="org.eclipse.platform:4.21.0.v20210906-0842"/> | ||
27 | + <item value="org.eclipse.rcp:4.21.0.v20210906-0842"/> | ||
28 | + <item value="org.eclipse.tm.terminal.connector.ssh.feature:10.4.0.202106130052"/> | ||
29 | + <item value="org.eclipse.tm.terminal.control.feature:10.4.0.202107100131"/> | ||
30 | + <item value="org.eclipse.tm.terminal.feature:10.4.0.202106130052"/> | ||
31 | + <item value="org.eclipse.tm.terminal.view.feature:10.4.0.202108241639"/> | ||
32 | + <item value="org.eclipse.userstorage:1.2.0.v20210517-0327"/> | ||
33 | + <item value="org.eclipse.wst.common.fproj:3.7.3.v202007142017"/> | ||
34 | + <item value="org.eclipse.wst.json_ui.feature:1.1.10.v202103121626"/> | ||
35 | + <item value="org.eclipse.wst.web_ui.feature:3.23.0.v202107272335"/> | ||
36 | + <item value="org.eclipse.wst.xml_ui.feature:3.23.0.v202107101937"/> | ||
37 | + <item value="org.jboss.tools.m2e.wro4j.feature:1.1.0.201406251020"/> | ||
38 | + <item value="org.jboss.tools.maven.apt.feature:1.5.2.201812241535"/> | ||
39 | + <item value="org.sonatype.m2e.buildhelper.feature:0.15.0.201207090124"/> | ||
40 | + <item value="org.sonatype.m2e.egit.feature:0.15.1.201806191431"/> | ||
41 | + <item value="org.sonatype.m2e.mavenarchiver.feature:0.17.5.202002191804"/> | ||
42 | + </list> | ||
43 | + <section name="ExternalProjectImportWizard"> | ||
44 | + </section> | ||
45 | +</section> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<workingSetManager> | ||
3 | +<workingSet editPageId="org.eclipse.jdt.internal.ui.DynamicSourcesWorkingSet" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1724993341454_0" label="Java Main Sources" name="Java Main Sources"/> | ||
4 | +<workingSet editPageId="org.eclipse.jdt.internal.ui.DynamicSourcesWorkingSet" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1724993341467_1" label="Java Test Sources" name="Java Test Sources"/> | ||
5 | +<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1724993343206_2" label="Window Working Set" name="Aggregate for window 1724993343206"/> | ||
6 | +</workingSetManager> |
.metadata/version.ini
0 → 100644
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + <groupId>org.yrhl</groupId> | ||
6 | + <artifactId>syncData</artifactId> | ||
7 | + <version>0.0.1-SNAPSHOT</version> | ||
8 | + <name>syncData</name> | ||
9 | + <description>syncData</description> | ||
10 | + <properties> | ||
11 | + <java.version>1.8</java.version> | ||
12 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
13 | + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
14 | + <spring-boot.version>2.6.13</spring-boot.version> | ||
15 | + <sqlserver.version>4.0</sqlserver.version> | ||
16 | + <mybatisplus.version>3.3.1</mybatisplus.version> | ||
17 | + <druid.version>1.2.13</druid.version> | ||
18 | + <mysql.version>8.0.18</mysql.version> | ||
19 | + <mssql.driver.version>1.3.1</mssql.driver.version> | ||
20 | + <mybatis-spring.version>2.2.2</mybatis-spring.version> | ||
21 | + <hutool.version>5.1.2</hutool.version> | ||
22 | + <knife4j.version>3.0.3</knife4j.version> | ||
23 | + </properties> | ||
24 | + <dependencies> | ||
25 | + <dependency> | ||
26 | + <groupId>org.springframework.boot</groupId> | ||
27 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
28 | + </dependency> | ||
29 | + <dependency> | ||
30 | + <groupId>org.springframework.boot</groupId> | ||
31 | + <artifactId>spring-boot-starter-web</artifactId> | ||
32 | + </dependency> | ||
33 | + <dependency> | ||
34 | + <groupId>org.springframework.boot</groupId> | ||
35 | + <artifactId>spring-boot-starter-test</artifactId> | ||
36 | + <scope>test</scope> | ||
37 | + </dependency> | ||
38 | + <dependency> | ||
39 | + <groupId>com.h2database</groupId> | ||
40 | + <artifactId>h2</artifactId> | ||
41 | + <scope>runtime</scope> | ||
42 | + </dependency> | ||
43 | + <!-- AOP begin --> | ||
44 | + <dependency> | ||
45 | + <groupId>org.aspectj</groupId> | ||
46 | + <artifactId>aspectjrt</artifactId> | ||
47 | + <version>1.7.4</version> | ||
48 | + </dependency> | ||
49 | + <dependency> | ||
50 | + <groupId>org.aspectj</groupId> | ||
51 | + <artifactId>aspectjweaver</artifactId> | ||
52 | + <version>1.7.4</version> | ||
53 | + </dependency> | ||
54 | + <dependency> | ||
55 | + <groupId>cglib</groupId> | ||
56 | + <artifactId>cglib</artifactId> | ||
57 | + <version>3.1</version> | ||
58 | + </dependency> | ||
59 | + <!-- AOP end --> | ||
60 | + <!-- sqlserver驱动 --> | ||
61 | + <dependency> | ||
62 | + <groupId>com.alibaba</groupId> | ||
63 | + <artifactId>druid-spring-boot-starter</artifactId> | ||
64 | + <version>${druid.version}</version> | ||
65 | + </dependency> | ||
66 | + | ||
67 | + <dependency> | ||
68 | + <groupId>mysql</groupId> | ||
69 | + <artifactId>mysql-connector-java</artifactId> | ||
70 | + <version>${mysql.version}</version> | ||
71 | + </dependency> | ||
72 | + | ||
73 | + <dependency> | ||
74 | + <groupId>org.mybatis.spring.boot</groupId> | ||
75 | + <artifactId>mybatis-spring-boot-starter</artifactId> | ||
76 | + <version>${mybatis-spring.version}</version> | ||
77 | + </dependency> | ||
78 | + <!--mybatis-plus --> | ||
79 | + <dependency> | ||
80 | + <groupId>com.baomidou</groupId> | ||
81 | + <artifactId>mybatis-plus-boot-starter</artifactId> | ||
82 | + <version>${mybatisplus.version}</version> | ||
83 | + <exclusions> | ||
84 | + <exclusion> | ||
85 | + <groupId>com.baomidou</groupId> | ||
86 | + <artifactId>mybatis-plus-generator</artifactId> | ||
87 | + </exclusion> | ||
88 | + </exclusions> | ||
89 | + </dependency> | ||
90 | + <dependency> | ||
91 | + <groupId>net.sourceforge.jtds</groupId> | ||
92 | + <artifactId>jtds</artifactId> | ||
93 | + <version>${mssql.driver.version}</version> | ||
94 | + <scope>runtime</scope> | ||
95 | + </dependency> | ||
96 | + | ||
97 | + <dependency> | ||
98 | + <groupId>cn.hutool</groupId> | ||
99 | + <artifactId>hutool-all</artifactId> | ||
100 | + <version>${hutool.version}</version> | ||
101 | + </dependency> | ||
102 | + <!-- swaggerconf--> | ||
103 | + <!-- <dependency> | ||
104 | + <groupId>com.github.xiaoymin</groupId> | ||
105 | + <artifactId>knife4j-spring-boot-starter</artifactId> | ||
106 | + <version>${knife4j.version}</version> | ||
107 | + </dependency>--> | ||
108 | + <dependency> | ||
109 | + <groupId>org.springframework.boot</groupId> | ||
110 | + <artifactId>spring-boot-configuration-processor</artifactId> | ||
111 | + <optional>true</optional> | ||
112 | + </dependency> | ||
113 | + <!-- lombok --> | ||
114 | + <dependency> | ||
115 | + <groupId>org.projectlombok</groupId> | ||
116 | + <artifactId>lombok</artifactId> | ||
117 | + <optional>true</optional> | ||
118 | + </dependency> | ||
119 | + <dependency> | ||
120 | + <groupId>com.baomidou</groupId> | ||
121 | + <artifactId>mybatis-plus-boot-starter</artifactId> | ||
122 | + <version>${mybatisplus.version}</version> | ||
123 | + </dependency> | ||
124 | + | ||
125 | + </dependencies> | ||
126 | + <dependencyManagement> | ||
127 | + <dependencies> | ||
128 | + <dependency> | ||
129 | + <groupId>org.springframework.boot</groupId> | ||
130 | + <artifactId>spring-boot-dependencies</artifactId> | ||
131 | + <version>${spring-boot.version}</version> | ||
132 | + <type>pom</type> | ||
133 | + <scope>import</scope> | ||
134 | + </dependency> | ||
135 | + </dependencies> | ||
136 | + </dependencyManagement> | ||
137 | + | ||
138 | + <build> | ||
139 | + <plugins> | ||
140 | + <plugin> | ||
141 | + <groupId>org.apache.maven.plugins</groupId> | ||
142 | + <artifactId>maven-compiler-plugin</artifactId> | ||
143 | + <version>3.8.1</version> | ||
144 | + <configuration> | ||
145 | + <source>1.8</source> | ||
146 | + <target>1.8</target> | ||
147 | + <encoding>UTF-8</encoding> | ||
148 | + </configuration> | ||
149 | + </plugin> | ||
150 | + <plugin> | ||
151 | + <groupId>org.springframework.boot</groupId> | ||
152 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
153 | + <version>${spring-boot.version}</version> | ||
154 | + <configuration> | ||
155 | + <mainClass>org.yrhl.syncdata.SyncDataApplication</mainClass> | ||
156 | + <skip>true</skip> | ||
157 | + </configuration> | ||
158 | + <executions> | ||
159 | + <execution> | ||
160 | + <id>repackage</id> | ||
161 | + <goals> | ||
162 | + <goal>repackage</goal> | ||
163 | + </goals> | ||
164 | + </execution> | ||
165 | + </executions> | ||
166 | + </plugin> | ||
167 | + </plugins> | ||
168 | + </build> | ||
169 | + | ||
170 | + <!-- 阿里云maven仓库 --> | ||
171 | + <repositories> | ||
172 | + <repository> | ||
173 | + <id>public</id> | ||
174 | + <name>aliyun nexus</name> | ||
175 | + <url>https://maven.aliyun.com/repository/public/</url> | ||
176 | + <releases> | ||
177 | + <enabled>true</enabled> | ||
178 | + </releases> | ||
179 | + </repository> | ||
180 | + </repositories> | ||
181 | + | ||
182 | + <pluginRepositories> | ||
183 | + <pluginRepository> | ||
184 | + <id>public</id> | ||
185 | + <name>aliyun nexus</name> | ||
186 | + <url>https://maven.aliyun.com/repository/public/</url> | ||
187 | + <releases> | ||
188 | + <enabled>true</enabled> | ||
189 | + </releases> | ||
190 | + <snapshots> | ||
191 | + <enabled>false</enabled> | ||
192 | + </snapshots> | ||
193 | + </pluginRepository> | ||
194 | + </pluginRepositories> | ||
195 | + | ||
196 | + | ||
197 | +</project> |
1 | +package org.yrhl.syncdata.Retention; | ||
2 | + | ||
3 | +import java.lang.annotation.ElementType; | ||
4 | +import java.lang.annotation.Retention; | ||
5 | +import java.lang.annotation.RetentionPolicy; | ||
6 | +import java.lang.annotation.Target; | ||
7 | + | ||
8 | +/** | ||
9 | + * 描述: | ||
10 | + * | ||
11 | + * @author : zzq | ||
12 | + * @date : 2024-06-02 12:36 | ||
13 | + **/ | ||
14 | +@Target(ElementType.METHOD) | ||
15 | +@Retention(RetentionPolicy.RUNTIME) | ||
16 | +public @interface BatchInsert { | ||
17 | +} | ||
18 | + |
1 | +package org.yrhl.syncdata; | ||
2 | + | ||
3 | +import org.mybatis.spring.annotation.MapperScan; | ||
4 | +import org.springframework.boot.SpringApplication; | ||
5 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
6 | +import org.springframework.context.annotation.ComponentScan; | ||
7 | + | ||
8 | +@SpringBootApplication | ||
9 | +@MapperScan("org.yrhl.syncdata.mapper") | ||
10 | +public class SyncDataApplication { | ||
11 | + | ||
12 | + public static void main(String[] args) { | ||
13 | + SpringApplication.run(SyncDataApplication.class, args); | ||
14 | + System.out.println("启动成功"); | ||
15 | + } | ||
16 | + | ||
17 | +} |
1 | +package org.yrhl.syncdata.config; | ||
2 | +import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; | ||
3 | +import org.apache.ibatis.session.SqlSessionFactory; | ||
4 | +import org.mybatis.spring.SqlSessionFactoryBean; | ||
5 | +import org.mybatis.spring.SqlSessionTemplate; | ||
6 | +import org.mybatis.spring.annotation.MapperScan; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
9 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
10 | +import org.springframework.boot.jdbc.DataSourceBuilder; | ||
11 | +import org.springframework.context.annotation.Bean; | ||
12 | +import org.springframework.context.annotation.Configuration; | ||
13 | +import org.springframework.context.annotation.Primary; | ||
14 | +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | ||
15 | +import javax.annotation.Resource; | ||
16 | +import javax.sql.DataSource; | ||
17 | +/** | ||
18 | + * | ||
19 | + * @date :Created in 2023/12/2 19:51 | ||
20 | + * @description:本地数据源 | ||
21 | + * @modified By: | ||
22 | + * @version: | ||
23 | + */ | ||
24 | +@Configuration | ||
25 | +@MapperScan(basePackages = "org.yrhl.syncdata.mapper.local", sqlSessionTemplateRef = "sqlSessionTemplate1") | ||
26 | +public class MybatisLocalConfig { | ||
27 | + @Bean | ||
28 | + @ConfigurationProperties(prefix = "spring.datasource.local") | ||
29 | + public DataSource dataSource1() { | ||
30 | + return DataSourceBuilder.create().build(); | ||
31 | + } | ||
32 | + @Bean | ||
33 | + public SqlSessionFactory sqlSessionFactory1(@Qualifier("dataSource1") DataSource dataSource) throws Exception { | ||
34 | + MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); | ||
35 | + factoryBean.setDataSource(dataSource); | ||
36 | + // 设置mapper.xml文件的位置 | ||
37 | + factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:localmapper/*.xml")); | ||
38 | + return factoryBean.getObject(); | ||
39 | + } | ||
40 | + @Bean | ||
41 | + public SqlSessionTemplate sqlSessionTemplate1(@Qualifier("sqlSessionFactory1") SqlSessionFactory sqlSessionFactory) { | ||
42 | + return new SqlSessionTemplate(sqlSessionFactory); | ||
43 | + } | ||
44 | +} |
1 | +package org.yrhl.syncdata.config; | ||
2 | +import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; | ||
3 | +import org.apache.ibatis.session.SqlSessionFactory; | ||
4 | +import org.mybatis.spring.SqlSessionFactoryBean; | ||
5 | +import org.mybatis.spring.SqlSessionTemplate; | ||
6 | +import org.mybatis.spring.annotation.MapperScan; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
9 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
10 | +import org.springframework.boot.jdbc.DataSourceBuilder; | ||
11 | +import org.springframework.context.annotation.Bean; | ||
12 | +import org.springframework.context.annotation.Configuration; | ||
13 | +import org.springframework.context.annotation.Primary; | ||
14 | +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | ||
15 | +import javax.annotation.Resource; | ||
16 | +import javax.sql.DataSource; | ||
17 | +/** | ||
18 | + * | ||
19 | + * @date :Created in 2023/12/2 19:51 | ||
20 | + * @description:本地数据源 | ||
21 | + * @modified By: | ||
22 | + * @version: | ||
23 | + */ | ||
24 | +@Configuration | ||
25 | +@MapperScan(basePackages = "org.yrhl.syncdata.mapper.remote", sqlSessionTemplateRef = "sqlSessionTemplate2") | ||
26 | +public class MybatisRemoteConfig { | ||
27 | + @Bean | ||
28 | + @ConfigurationProperties(prefix = "spring.datasource.remote") | ||
29 | + public DataSource dataSource2() { | ||
30 | + return DataSourceBuilder.create().build(); | ||
31 | + } | ||
32 | + @Bean | ||
33 | + public SqlSessionFactory sqlSessionFactory2(@Qualifier("dataSource2") DataSource dataSource) throws Exception { | ||
34 | + MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); | ||
35 | + factoryBean.setDataSource(dataSource); | ||
36 | + // 设置mapper.xml文件的位置 | ||
37 | + factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:remotemapper/*.xml")); | ||
38 | + return factoryBean.getObject(); | ||
39 | + } | ||
40 | + @Bean | ||
41 | + public SqlSessionTemplate sqlSessionTemplate2(@Qualifier("sqlSessionFactory2") SqlSessionFactory sqlSessionFactory) { | ||
42 | + return new SqlSessionTemplate(sqlSessionFactory); | ||
43 | + } | ||
44 | +} |
1 | +package org.yrhl.syncdata.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
6 | +import lombok.Data; | ||
7 | +import lombok.EqualsAndHashCode; | ||
8 | + | ||
9 | +import java.util.Date; | ||
10 | + | ||
11 | +/** | ||
12 | + * 一网同步推送结果 | ||
13 | + * | ||
14 | + * @author Mark sunlightcs@gmail.com | ||
15 | + * @since 1.0.0 2022-04-25 | ||
16 | + */ | ||
17 | +@Data | ||
18 | +@EqualsAndHashCode(callSuper=false) | ||
19 | +@TableName("allinonepushresults") | ||
20 | +public class AllinonepushresultsEntity extends BaseEntity { | ||
21 | + private static final long serialVersionUID = 1L; | ||
22 | + | ||
23 | + /** | ||
24 | + * 租户编码 | ||
25 | + */ | ||
26 | + @TableField(fill = FieldFill.INSERT) | ||
27 | + private Long tenantCode; | ||
28 | + /** | ||
29 | + * | ||
30 | + */ | ||
31 | + private Long id; | ||
32 | + /** | ||
33 | + * | ||
34 | + */ | ||
35 | + private String tenderprojectid; | ||
36 | + /** | ||
37 | + * | ||
38 | + */ | ||
39 | + private String module; | ||
40 | + /** | ||
41 | + * | ||
42 | + */ | ||
43 | + private String tablename; | ||
44 | + /** | ||
45 | + * | ||
46 | + */ | ||
47 | + private String infoid; | ||
48 | + /** | ||
49 | + * | ||
50 | + */ | ||
51 | + private Boolean success; | ||
52 | + /** | ||
53 | + * | ||
54 | + */ | ||
55 | + private String senddata; | ||
56 | + /** | ||
57 | + * | ||
58 | + */ | ||
59 | + private String optype; | ||
60 | + /** | ||
61 | + * | ||
62 | + */ | ||
63 | + private Date createtime; | ||
64 | + /** | ||
65 | + * | ||
66 | + */ | ||
67 | + private Date updatetime; | ||
68 | + /** | ||
69 | + * | ||
70 | + */ | ||
71 | + private String remark; | ||
72 | + /** | ||
73 | + * | ||
74 | + */ | ||
75 | + private String tenderflowkey; | ||
76 | + | ||
77 | + private String blockChainHash; | ||
78 | + private String blockChainUrl; | ||
79 | + private String blockChainTime; | ||
80 | + private String blockChainPrev; | ||
81 | + private String pushInfo; | ||
82 | + private String desData; | ||
83 | + private String mqKey; | ||
84 | + private String date; | ||
85 | +} |
1 | +/** | ||
2 | + * Copyright (c) 2018 人人开源 All rights reserved. | ||
3 | + * | ||
4 | + * https://www.renren.io | ||
5 | + * | ||
6 | + * 版权所有,侵权必究! | ||
7 | + */ | ||
8 | + | ||
9 | +package org.yrhl.syncdata.domain; | ||
10 | + | ||
11 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
12 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
13 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
14 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
15 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
16 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
17 | +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
18 | +import lombok.Data; | ||
19 | + | ||
20 | +import java.io.Serializable; | ||
21 | +import java.util.Date; | ||
22 | + | ||
23 | +/** | ||
24 | + * 基础实体类,所有实体都需要继承 | ||
25 | + * | ||
26 | + * @author Mark sunlightcs@gmail.com | ||
27 | + */ | ||
28 | +@Data | ||
29 | +public abstract class BaseEntity implements Serializable { | ||
30 | + /** | ||
31 | + * id | ||
32 | + */ | ||
33 | + @JsonSerialize(using = ToStringSerializer.class) | ||
34 | + @TableId(value = "id", type = IdType.ID_WORKER) | ||
35 | + private Long id; | ||
36 | + /** | ||
37 | + * 创建者 | ||
38 | + */ | ||
39 | + @TableField(fill = FieldFill.INSERT) | ||
40 | + @JsonSerialize(using = ToStringSerializer.class) | ||
41 | + private Long creator; | ||
42 | + /** | ||
43 | + * 创建时间 | ||
44 | + */ | ||
45 | + @TableField(fill = FieldFill.INSERT) | ||
46 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||
47 | + private Date createDate; | ||
48 | +} |
1 | +package org.yrhl.syncdata.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
4 | +import lombok.Data; | ||
5 | +import lombok.EqualsAndHashCode; | ||
6 | + | ||
7 | +import java.util.Date; | ||
8 | +import java.util.Map; | ||
9 | + | ||
10 | + | ||
11 | +/** | ||
12 | + * 上链入参参数 | ||
13 | + * | ||
14 | + * @author Mark sunlightcs@gmail.com | ||
15 | + * @since 1.0.0 2023-06-12 | ||
16 | + */ | ||
17 | +@Data | ||
18 | +@EqualsAndHashCode(callSuper=false) | ||
19 | +@TableName("block_new_source_data") | ||
20 | +public class BlockNewSourceDataEntity extends BaseEntity { | ||
21 | + private static final long serialVersionUID = 1L; | ||
22 | + | ||
23 | + /** | ||
24 | + * 平台编码 | ||
25 | + */ | ||
26 | + private String platformCode; | ||
27 | + /** | ||
28 | + * 系统编码 | ||
29 | + */ | ||
30 | + private String pubServicePlatCode; | ||
31 | + /** | ||
32 | + * 系统标识码 | ||
33 | + */ | ||
34 | + private String systemCode; | ||
35 | + | ||
36 | + /** | ||
37 | + * 上一区块hash | ||
38 | + */ | ||
39 | + private String blockChainPrev; | ||
40 | + /** | ||
41 | + * 加密的业务数据 | ||
42 | + */ | ||
43 | + private String data; | ||
44 | + /** | ||
45 | + * 解密的业务数据 | ||
46 | + */ | ||
47 | + private String desData; | ||
48 | + /** | ||
49 | + * 回调地址 | ||
50 | + */ | ||
51 | + private String callbackUrl; | ||
52 | + /** | ||
53 | + * ip地址 | ||
54 | + */ | ||
55 | + private String ip; | ||
56 | + /** | ||
57 | + * 项目id | ||
58 | + */ | ||
59 | + private String tenderProjectId; | ||
60 | + /** | ||
61 | + * 项目业务流程环节 | ||
62 | + */ | ||
63 | + private String module; | ||
64 | + /** | ||
65 | + * 业务审批唯一标识。若无审批流程则为-1 | ||
66 | + */ | ||
67 | + private String tenderFlowKey; | ||
68 | + /** | ||
69 | + * 操作类型 | ||
70 | + */ | ||
71 | + private String opType; | ||
72 | + /** | ||
73 | + * 业务表名称 | ||
74 | + */ | ||
75 | + private String tableName; | ||
76 | + /** | ||
77 | + * 业务表主键 | ||
78 | + */ | ||
79 | + private String tableInfoId; | ||
80 | + | ||
81 | + /** | ||
82 | + * 数据类型(0:存证上链,1:专家抽取合约,2:投标文件校验合约,3:开标时间校验合约) | ||
83 | + */ | ||
84 | + private String datasType; | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + public static BlockNewSourceDataEntity fromMap(Map<String, Object> map) { | ||
89 | + BlockNewSourceDataEntity entity = new BlockNewSourceDataEntity(); | ||
90 | + entity.setId(null== map.get("id")?null:(Long) map.get("id")); | ||
91 | + entity.setPlatformCode(null==map.get("platform_code")?null:(String) map.get("platform_code")); | ||
92 | + entity.setPubServicePlatCode(null== map.get("pub_service_plat_code")?null:(String) map.get("pub_service_plat_code")); | ||
93 | + entity.setSystemCode(null==map.get("system_code")?null:(String) map.get("system_code")); | ||
94 | + entity.setBlockChainPrev(null== map.get("block_chain_prev")?null:(String) map.get("block_chain_prev")); | ||
95 | + entity.setData(null==map.get("data")?null:(String) map.get("data")); | ||
96 | + entity.setDesData(null==map.get("des_data")?null:(String) map.get("des_data")); | ||
97 | + entity.setCallbackUrl(null== map.get("callback_url")?null:(String) map.get("callback_url")); | ||
98 | + entity.setIp(null== map.get("ip")?null:(String) map.get("ip")); | ||
99 | + entity.setCreator(null==map.get("creator")?null:(long) map.get("creator")); | ||
100 | + entity.setCreateDate(null==map.get("create_date")?null:(Date) map.get("create_date")); | ||
101 | + entity.setTenderProjectId(null==map.get("tender_project_id")?null:(String) map.get("tender_project_id")); | ||
102 | + entity.setModule(null==map.get("module")?null:(String) map.get("module")); | ||
103 | + entity.setTenderFlowKey(null==map.get("tender_flow_key")?null:(String) map.get("tender_flow_key")); | ||
104 | + entity.setOpType(null== map.get("op_type")?null:(String) map.get("op_type")); | ||
105 | + entity.setTableName(null==map.get("table_name")?null:(String) map.get("table_name")); | ||
106 | + entity.setTableInfoId(null==map.get("table_info_id")?null:(String) map.get("table_info_id")); | ||
107 | + entity.setDatasType(null==map.get("datas_type")?null:(String) map.get("datas_type")); | ||
108 | + return entity; | ||
109 | + } | ||
110 | +} |
1 | +package org.yrhl.syncdata.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
4 | +import lombok.Data; | ||
5 | +import lombok.EqualsAndHashCode; | ||
6 | + | ||
7 | +import java.util.Date; | ||
8 | +import java.util.Map; | ||
9 | + | ||
10 | +/** | ||
11 | + * @ClassName BlockSourceDataEntity | ||
12 | + * @Description 存证传入数据 | ||
13 | + * @Author kun | ||
14 | + * @Date 2022-3-12 10:59 | ||
15 | + * @Version 1.0 | ||
16 | + **/ | ||
17 | +@Data | ||
18 | +@EqualsAndHashCode(callSuper=false) | ||
19 | +@TableName("block_source_data") | ||
20 | +public class BlockSourceDataEntity extends BaseEntity { | ||
21 | + private static final long serialVersionUID = 1L; | ||
22 | + | ||
23 | + /** | ||
24 | + * 平台编码 | ||
25 | + */ | ||
26 | + private String platformCode; | ||
27 | + /** | ||
28 | + * 系统编码 | ||
29 | + */ | ||
30 | + private String pubservicePlatCode; | ||
31 | + /** | ||
32 | + * 系统标识码 | ||
33 | + */ | ||
34 | + private String systemCode; | ||
35 | + /** | ||
36 | + * 招标项目id | ||
37 | + */ | ||
38 | + private String tenderProjectId; | ||
39 | + /** | ||
40 | + * 项目流程环节 | ||
41 | + */ | ||
42 | + private String module; | ||
43 | + /** | ||
44 | + * 业务审批流程唯一标识 | ||
45 | + */ | ||
46 | + private String tenderFlowKey; | ||
47 | + /** | ||
48 | + * 操作类型 | ||
49 | + */ | ||
50 | + private String opType; | ||
51 | + /** | ||
52 | + * 业务表名 | ||
53 | + */ | ||
54 | + private String tableName; | ||
55 | + /** | ||
56 | + * 业务id | ||
57 | + */ | ||
58 | + private String tableInfoId; | ||
59 | + /** | ||
60 | + * 上一区块 | ||
61 | + */ | ||
62 | + private String blockChainPrev; | ||
63 | + /** | ||
64 | + * 区块链存证hash | ||
65 | + */ | ||
66 | + private String blockChainHash; | ||
67 | + /** | ||
68 | + * 区块链查证url | ||
69 | + */ | ||
70 | + private String blockChainUrl; | ||
71 | + | ||
72 | + /** | ||
73 | + * 签名值 | ||
74 | + */ | ||
75 | + private String signValue; | ||
76 | + /** | ||
77 | + * 原始数据 | ||
78 | + */ | ||
79 | + private String data; | ||
80 | + /** | ||
81 | + * 解密数据 | ||
82 | + */ | ||
83 | + private String desData; | ||
84 | + /** | ||
85 | + * 0:解密失败,1:解密成功 | ||
86 | + */ | ||
87 | + private String status; | ||
88 | + | ||
89 | + private String ip; | ||
90 | + /** | ||
91 | + * 修改时间 | ||
92 | + */ | ||
93 | + private Date updateDate; | ||
94 | + /** | ||
95 | + * 上链时间 | ||
96 | + */ | ||
97 | + private Date blockChainTime; | ||
98 | + /** | ||
99 | + * 标段编号(多个标段用英文逗号分隔) | ||
100 | + */ | ||
101 | + private String bidSectionCodes; | ||
102 | + | ||
103 | + | ||
104 | + /** | ||
105 | + * 是否推送一网通办(0-为推送,1-为不推送) | ||
106 | + */ | ||
107 | + private Integer isPush; | ||
108 | + | ||
109 | + | ||
110 | + // 静态方法,用于从 Map 转换到 BusinessDataResultsEntity | ||
111 | + public static BlockSourceDataEntity fromMap(Map<String, Object> map) { | ||
112 | + BlockSourceDataEntity entity = new BlockSourceDataEntity(); | ||
113 | + // 假设 map 中有与 entity 字段对应的键 | ||
114 | + entity.setId((Long) map.get("id")); | ||
115 | + entity.setPlatformCode(null==map.get("platform_code")?null:(String) map.get("platform_code")); | ||
116 | + entity.setPubservicePlatCode(null== map.get("pubservice_plat_code")?null:(String) map.get("pubservice_plat_code")); | ||
117 | + entity.setSystemCode(null== map.get("system_code")?null:(String) map.get("system_code")); | ||
118 | + entity.setTenderProjectId(null==map.get("tender_project_id")?null:(String) map.get("tender_project_id")); | ||
119 | + entity.setModule(null==map.get("module")?null:(String) map.get("module")); | ||
120 | + entity.setTenderFlowKey(null== map.get("tender_flow_key")?null:(String) map.get("tender_flow_key")); | ||
121 | + entity.setOpType(null==map.get("op_type")?null:(String) map.get("op_type")); | ||
122 | + entity.setTableName(null== map.get("table_name")?null:(String) map.get("table_name")); | ||
123 | + entity.setTableInfoId(null==map.get("table_info_id")?null:(String) map.get("table_info_id")); | ||
124 | + entity.setBlockChainPrev(null== map.get("block_chain_prev")?null:(String) map.get("block_chain_prev")); | ||
125 | + entity.setBlockChainHash(null==map.get("block_chain_hash")?null:(String) map.get("block_chain_hash")); | ||
126 | + entity.setBlockChainUrl(null==map.get("block_chain_url")?null:(String) map.get("block_chain_url")); | ||
127 | + entity.setStatus(null== map.get("status")?null:(String) map.get("status")); | ||
128 | + entity.setSignValue(null== map.get("sign_value")?null:(String) map.get("sign_value")); | ||
129 | + entity.setCreator(null==map.get("creator")?null:(long) map.get("creator")); | ||
130 | + entity.setCreateDate(null==map.get("create_date")?null:(Date) map.get("create_date")); | ||
131 | + entity.setData(null==map.get("data")?null:(String) map.get("data")); | ||
132 | + entity.setDesData(null==map.get("des_data")?null:(String) map.get("des_data")); | ||
133 | + entity.setIp(null==map.get("ip")?null:(String) map.get("ip")); | ||
134 | + entity.setUpdateDate(null== map.get("update_date")?null:(Date) map.get("update_date")); | ||
135 | + entity.setBidSectionCodes(null== map.get("bid_section_codes")?null:(String) map.get("bid_section_codes")); | ||
136 | + entity.setBlockChainTime(null==map.get("block_chain_time")?null:(Date) map.get("block_chain_time")); | ||
137 | + entity.setIsPush(null==map.get("is_push")?null:(int) map.get("is_push")); | ||
138 | + return entity; | ||
139 | + } | ||
140 | +} |
1 | +package org.yrhl.syncdata.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
4 | +import lombok.Data; | ||
5 | +import lombok.EqualsAndHashCode; | ||
6 | + | ||
7 | +import java.util.Date; | ||
8 | +import java.util.Map; | ||
9 | + | ||
10 | +/** | ||
11 | + * 数据凭证结果表 | ||
12 | + * | ||
13 | + * @author Mark sunlightcs@gmail.com | ||
14 | + * @since 1.0.0 2022-03-01 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@EqualsAndHashCode(callSuper=false) | ||
18 | +@TableName("business_data_results") | ||
19 | +public class BusinessDataResultsEntity extends BaseEntity { | ||
20 | + private static final long serialVersionUID = 1L; | ||
21 | + | ||
22 | + /** | ||
23 | + * 平台编码 | ||
24 | + */ | ||
25 | + private String platformCode; | ||
26 | + /** | ||
27 | + * 系统编码 | ||
28 | + */ | ||
29 | + private String pubservicePlatCode; | ||
30 | + /** | ||
31 | + * 系统标识码 | ||
32 | + */ | ||
33 | + private String systemCode; | ||
34 | + /** | ||
35 | + * 项目id | ||
36 | + */ | ||
37 | + private String tenderProjectId; | ||
38 | + /** | ||
39 | + * 模块名称 | ||
40 | + */ | ||
41 | + private String module; | ||
42 | + /** | ||
43 | + * | ||
44 | + */ | ||
45 | + private String tenderFlowKey; | ||
46 | + /** | ||
47 | + * | ||
48 | + */ | ||
49 | + private String opType; | ||
50 | + /** | ||
51 | + * 业务节点名称 | ||
52 | + */ | ||
53 | + private String tableName; | ||
54 | + /** | ||
55 | + * 业务id | ||
56 | + */ | ||
57 | + private String tableInfoId; | ||
58 | + /** | ||
59 | + * 业务数据json | ||
60 | + */ | ||
61 | + private String dataValue; | ||
62 | + /** | ||
63 | + * | ||
64 | + */ | ||
65 | + private String blockChainPrev; | ||
66 | + /** | ||
67 | + * 执行结果 | ||
68 | + */ | ||
69 | + private String blockChainHash; | ||
70 | + /** | ||
71 | + * | ||
72 | + */ | ||
73 | + private String blockChainUrl; | ||
74 | + /** | ||
75 | + * 执行状态(0:存证失败 1:存证成功) | ||
76 | + */ | ||
77 | + private Integer status; | ||
78 | + /** | ||
79 | + * 块号 | ||
80 | + */ | ||
81 | + private String blockNum; | ||
82 | + | ||
83 | + private String date; | ||
84 | + | ||
85 | + | ||
86 | + // 静态方法,用于从 Map 转换到 BusinessDataResultsEntity | ||
87 | + public static BusinessDataResultsEntity fromMap(Map<String, Object> map) { | ||
88 | + BusinessDataResultsEntity entity = new BusinessDataResultsEntity(); | ||
89 | + // 假设 map 中有与 entity 字段对应的键 | ||
90 | + entity.setId(null== map.get("id")?null:(Long) map.get("id")); | ||
91 | + entity.setPlatformCode(null== map.get("platform_code")?null:(String) map.get("platform_code")); | ||
92 | + entity.setPubservicePlatCode(null== map.get("pubservice_plat_code")?null:(String) map.get("pubservice_plat_code")); | ||
93 | + entity.setSystemCode(null==map.get("system_code")?null:(String) map.get("system_code")); | ||
94 | + entity.setTenderProjectId((String) map.get("tender_project_id")); | ||
95 | + entity.setModule(null==map.get("module")?null:(String) map.get("module")); | ||
96 | + entity.setTenderFlowKey(null== map.get("tender_flow_key")?null:(String) map.get("tender_flow_key")); | ||
97 | + entity.setOpType(null==map.get("op_type")?null:(String) map.get("op_type")); | ||
98 | + entity.setTableName(null== map.get("table_name")?null:(String) map.get("table_name")); | ||
99 | + entity.setTableInfoId(null==map.get("table_info_id")?null:(String) map.get("table_info_id")); | ||
100 | + entity.setDataValue(null== map.get("data_value")?null:(String) map.get("data_value")); | ||
101 | + entity.setBlockChainPrev(null== map.get("block_chain_prev")?null:(String) map.get("block_chain_prev")); | ||
102 | + entity.setBlockChainHash(null== map.get("block_chain_hash")?null:(String) map.get("block_chain_hash")); | ||
103 | + entity.setBlockChainUrl(null== map.get("block_chain_url")?null:(String) map.get("block_chain_url")); | ||
104 | + entity.setStatus(null==map.get("status")?null:(int) map.get("status")); | ||
105 | + entity.setBlockNum(null==map.get("block_num")?null:(String) map.get("block_num")); | ||
106 | + entity.setCreator(null==map.get("creator")?null:(long) map.get("creator")); | ||
107 | + entity.setCreateDate(null== map.get("create_date")?null:(Date) map.get("create_date")); | ||
108 | + // 其他字段的设置... | ||
109 | + return entity; | ||
110 | + } | ||
111 | +} |
1 | +package org.yrhl.syncdata.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
6 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
7 | +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
8 | +import lombok.Data; | ||
9 | +import lombok.EqualsAndHashCode; | ||
10 | + | ||
11 | +import java.util.Date; | ||
12 | + | ||
13 | +/*** | ||
14 | + * 同步结果表 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@EqualsAndHashCode(callSuper=false) | ||
18 | +@TableName("sync_result") | ||
19 | +public class SyncResult { | ||
20 | + | ||
21 | + @JsonSerialize(using = ToStringSerializer.class) | ||
22 | + @TableId(value = "id", type = IdType.ID_WORKER) | ||
23 | + private Long id; | ||
24 | + | ||
25 | + // 同步表名 | ||
26 | + private String TableName; | ||
27 | + | ||
28 | + //业务id | ||
29 | + private Long InfoId; | ||
30 | + | ||
31 | + //数据源表创建时间 | ||
32 | + private Date DateCreateTime; | ||
33 | + | ||
34 | + //同步状态 0:待同步 1:同步成功 -1:同步失败 | ||
35 | + private Integer Status; | ||
36 | + | ||
37 | + //创建时间 | ||
38 | + private Date CreateDateTime; | ||
39 | + | ||
40 | + //更新时间 | ||
41 | + private Date UpdateTime; | ||
42 | +} |
1 | +package org.yrhl.syncdata.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
6 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
7 | +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
8 | +import lombok.Data; | ||
9 | +import lombok.EqualsAndHashCode; | ||
10 | + | ||
11 | +/*** | ||
12 | + * 需要同步的表名 | ||
13 | + */ | ||
14 | +@Data | ||
15 | +@EqualsAndHashCode(callSuper=false) | ||
16 | +@TableName("sync_table") | ||
17 | +public class SyncTable { | ||
18 | + | ||
19 | + @JsonSerialize(using = ToStringSerializer.class) | ||
20 | + @TableId(value = "id", type = IdType.ID_WORKER) | ||
21 | + private Long id; | ||
22 | + | ||
23 | + private String tableName; | ||
24 | + | ||
25 | + private String isDelete; | ||
26 | + | ||
27 | + | ||
28 | +} |
1 | +package org.yrhl.syncdata.mapper.local; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | +import org.apache.ibatis.annotations.Param; | ||
6 | +import org.yrhl.syncdata.Retention.BatchInsert; | ||
7 | +import org.yrhl.syncdata.domain.*; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | + | ||
12 | +@Mapper | ||
13 | +public interface CourseOneMapper extends BaseMapper<SyncResult> { | ||
14 | + | ||
15 | + | ||
16 | + List<SyncTable> getSyncTableList(); | ||
17 | + | ||
18 | + //查询待同步的数据 | ||
19 | + List<SyncResult> getSyncResultListForWaitForAllinonepushresults(@Param("tableName") String tableName,@Param("page") int page,@Param("size") int size); | ||
20 | + | ||
21 | + List<SyncResult> getSyncResultListForWait(@Param("tableName") String tableName,@Param("page") int page,@Param("size") int size); | ||
22 | + | ||
23 | + | ||
24 | + List<BusinessDataResultsEntity> getList(); | ||
25 | + | ||
26 | + List<BlockSourceDataEntity> getBlockSourceDataEntityList(); | ||
27 | + | ||
28 | + | ||
29 | + List<BlockNewSourceDataEntity> getBlockNewSourceDataEntityList(); | ||
30 | + | ||
31 | + List<AllinonepushresultsEntity> getAllinonepushresultsEntityList(); | ||
32 | + | ||
33 | + void insertSyncResult(List<SyncResult> syncResultListForWait); | ||
34 | + | ||
35 | + List<AllinonepushresultsEntity> getSyncResultListForWaitForConsumer(@Param("tableName") String tableName,@Param("page") int page,@Param("size") int size); | ||
36 | + | ||
37 | + List<Map<String, Object>> getSyncResultListForWaitForOtherConsumer(@Param("tableName") String tableName,@Param("page") int page,@Param("size") int size); | ||
38 | + | ||
39 | + void updateSyncResult(@Param("infoId") Long infoId); | ||
40 | + | ||
41 | + void updateSyncResultFail(@Param("infoId") Long infoId); | ||
42 | + | ||
43 | + int isExesit(@Param("infoId") Long infoId); | ||
44 | +} |
1 | +package org.yrhl.syncdata.mapper.remote; | ||
2 | + | ||
3 | +import org.apache.ibatis.annotations.Mapper; | ||
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | +import org.yrhl.syncdata.domain.AllinonepushresultsEntity; | ||
6 | +import org.yrhl.syncdata.domain.BlockNewSourceDataEntity; | ||
7 | +import org.yrhl.syncdata.domain.BlockSourceDataEntity; | ||
8 | +import org.yrhl.syncdata.domain.BusinessDataResultsEntity; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | +@Mapper | ||
12 | +public interface CourseTwoMapper { | ||
13 | + | ||
14 | + /** | ||
15 | + * 批量插入 | ||
16 | + * @param list | ||
17 | + */ | ||
18 | + void insertBusinessDataResultsBatch(@Param("list") List<BusinessDataResultsEntity> list); | ||
19 | + | ||
20 | + | ||
21 | + void insertBlockSourceDataEntityBatch(@Param("list") List<BlockSourceDataEntity> list); | ||
22 | + | ||
23 | + void insertBlockNewSourceDataEntityBatch(@Param("list") List<BlockNewSourceDataEntity> list); | ||
24 | + | ||
25 | + void insertAllinonepushresultsEntityBatch(@Param("list") List<AllinonepushresultsEntity> list); | ||
26 | + | ||
27 | + int isExist(@Param("tableName") String tableName ,@Param("infoId") Long infoId); | ||
28 | +} |
1 | +package org.yrhl.syncdata.task; | ||
2 | + | ||
3 | +import cn.hutool.core.bean.BeanUtil; | ||
4 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
5 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||
6 | +import org.slf4j.Logger; | ||
7 | +import org.slf4j.LoggerFactory; | ||
8 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
9 | +import org.springframework.scheduling.annotation.Scheduled; | ||
10 | +import org.springframework.stereotype.Component; | ||
11 | +import org.yrhl.syncdata.domain.*; | ||
12 | +import org.yrhl.syncdata.mapper.local.CourseOneMapper; | ||
13 | +import org.yrhl.syncdata.mapper.remote.CourseTwoMapper; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import java.util.ArrayList; | ||
17 | +import java.util.HashMap; | ||
18 | +import java.util.List; | ||
19 | +import java.util.Map; | ||
20 | +import java.util.stream.Collectors; | ||
21 | + | ||
22 | +@EnableScheduling //开启定时 | ||
23 | +@Component | ||
24 | +public class MySchedule { | ||
25 | + private static final Logger log = LoggerFactory.getLogger(MySchedule.class); | ||
26 | + @Resource | ||
27 | + private CourseOneMapper courseOneMapper; | ||
28 | + @Resource | ||
29 | + private CourseTwoMapper courseTwoMapper; | ||
30 | + /** | ||
31 | + * 每隔10秒执行一次 执行生产者 准备数据 | ||
32 | + */ | ||
33 | + @Scheduled(fixedDelay = 20000) | ||
34 | + public void test(){ | ||
35 | + //先查询需要同步的表信息 | ||
36 | + List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
37 | + if(syncTableList.isEmpty()){ | ||
38 | + log.error("没有可用的同步表,请查看sync_table表是否有可用的数据"); | ||
39 | + return ; | ||
40 | + } | ||
41 | + for(SyncTable syncTable:syncTableList){ | ||
42 | + int i = insertIntoSyncResult(syncTable.getTableName()); | ||
43 | + log.error("插入SyncResult状态为{}",i==1?"成功":"失败"); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + @Scheduled(fixedDelay = 40000) | ||
49 | + public void test1() { | ||
50 | + //从中间表查询需要同步的数据 | ||
51 | + List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
52 | + for (SyncTable syncTable : syncTableList) { | ||
53 | + int i = syncTargetSoucre(syncTable.getTableName()); | ||
54 | + log.error("数据同步到目标数据库{}",i==0?"成功":"失败"); | ||
55 | + } | ||
56 | + | ||
57 | + } | ||
58 | + | ||
59 | + | ||
60 | + /*** | ||
61 | + * 获取可备份的业务数据并将数据插入到SyncResult中待备份 | ||
62 | + * @param tablename | ||
63 | + * @return | ||
64 | + */ | ||
65 | + private int insertIntoSyncResult(String tablename ) { | ||
66 | + | ||
67 | + int page = 1; | ||
68 | + while (true) { | ||
69 | + log.info("生产者:当前第{}页",page); | ||
70 | + //将数据插入到sync_result 中 | ||
71 | + List<SyncResult> syncResultListForWait = null; | ||
72 | + if("allinonepushresults".equals(tablename)){ | ||
73 | + syncResultListForWait = courseOneMapper.getSyncResultListForWaitForAllinonepushresults(tablename,(page-1)*100,100); | ||
74 | + }else{ | ||
75 | + syncResultListForWait = courseOneMapper.getSyncResultListForWait(tablename,(page-1)*100,100); | ||
76 | + } | ||
77 | + if(CollectionUtils.isEmpty(syncResultListForWait)) { | ||
78 | + break; | ||
79 | + } | ||
80 | + try { | ||
81 | + // 1.在中间表查询是否存在数据(根据业务主键):如果存在,忽略,如果不存在,插入 | ||
82 | + List<SyncResult> res= new ArrayList<>(); | ||
83 | + for(SyncResult syncResult:syncResultListForWait){ | ||
84 | + // 遍历逐条分析: | ||
85 | + int exesit = courseOneMapper.isExesit(syncResult.getInfoId()); | ||
86 | + if(0==exesit){ | ||
87 | + res.add(syncResult); | ||
88 | + } | ||
89 | + } | ||
90 | + if(CollectionUtils.isNotEmpty(res)){ | ||
91 | + log.info("一共:"+res.size()+ "条"); | ||
92 | + long start = System.currentTimeMillis(); | ||
93 | + courseOneMapper.insertSyncResult(res); | ||
94 | + long end = System.currentTimeMillis(); | ||
95 | + log.info("数据总耗时:" + (end-start) + "ms"); | ||
96 | + } | ||
97 | + | ||
98 | + }catch (Exception e){ | ||
99 | + log.error("插入数据失败", e); | ||
100 | + return 0; | ||
101 | + } | ||
102 | + page++; | ||
103 | + } | ||
104 | + | ||
105 | + return 0; | ||
106 | + } | ||
107 | + | ||
108 | + | ||
109 | + private int syncTargetSoucre(String tableName){ | ||
110 | + | ||
111 | + if ("allinonepushresults".equals(tableName)) { | ||
112 | + int page = 1; | ||
113 | + while (true) { | ||
114 | + log.info("消费者:表名{}当前第{}页","allinonepushresults",page); | ||
115 | + List<AllinonepushresultsEntity> syncResultListForWait = courseOneMapper.getSyncResultListForWaitForConsumer(tableName,(page-1)*100,100); | ||
116 | + List<Long> ids = null; | ||
117 | + if (CollectionUtils.isEmpty(syncResultListForWait)) { | ||
118 | + break; | ||
119 | + } | ||
120 | + try { | ||
121 | + List<AllinonepushresultsEntity> resData = new ArrayList<>(); | ||
122 | + for (AllinonepushresultsEntity allinonepushresultsEntity : syncResultListForWait) { | ||
123 | + int count = courseTwoMapper.isExist("allinonepushresults", allinonepushresultsEntity.getId()); | ||
124 | + if (0 == count) { | ||
125 | + resData.add(allinonepushresultsEntity); | ||
126 | + } | ||
127 | + } | ||
128 | + if (CollectionUtils.isNotEmpty(resData)) { | ||
129 | + courseTwoMapper.insertAllinonepushresultsEntityBatch(resData); | ||
130 | + } | ||
131 | + ids = syncResultListForWait.stream() | ||
132 | + .map(AllinonepushresultsEntity::getId) | ||
133 | + .collect(Collectors.toList()); | ||
134 | + for (Long id : ids) { | ||
135 | + courseOneMapper.updateSyncResult(id); | ||
136 | + } | ||
137 | + } catch (Exception e) { | ||
138 | + ids = syncResultListForWait.stream() | ||
139 | + .map(AllinonepushresultsEntity::getId) | ||
140 | + .collect(Collectors.toList()); | ||
141 | + for (Long id : ids) { | ||
142 | + courseOneMapper.updateSyncResultFail(id); | ||
143 | + } | ||
144 | + } | ||
145 | + page++; | ||
146 | + } | ||
147 | + log.info("消费者:表名{}同步完毕,一共{}页数据",tableName,page); | ||
148 | + } | ||
149 | + else if ("block_new_source_data".equals(tableName)) { | ||
150 | + int page = 1; | ||
151 | + while (true) { | ||
152 | + log.info("消费者:表名{}当前第{}页","block_new_source_data",page); | ||
153 | + List<Long> ids = null; | ||
154 | + List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
155 | + if (CollectionUtils.isEmpty(list3)) { | ||
156 | + break; | ||
157 | + } | ||
158 | + List<BlockNewSourceDataEntity> res1 = list3.stream() | ||
159 | + .map(BlockNewSourceDataEntity::fromMap) | ||
160 | + .collect(Collectors.toList()); | ||
161 | + page++; | ||
162 | + try { | ||
163 | + List<BlockNewSourceDataEntity> resData = new ArrayList<>(); | ||
164 | + for (BlockNewSourceDataEntity blockNewSourceDataEntity : res1) { | ||
165 | + int count = courseTwoMapper.isExist("block_new_source_data", blockNewSourceDataEntity.getId()); | ||
166 | + if (0 == count) { | ||
167 | + resData.add(blockNewSourceDataEntity); | ||
168 | + } | ||
169 | + } | ||
170 | + if (CollectionUtils.isNotEmpty(resData)) { | ||
171 | + long start = System.currentTimeMillis(); | ||
172 | + courseTwoMapper.insertBlockNewSourceDataEntityBatch(resData); | ||
173 | + long end = System.currentTimeMillis(); | ||
174 | + log.info("消费者插入数据总耗时:" + (end-start) + "ms"); | ||
175 | + } | ||
176 | + ids = res1.stream() | ||
177 | + .map(BlockNewSourceDataEntity::getId) | ||
178 | + .collect(Collectors.toList()); | ||
179 | + for (Long id : ids) { | ||
180 | + courseOneMapper.updateSyncResult(id); | ||
181 | + } | ||
182 | + } catch (Exception e) { | ||
183 | + ids = res1.stream() | ||
184 | + .map(BlockNewSourceDataEntity::getId) | ||
185 | + .collect(Collectors.toList()); | ||
186 | + for (Long id : ids) { | ||
187 | + courseOneMapper.updateSyncResultFail(id); | ||
188 | + } | ||
189 | + } | ||
190 | + } | ||
191 | + log.info("消费者:表名{}同步完毕,一共{}页数据",tableName); | ||
192 | + } | ||
193 | + else if("block_source_data".equals(tableName)){ | ||
194 | + { | ||
195 | + int page = 1; | ||
196 | + while (true) { | ||
197 | + log.info("消费者:表名{}当前第{}页","block_source_data",page); | ||
198 | + List<Long> ids = null; | ||
199 | + List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
200 | + if (CollectionUtils.isEmpty(list3)) { | ||
201 | + break; | ||
202 | + } | ||
203 | + List<BlockSourceDataEntity> res1 = list3.stream() | ||
204 | + .map(BlockSourceDataEntity::fromMap) | ||
205 | + .collect(Collectors.toList()); | ||
206 | + page++; | ||
207 | + try { | ||
208 | + List<BlockSourceDataEntity> resData = new ArrayList<>(); | ||
209 | + for (BlockSourceDataEntity blockSourceDataEntity : res1) { | ||
210 | + int count = courseTwoMapper.isExist("block_source_data", blockSourceDataEntity.getId()); | ||
211 | + if (0 == count) { | ||
212 | + resData.add(blockSourceDataEntity); | ||
213 | + } | ||
214 | + } | ||
215 | + if (CollectionUtils.isNotEmpty(resData)) { | ||
216 | + courseTwoMapper.insertBlockSourceDataEntityBatch(resData); | ||
217 | + } | ||
218 | + ids = res1.stream() | ||
219 | + .map(BlockSourceDataEntity::getId) | ||
220 | + .collect(Collectors.toList()); | ||
221 | + for (Long id : ids) { | ||
222 | + courseOneMapper.updateSyncResult(id); | ||
223 | + } | ||
224 | + } catch (Exception e) { | ||
225 | + ids = res1.stream() | ||
226 | + .map(BlockSourceDataEntity::getId) | ||
227 | + .collect(Collectors.toList()); | ||
228 | + for (Long id : ids) { | ||
229 | + courseOneMapper.updateSyncResultFail(id); | ||
230 | + } | ||
231 | + } | ||
232 | + } | ||
233 | + log.info("消费者:表名{}同步完毕,一共{}页数据",tableName,page); | ||
234 | + } | ||
235 | + | ||
236 | + } | ||
237 | + else if("business_data_results".equals(tableName)){ | ||
238 | + { | ||
239 | + int page = 1; | ||
240 | + while (true) { | ||
241 | + log.info("消费者:表名{}当前第{}页","business_data_results",page); | ||
242 | + List<Long> ids = null; | ||
243 | + List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
244 | + if (CollectionUtils.isEmpty(list3)) { | ||
245 | + break; | ||
246 | + } | ||
247 | + List<BusinessDataResultsEntity> res1 = list3.stream() | ||
248 | + .map(BusinessDataResultsEntity::fromMap) | ||
249 | + .collect(Collectors.toList()); | ||
250 | + page++; | ||
251 | + try { | ||
252 | + List<BusinessDataResultsEntity> resData = new ArrayList<>(); | ||
253 | + for (BusinessDataResultsEntity businessDataResultsEntity : res1) { | ||
254 | + int count = courseTwoMapper.isExist("business_data_results", businessDataResultsEntity.getId()); | ||
255 | + if (0 == count) { | ||
256 | + resData.add(businessDataResultsEntity); | ||
257 | + } | ||
258 | + } | ||
259 | + if (CollectionUtils.isNotEmpty(resData)) { | ||
260 | + courseTwoMapper.insertBusinessDataResultsBatch(resData); | ||
261 | + } | ||
262 | + ids = res1.stream() | ||
263 | + .map(BusinessDataResultsEntity::getId) | ||
264 | + .collect(Collectors.toList()); | ||
265 | + for (Long id : ids) { | ||
266 | + courseOneMapper.updateSyncResult(id); | ||
267 | + } | ||
268 | + } catch (Exception e) { | ||
269 | + ids = res1.stream() | ||
270 | + .map(BusinessDataResultsEntity::getId) | ||
271 | + .collect(Collectors.toList()); | ||
272 | + for (Long id : ids) { | ||
273 | + courseOneMapper.updateSyncResultFail(id); | ||
274 | + } | ||
275 | + } | ||
276 | + } | ||
277 | + log.info("消费者:表名{}同步完毕,一共{}页数据",tableName,page); | ||
278 | + } | ||
279 | + } | ||
280 | + | ||
281 | + return 0; | ||
282 | + } | ||
283 | +} |
1 | +//package org.yrhl.syncdata.task; | ||
2 | +// | ||
3 | +//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||
4 | +//import org.slf4j.Logger; | ||
5 | +//import org.slf4j.LoggerFactory; | ||
6 | +//import org.springframework.scheduling.annotation.EnableScheduling; | ||
7 | +//import org.springframework.scheduling.annotation.Scheduled; | ||
8 | +//import org.springframework.stereotype.Component; | ||
9 | +//import org.yrhl.syncdata.domain.*; | ||
10 | +//import org.yrhl.syncdata.mapper.local.CourseOneMapper; | ||
11 | +//import org.yrhl.syncdata.mapper.remote.CourseTwoMapper; | ||
12 | +// | ||
13 | +//import javax.annotation.Resource; | ||
14 | +//import java.util.ArrayList; | ||
15 | +//import java.util.List; | ||
16 | +//import java.util.Map; | ||
17 | +//import java.util.stream.Collectors; | ||
18 | +// | ||
19 | +//@EnableScheduling //开启定时 | ||
20 | +//@Component | ||
21 | +//public class MySchedule1 { | ||
22 | +// private static final Logger log = LoggerFactory.getLogger(MySchedule1.class); | ||
23 | +// @Resource | ||
24 | +// private CourseOneMapper courseOneMapper; | ||
25 | +// @Resource | ||
26 | +// private CourseTwoMapper courseTwoMapper; | ||
27 | +// /** | ||
28 | +// * 每隔10秒执行一次 执行生产者 准备数据 | ||
29 | +// */ | ||
30 | +// @Scheduled(fixedDelay = 20000) | ||
31 | +// public void test(){ | ||
32 | +// //先查询需要同步的表信息 | ||
33 | +// List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
34 | +// if(syncTableList.isEmpty()){ | ||
35 | +// log.error("没有可用的同步表,请查看sync_table表是否有可用的数据"); | ||
36 | +// return ; | ||
37 | +// } | ||
38 | +// for(SyncTable syncTable:syncTableList){ | ||
39 | +// //查询需要待同步的表数据 | ||
40 | +// if("allinonepushresults".equals(syncTable.getTableName())){ | ||
41 | +// int page = 1; | ||
42 | +// while (true) { | ||
43 | +// log.info("生产者:当前第{}页",page); | ||
44 | +// //将数据插入到sync_result 中 | ||
45 | +// List<SyncResult> syncResultListForWait = courseOneMapper.getSyncResultListForWaitForAllinonepushresults(syncTable.getTableName(),(page-1)*100,100); | ||
46 | +// if(CollectionUtils.isEmpty(syncResultListForWait)) { | ||
47 | +// break; | ||
48 | +// } | ||
49 | +// page++; | ||
50 | +// try { | ||
51 | +// // 1.在中间表查询是否存在数据(根据业务主键):如果存在,忽略,如果不存在,插入 | ||
52 | +// List<SyncResult> res= new ArrayList<>(); | ||
53 | +// for(SyncResult syncResult:syncResultListForWait){ | ||
54 | +// // 遍历逐条分析: | ||
55 | +// int exesit = courseOneMapper.isExesit(syncResult.getInfoId()); | ||
56 | +// if(0==exesit){ | ||
57 | +// res.add(syncResult); | ||
58 | +// } | ||
59 | +// } | ||
60 | +// if(CollectionUtils.isNotEmpty(res)){ | ||
61 | +// courseOneMapper.insertSyncResult(res); | ||
62 | +// } | ||
63 | +// }catch (Exception e){ | ||
64 | +// log.error("插入数据失败", e); | ||
65 | +// } | ||
66 | +// } | ||
67 | +// } | ||
68 | +// else{ | ||
69 | +// int page = 1; | ||
70 | +// while (true) { | ||
71 | +// log.info("生产者:表名{}第{}页",syncTable,page); | ||
72 | +// List<SyncResult> syncResultListForWait = courseOneMapper.getSyncResultListForWait(syncTable.getTableName(),(page-1)*100,100); | ||
73 | +// if(CollectionUtils.isEmpty(syncResultListForWait)) { | ||
74 | +// break; | ||
75 | +// } | ||
76 | +// page++; | ||
77 | +// try { | ||
78 | +// // 1.在中间表查询是否存在数据(根据业务主键):如果存在,忽略,如果不存在,插入 | ||
79 | +// List<SyncResult> res = new ArrayList<>(); | ||
80 | +// for (SyncResult syncResult : syncResultListForWait) { | ||
81 | +// // 遍历逐条分析: | ||
82 | +// int exesit = courseOneMapper.isExesit(syncResult.getInfoId()); | ||
83 | +// if (0 == exesit) { | ||
84 | +// res.add(syncResult); | ||
85 | +// } | ||
86 | +// } | ||
87 | +// if (CollectionUtils.isNotEmpty(res)) { | ||
88 | +// courseOneMapper.insertSyncResult(res); | ||
89 | +// } | ||
90 | +// log.info("生产者:表名{}插入中间表结束",syncTable); | ||
91 | +// } catch (Exception e) { | ||
92 | +// log.error("插入数据失败", e); | ||
93 | +// } | ||
94 | +// } | ||
95 | +// } | ||
96 | +// | ||
97 | +// } | ||
98 | +// } | ||
99 | +// | ||
100 | +// | ||
101 | +// @Scheduled(fixedDelay = 40000) | ||
102 | +// public void test1() { | ||
103 | +// //从中间表查询需要同步的数据 | ||
104 | +// List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
105 | +// for (SyncTable syncTable : syncTableList) { | ||
106 | +// if ("allinonepushresults".equals(syncTable.getTableName())) { | ||
107 | +// int page = 1; | ||
108 | +// while (true) { | ||
109 | +// log.info("消费者:表名{}当前第{}页","allinonepushresults",page); | ||
110 | +// List<AllinonepushresultsEntity> syncResultListForWait = courseOneMapper.getSyncResultListForWaitForConsumer(syncTable.getTableName(),(page-1)*100,100); | ||
111 | +// List<Long> ids = null; | ||
112 | +// if (CollectionUtils.isEmpty(syncResultListForWait)) { | ||
113 | +// break; | ||
114 | +// } | ||
115 | +// page++; | ||
116 | +// try { | ||
117 | +// List<AllinonepushresultsEntity> resData = new ArrayList<>(); | ||
118 | +// for (AllinonepushresultsEntity allinonepushresultsEntity : syncResultListForWait) { | ||
119 | +// int count = courseTwoMapper.isExist("allinonepushresults", allinonepushresultsEntity.getId()); | ||
120 | +// if (0 == count) { | ||
121 | +// resData.add(allinonepushresultsEntity); | ||
122 | +// } | ||
123 | +// } | ||
124 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
125 | +// courseTwoMapper.insertAllinonepushresultsEntityBatch(resData); | ||
126 | +// } | ||
127 | +// ids = syncResultListForWait.stream() | ||
128 | +// .map(AllinonepushresultsEntity::getId) | ||
129 | +// .collect(Collectors.toList()); | ||
130 | +// for (Long id : ids) { | ||
131 | +// courseOneMapper.updateSyncResult(id); | ||
132 | +// } | ||
133 | +// } catch (Exception e) { | ||
134 | +// ids = syncResultListForWait.stream() | ||
135 | +// .map(AllinonepushresultsEntity::getId) | ||
136 | +// .collect(Collectors.toList()); | ||
137 | +// for (Long id : ids) { | ||
138 | +// courseOneMapper.updateSyncResultFail(id); | ||
139 | +// } | ||
140 | +// } | ||
141 | +// } | ||
142 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",syncTable,page); | ||
143 | +// } | ||
144 | +// else if ("block_new_source_data".equals(syncTable.getTableName())) { | ||
145 | +// int page = 1; | ||
146 | +// while (true) { | ||
147 | +// log.info("消费者:表名{}当前第{}页","block_new_source_data",page); | ||
148 | +// List<Long> ids = null; | ||
149 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(syncTable.getTableName(),(page-1)*100,100); | ||
150 | +// if (CollectionUtils.isEmpty(list3)) { | ||
151 | +// break; | ||
152 | +// } | ||
153 | +// List<BlockNewSourceDataEntity> res1 = list3.stream() | ||
154 | +// .map(BlockNewSourceDataEntity::fromMap) | ||
155 | +// .collect(Collectors.toList()); | ||
156 | +// page++; | ||
157 | +// try { | ||
158 | +// List<BlockNewSourceDataEntity> resData = new ArrayList<>(); | ||
159 | +// for (BlockNewSourceDataEntity blockNewSourceDataEntity : res1) { | ||
160 | +// int count = courseTwoMapper.isExist("block_new_source_data", blockNewSourceDataEntity.getId()); | ||
161 | +// if (0 == count) { | ||
162 | +// resData.add(blockNewSourceDataEntity); | ||
163 | +// } | ||
164 | +// } | ||
165 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
166 | +// courseTwoMapper.insertBlockNewSourceDataEntityBatch(resData); | ||
167 | +// } | ||
168 | +// ids = res1.stream() | ||
169 | +// .map(BlockNewSourceDataEntity::getId) | ||
170 | +// .collect(Collectors.toList()); | ||
171 | +// for (Long id : ids) { | ||
172 | +// courseOneMapper.updateSyncResult(id); | ||
173 | +// } | ||
174 | +// } catch (Exception e) { | ||
175 | +// ids = res1.stream() | ||
176 | +// .map(BlockNewSourceDataEntity::getId) | ||
177 | +// .collect(Collectors.toList()); | ||
178 | +// for (Long id : ids) { | ||
179 | +// courseOneMapper.updateSyncResultFail(id); | ||
180 | +// } | ||
181 | +// } | ||
182 | +// } | ||
183 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",syncTable); | ||
184 | +// } | ||
185 | +// else if("block_source_data".equals(syncTable.getTableName())){ | ||
186 | +// { | ||
187 | +// int page = 1; | ||
188 | +// while (true) { | ||
189 | +// log.info("消费者:表名{}当前第{}页","block_source_data",page); | ||
190 | +// List<Long> ids = null; | ||
191 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(syncTable.getTableName(),(page-1)*100,100); | ||
192 | +// if (CollectionUtils.isEmpty(list3)) { | ||
193 | +// break; | ||
194 | +// } | ||
195 | +// List<BlockSourceDataEntity> res1 = list3.stream() | ||
196 | +// .map(BlockSourceDataEntity::fromMap) | ||
197 | +// .collect(Collectors.toList()); | ||
198 | +// page++; | ||
199 | +// try { | ||
200 | +// List<BlockSourceDataEntity> resData = new ArrayList<>(); | ||
201 | +// for (BlockSourceDataEntity blockSourceDataEntity : res1) { | ||
202 | +// int count = courseTwoMapper.isExist("block_source_data", blockSourceDataEntity.getId()); | ||
203 | +// if (0 == count) { | ||
204 | +// resData.add(blockSourceDataEntity); | ||
205 | +// } | ||
206 | +// } | ||
207 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
208 | +// courseTwoMapper.insertBlockSourceDataEntityBatch(resData); | ||
209 | +// } | ||
210 | +// ids = res1.stream() | ||
211 | +// .map(BlockSourceDataEntity::getId) | ||
212 | +// .collect(Collectors.toList()); | ||
213 | +// for (Long id : ids) { | ||
214 | +// courseOneMapper.updateSyncResult(id); | ||
215 | +// } | ||
216 | +// } catch (Exception e) { | ||
217 | +// ids = res1.stream() | ||
218 | +// .map(BlockSourceDataEntity::getId) | ||
219 | +// .collect(Collectors.toList()); | ||
220 | +// for (Long id : ids) { | ||
221 | +// courseOneMapper.updateSyncResultFail(id); | ||
222 | +// } | ||
223 | +// } | ||
224 | +// } | ||
225 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",syncTable,page); | ||
226 | +// } | ||
227 | +// | ||
228 | +// } | ||
229 | +// else if("business_data_results".equals(syncTable.getTableName())){ | ||
230 | +// { | ||
231 | +// int page = 1; | ||
232 | +// while (true) { | ||
233 | +// log.info("消费者:表名{}当前第{}页","business_data_results",page); | ||
234 | +// List<Long> ids = null; | ||
235 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(syncTable.getTableName(),(page-1)*100,100); | ||
236 | +// if (CollectionUtils.isEmpty(list3)) { | ||
237 | +// break; | ||
238 | +// } | ||
239 | +// List<BusinessDataResultsEntity> res1 = list3.stream() | ||
240 | +// .map(BusinessDataResultsEntity::fromMap) | ||
241 | +// .collect(Collectors.toList()); | ||
242 | +// page++; | ||
243 | +// try { | ||
244 | +// List<BusinessDataResultsEntity> resData = new ArrayList<>(); | ||
245 | +// for (BusinessDataResultsEntity businessDataResultsEntity : res1) { | ||
246 | +// int count = courseTwoMapper.isExist("business_data_results", businessDataResultsEntity.getId()); | ||
247 | +// if (0 == count) { | ||
248 | +// resData.add(businessDataResultsEntity); | ||
249 | +// } | ||
250 | +// } | ||
251 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
252 | +// courseTwoMapper.insertBusinessDataResultsBatch(resData); | ||
253 | +// } | ||
254 | +// ids = res1.stream() | ||
255 | +// .map(BusinessDataResultsEntity::getId) | ||
256 | +// .collect(Collectors.toList()); | ||
257 | +// for (Long id : ids) { | ||
258 | +// courseOneMapper.updateSyncResult(id); | ||
259 | +// } | ||
260 | +// } catch (Exception e) { | ||
261 | +// ids = res1.stream() | ||
262 | +// .map(BusinessDataResultsEntity::getId) | ||
263 | +// .collect(Collectors.toList()); | ||
264 | +// for (Long id : ids) { | ||
265 | +// courseOneMapper.updateSyncResultFail(id); | ||
266 | +// } | ||
267 | +// } | ||
268 | +// } | ||
269 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",syncTable,page); | ||
270 | +// } | ||
271 | +// } | ||
272 | +// | ||
273 | +// } | ||
274 | +// | ||
275 | +// } | ||
276 | +//} |
1 | +//package org.yrhl.syncdata.task; | ||
2 | +// | ||
3 | +//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||
4 | +//import org.slf4j.Logger; | ||
5 | +//import org.slf4j.LoggerFactory; | ||
6 | +//import org.springframework.scheduling.annotation.EnableScheduling; | ||
7 | +//import org.springframework.scheduling.annotation.Scheduled; | ||
8 | +//import org.springframework.stereotype.Component; | ||
9 | +//import org.yrhl.syncdata.domain.*; | ||
10 | +//import org.yrhl.syncdata.mapper.local.CourseOneMapper; | ||
11 | +//import org.yrhl.syncdata.mapper.remote.CourseTwoMapper; | ||
12 | +// | ||
13 | +//import javax.annotation.Resource; | ||
14 | +//import java.util.ArrayList; | ||
15 | +//import java.util.List; | ||
16 | +//import java.util.Map; | ||
17 | +//import java.util.stream.Collectors; | ||
18 | +// | ||
19 | +//@EnableScheduling //开启定时 | ||
20 | +//@Component | ||
21 | +//public class MySchedule2 { | ||
22 | +// private static final Logger log = LoggerFactory.getLogger(MySchedule2.class); | ||
23 | +// @Resource | ||
24 | +// private CourseOneMapper courseOneMapper; | ||
25 | +// @Resource | ||
26 | +// private CourseTwoMapper courseTwoMapper; | ||
27 | +// /** | ||
28 | +// * 每隔10秒执行一次 执行生产者 准备数据 | ||
29 | +// */ | ||
30 | +// @Scheduled(fixedDelay = 20000) | ||
31 | +// public void test(){ | ||
32 | +// //先查询需要同步的表信息 | ||
33 | +// List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
34 | +// if(syncTableList.isEmpty()){ | ||
35 | +// log.error("没有可用的同步表,请查看sync_table表是否有可用的数据"); | ||
36 | +// return ; | ||
37 | +// } | ||
38 | +// for(SyncTable syncTable:syncTableList){ | ||
39 | +// int i = insertIntoSyncResult(syncTable.getTableName()); | ||
40 | +// log.error("插入SyncResult状态为{}",i==1?"成功":"失败"); | ||
41 | +// } | ||
42 | +// log.info("--------------------插入SyncResult表成功--------------------"); | ||
43 | +// log.info("--------------------开始备份数据到目标库--------------------"); | ||
44 | +// test1(); | ||
45 | +// } | ||
46 | +// | ||
47 | +// | ||
48 | +//// @Scheduled(fixedDelay = 40000) | ||
49 | +// public void test1() { | ||
50 | +// //从中间表查询需要同步的数据 | ||
51 | +// List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
52 | +// for (SyncTable syncTable : syncTableList) { | ||
53 | +// syncTargetSoucre(syncTable.getTableName()); | ||
54 | +// } | ||
55 | +// log.error("数据同步到目标数据库成功"); | ||
56 | +// } | ||
57 | +// | ||
58 | +// | ||
59 | +// /*** | ||
60 | +// * 获取可备份的业务数据并将数据插入到SyncResult中待备份 | ||
61 | +// * @param tablename | ||
62 | +// * @return | ||
63 | +// */ | ||
64 | +// private int insertIntoSyncResult(String tablename ) { | ||
65 | +// | ||
66 | +// int page = 1; | ||
67 | +// while (true) { | ||
68 | +// //将数据插入到sync_result 中 | ||
69 | +// List<SyncResult> syncResultListForWait = null; | ||
70 | +// if("allinonepushresults".equals(tablename)){ | ||
71 | +// syncResultListForWait = courseOneMapper.getSyncResultListForWaitForAllinonepushresults(tablename,(page-1)*100,100); | ||
72 | +// }else{ | ||
73 | +// syncResultListForWait = courseOneMapper.getSyncResultListForWait(tablename,(page-1)*100,100); | ||
74 | +// } | ||
75 | +// if(CollectionUtils.isEmpty(syncResultListForWait)) { | ||
76 | +// break; | ||
77 | +// } | ||
78 | +// page++; | ||
79 | +// try { | ||
80 | +// // 1.在中间表查询是否存在数据(根据业务主键):如果存在,忽略,如果不存在,插入 | ||
81 | +// List<SyncResult> res= new ArrayList<>(); | ||
82 | +// for(SyncResult syncResult:syncResultListForWait){ | ||
83 | +// // 遍历逐条分析: | ||
84 | +// int exesit = courseOneMapper.isExesit(syncResult.getInfoId()); | ||
85 | +// if(0==exesit){ | ||
86 | +// res.add(syncResult); | ||
87 | +// } | ||
88 | +// } | ||
89 | +// if(CollectionUtils.isNotEmpty(res)){ | ||
90 | +// courseOneMapper.insertSyncResult(res); | ||
91 | +// return 1; | ||
92 | +// } | ||
93 | +// }catch (Exception e){ | ||
94 | +// log.error("向SyncResult表插入数据失败", e); | ||
95 | +// return 0; | ||
96 | +// } | ||
97 | +// } | ||
98 | +// | ||
99 | +// return 0; | ||
100 | +// } | ||
101 | +// | ||
102 | +// | ||
103 | +// private int syncTargetSoucre(String tableName){ | ||
104 | +// | ||
105 | +// if ("allinonepushresults".equals(tableName)) { | ||
106 | +// int page = 1; | ||
107 | +// while (true) { | ||
108 | +// log.info("消费者:获取{}的数据","allinonepushresults"); | ||
109 | +// List<AllinonepushresultsEntity> syncResultListForWait = courseOneMapper.getSyncResultListForWaitForConsumer(tableName,(page-1)*100,100); | ||
110 | +// List<Long> ids = null; | ||
111 | +// if (CollectionUtils.isEmpty(syncResultListForWait)) { | ||
112 | +// break; | ||
113 | +// } | ||
114 | +// page++; | ||
115 | +// try { | ||
116 | +// List<AllinonepushresultsEntity> resData = new ArrayList<>(); | ||
117 | +// for (AllinonepushresultsEntity allinonepushresultsEntity : syncResultListForWait) { | ||
118 | +// int count = courseTwoMapper.isExist("allinonepushresults", allinonepushresultsEntity.getId()); | ||
119 | +// if (0 == count) { | ||
120 | +// resData.add(allinonepushresultsEntity); | ||
121 | +// } | ||
122 | +// } | ||
123 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
124 | +// courseTwoMapper.insertAllinonepushresultsEntityBatch(resData); | ||
125 | +// } | ||
126 | +// ids = syncResultListForWait.stream() | ||
127 | +// .map(AllinonepushresultsEntity::getId) | ||
128 | +// .collect(Collectors.toList()); | ||
129 | +// for (Long id : ids) { | ||
130 | +// courseOneMapper.updateSyncResult(id); | ||
131 | +// } | ||
132 | +// } catch (Exception e) { | ||
133 | +// ids = syncResultListForWait.stream() | ||
134 | +// .map(AllinonepushresultsEntity::getId) | ||
135 | +// .collect(Collectors.toList()); | ||
136 | +// for (Long id : ids) { | ||
137 | +// courseOneMapper.updateSyncResultFail(id); | ||
138 | +// } | ||
139 | +// } | ||
140 | +// } | ||
141 | +// log.info("消费者:表名{}同步完毕","allinonepushresults"); | ||
142 | +// } | ||
143 | +// else if ("block_new_source_data".equals(tableName)) { | ||
144 | +// int page = 1; | ||
145 | +// while (true) { | ||
146 | +// log.info("消费者:获取{}数据","block_new_source_data"); | ||
147 | +// List<Long> ids = null; | ||
148 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
149 | +// if (CollectionUtils.isEmpty(list3)) { | ||
150 | +// break; | ||
151 | +// } | ||
152 | +// List<BlockNewSourceDataEntity> res1 = list3.stream() | ||
153 | +// .map(BlockNewSourceDataEntity::fromMap) | ||
154 | +// .collect(Collectors.toList()); | ||
155 | +// page++; | ||
156 | +// try { | ||
157 | +// List<BlockNewSourceDataEntity> resData = new ArrayList<>(); | ||
158 | +// for (BlockNewSourceDataEntity blockNewSourceDataEntity : res1) { | ||
159 | +// int count = courseTwoMapper.isExist("block_new_source_data", blockNewSourceDataEntity.getId()); | ||
160 | +// if (0 == count) { | ||
161 | +// resData.add(blockNewSourceDataEntity); | ||
162 | +// } | ||
163 | +// } | ||
164 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
165 | +// courseTwoMapper.insertBlockNewSourceDataEntityBatch(resData); | ||
166 | +// } | ||
167 | +// ids = res1.stream() | ||
168 | +// .map(BlockNewSourceDataEntity::getId) | ||
169 | +// .collect(Collectors.toList()); | ||
170 | +// for (Long id : ids) { | ||
171 | +// courseOneMapper.updateSyncResult(id); | ||
172 | +// } | ||
173 | +// } catch (Exception e) { | ||
174 | +// ids = res1.stream() | ||
175 | +// .map(BlockNewSourceDataEntity::getId) | ||
176 | +// .collect(Collectors.toList()); | ||
177 | +// for (Long id : ids) { | ||
178 | +// courseOneMapper.updateSyncResultFail(id); | ||
179 | +// } | ||
180 | +// } | ||
181 | +// } | ||
182 | +// log.info("消费者:表名{}同步完毕","block_new_source_data"); | ||
183 | +// } | ||
184 | +// else if("block_source_data".equals(tableName)){ | ||
185 | +// { | ||
186 | +// int page = 1; | ||
187 | +// while (true) { | ||
188 | +// log.info("消费者:获取{}的数据","block_source_data"); | ||
189 | +// List<Long> ids = null; | ||
190 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
191 | +// if (CollectionUtils.isEmpty(list3)) { | ||
192 | +// break; | ||
193 | +// } | ||
194 | +// List<BlockSourceDataEntity> res1 = list3.stream() | ||
195 | +// .map(BlockSourceDataEntity::fromMap) | ||
196 | +// .collect(Collectors.toList()); | ||
197 | +// page++; | ||
198 | +// try { | ||
199 | +// List<BlockSourceDataEntity> resData = new ArrayList<>(); | ||
200 | +// for (BlockSourceDataEntity blockSourceDataEntity : res1) { | ||
201 | +// int count = courseTwoMapper.isExist("block_source_data", blockSourceDataEntity.getId()); | ||
202 | +// if (0 == count) { | ||
203 | +// resData.add(blockSourceDataEntity); | ||
204 | +// } | ||
205 | +// } | ||
206 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
207 | +// courseTwoMapper.insertBlockSourceDataEntityBatch(resData); | ||
208 | +// } | ||
209 | +// ids = res1.stream() | ||
210 | +// .map(BlockSourceDataEntity::getId) | ||
211 | +// .collect(Collectors.toList()); | ||
212 | +// for (Long id : ids) { | ||
213 | +// courseOneMapper.updateSyncResult(id); | ||
214 | +// } | ||
215 | +// } catch (Exception e) { | ||
216 | +// ids = res1.stream() | ||
217 | +// .map(BlockSourceDataEntity::getId) | ||
218 | +// .collect(Collectors.toList()); | ||
219 | +// for (Long id : ids) { | ||
220 | +// courseOneMapper.updateSyncResultFail(id); | ||
221 | +// } | ||
222 | +// } | ||
223 | +// } | ||
224 | +// log.info("消费者:表名{}同步完毕","block_source_data"); | ||
225 | +// } | ||
226 | +// | ||
227 | +// } | ||
228 | +// else if("business_data_results".equals(tableName)){ | ||
229 | +// { | ||
230 | +// int page = 1; | ||
231 | +// while (true) { | ||
232 | +// log.info("消费者:获取{}数据","business_data_results"); | ||
233 | +// List<Long> ids = null; | ||
234 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
235 | +// if (CollectionUtils.isEmpty(list3)) { | ||
236 | +// break; | ||
237 | +// } | ||
238 | +// List<BusinessDataResultsEntity> res1 = list3.stream() | ||
239 | +// .map(BusinessDataResultsEntity::fromMap) | ||
240 | +// .collect(Collectors.toList()); | ||
241 | +// page++; | ||
242 | +// try { | ||
243 | +// List<BusinessDataResultsEntity> resData = new ArrayList<>(); | ||
244 | +// for (BusinessDataResultsEntity businessDataResultsEntity : res1) { | ||
245 | +// int count = courseTwoMapper.isExist("business_data_results", businessDataResultsEntity.getId()); | ||
246 | +// if (0 == count) { | ||
247 | +// resData.add(businessDataResultsEntity); | ||
248 | +// } | ||
249 | +// } | ||
250 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
251 | +// courseTwoMapper.insertBusinessDataResultsBatch(resData); | ||
252 | +// } | ||
253 | +// ids = res1.stream() | ||
254 | +// .map(BusinessDataResultsEntity::getId) | ||
255 | +// .collect(Collectors.toList()); | ||
256 | +// for (Long id : ids) { | ||
257 | +// courseOneMapper.updateSyncResult(id); | ||
258 | +// } | ||
259 | +// } catch (Exception e) { | ||
260 | +// ids = res1.stream() | ||
261 | +// .map(BusinessDataResultsEntity::getId) | ||
262 | +// .collect(Collectors.toList()); | ||
263 | +// for (Long id : ids) { | ||
264 | +// courseOneMapper.updateSyncResultFail(id); | ||
265 | +// } | ||
266 | +// } | ||
267 | +// } | ||
268 | +// log.info("消费者:表名{}同步完毕","business_data_results"); | ||
269 | +// } | ||
270 | +// } | ||
271 | +// | ||
272 | +// return 0; | ||
273 | +// } | ||
274 | +//} |
1 | +//package org.yrhl.syncdata.task; | ||
2 | +// | ||
3 | +//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||
4 | +//import org.slf4j.Logger; | ||
5 | +//import org.slf4j.LoggerFactory; | ||
6 | +//import org.springframework.scheduling.annotation.EnableScheduling; | ||
7 | +//import org.springframework.scheduling.annotation.Scheduled; | ||
8 | +//import org.springframework.stereotype.Component; | ||
9 | +//import org.yrhl.syncdata.domain.*; | ||
10 | +//import org.yrhl.syncdata.mapper.local.CourseOneMapper; | ||
11 | +//import org.yrhl.syncdata.mapper.remote.CourseTwoMapper; | ||
12 | +// | ||
13 | +//import javax.annotation.Resource; | ||
14 | +//import java.util.ArrayList; | ||
15 | +//import java.util.List; | ||
16 | +//import java.util.Map; | ||
17 | +//import java.util.stream.Collectors; | ||
18 | +// | ||
19 | +//@EnableScheduling //开启定时 | ||
20 | +//@Component | ||
21 | +//public class MySchedule4 { | ||
22 | +// private static final Logger log = LoggerFactory.getLogger(MySchedule4.class); | ||
23 | +// @Resource | ||
24 | +// private CourseOneMapper courseOneMapper; | ||
25 | +// @Resource | ||
26 | +// private CourseTwoMapper courseTwoMapper; | ||
27 | +// /** | ||
28 | +// * 每隔10秒执行一次 执行生产者 准备数据 | ||
29 | +// */ | ||
30 | +// @Scheduled(fixedDelay = 70000) | ||
31 | +// public void test(){ | ||
32 | +// List<BlockNewSourceDataEntity> list = courseOneMapper.getBlockNewSourceDataEntityList(); | ||
33 | +// courseTwoMapper.insertBlockNewSourceDataEntityBatch(list); | ||
34 | +// System.out.println("===================成功======================"); | ||
35 | +// } | ||
36 | +// | ||
37 | +// | ||
38 | +// // @Scheduled(fixedDelay = 40000) | ||
39 | +// public void test1() { | ||
40 | +// //从中间表查询需要同步的数据 | ||
41 | +// List<SyncTable> syncTableList = courseOneMapper.getSyncTableList(); | ||
42 | +// for (SyncTable syncTable : syncTableList) { | ||
43 | +// int i = syncTargetSoucre(syncTable.getTableName()); | ||
44 | +// log.error("数据同步到目标数据库{}",i==0?"成功":"失败"); | ||
45 | +// } | ||
46 | +// | ||
47 | +// } | ||
48 | +// | ||
49 | +// | ||
50 | +// /*** | ||
51 | +// * 获取可备份的业务数据并将数据插入到SyncResult中待备份 | ||
52 | +// * @param tablename | ||
53 | +// * @return | ||
54 | +// */ | ||
55 | +// private int insertIntoSyncResult(String tablename ) { | ||
56 | +// | ||
57 | +// int page = 1; | ||
58 | +// while (true) { | ||
59 | +// log.info("生产者:当前第{}页",page); | ||
60 | +// //将数据插入到sync_result 中 | ||
61 | +// List<SyncResult> syncResultListForWait = null; | ||
62 | +// if("allinonepushresults".equals(tablename)){ | ||
63 | +// syncResultListForWait = courseOneMapper.getSyncResultListForWaitForAllinonepushresults(tablename,(page-1)*100,1000); | ||
64 | +// }else{ | ||
65 | +// syncResultListForWait = courseOneMapper.getSyncResultListForWait(tablename,(page-1)*100,10000); | ||
66 | +// } | ||
67 | +// if(CollectionUtils.isEmpty(syncResultListForWait)) { | ||
68 | +// break; | ||
69 | +// } | ||
70 | +// page++; | ||
71 | +// try { | ||
72 | +// // 1.在中间表查询是否存在数据(根据业务主键):如果存在,忽略,如果不存在,插入 | ||
73 | +// List<SyncResult> res= new ArrayList<>(); | ||
74 | +// for(SyncResult syncResult:syncResultListForWait){ | ||
75 | +// // 遍历逐条分析: | ||
76 | +// int exesit = courseOneMapper.isExesit(syncResult.getInfoId()); | ||
77 | +// if(0==exesit){ | ||
78 | +// res.add(syncResult); | ||
79 | +// } | ||
80 | +// } | ||
81 | +// if(CollectionUtils.isNotEmpty(res)){ | ||
82 | +// courseOneMapper.insertSyncResult(res); | ||
83 | +// } | ||
84 | +// }catch (Exception e){ | ||
85 | +// log.error("插入数据失败", e); | ||
86 | +// return 0; | ||
87 | +// } | ||
88 | +// } | ||
89 | +// | ||
90 | +// return 0; | ||
91 | +// } | ||
92 | +// | ||
93 | +// | ||
94 | +// private int syncTargetSoucre(String tableName){ | ||
95 | +// | ||
96 | +// if ("allinonepushresults".equals(tableName)) { | ||
97 | +// int page = 1; | ||
98 | +// while (true) { | ||
99 | +// log.info("消费者:表名{}当前第{}页","allinonepushresults",page); | ||
100 | +// List<AllinonepushresultsEntity> syncResultListForWait = courseOneMapper.getSyncResultListForWaitForConsumer(tableName,(page-1)*100,100); | ||
101 | +// List<Long> ids = null; | ||
102 | +// if (CollectionUtils.isEmpty(syncResultListForWait)) { | ||
103 | +// break; | ||
104 | +// } | ||
105 | +// page++; | ||
106 | +// try { | ||
107 | +// List<AllinonepushresultsEntity> resData = new ArrayList<>(); | ||
108 | +// for (AllinonepushresultsEntity allinonepushresultsEntity : syncResultListForWait) { | ||
109 | +// int count = courseTwoMapper.isExist("allinonepushresults", allinonepushresultsEntity.getId()); | ||
110 | +// if (0 == count) { | ||
111 | +// resData.add(allinonepushresultsEntity); | ||
112 | +// } | ||
113 | +// } | ||
114 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
115 | +// courseTwoMapper.insertAllinonepushresultsEntityBatch(resData); | ||
116 | +// } | ||
117 | +// ids = syncResultListForWait.stream() | ||
118 | +// .map(AllinonepushresultsEntity::getId) | ||
119 | +// .collect(Collectors.toList()); | ||
120 | +// for (Long id : ids) { | ||
121 | +// courseOneMapper.updateSyncResult(id); | ||
122 | +// } | ||
123 | +// } catch (Exception e) { | ||
124 | +// ids = syncResultListForWait.stream() | ||
125 | +// .map(AllinonepushresultsEntity::getId) | ||
126 | +// .collect(Collectors.toList()); | ||
127 | +// for (Long id : ids) { | ||
128 | +// courseOneMapper.updateSyncResultFail(id); | ||
129 | +// } | ||
130 | +// } | ||
131 | +// } | ||
132 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",tableName,page); | ||
133 | +// } | ||
134 | +// else if ("block_new_source_data".equals(tableName)) { | ||
135 | +// int page = 1; | ||
136 | +// while (true) { | ||
137 | +// log.info("消费者:表名{}当前第{}页","block_new_source_data",page); | ||
138 | +// List<Long> ids = null; | ||
139 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
140 | +// if (CollectionUtils.isEmpty(list3)) { | ||
141 | +// break; | ||
142 | +// } | ||
143 | +// List<BlockNewSourceDataEntity> res1 = list3.stream() | ||
144 | +// .map(BlockNewSourceDataEntity::fromMap) | ||
145 | +// .collect(Collectors.toList()); | ||
146 | +// page++; | ||
147 | +// try { | ||
148 | +// List<BlockNewSourceDataEntity> resData = new ArrayList<>(); | ||
149 | +// for (BlockNewSourceDataEntity blockNewSourceDataEntity : res1) { | ||
150 | +// int count = courseTwoMapper.isExist("block_new_source_data", blockNewSourceDataEntity.getId()); | ||
151 | +// if (0 == count) { | ||
152 | +// resData.add(blockNewSourceDataEntity); | ||
153 | +// } | ||
154 | +// } | ||
155 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
156 | +// courseTwoMapper.insertBlockNewSourceDataEntityBatch(resData); | ||
157 | +// } | ||
158 | +// ids = res1.stream() | ||
159 | +// .map(BlockNewSourceDataEntity::getId) | ||
160 | +// .collect(Collectors.toList()); | ||
161 | +// for (Long id : ids) { | ||
162 | +// courseOneMapper.updateSyncResult(id); | ||
163 | +// } | ||
164 | +// } catch (Exception e) { | ||
165 | +// ids = res1.stream() | ||
166 | +// .map(BlockNewSourceDataEntity::getId) | ||
167 | +// .collect(Collectors.toList()); | ||
168 | +// for (Long id : ids) { | ||
169 | +// courseOneMapper.updateSyncResultFail(id); | ||
170 | +// } | ||
171 | +// } | ||
172 | +// } | ||
173 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",tableName); | ||
174 | +// } | ||
175 | +// else if("block_source_data".equals(tableName)){ | ||
176 | +// { | ||
177 | +// int page = 1; | ||
178 | +// while (true) { | ||
179 | +// log.info("消费者:表名{}当前第{}页","block_source_data",page); | ||
180 | +// List<Long> ids = null; | ||
181 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
182 | +// if (CollectionUtils.isEmpty(list3)) { | ||
183 | +// break; | ||
184 | +// } | ||
185 | +// List<BlockSourceDataEntity> res1 = list3.stream() | ||
186 | +// .map(BlockSourceDataEntity::fromMap) | ||
187 | +// .collect(Collectors.toList()); | ||
188 | +// page++; | ||
189 | +// try { | ||
190 | +// List<BlockSourceDataEntity> resData = new ArrayList<>(); | ||
191 | +// for (BlockSourceDataEntity blockSourceDataEntity : res1) { | ||
192 | +// int count = courseTwoMapper.isExist("block_source_data", blockSourceDataEntity.getId()); | ||
193 | +// if (0 == count) { | ||
194 | +// resData.add(blockSourceDataEntity); | ||
195 | +// } | ||
196 | +// } | ||
197 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
198 | +// courseTwoMapper.insertBlockSourceDataEntityBatch(resData); | ||
199 | +// } | ||
200 | +// ids = res1.stream() | ||
201 | +// .map(BlockSourceDataEntity::getId) | ||
202 | +// .collect(Collectors.toList()); | ||
203 | +// for (Long id : ids) { | ||
204 | +// courseOneMapper.updateSyncResult(id); | ||
205 | +// } | ||
206 | +// } catch (Exception e) { | ||
207 | +// ids = res1.stream() | ||
208 | +// .map(BlockSourceDataEntity::getId) | ||
209 | +// .collect(Collectors.toList()); | ||
210 | +// for (Long id : ids) { | ||
211 | +// courseOneMapper.updateSyncResultFail(id); | ||
212 | +// } | ||
213 | +// } | ||
214 | +// } | ||
215 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",tableName,page); | ||
216 | +// } | ||
217 | +// | ||
218 | +// } | ||
219 | +// else if("business_data_results".equals(tableName)){ | ||
220 | +// { | ||
221 | +// int page = 1; | ||
222 | +// while (true) { | ||
223 | +// log.info("消费者:表名{}当前第{}页","business_data_results",page); | ||
224 | +// List<Long> ids = null; | ||
225 | +// List<Map<String, Object>> list3 = courseOneMapper.getSyncResultListForWaitForOtherConsumer(tableName,(page-1)*100,100); | ||
226 | +// if (CollectionUtils.isEmpty(list3)) { | ||
227 | +// break; | ||
228 | +// } | ||
229 | +// List<BusinessDataResultsEntity> res1 = list3.stream() | ||
230 | +// .map(BusinessDataResultsEntity::fromMap) | ||
231 | +// .collect(Collectors.toList()); | ||
232 | +// page++; | ||
233 | +// try { | ||
234 | +// List<BusinessDataResultsEntity> resData = new ArrayList<>(); | ||
235 | +// for (BusinessDataResultsEntity businessDataResultsEntity : res1) { | ||
236 | +// int count = courseTwoMapper.isExist("business_data_results", businessDataResultsEntity.getId()); | ||
237 | +// if (0 == count) { | ||
238 | +// resData.add(businessDataResultsEntity); | ||
239 | +// } | ||
240 | +// } | ||
241 | +// if (CollectionUtils.isNotEmpty(resData)) { | ||
242 | +// courseTwoMapper.insertBusinessDataResultsBatch(resData); | ||
243 | +// } | ||
244 | +// ids = res1.stream() | ||
245 | +// .map(BusinessDataResultsEntity::getId) | ||
246 | +// .collect(Collectors.toList()); | ||
247 | +// for (Long id : ids) { | ||
248 | +// courseOneMapper.updateSyncResult(id); | ||
249 | +// } | ||
250 | +// } catch (Exception e) { | ||
251 | +// ids = res1.stream() | ||
252 | +// .map(BusinessDataResultsEntity::getId) | ||
253 | +// .collect(Collectors.toList()); | ||
254 | +// for (Long id : ids) { | ||
255 | +// courseOneMapper.updateSyncResultFail(id); | ||
256 | +// } | ||
257 | +// } | ||
258 | +// } | ||
259 | +// log.info("消费者:表名{}同步完毕,一共{}页数据",tableName,page); | ||
260 | +// } | ||
261 | +// } | ||
262 | +// | ||
263 | +// return 0; | ||
264 | +// } | ||
265 | +//} |
src/main/resources/application.yml
0 → 100644
1 | +server: | ||
2 | + port: 8087 | ||
3 | +spring: | ||
4 | + datasource: | ||
5 | + local : | ||
6 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
7 | +# jdbc-url: jdbc:mysql://www.lepin51.com:23306/block_chain_test?&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&autoReconnect=true&failOverReadOnly=false&allow | ||
8 | +# username: root | ||
9 | +# password: Admin@2023@09 | ||
10 | + jdbc-url: jdbc:mysql://rm-bp1z30vh0pyf4j013o.mysql.rds.aliyuncs.com:3306/block_service?&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&autoReconnect=true&failOverReadOnly=false&allow | ||
11 | + username: block | ||
12 | + password: Block@2022#31 | ||
13 | + remote : | ||
14 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
15 | + jdbc-url: jdbc:mysql://192.168.31.224:3306/block_service_back?&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&allow | ||
16 | + username: block | ||
17 | + password: Block@2024#03 | ||
18 | +mybatis-plus: | ||
19 | + configuration: | ||
20 | + map-underscore-to-camel-case: true | ||
21 | + executor-type: BATCH | ||
22 | + incomplete-statements: | ||
23 | + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 显示完整sql语句 | ||
24 | + | ||
25 | +mybatis: | ||
26 | + executor-type: batch | ||
27 | + |
src/main/resources/banner.txt
0 → 100644
1 | + __ __ _____ _ _ _____ __ __ _____ _______ ______ __ __ | ||
2 | + \ \ / / |_ _| | \ | | / ____| \ \ / / / ____| |__ __| | ____| | \/ | | ||
3 | + \ \ /\ / / | | | \| | | (___ \ \_/ / | (___ | | | |__ | \ / | | ||
4 | + \ \/ \/ / | | | . ` | \___ \ \ / \___ \ | | | __| | |\/| | | ||
5 | + \ /\ / _| |_ | |\ | ____) | | | ____) | | | | |____ | | | | | ||
6 | + \/ \/ |_____| |_| \_| |_____/ |_| |_____/ |_| |______| |_| |_| | ||
7 | + | ||
8 | + |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="org.yrhl.syncdata.mapper.local.CourseOneMapper"> | ||
4 | + | ||
5 | + <select id="getList" resultType="org.yrhl.syncdata.domain.BusinessDataResultsEntity"> | ||
6 | + select * from business_data_results where create_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_SUB(CURDATE(), INTERVAL 1 SECOND); | ||
7 | + </select> | ||
8 | + | ||
9 | + | ||
10 | + <select id="getBlockSourceDataEntityList" resultType="org.yrhl.syncdata.domain.BlockSourceDataEntity"> | ||
11 | + select * from block_source_data where create_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_SUB(CURDATE(), INTERVAL 1 SECOND); | ||
12 | + </select> | ||
13 | + | ||
14 | + <select id="getBlockNewSourceDataEntityList" resultType="org.yrhl.syncdata.domain.BlockNewSourceDataEntity"> | ||
15 | + select * from block_new_source_data ; | ||
16 | + </select> | ||
17 | + | ||
18 | + <select id="getAllinonepushresultsEntityList" resultType="org.yrhl.syncdata.domain.AllinonepushresultsEntity"> | ||
19 | + select * from allinonepushresults where CreateTime BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_SUB(CURDATE(), INTERVAL 1 SECOND); | ||
20 | + </select> | ||
21 | + | ||
22 | + <select id="getSyncTableList" resultType="org.yrhl.syncdata.domain.SyncTable"> | ||
23 | + select TableName from sync_table where isDelete=0 ; | ||
24 | + </select> | ||
25 | + | ||
26 | + <select id="getSyncResultListForWaitForAllinonepushresults" resultType="org.yrhl.syncdata.domain.SyncResult" parameterType="string"> | ||
27 | + SELECT | ||
28 | + #{tableName} as TableName ,a.Id as InfoId ,a.CreateTime AS DateCreateTime,0 AS STATUS,now() AS CreateDateTime,now() AS UpdateTime | ||
29 | + FROM ${tableName} a | ||
30 | + WHERE | ||
31 | + a.CreateTime >( SELECT IF ( max( datecreatetime ) IS NULL, '2024-09-01 00:00:00', max( datecreatetime )) FROM sync_result sr WHERE sr.TableName = #{tableName} ) | ||
32 | + ORDER BY | ||
33 | + a.CreateTime | ||
34 | + LIMIT #{page}, | ||
35 | + #{size} | ||
36 | + </select> | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <select id="isExist" resultType="int" parameterType="long"> | ||
41 | + SELECT count(1) from sync_result where InfoId=#{infoId} | ||
42 | + </select> | ||
43 | + | ||
44 | + <select id="getSyncResultListForWait" resultType="org.yrhl.syncdata.domain.SyncResult" parameterType="string"> | ||
45 | + SELECT | ||
46 | + #{tableName} as TableName ,a.Id as InfoId ,a.create_date AS DateCreateTime,0 AS STATUS,now() AS CreateDateTime,now() AS UpdateTime | ||
47 | + FROM ${tableName} a | ||
48 | + WHERE | ||
49 | + a.create_date >( SELECT IF ( max( datecreatetime ) IS NULL, '2024-01-01 00:00:00', max( datecreatetime )) FROM sync_result sr WHERE sr.TableName = #{tableName} ) | ||
50 | + ORDER BY | ||
51 | + a.create_date | ||
52 | + LIMIT #{page}, | ||
53 | + #{size} | ||
54 | + </select> | ||
55 | + | ||
56 | + <insert id="insertSyncResult"> | ||
57 | + INSERT INTO sync_result ( | ||
58 | + Id, | ||
59 | + TableName, | ||
60 | + InfoId, | ||
61 | + DateCreateTime, | ||
62 | + Status, | ||
63 | + CreateDateTime, | ||
64 | + UpdateTime | ||
65 | + ) | ||
66 | + VALUES | ||
67 | + <foreach collection="list" item="item" separator=","> | ||
68 | + ( | ||
69 | + #{item.id}, | ||
70 | + #{item.TableName}, | ||
71 | + #{item.InfoId}, | ||
72 | + #{item.DateCreateTime}, | ||
73 | + 0, | ||
74 | + #{item.CreateDateTime}, | ||
75 | + #{item.UpdateTime} | ||
76 | + ) | ||
77 | + </foreach> | ||
78 | + </insert> | ||
79 | + | ||
80 | + | ||
81 | + <update id="updateSyncResult" parameterType="long" > | ||
82 | + UPDATE sync_result | ||
83 | + SET Status =1 | ||
84 | + WHERE InfoId = #{infoId} | ||
85 | + </update> | ||
86 | + | ||
87 | + | ||
88 | + <update id="updateSyncResultFail" parameterType="long" > | ||
89 | + UPDATE sync_result | ||
90 | + SET Status =-1 | ||
91 | + WHERE InfoId = #{infoId} | ||
92 | + </update> | ||
93 | + | ||
94 | + | ||
95 | + | ||
96 | + <select id="getSyncTableList" resultType="org.yrhl.syncdata.domain.SyncTable"> | ||
97 | + select * from sync_table where isDelete=0 ; | ||
98 | + </select> | ||
99 | + | ||
100 | + <select id="getSyncResultListForWaitForConsumer" resultType="org.yrhl.syncdata.domain.AllinonepushresultsEntity" parameterType="string"> | ||
101 | + select * from ${tableName} a where a.Id in(select InfoId from sync_result where TableName =#{tableName} and Status !=1) order by a.CreateTime asc limit #{page},#{size} | ||
102 | + </select> | ||
103 | + | ||
104 | + <select id="getSyncResultListForWaitForOtherConsumer" resultType="map" parameterType="string"> | ||
105 | + select * from ${tableName} a where a.Id in(select InfoId from sync_result where TableName =#{tableName} and Status !=1) order by a.create_date asc limit #{page},#{size} | ||
106 | + </select> | ||
107 | + | ||
108 | + | ||
109 | + <select id="isExesit" resultType="int" parameterType="long"> | ||
110 | + select count(1) from sync_result where InfoId=#{infoId} | ||
111 | + </select> | ||
112 | + | ||
113 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="org.yrhl.syncdata.mapper.remote.CourseTwoMapper"> | ||
4 | + | ||
5 | + <insert id="insertBusinessDataResultsBatch"> | ||
6 | + INSERT INTO business_data_results (id, | ||
7 | + platform_code, | ||
8 | + pubservice_plat_code, | ||
9 | + system_code, | ||
10 | + tender_project_id, | ||
11 | + module, | ||
12 | + tender_flow_key, | ||
13 | + op_type, | ||
14 | + table_name, | ||
15 | + table_info_id, | ||
16 | + data_value, | ||
17 | + block_chain_prev, | ||
18 | + block_chain_hash, | ||
19 | + block_chain_url, | ||
20 | + status, | ||
21 | + block_num, | ||
22 | + creator, | ||
23 | + create_date ) | ||
24 | + VALUES | ||
25 | + <foreach collection="list" item="item" separator=","> | ||
26 | + ( | ||
27 | + #{item.id}, | ||
28 | + #{item.platformCode}, | ||
29 | + #{item.pubservicePlatCode}, | ||
30 | + #{item.systemCode}, | ||
31 | + #{item.tenderProjectId}, | ||
32 | + #{item.module}, | ||
33 | + #{item.tenderFlowKey}, | ||
34 | + #{item.opType}, | ||
35 | + #{item.tableName}, | ||
36 | + #{item.tableInfoId}, | ||
37 | + #{item.dataValue}, | ||
38 | + #{item.blockChainPrev}, | ||
39 | + #{item.blockChainHash}, | ||
40 | + #{item.blockChainUrl}, | ||
41 | + #{item.status}, | ||
42 | + #{item.blockNum}, | ||
43 | + #{item.creator}, | ||
44 | + #{item.createDate} ) | ||
45 | + </foreach> | ||
46 | + </insert> | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + <insert id="insertBlockSourceDataEntityBatch"> | ||
51 | + INSERT INTO block_source_data (id, | ||
52 | + platform_code, | ||
53 | + pubservice_plat_code, | ||
54 | + system_code, | ||
55 | + tender_project_id, | ||
56 | + module, | ||
57 | + tender_flow_key, | ||
58 | + op_type, | ||
59 | + table_name, | ||
60 | + table_info_id, | ||
61 | + block_chain_prev, | ||
62 | + block_chain_hash, | ||
63 | + block_chain_url, | ||
64 | + sign_value, | ||
65 | + data, | ||
66 | + des_data, | ||
67 | + status, | ||
68 | + ip, | ||
69 | + create_date, | ||
70 | + update_date, | ||
71 | + creator, | ||
72 | + bid_section_codes, | ||
73 | + block_chain_time, | ||
74 | + is_push ) | ||
75 | + VALUES | ||
76 | + <foreach collection="list" item="item" separator=","> | ||
77 | + ( | ||
78 | + #{item.id}, | ||
79 | + #{item.platformCode}, | ||
80 | + #{item.pubservicePlatCode}, | ||
81 | + #{item.systemCode}, | ||
82 | + #{item.tenderProjectId}, | ||
83 | + #{item.module}, | ||
84 | + #{item.tenderFlowKey}, | ||
85 | + #{item.opType}, | ||
86 | + #{item.tableName}, | ||
87 | + #{item.tableInfoId}, | ||
88 | + #{item.blockChainPrev}, | ||
89 | + #{item.blockChainHash}, | ||
90 | + #{item.blockChainUrl}, | ||
91 | + #{item.signValue}, | ||
92 | + #{item.data}, | ||
93 | + #{item.desData}, | ||
94 | + #{item.status}, | ||
95 | + #{item.ip}, | ||
96 | + #{item.createDate}, | ||
97 | + #{item.updateDate}, | ||
98 | + #{item.creator}, | ||
99 | + #{item.bidSectionCodes}, | ||
100 | + #{item.blockChainTime}, | ||
101 | + #{item.isPush} ) | ||
102 | + </foreach> | ||
103 | + </insert> | ||
104 | + | ||
105 | + | ||
106 | + | ||
107 | + | ||
108 | + <insert id="insertBlockNewSourceDataEntityBatch"> | ||
109 | + INSERT INTO block_new_source_data (id, | ||
110 | + platform_code, | ||
111 | + pub_service_plat_code, | ||
112 | + system_code, | ||
113 | + block_chain_prev, | ||
114 | + data, | ||
115 | + des_data, | ||
116 | + callback_url, | ||
117 | + ip, | ||
118 | + create_date, | ||
119 | + creator, | ||
120 | + tender_project_id, | ||
121 | + module, | ||
122 | + tender_flow_key, | ||
123 | + op_type, | ||
124 | + table_name, | ||
125 | + table_info_id, | ||
126 | + datas_type | ||
127 | + ) | ||
128 | + VALUES | ||
129 | + <foreach collection="list" item="item" separator=","> | ||
130 | + ( | ||
131 | + #{item.id}, | ||
132 | + #{item.platformCode}, | ||
133 | + #{item.pubServicePlatCode}, | ||
134 | + #{item.systemCode}, | ||
135 | + #{item.blockChainPrev}, | ||
136 | + #{item.data}, | ||
137 | + #{item.desData}, | ||
138 | + #{item.callbackUrl}, | ||
139 | + #{item.ip}, | ||
140 | + #{item.createDate}, | ||
141 | + #{item.creator}, | ||
142 | + #{item.tenderProjectId}, | ||
143 | + #{item.module}, | ||
144 | + #{item.tenderFlowKey}, | ||
145 | + #{item.opType}, | ||
146 | + #{item.tableName}, | ||
147 | + #{item.tableInfoId}, | ||
148 | + #{item.datasType} | ||
149 | + ) | ||
150 | + </foreach> | ||
151 | + </insert> | ||
152 | + | ||
153 | + <insert id="insertAllinonepushresultsEntityBatch"> | ||
154 | + INSERT INTO allinonepushresults (id, | ||
155 | + TenderProjectId, | ||
156 | + Module, | ||
157 | + TableName, | ||
158 | + InfoId, | ||
159 | + Success, | ||
160 | + SendData, | ||
161 | + OpType, | ||
162 | + CreateTime, | ||
163 | + UpdateTime, | ||
164 | + Remark, | ||
165 | + TenderFlowKey, | ||
166 | + PushInfo, | ||
167 | + DesData, | ||
168 | + MqKey | ||
169 | + ) | ||
170 | + VALUES | ||
171 | + <foreach collection="list" item="item" separator=","> | ||
172 | + ( | ||
173 | + #{item.id}, | ||
174 | + #{item.tenderprojectid}, | ||
175 | + #{item.module}, | ||
176 | + #{item.tablename}, | ||
177 | + #{item.infoid}, | ||
178 | + #{item.success}, | ||
179 | + #{item.senddata}, | ||
180 | + #{item.optype}, | ||
181 | + #{item.createtime}, | ||
182 | + #{item.updatetime}, | ||
183 | + #{item.remark}, | ||
184 | + #{item.tenderflowkey}, | ||
185 | + #{item.pushInfo}, | ||
186 | + #{item.desData}, | ||
187 | + #{item.mqKey} | ||
188 | + | ||
189 | + ) | ||
190 | + </foreach> | ||
191 | + </insert> | ||
192 | + | ||
193 | + <select id="isExist" resultType="int" parameterType="long" > | ||
194 | + select count(1) from ${tableName} where Id=#{infoId} | ||
195 | + </select> | ||
196 | +</mapper> |
src/main/resources/static/index.html
0 → 100644
-
请 注册 或 登录 后发表评论