From 09ba53cbe50ea20ec17ea8c9e5c620fa520f5b45 Mon Sep 17 00:00:00 2001
From: 许鹏程 <1821349743@qq.com>
Date: 星期四, 07 九月 2023 21:56:59 +0800
Subject: [PATCH] commit
---
/dev/null | 358 ------------------
.gitignore | 1
product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java | 52 +-
product-server-data-center/src/main/java/com/product/data/center/service/DataArchivingQueue.java | 698 +++++++++++++++++++-----------------
4 files changed, 394 insertions(+), 715 deletions(-)
diff --git a/.gitignore b/.gitignore
index 65aefc9..2f6cb1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@
#鎵�鏈夌洰褰曚笅鐨則arget鏂囦欢澶�
**/target/
.svn
+.idea
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 0d1a979..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="CompilerConfiguration">
- <annotationProcessing>
- <profile default="true" name="Default" enabled="true" />
- <profile name="Maven default annotation processors profile" enabled="true">
- <sourceOutputDir name="target/generated-sources/annotations" />
- <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
- <outputRelativeToContentRoot value="true" />
- <module name="product-server-web" />
- <module name="product-server-datasource" />
- <module name="product-server-report" />
- <module name="product-server-kt-test" />
- <module name="product-server-data-centerV2" />
- </profile>
- </annotationProcessing>
- </component>
- <component name="JavacSettings">
- <option name="ADDITIONAL_OPTIONS_OVERRIDE">
- <module name="product-server-data-centerV2" options="-parameters" />
- <module name="product-server-datasource" options="-parameters" />
- <module name="product-server-kt-test" options="-parameters" />
- <module name="product-server-report" options="-parameters" />
- <module name="product-server-web" options="-parameters" />
- </option>
- </component>
-</project>
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 01a52f5..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
- <file url="file://$PROJECT_DIR$/product-server-data-center/src/main/java" charset="UTF-8" />
- <file url="file://$PROJECT_DIR$/product-server-datasource/src/main/java" charset="UTF-8" />
- <file url="file://$PROJECT_DIR$/product-server-kt-test/src/main/java" charset="UTF-8" />
- <file url="file://$PROJECT_DIR$/product-server-report/src/main/java" charset="UTF-8" />
- <file url="file://$PROJECT_DIR$/product-server-web/src/main/java" charset="UTF-8" />
- <file url="PROJECT" charset="UTF-8" />
- </component>
-</project>
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
deleted file mode 100644
index 2d7ac20..0000000
--- a/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="RemoteRepositoriesConfiguration">
- <remote-repository>
- <option name="id" value="aliyun" />
- <option name="name" value="aliyun" />
- <option name="url" value="http://nonxin.cn:8088/repository/LX-PRODUCT-PUBLIC/" />
- </remote-repository>
- <remote-repository>
- <option name="id" value="central" />
- <option name="name" value="Central Repository" />
- <option name="url" value="http://nonxin.cn:8088/repository/LX-PRODUCT-PUBLIC/" />
- </remote-repository>
- <remote-repository>
- <option name="id" value="nexus" />
- <option name="name" value="Team Nexus Repository" />
- <option name="url" value="http://nonxin.cn:8088/repository/LX-PRODUCT-PUBLIC/" />
- </remote-repository>
- <remote-repository>
- <option name="id" value="central" />
- <option name="name" value="Maven Central repository" />
- <option name="url" value="https://repo1.maven.org/maven2" />
- </remote-repository>
- <remote-repository>
- <option name="id" value="jboss.community" />
- <option name="name" value="JBoss Community repository" />
- <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
- </remote-repository>
- <remote-repository>
- <option name="id" value="central" />
- <option name="name" value="Central Repository" />
- <option name="url" value="https://maven.aliyun.com/repository/public" />
- </remote-repository>
- </component>
-</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 771eeac..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ExternalStorageConfigurationManager" enabled="true" />
- <component name="MavenProjectsManager">
- <option name="originalFiles">
- <list>
- <option value="$PROJECT_DIR$/pom.xml" />
- </list>
- </option>
- </component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
- <component name="SvnBranchConfigurationManager">
- <option name="myConfigurationMap">
- <map>
- <entry key="$PROJECT_DIR$">
- <value>
- <SvnBranchConfiguration>
- <option name="trunkUrl" value="http://za03a35kntye7vw:443/svn/changHong-KT" />
- </SvnBranchConfiguration>
- </value>
- </entry>
- </map>
- </option>
- </component>
-</project>
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 797acea..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="RunConfigurationProducerService">
- <option name="ignoredProducers">
- <set>
- <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
- </set>
- </option>
- </component>
-</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 78e665f..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="VcsDirectoryMappings">
- <mapping directory="$PROJECT_DIR$" vcs="svn" />
- </component>
-</project>
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index cdafd93..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,358 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="AutoImportSettings">
- <option name="autoReloadType" value="SELECTIVE" />
- </component>
- <component name="ChangeListManager">
- <list default="true" id="5006eae6-b7c0-49af-a2a6-4dcfaf4c5a08" name="Changes" comment="">
- <change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
- <change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
- <change afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/entity/HistoryEntity.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/config/CmnConst.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/config/CmnConst.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/config/ErrorCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/config/ErrorCode.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/controller/MesExternalController.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/controller/MesExternalController.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/JournalManagerService.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/JournalManagerService.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/utils/QuerySqlParseUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/utils/QuerySqlParseUtil.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-web/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-web/pom.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-web/resources/LicenseKey.dat" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-web/resources/LicenseKey.dat" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-web/src/main/java/com/product/InitialLoad.java" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-web/src/main/java/com/product/InitialLoad.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/product-server-web/src/main/resources/application-dev.properties" beforeDir="false" afterPath="$PROJECT_DIR$/product-server-web/src/main/resources/application-dev.properties" afterDir="false" />
- </list>
- <option name="SHOW_DIALOG" value="false" />
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
- <option name="LAST_RESOLUTION" value="IGNORE" />
- </component>
- <component name="FileTemplateManagerImpl">
- <option name="RECENT_TEMPLATES">
- <list>
- <option value="Class" />
- </list>
- </option>
- </component>
- <component name="GitSEFilterConfiguration">
- <file-type-list>
- <filtered-out-file-type name="LOCAL_BRANCH" />
- <filtered-out-file-type name="REMOTE_BRANCH" />
- <filtered-out-file-type name="TAG" />
- <filtered-out-file-type name="COMMIT_BY_MESSAGE" />
- </file-type-list>
- </component>
- <component name="ProjectId" id="2LgBBdZhrsoD5eiK3erl6mCnWKT" />
- <component name="ProjectViewState">
- <option name="hideEmptyMiddlePackages" value="true" />
- <option name="showLibraryContents" value="true" />
- </component>
- <component name="PropertiesComponent">
- <property name="ExpandSpringBootJavaOptionsPanel" value="true" />
- <property name="RequestMappingsPanelOrder0" value="0" />
- <property name="RequestMappingsPanelOrder1" value="1" />
- <property name="RequestMappingsPanelWidth0" value="75" />
- <property name="RequestMappingsPanelWidth1" value="75" />
- <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
- <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
- <property name="WebServerToolWindowFactoryState" value="false" />
- <property name="last_opened_file_path" value="$PROJECT_DIR$" />
- <property name="nodejs_package_manager_path" value="npm" />
- <property name="project.structure.last.edited" value="Modules" />
- <property name="project.structure.proportion" value="0.0" />
- <property name="project.structure.side.proportion" value="0.0" />
- <property name="restartRequiresConfirmation" value="false" />
- <property name="settings.editor.selected.configurable" value="build.tools" />
- <property name="vue.rearranger.settings.migration" value="true" />
- </component>
- <component name="ReactorSettings">
- <option name="notificationShown" value="true" />
- </component>
- <component name="RecentsManager">
- <key name="CopyFile.RECENT_KEYS">
- <recent name="D:\work\project\changHong-KT" />
- </key>
- </component>
- <component name="RunManager" selected="Spring Boot.Application">
- <configuration name="MesExternalService" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
- <option name="MAIN_CLASS_NAME" value="com.product.data.center.service.MesExternalService" />
- <module name="product-server-data-centerV2" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.product.data.center.service.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="SyncDelRecordService" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
- <option name="MAIN_CLASS_NAME" value="com.product.data.center.service.SyncDelRecordService" />
- <module name="product-server-data-centerV2" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.product.data.center.service.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="10.13.1.39 debugger" type="Remote">
- <module name="product-server-web" />
- <option name="USE_SOCKET_TRANSPORT" value="true" />
- <option name="SERVER_MODE" value="false" />
- <option name="SHMEM_ADDRESS" />
- <option name="HOST" value="10.13.1.39" />
- <option name="PORT" value="5005" />
- <option name="AUTO_RESTART" value="false" />
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="5005" />
- <option name="LOCAL" value="false" />
- </RunnerSettings>
- <method v="2" />
- </configuration>
- <configuration name="10.16.60.170 debugger" type="Remote">
- <option name="USE_SOCKET_TRANSPORT" value="true" />
- <option name="SERVER_MODE" value="false" />
- <option name="SHMEM_ADDRESS" />
- <option name="HOST" value="10.16.60.170" />
- <option name="PORT" value="5005" />
- <option name="AUTO_RESTART" value="false" />
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="5005" />
- <option name="LOCAL" value="false" />
- </RunnerSettings>
- <method v="2" />
- </configuration>
- <configuration name="Application" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
- <module name="product-server-web" />
- <option name="SPRING_BOOT_MAIN_CLASS" value="com.product.Application" />
- <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/../product-server_v2.0.0/product-server-web" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="SHORTEN_COMMAND_LINE" value="NONE" />
- <option name="UPDATE_ACTION_UPDATE_POLICY" value="UpdateClassesAndResources" />
- <option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <list>
- <item itemvalue="Application.SyncDelRecordService" />
- <item itemvalue="Application.MesExternalService" />
- <item itemvalue="Remote JVM Debug.10.16.60.170 debugger" />
- <item itemvalue="Remote JVM Debug.10.13.1.39 debugger" />
- <item itemvalue="Spring Boot.Application" />
- </list>
- <recent_temporary>
- <list>
- <item itemvalue="Application.MesExternalService" />
- <item itemvalue="Application.SyncDelRecordService" />
- </list>
- </recent_temporary>
- </component>
- <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
- <component name="SvnConfiguration" cleanupOnStartRun="true">
- <configuration>C:\Users\cheng\AppData\Roaming\Subversion</configuration>
- <supportedVersion>125</supportedVersion>
- </component>
- <component name="SvnFileUrlMappingImpl">
- <option name="myMappingRoots">
- <list>
- <SvnCopyRootSimple>
- <option name="myVcsRoot" value="D:\work\project\changHong-KT" />
- <option name="myCopyRoot" value="D:\work\project\changHong-KT" />
- </SvnCopyRootSimple>
- </list>
- </option>
- <option name="myMoreRealMappingRoots">
- <list>
- <SvnCopyRootSimple>
- <option name="myVcsRoot" value="D:\work\project\changHong-KT" />
- <option name="myCopyRoot" value="D:\work\project\changHong-KT" />
- </SvnCopyRootSimple>
- </list>
- </option>
- </component>
- <component name="TaskManager">
- <task active="true" id="Default" summary="Default task">
- <changelist id="5006eae6-b7c0-49af-a2a6-4dcfaf4c5a08" name="Changes" comment="" />
- <created>1676282712937</created>
- <option name="number" value="Default" />
- <option name="presentableId" value="Default" />
- <updated>1676282712937</updated>
- <workItem from="1676282714595" duration="1946000" />
- <workItem from="1676338269700" duration="338000" />
- <workItem from="1676443225557" duration="1402000" />
- <workItem from="1676511633357" duration="52000" />
- <workItem from="1676598175556" duration="4826000" />
- <workItem from="1676857947250" duration="5204000" />
- <workItem from="1676943092367" duration="5296000" />
- <workItem from="1677202091530" duration="67000" />
- <workItem from="1677640407209" duration="6757000" />
- <workItem from="1677721495635" duration="72000" />
- <workItem from="1677751216481" duration="861000" />
- <workItem from="1677807781397" duration="35000" />
- <workItem from="1678153343863" duration="149000" />
- <workItem from="1678361702745" duration="2461000" />
- <workItem from="1678411095819" duration="2000" />
- <workItem from="1678759533244" duration="5589000" />
- <workItem from="1678844671601" duration="3352000" />
- <workItem from="1678849158780" duration="13000" />
- <workItem from="1678851786240" duration="1599000" />
- <workItem from="1678930791277" duration="45000" />
- <workItem from="1679383442897" duration="6019000" />
- <workItem from="1679391958839" duration="4989000" />
- <workItem from="1679623728381" duration="145000" />
- <workItem from="1680513579837" duration="2553000" />
- <workItem from="1680750568147" duration="10868000" />
- <workItem from="1680831166371" duration="3239000" />
- <workItem from="1681094870393" duration="7958000" />
- <workItem from="1681118193008" duration="563000" />
- <workItem from="1681181610119" duration="3372000" />
- <workItem from="1681264880159" duration="8375000" />
- <workItem from="1681351410264" duration="3000" />
- <workItem from="1684719510569" duration="17387000" />
- <workItem from="1684745006469" duration="23000" />
- <workItem from="1685067103029" duration="2619000" />
- <workItem from="1685090409668" duration="3001000" />
- <workItem from="1685515317563" duration="323000" />
- <workItem from="1686706705067" duration="1964000" />
- <workItem from="1686722542467" duration="4415000" />
- <workItem from="1686808345317" duration="13479000" />
- <workItem from="1686879612542" duration="14000" />
- <workItem from="1686880512036" duration="3701000" />
- <workItem from="1686894607940" duration="4000" />
- <workItem from="1687763641245" duration="775000" />
- <workItem from="1687769326697" duration="14000" />
- <workItem from="1687769685046" duration="612000" />
- <workItem from="1687770468818" duration="278000" />
- <workItem from="1687770771703" duration="28000" />
- <workItem from="1687927873030" duration="2862000" />
- <workItem from="1688001437224" duration="11000" />
- <workItem from="1688105728364" duration="2181000" />
- <workItem from="1688117142100" duration="2632000" />
- </task>
- <task id="LOCAL-00001">
- <created>1676598553295</created>
- <option name="number" value="00001" />
- <option name="presentableId" value="LOCAL-00001" />
- <option name="project" value="LOCAL" />
- <updated>1676598553295</updated>
- </task>
- <task id="LOCAL-00002">
- <created>1676598999311</created>
- <option name="number" value="00002" />
- <option name="presentableId" value="LOCAL-00002" />
- <option name="project" value="LOCAL" />
- <updated>1676598999311</updated>
- </task>
- <task id="LOCAL-00003">
- <created>1676858519011</created>
- <option name="number" value="00003" />
- <option name="presentableId" value="LOCAL-00003" />
- <option name="project" value="LOCAL" />
- <updated>1676858519011</updated>
- </task>
- <task id="LOCAL-00004">
- <created>1676862704154</created>
- <option name="number" value="00004" />
- <option name="presentableId" value="LOCAL-00004" />
- <option name="project" value="LOCAL" />
- <updated>1676862704154</updated>
- </task>
- <task id="LOCAL-00005">
- <created>1676943932313</created>
- <option name="number" value="00005" />
- <option name="presentableId" value="LOCAL-00005" />
- <option name="project" value="LOCAL" />
- <updated>1676943932313</updated>
- </task>
- <task id="LOCAL-00006">
- <created>1676944022824</created>
- <option name="number" value="00006" />
- <option name="presentableId" value="LOCAL-00006" />
- <option name="project" value="LOCAL" />
- <updated>1676944022824</updated>
- </task>
- <task id="LOCAL-00007">
- <created>1676944756803</created>
- <option name="number" value="00007" />
- <option name="presentableId" value="LOCAL-00007" />
- <option name="project" value="LOCAL" />
- <updated>1676944756803</updated>
- </task>
- <task id="LOCAL-00008">
- <created>1677642261021</created>
- <option name="number" value="00008" />
- <option name="presentableId" value="LOCAL-00008" />
- <option name="project" value="LOCAL" />
- <updated>1677642261021</updated>
- </task>
- <task id="LOCAL-00009">
- <created>1678760111369</created>
- <option name="number" value="00009" />
- <option name="presentableId" value="LOCAL-00009" />
- <option name="project" value="LOCAL" />
- <updated>1678760111369</updated>
- </task>
- <task id="LOCAL-00010">
- <created>1680759561417</created>
- <option name="number" value="00010" />
- <option name="presentableId" value="LOCAL-00010" />
- <option name="project" value="LOCAL" />
- <updated>1680759561417</updated>
- </task>
- <task id="LOCAL-00011">
- <created>1681269717211</created>
- <option name="number" value="00011" />
- <option name="presentableId" value="LOCAL-00011" />
- <option name="project" value="LOCAL" />
- <updated>1681269717211</updated>
- </task>
- <option name="localTasksCounter" value="12" />
- <servers />
- </component>
- <component name="TypeScriptGeneratedFilesManager">
- <option name="version" value="3" />
- </component>
- <component name="VcsManagerConfiguration">
- <option name="LAST_COMMIT_MESSAGE" value="" />
- </component>
- <component name="XDebuggerManager">
- <breakpoint-manager>
- <breakpoints>
- <line-breakpoint enabled="true" type="java-line">
- <url>file://$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/controller/MesExternalController.java</url>
- <line>83</line>
- <option name="timeStamp" value="2" />
- </line-breakpoint>
- <line-breakpoint enabled="true" type="java-line">
- <url>file://$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java</url>
- <line>832</line>
- <option name="timeStamp" value="4" />
- </line-breakpoint>
- <line-breakpoint enabled="true" type="java-line">
- <url>file://$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/JournalManagerService.java</url>
- <line>356</line>
- <option name="timeStamp" value="5" />
- </line-breakpoint>
- <line-breakpoint enabled="true" type="java-line">
- <url>file://$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/service/DataCollectService.java</url>
- <line>216</line>
- <option name="timeStamp" value="6" />
- </line-breakpoint>
- <line-breakpoint enabled="true" type="java-line">
- <url>file://$PROJECT_DIR$/product-server-data-center/src/main/java/com/product/data/center/controller/MesExternalController.java</url>
- <line>63</line>
- <option name="timeStamp" value="7" />
- </line-breakpoint>
- <line-breakpoint enabled="true" type="java-line">
- <url>file://$PROJECT_DIR$/product-server-datasource/src/main/java/com/product/datasource/dao/impl/OracleDaoImpl.java</url>
- <line>429</line>
- <option name="timeStamp" value="28" />
- </line-breakpoint>
- </breakpoints>
- </breakpoint-manager>
- </component>
-</project>
\ No newline at end of file
diff --git a/product-server-data-center/src/main/java/com/product/data/center/service/DataArchivingQueue.java b/product-server-data-center/src/main/java/com/product/data/center/service/DataArchivingQueue.java
index 5741e4a..42972e2 100644
--- a/product-server-data-center/src/main/java/com/product/data/center/service/DataArchivingQueue.java
+++ b/product-server-data-center/src/main/java/com/product/data/center/service/DataArchivingQueue.java
@@ -17,6 +17,7 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -33,354 +34,381 @@
*/
@Service
public class DataArchivingQueue extends AbstractBaseService {
- // 鏌ヨ闃熷垪map锛歮ap<琛ㄥ悕锛宒te闃熷垪>
- private static Map<String, LinkedBlockingQueue<DataTableEntity>> queryMap = new ConcurrentHashMap<>();
- // 鏌ヨ瀛樻椿map锛氭鍦ㄦ墽琛屾煡璇㈢殑琛紝瀵瑰簲鐨勫�间负鎵ц鐨勭嚎绋嬫暟锛屼负0鏍囪瘑宸茬粡鎵ц瀹屾垚
- private static Map<String, Set<String>> existsQueryMap = Maps.newHashMap();
- // 鏌ヨ绾跨▼map
- private static Map<String, ExecutorService> queryThreadMap = Maps.newHashMap();
- // 閿欒鏃ュ織map
- private static Map<String, StringBuilder> errorLogMap = Maps.newHashMap();
- // 鍗曡〃鏌ヨ鏈�澶х嚎绋嬫暟
- private static final int QUERY_THREAD_COUNT = 3;
- // 鍗曡〃楠岃瘉鏌ヨ鏈�澶ф壒娆★紙鍗曡〃鏌ヨ鏈�澶ф壒娆�=鍗曡〃楠岃瘉鏌ヨ鏈�澶ф壒娆� + 鍗曡〃鏌ヨ鏈�澶х嚎绋嬫暟锛�
- private static final int QUERY_MAX_BATCH_COUNT = 4;
- // 鏌ヨ姣忛〉澶у皬
- private static final int QUERY_PAGE_SIZE = 50000;
- // 鎻掑叆姣忛〉澶у皬
- public static final int INSERT_PAGE_SIZE = 5000;
+ // 鏌ヨ闃熷垪map锛歮ap<琛ㄥ悕锛宒te闃熷垪>
+ private static Map<String, LinkedBlockingQueue<DataTableEntity>> queryMap = new ConcurrentHashMap<>();
+ // 鏌ヨ瀛樻椿map锛氭鍦ㄦ墽琛屾煡璇㈢殑琛紝瀵瑰簲鐨勫�间负鎵ц鐨勭嚎绋嬫暟锛屼负0鏍囪瘑宸茬粡鎵ц瀹屾垚
+ private static Map<String, Set<String>> existsQueryMap = Maps.newHashMap();
+ // 鏌ヨ绾跨▼map
+ private static Map<String, ExecutorService> queryThreadMap = Maps.newHashMap();
+ // 閿欒鏃ュ織map
+ private static Map<String, StringBuilder> errorLogMap = Maps.newHashMap();
+ // 鍗曡〃鏌ヨ鏈�澶х嚎绋嬫暟
+ private static final int QUERY_THREAD_COUNT = 3;
+ // 鍗曡〃楠岃瘉鏌ヨ鏈�澶ф壒娆★紙鍗曡〃鏌ヨ鏈�澶ф壒娆�=鍗曡〃楠岃瘉鏌ヨ鏈�澶ф壒娆� + 鍗曡〃鏌ヨ鏈�澶х嚎绋嬫暟锛�
+ private static final int QUERY_MAX_BATCH_COUNT = 4;
+ // 鏌ヨ姣忛〉澶у皬
+ private static final int QUERY_PAGE_SIZE = 50000;
+ // 鎻掑叆姣忛〉澶у皬
+ public static final int INSERT_PAGE_SIZE = 5000;
- /**
- * 鏌ヨ
- * @param sourceDbe
- * @param sourceTable
- * @param filter
- * @param params
- * @param uniqueField 涓婚敭锛屼笉浠呬細鐢ㄤ簬璇嗗埆杩樹細鐢ㄤ簬鎺掑簭闃叉oracle鍒嗛〉鑾峰彇鍒伴噸澶嶆暟鎹�
- * @param minID
- */
- public void query(DataBaseEntity sourceDbe, String sourceTable, String filter, Object[] params, String uniqueField, String minID) {
- Dao sourceDao = null;
- try {
- StringBuilder countSql = new StringBuilder(128);
- countSql.append("select count(*) count_value from ").append(sourceTable);
- if (!StringUtils.isEmpty(filter)) {
- countSql.append(" where ").append(filter);
- }
- sourceDao = sourceDbe.newDao();
- FieldSetEntity countFse = sourceDao.getOne(countSql.toString(), params);
- int totalCount = StringUtils.isEmpty(countFse.getString("count_value")) ? 0 : countFse.getInteger("count_value");
- int partCount = getPartCount(totalCount);
- shutdownQueryThread(sourceTable);
- ExecutorService executorService = Executors.newWorkStealingPool(QUERY_THREAD_COUNT);
- queryThreadMap.put(sourceTable, executorService);
- StringBuilder rangeSql = new StringBuilder(128);
- String tempPartMinID = minID;
- int partSize = partCount * QUERY_PAGE_SIZE;
- int count = ceilPage(totalCount, partSize);
- for (int i = 1; i <= count; i++) {
- rangeSql.setLength(0);
- if (!StringUtils.isEmpty(filter)) {
- rangeSql.append(filter).append(" and ");
- }
- rangeSql.append(uniqueField).append(">='").append(tempPartMinID).append("'");
- DataTableEntity rangeDte = sourceDao.getList(getSql(uniqueField, sourceTable, rangeSql.toString(), sourceDbe.getDbType().getValue(), 1, partSize), params);
- if (DataTableEntity.isEmpty(rangeDte)) {
- continue;
- }
- FieldSetEntity rangeFse = rangeDte.getFieldSetEntity(0);
- String curPartMaxID = rangeFse.getString("max_id");
- String curPartMinID = tempPartMinID;
- executorService.submit(() -> {
- String threadInfo = String.valueOf(Thread.currentThread().getId());
- Dao threadSourceDao = null;
- String thisPartMinID = curPartMinID;
- try {
- threadSourceDao = sourceDbe.newDao();
- startQuery(sourceTable, threadInfo);
- int totalPage = ceilPage(partSize, QUERY_PAGE_SIZE);
- StringBuilder tempFilter = new StringBuilder(128);
- for (int j = 0; j < totalPage; j++) {
- while (!allowQuery(sourceTable)) {
- Thread.sleep(RandomUtil.randomInt(800, 1200));
- }
- tempFilter.setLength(0);
- tempFilter.append(uniqueField);
- WriteUtil.append("DA-threadInfo:" + threadInfo + "-thisPartMinID:" + thisPartMinID);
- if (minID.equals(thisPartMinID)) {
- tempFilter.append(">=");
- } else {
- tempFilter.append(">");
- }
- tempFilter.append("'").append(thisPartMinID).append("'").append(" and ").append(uniqueField).append("<='").append(curPartMaxID).append("'");
- if (!StringUtils.isEmpty(filter)) {
- tempFilter.append(" and ").append(filter);
- }
- WriteUtil.append("DA-threadInfo:" + threadInfo + "-currentPage锛�" + (j + 1) + "-pageSize锛�" + QUERY_PAGE_SIZE + "-filter锛�" + tempFilter);
- DataTableEntity allDte = threadSourceDao.getList(sourceTable, tempFilter.toString(), params, uniqueField, 1, QUERY_PAGE_SIZE);
- if (!DataTableEntity.isEmpty(allDte)) {
- add(sourceTable, allDte);
- thisPartMinID = allDte.getFieldSetEntity(allDte.getRows() - 1).getString(uniqueField);
- } else {
- break;
- }
- }
- } catch (Exception e) {
- appendErrorLog(sourceTable, SpringUtils.getBean(JournalManagerService.class).getStackTrace(e).trim());
- SpringMVCContextHolder.getSystemLogger().error(e);
- clear(sourceTable);
- } finally {
- if (threadSourceDao != null) {
- threadSourceDao.closeConnection();
- }
- finalQuery(sourceTable, threadInfo);
- }
- });
- tempPartMinID = curPartMaxID;
- }
- } catch (Exception e) {
- throw e;
- } finally {
- if (sourceDao != null) {
- sourceDao.closeConnection();
- }
- }
- }
+ /**
+ * 鏌ヨ
+ *
+ * @param sourceDbe
+ * @param sourceTable
+ * @param filter
+ * @param params
+ * @param uniqueField 涓婚敭锛屼笉浠呬細鐢ㄤ簬璇嗗埆杩樹細鐢ㄤ簬鎺掑簭闃叉oracle鍒嗛〉鑾峰彇鍒伴噸澶嶆暟鎹�
+ * @param minID
+ */
+ public void query(DataBaseEntity sourceDbe, String sourceTable, String filter, Object[] params, String uniqueField, String minID) {
+ Dao sourceDao = null;
+ try {
+ StringBuilder countSql = new StringBuilder(128);
+ countSql.append("select count(*) count_value from ").append(sourceTable);
+ if (!StringUtils.isEmpty(filter)) {
+ countSql.append(" where ").append(filter);
+ }
+ sourceDao = sourceDbe.newDao();
+ FieldSetEntity countFse = sourceDao.getOne(countSql.toString(), params);
+ int totalCount = StringUtils.isEmpty(countFse.getString("count_value")) ? 0 : countFse.getInteger("count_value");
+ int partCount = getPartCount(totalCount);
+ shutdownQueryThread(sourceTable);
+ ExecutorService executorService = Executors.newWorkStealingPool(QUERY_THREAD_COUNT);
+ queryThreadMap.put(sourceTable, executorService);
+ StringBuilder rangeSql = new StringBuilder(128);
+ String tempPartMinID = minID;
+ int partSize = partCount * QUERY_PAGE_SIZE;
+ int count = ceilPage(totalCount, partSize);
+ for (int i = 1; i <= count; i++) {
+ rangeSql.setLength(0);
+ if (!StringUtils.isEmpty(filter)) {
+ rangeSql.append(filter).append(" and ");
+ }
+ rangeSql.append(uniqueField).append(">='").append(tempPartMinID).append("'");
+ DataTableEntity rangeDte = sourceDao.getList(getSql(uniqueField, sourceTable, rangeSql.toString(), sourceDbe.getDbType().getValue(), 1, partSize), params);
+ if (DataTableEntity.isEmpty(rangeDte)) {
+ continue;
+ }
+ FieldSetEntity rangeFse = rangeDte.getFieldSetEntity(0);
+ String curPartMaxID = rangeFse.getString("max_id");
+ String curPartMinID = tempPartMinID;
+ executorService.submit(() -> {
+ String threadInfo = String.valueOf(Thread.currentThread().getId());
+ Dao threadSourceDao = null;
+ String thisPartMinID = curPartMinID;
+ try {
+ threadSourceDao = sourceDbe.newDao();
+ startQuery(sourceTable, threadInfo);
+ int totalPage = ceilPage(partSize, QUERY_PAGE_SIZE);
+ StringBuilder tempFilter = new StringBuilder(128);
+ for (int j = 0; j < totalPage; j++) {
+ while (!allowQuery(sourceTable)) {
+ Thread.sleep(RandomUtil.randomInt(800, 1200));
+ }
+ tempFilter.setLength(0);
+ tempFilter.append(uniqueField);
+ WriteUtil.append("DA-threadInfo:" + threadInfo + "-thisPartMinID:" + thisPartMinID);
+ if (minID.equals(thisPartMinID)) {
+ tempFilter.append(">=");
+ } else {
+ tempFilter.append(">");
+ }
+ tempFilter.append("'").append(thisPartMinID).append("'").append(" and ").append(uniqueField).append("<='").append(curPartMaxID).append("'");
+ if (!StringUtils.isEmpty(filter)) {
+ tempFilter.append(" and ").append(filter);
+ }
+ WriteUtil.append("DA-threadInfo:" + threadInfo + "-currentPage锛�" + (j + 1) + "-pageSize锛�" + QUERY_PAGE_SIZE + "-filter锛�" + tempFilter);
+ DataTableEntity allDte = threadSourceDao.getList(sourceTable, tempFilter.toString(), params, uniqueField, 1, QUERY_PAGE_SIZE);
+ if (!DataTableEntity.isEmpty(allDte)) {
+ add(sourceTable, allDte);
+ thisPartMinID = allDte.getFieldSetEntity(allDte.getRows() - 1).getString(uniqueField);
+ } else {
+ break;
+ }
+ }
+ } catch (Exception e) {
+ appendErrorLog(sourceTable, SpringUtils.getBean(JournalManagerService.class).getStackTrace(e).trim());
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ clear(sourceTable);
+ } finally {
+ if (threadSourceDao != null) {
+ threadSourceDao.closeConnection();
+ }
+ finalQuery(sourceTable, threadInfo);
+ }
+ });
+ tempPartMinID = curPartMaxID;
+ }
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ if (sourceDao != null) {
+ sourceDao.closeConnection();
+ }
+ }
+ }
- /**
- * 浠庨槦鍒椾腑鑾峰彇
- * @param tableName
- * @return
- */
- public DataTableEntity get(String tableName) {
- WriteUtil.append("DA-浠庨槦鍒椾腑鑾峰彇-琛ㄥ悕锛�" + tableName);
- synchronized (tableName.intern()) {
- LinkedBlockingQueue<DataTableEntity> queryQueue = queryMap.get(tableName);
- if (queryQueue == null) {
- return null;
- }
- return queryQueue.poll();
- }
- }
+ /**
+ * 浠庨槦鍒椾腑鑾峰彇
+ *
+ * @param tableName
+ * @return
+ */
+ public DataTableEntity get(String tableName) {
+ WriteUtil.append("DA-浠庨槦鍒椾腑鑾峰彇-琛ㄥ悕锛�" + tableName);
+ synchronized (tableName.intern()) {
+ LinkedBlockingQueue<DataTableEntity> queryQueue = queryMap.get(tableName);
+ if (queryQueue == null) {
+ return null;
+ }
+ return queryQueue.poll();
+ }
+ }
- /**
- * 鍒ゅ畾鏄惁鏌ヨ瀹屾瘯
- * @param tableName
- * @return
- */
- public boolean checkQueryFinish(String tableName) {
- WriteUtil.append("DA-鍒ゅ畾鏄惁鏌ヨ瀹屾瘯");
- Set<String> set = existsQueryMap.get(tableName);
- return set == null || set.isEmpty();
- }
+ /**
+ * 鍒ゅ畾鏄惁鏌ヨ瀹屾瘯
+ *
+ * @param tableName
+ * @return
+ */
+ public boolean checkQueryFinish(String tableName) {
+ WriteUtil.append("DA-鍒ゅ畾鏄惁鏌ヨ瀹屾瘯");
+ Set<String> set = existsQueryMap.get(tableName);
+ return set == null || set.isEmpty();
+ }
- /**
- * 鍒ゅ畾鎻掑叆闃熷垪锛堟煡璇㈠畬鎴愬悗鏀惧叆鐨勯槦鍒楋級鏄惁涓虹┖
- * @param tableName
- * @return
- */
- public boolean checkInsertQueueEmpty(String tableName) {
- WriteUtil.append("DA-鍒ゅ畾鎻掑叆闃熷垪锛堟煡璇㈠畬鎴愬悗鏀惧叆鐨勯槦鍒楋級鏄惁涓虹┖");
- return queryMap == null || queryMap.get(tableName) == null || queryMap.get(tableName).isEmpty();
- }
+ /**
+ * 鍒ゅ畾鎻掑叆闃熷垪锛堟煡璇㈠畬鎴愬悗鏀惧叆鐨勯槦鍒楋級鏄惁涓虹┖
+ *
+ * @param tableName
+ * @return
+ */
+ public boolean checkInsertQueueEmpty(String tableName) {
+ WriteUtil.append("DA-鍒ゅ畾鎻掑叆闃熷垪锛堟煡璇㈠畬鎴愬悗鏀惧叆鐨勯槦鍒楋級鏄惁涓虹┖");
+ return queryMap == null || queryMap.get(tableName) == null || queryMap.get(tableName).isEmpty();
+ }
- /**
- * 鍏抽棴鏌ヨ绾跨▼
- * @param tableName
- */
- public void shutdownQueryThread(String tableName) {
- synchronized (tableName.intern()) {
- ExecutorService executorService = queryThreadMap.get(tableName);
- if (executorService != null) {
- if (!executorService.isShutdown()) {
- executorService.shutdown();
- }
- queryThreadMap.remove(tableName);
- }
- }
- }
+ /**
+ * 鍏抽棴鏌ヨ绾跨▼
+ *
+ * @param tableName
+ */
+ public void shutdownQueryThread(String tableName) {
+ synchronized (tableName.intern()) {
+ ExecutorService executorService = queryThreadMap.get(tableName);
+ if (executorService != null) {
+ if (!executorService.isShutdown()) {
+ executorService.shutdown();
+ }
+ queryThreadMap.remove(tableName);
+ }
+ }
+ }
- /**
- * 娓呯悊
- * @param tableName
- */
- public void clear(String tableName) {
- synchronized (tableName.intern()) {
- queryMap.remove(tableName);
- shutdownQueryThread(tableName);
- }
- }
+ /**
+ * 娓呯悊
+ *
+ * @param tableName
+ */
+ public void clear(String tableName) {
+ synchronized (tableName.intern()) {
+ queryMap.remove(tableName);
+ shutdownQueryThread(tableName);
+ }
+ }
- /**
- * 鎻愬彇閿欒鏃ュ織锛屽彧鑳芥彁鍙栦竴娆★紝鎻愬彇鍚庝細鐩存帴娓呯┖
- * @param tableName
- * @return
- */
- public String getErrorLog(String tableName) {
- synchronized (tableName.intern()) {
- if (errorLogMap == null) {
- return null;
- } else {
- StringBuilder result = errorLogMap.get(tableName);
- errorLogMap.remove(tableName);
- return result == null ? null : result.toString();
- }
- }
- }
+ /**
+ * 鎻愬彇閿欒鏃ュ織锛屽彧鑳芥彁鍙栦竴娆★紝鎻愬彇鍚庝細鐩存帴娓呯┖
+ *
+ * @param tableName
+ * @return
+ */
+ public String getErrorLog(String tableName) {
+ synchronized (tableName.intern()) {
+ if (errorLogMap == null) {
+ return null;
+ } else {
+ StringBuilder result = errorLogMap.get(tableName);
+ errorLogMap.remove(tableName);
+ return result == null ? null : result.toString();
+ }
+ }
+ }
- /**
- * 鑾峰彇鍒嗘鐨勬暟閲忥紝鏈�澶�16锛屾渶灏忎负0锛屼负0琛ㄧず鐢ㄤ笉涓婃墍鏈夌殑绾跨▼
- * @param totalCount
- * @return
- */
- private int getPartCount(int totalCount) {
- int num = QUERY_THREAD_COUNT * QUERY_PAGE_SIZE;
- int partCount = totalCount / num + (totalCount % num == 0 ? 0 : 1);
- if (partCount >= 16) {
- return 16;
- } else if (partCount >= 8) {
- return 8;
- } else if (partCount >= 4) {
- return 4;
- } else if (partCount >= 2) {
- return 2;
- } else if (partCount >= 1) {
- return 1;
- } else {
- return 0;
- }
- }
+ /**
+ * 鑾峰彇鍒嗘鐨勬暟閲忥紝鏈�澶�16锛屾渶灏忎负0锛屼负0琛ㄧず鐢ㄤ笉涓婃墍鏈夌殑绾跨▼
+ *
+ * @param totalCount
+ * @return
+ */
+ private int getPartCount(int totalCount) {
+ int num = QUERY_THREAD_COUNT * QUERY_PAGE_SIZE;
+ int partCount = totalCount / num + (totalCount % num == 0 ? 0 : 1);
+ if (partCount >= 16) {
+ return 16;
+ } else if (partCount >= 8) {
+ return 8;
+ } else if (partCount >= 4) {
+ return 4;
+ } else if (partCount >= 2) {
+ return 2;
+ } else if (partCount >= 1) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
- /**
- * 鑾峰彇sql锛氭煡璇㈣寖鍥村唴鐨勬渶澶d鍊�
- * @param uniqueField
- * @param sourceTable
- * @param filter
- * @param dbType
- * @param pageIndex
- * @param pageSize
- * @return
- */
- private String getSql(String uniqueField, String sourceTable, String filter, int dbType, int pageIndex, int pageSize) {
- int startIndex = (Math.max(pageIndex, 1) - 1) * pageSize;
- int finalIndex = startIndex + pageSize;
- StringBuilder sql = new StringBuilder(128);
- if (DataBaseType.MYSQL.getValue() == dbType) {
- sql.append("select max(").append(uniqueField).append(") max_id from (");
- sql.append("\n select ").append(uniqueField).append(" from ").append(sourceTable);
- if (!StringUtils.isEmpty(filter)) {
- sql.append("\n where ").append(filter);
- }
- sql.append("\n order by ").append(uniqueField);
- sql.append("\n limit ").append(startIndex).append(",").append(pageSize);
- sql.append("\n) t");
- } else if (DataBaseType.ORACLE.getValue() == dbType) {
- sql.append("SELECT MAX(").append(uniqueField).append(") max_id FROM (");
- sql.append("\n SELECT ").append(uniqueField).append(",ROWNUM R FROM (");
- sql.append("\n SELECT ").append(uniqueField).append(" FROM ").append(sourceTable);
- if (!StringUtils.isEmpty(filter)) {
- sql.append("\n WHERE ").append(filter);
- }
- sql.append("\n ORDER BY ").append(uniqueField);
- sql.append("\n ) T1");
- sql.append("\n WHERE ROWNUM<=").append(finalIndex);
- sql.append("\n) T2");
- sql.append("\nWHERE R>").append(startIndex);
- }
- return sql.toString();
- }
+ /**
+ * 鑾峰彇sql锛氭煡璇㈣寖鍥村唴鐨勬渶澶d鍊�
+ *
+ * @param uniqueField
+ * @param sourceTable
+ * @param filter
+ * @param dbType
+ * @param pageIndex
+ * @param pageSize
+ * @return
+ */
+ private String getSql(String uniqueField, String sourceTable, String filter, int dbType, int pageIndex, int pageSize) {
+ int startIndex = (Math.max(pageIndex, 1) - 1) * pageSize;
+ int finalIndex = startIndex + pageSize;
+ StringBuilder sql = new StringBuilder(128);
+ if (DataBaseType.MYSQL.getValue() == dbType) {
+ sql.append("select max(").append(uniqueField).append(") max_id from (");
+ sql.append("\n select ").append(uniqueField).append(" from ").append(sourceTable);
+ if (!StringUtils.isEmpty(filter)) {
+ sql.append("\n where ").append(filter);
+ }
+ sql.append("\n order by ").append(uniqueField);
+ sql.append("\n limit ").append(startIndex).append(",").append(pageSize);
+ sql.append("\n) t");
+ } else if (DataBaseType.ORACLE.getValue() == dbType) {
+ sql.append("SELECT MAX(").append(uniqueField).append(") max_id FROM (");
+ sql.append("\n SELECT ").append(uniqueField).append(",ROWNUM R FROM (");
+ sql.append("\n SELECT ").append(uniqueField).append(" FROM ").append(sourceTable);
+ if (!StringUtils.isEmpty(filter)) {
+ sql.append("\n WHERE ").append(filter);
+ }
+ sql.append("\n ORDER BY ").append(uniqueField);
+ sql.append("\n ) T1");
+ sql.append("\n WHERE ROWNUM<=").append(finalIndex);
+ sql.append("\n) T2");
+ sql.append("\nWHERE R>").append(startIndex);
+ }
+ return sql.toString();
+ }
- /**
- * 鏀惧叆闃熷垪
- * @param tableName
- * @param dte
- */
- private void add(String tableName, DataTableEntity dte) {
- synchronized (tableName.intern()) {
- LinkedBlockingQueue<DataTableEntity> queryQueue = queryMap.get(tableName);
- if (queryQueue == null) {
- queryQueue = new LinkedBlockingQueue<>();
- queryMap.put(tableName, queryQueue);
- }
- queryQueue.add(dte);
- WriteUtil.append("DA-鎴愬姛鏀惧叆闃熷垪-" + tableName + "-褰撳墠鍓╀綑闃熷垪鏁帮細" + queryQueue.size());
- }
- }
+ /**
+ * 鏀惧叆闃熷垪
+ *
+ * @param tableName
+ * @param dte
+ */
+ private void add(String tableName, DataTableEntity dte) {
+ synchronized (tableName.intern()) {
+ LinkedBlockingQueue<DataTableEntity> queryQueue = queryMap.get(tableName);
+ if (queryQueue == null) {
+ queryQueue = new LinkedBlockingQueue<>();
+ queryMap.put(tableName, queryQueue);
+ }
+ if (tableName.endsWith("BAK20230823")) {
+ //妫�鏌te涓殑source_info 鍜� pre_master_key 鏄惁涓虹┖
+ for (int i = 0; i < dte.getRows(); i++) {
+ String sourceInfo = dte.getString(i, "source_info");
+ String preMasterKey = dte.getString(i, "pre_master_key");
+ if (StringUtils.isEmpty(sourceInfo) || StringUtils.isEmpty(preMasterKey)) {
+ dte.setFieldValue(i, "source_info", "ch-kt");
+ String idFiledName = tableName.toLowerCase(Locale.ROOT).startsWith("t_wip_detail") ? "wip_detail_id" : tableName.toLowerCase(Locale.ROOT).startsWith("t_wip_product_keyp") ? "pk_id" : "wip_id";
+ dte.setFieldValue(i, "pre_master_key", dte.getString(i, idFiledName));
+ }
+ }
+ }
+ queryQueue.add(dte);
+ WriteUtil.append("DA-鎴愬姛鏀惧叆闃熷垪-" + tableName + "-褰撳墠鍓╀綑闃熷垪鏁帮細" + queryQueue.size());
+ }
+ }
- /**
- * 鏌ヨ寮�濮嬶紝鍚戝瓨娲籱ap涓坊鍔�1
- * @param tableName
- */
- private void startQuery(String tableName, String threadInfo) {
- synchronized (tableName.intern()) {
- Set<String> set = existsQueryMap.computeIfAbsent(tableName, k -> Sets.newLinkedHashSet());
- set.add(threadInfo);
- }
- }
+ /**
+ * 鏌ヨ寮�濮嬶紝鍚戝瓨娲籱ap涓坊鍔�1
+ *
+ * @param tableName
+ */
+ private void startQuery(String tableName, String threadInfo) {
+ synchronized (tableName.intern()) {
+ Set<String> set = existsQueryMap.computeIfAbsent(tableName, k -> Sets.newLinkedHashSet());
+ set.add(threadInfo);
+ }
+ }
- /**
- * 鏌ヨ缁撴潫锛屽悜瀛樻椿map涓噺灏�1
- * @param tableName
- */
- private void finalQuery(String tableName, String threadInfo) {
- synchronized (tableName.intern()) {
- Set<String> set = existsQueryMap.get(tableName);
- if (set == null || !set.contains(threadInfo)) {
- throw new BaseException(ErrorCode.DATA_ARCHIVE_QUERY_THREAD_COUNT_ERROR.getValue(), ErrorCode.DATA_ARCHIVE_QUERY_THREAD_COUNT_ERROR.getText() + " table_name: " + tableName);
- }
- set.remove(threadInfo);
- if (set.isEmpty()) {
- existsQueryMap.remove(tableName);
- }
- }
- }
+ /**
+ * 鏌ヨ缁撴潫锛屽悜瀛樻椿map涓噺灏�1
+ *
+ * @param tableName
+ */
+ private void finalQuery(String tableName, String threadInfo) {
+ synchronized (tableName.intern()) {
+ Set<String> set = existsQueryMap.get(tableName);
+ if (set == null || !set.contains(threadInfo)) {
+ throw new BaseException(ErrorCode.DATA_ARCHIVE_QUERY_THREAD_COUNT_ERROR.getValue(), ErrorCode.DATA_ARCHIVE_QUERY_THREAD_COUNT_ERROR.getText() + " table_name: " + tableName);
+ }
+ set.remove(threadInfo);
+ if (set.isEmpty()) {
+ existsQueryMap.remove(tableName);
+ }
+ }
+ }
- /**
- * 鍏佽鎵ц鏌ヨ锛堥伩鍏嶉槦鍒椾腑绛夊緟鎻掑叆鐨勫お澶氾紝瀵艰嚧鍐呭瓨婧㈠嚭锛�
- * @param tableName
- * @return
- */
- private boolean allowQuery(String tableName) {
- synchronized (tableName.intern()) {
- return queryMap.get(tableName) == null || queryMap.get(tableName).size() <= QUERY_MAX_BATCH_COUNT;
- }
- }
+ /**
+ * 鍏佽鎵ц鏌ヨ锛堥伩鍏嶉槦鍒椾腑绛夊緟鎻掑叆鐨勫お澶氾紝瀵艰嚧鍐呭瓨婧㈠嚭锛�
+ *
+ * @param tableName
+ * @return
+ */
+ private boolean allowQuery(String tableName) {
+ synchronized (tableName.intern()) {
+ return queryMap.get(tableName) == null || queryMap.get(tableName).size() <= QUERY_MAX_BATCH_COUNT;
+ }
+ }
- /**
- * 鎻掑叆閿欒鏃ュ織
- * @param tableName
- * @param error
- */
- private void appendErrorLog(String tableName, String error) {
- synchronized (tableName.intern()) {
- StringBuilder errorSb = errorLogMap.get(tableName);
- if (errorSb == null) {
- errorSb = new StringBuilder(128);
- errorLogMap.put(tableName, errorSb);
- }
- if (errorSb.length() > 0) {
- errorSb.append("\n");
- }
- if (errorSb.length() < 2000) {
- errorSb.append(error);
- }
- }
- }
+ /**
+ * 鎻掑叆閿欒鏃ュ織
+ *
+ * @param tableName
+ * @param error
+ */
+ private void appendErrorLog(String tableName, String error) {
+ synchronized (tableName.intern()) {
+ StringBuilder errorSb = errorLogMap.get(tableName);
+ if (errorSb == null) {
+ errorSb = new StringBuilder(128);
+ errorLogMap.put(tableName, errorSb);
+ }
+ if (errorSb.length() > 0) {
+ errorSb.append("\n");
+ }
+ if (errorSb.length() < 2000) {
+ errorSb.append(error);
+ }
+ }
+ }
- /**
- * 鑾峰彇椤垫暟锛屽悜涓婂彇鏁�
- * @param count
- * @param size
- * @return
- */
- private int ceilPage(int count, int size) {
- if (size == 0) {
- if (count == 0) {
- return 0;
- } else {
- throw new BaseException(ErrorCode.ARCHIVE_PAGE_CALCULATE_ERROR);
- }
- }
- return count / size + (count % size == 0 ? 0 : 1);
- }
+ /**
+ * 鑾峰彇椤垫暟锛屽悜涓婂彇鏁�
+ *
+ * @param count
+ * @param size
+ * @return
+ */
+ private int ceilPage(int count, int size) {
+ if (size == 0) {
+ if (count == 0) {
+ return 0;
+ } else {
+ throw new BaseException(ErrorCode.ARCHIVE_PAGE_CALCULATE_ERROR);
+ }
+ }
+ return count / size + (count % size == 0 ? 0 : 1);
+ }
}
diff --git a/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java b/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java
index 7571c69..4383253 100644
--- a/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java
+++ b/product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java
@@ -4,6 +4,7 @@
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
+import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
@@ -42,6 +43,10 @@
import java.sql.SQLException;
import java.time.format.DateTimeFormatter;
import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionService;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
import java.util.stream.Collectors;
/**
@@ -104,8 +109,8 @@
Set<String> detailTableSet = QuerySqlParseUtil.getAllTableName(reportDao, reportDbName, "da_t_wip_detail");
HistoryEntity detailData = historyBeforeDispose(getData(reportDao, detailTableSet, "serial_number", serialNumber, new ErrorCode[]{ErrorCode.DETAIL_TABLE_NOT_EXISTS, ErrorCode.DETAIL_DATA_NOT_FOUND}), CmnConst.T_WIP_DETAIL);
- Set<String> productSnTableSet = QuerySqlParseUtil.getAllTableName(reportDao, reportDbName, "da_t_pm_product_sn");
- HistoryEntity productSnData = historyBeforeDispose(getData(reportDao, productSnTableSet, "product_sn", serialNumber, new ErrorCode[]{ErrorCode.PRODUCT_SN_TABLE_NOT_EXISTS, ErrorCode.PRODUCT_SN_DATA_NOT_FOUND}), CmnConst.T_PM_PRODUCT_SN);
+// Set<String> productSnTableSet = QuerySqlParseUtil.getAllTableName(reportDao, reportDbName, "da_t_pm_product_sn");
+// HistoryEntity productSnData = historyBeforeDispose(getData(reportDao, productSnTableSet, "product_sn", serialNumber, new ErrorCode[]{ErrorCode.PRODUCT_SN_TABLE_NOT_EXISTS, ErrorCode.PRODUCT_SN_DATA_NOT_FOUND}), CmnConst.T_PM_PRODUCT_SN);
//涓诲簱鏁版嵁婧愰厤缃�
@@ -117,7 +122,7 @@
try {
Connection connection = dao.getConnection();
connection.setAutoCommit(false);
- HistoryEntity[] historyEntities = {trackingData, keypData, detailData, productSnData};
+ HistoryEntity[] historyEntities = {trackingData, keypData, detailData};
insertMasterTableData(dao, historyEntities);
insertSubTableData(groupDao, groupByCollectId, groupBySourceTable, historyEntities);
connection.commit();
@@ -164,7 +169,13 @@
*/
public void insertMasterTableData(Dao dao, HistoryEntity[] historyEntities) {
for (HistoryEntity historyEntity : historyEntities) {
+ if (historyEntity == null) {
+ continue;
+ }
DataTableEntity masterDataTable = historyEntity.getMasterDataTable();
+ if (DataTableEntity.isEmpty(masterDataTable)) {
+ continue;
+ }
Object[] objects = masterDataTable.getData().stream().map(item -> item.getString(historyEntity.getPrimaryField())).toArray();
//鏌ヨ涓诲簱鏁版嵁鏄惁瀛樺湪
DataTableEntity list = dao.getList(historyEntity.getTableName(),
@@ -200,6 +211,9 @@
public void insertSubTableData(Map<String, Dao> groupDao, Map<String, List<FieldSetEntity>> groupByCollectId,
Map<String, List<FieldSetEntity>> groupBySourceTable, HistoryEntity[] historyEntities) throws Exception {
for (HistoryEntity historyEntity : historyEntities) {
+ if (historyEntity == null) {
+ continue;
+ }
Map<String, List<FieldSetEntity>> groupData = historyEntity.getGroupData();
if (groupData == null || groupData.isEmpty()) {
continue;
@@ -248,6 +262,9 @@
}
public HistoryEntity historyBeforeDispose(DataTableEntity dt, String targetTableName) {
+ if (DataTableEntity.isEmpty(dt)) {
+ return null;
+ }
HistoryEntity historyEntity = new HistoryEntity();
historyEntity.setMoNumberField("mo_number");
if (CmnConst.T_WIP_TRACKING.equalsIgnoreCase(targetTableName)) {
@@ -304,33 +321,24 @@
}
public DataTableEntity getData(Dao dao, Set<String> tableSet, String filterFieldName, String
- serialNumber, ErrorCode[] errorCodes) {
+ serialNumber, ErrorCode[] errorCodes) throws InterruptedException, ExecutionException {
if (CollectionUtil.isEmpty(tableSet)) {
throw new BaseException(errorCodes[0]);
}
String[] tableArray = tableSet.toArray(new String[]{});
- StringBuilder sql = new StringBuilder();
- sql.append("with ");
- List<Object> params = new ArrayList<>();
- for (int i = 0; i < tableArray.length; i++) {
- String takcingTable = tableArray[i];
- if (i > 0) {
- sql.append(",\n\t");
- }
- sql.append("`").append(takcingTable).append("` as (select a.*,'").append(takcingTable).append("' as '~table_name~' ").append(" from ").append(takcingTable).append(" a where `").append(filterFieldName).append("`=? )");
- params.add(serialNumber);
+ CompletionService<DataTableEntity> objectCompletionService = ThreadUtil.newCompletionService();
+ //澶氱嚎绋嬫煡璇㈠崟寮犺〃锛岀瓑寰呮墍鏈夌嚎绋嬫煡璇㈠畬姣�
+ for (String tableName : tableArray) {
+ objectCompletionService.submit(() -> dao.getList("select a.*,'" + tableName + "' as '~table_name~' from " + tableName + "a where " + filterFieldName + " = ?", new Object[]{serialNumber}));
}
- sql.append("\nselect * from (");
+ DataTableEntity data = new DataTableEntity();
+ Future<DataTableEntity> take = objectCompletionService.take();
for (int i = 0; i < tableArray.length; i++) {
- if (i > 0) {
- sql.append("\n\tunion all");
- }
- sql.append("\n\tselect * from `").append(tableArray[i]).append("`");
+ DataTableEntity dataTableEntity = take.get();
+ BaseUtil.dataTableMerge(data, dataTableEntity);
}
- sql.append("\n) a");
- DataTableEntity data = dao.getList(sql.toString(), params.toArray());
- if (DataTableEntity.isEmpty(data)) {
+ if (DataTableEntity.isEmpty(data) && !"product_sn".equals(filterFieldName)) {
throw new BaseException(errorCodes[1]);
}
return data;
--
Gitblit v1.9.2