集成iec104 mqtt opcda 级联客户端
This commit is contained in:
commit
8447d1f0f4
2
gather-broker/.idea/.gitignore
generated
vendored
Normal file
2
gather-broker/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/workspace.xml
|
||||||
5
gather-broker/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
gather-broker/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
19
gather-broker/.idea/compiler.xml
generated
Normal file
19
gather-broker/.idea/compiler.xml
generated
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?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="gather-broker" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
<component name="JavacSettings">
|
||||||
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="gather-broker" options="-parameters" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
gather-broker/.idea/encodings.xml
generated
Normal file
6
gather-broker/.idea/encodings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
36
gather-broker/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
36
gather-broker/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="date" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
14
gather-broker/.idea/misc.xml
generated
Normal file
14
gather-broker/.idea/misc.xml
generated
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
124
gather-broker/.idea/uiDesigner.xml
generated
Normal file
124
gather-broker/.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
gather-broker/.idea/vcs.xml
generated
Normal file
6
gather-broker/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
52978
gather-broker/log/gather-broker.2022-05-31.log
Normal file
52978
gather-broker/log/gather-broker.2022-05-31.log
Normal file
File diff suppressed because it is too large
Load Diff
97829
gather-broker/log/gather-broker.2022-06-01.log
Normal file
97829
gather-broker/log/gather-broker.2022-06-01.log
Normal file
File diff suppressed because one or more lines are too long
7247
gather-broker/log/gather-broker.2022-06-07.log
Normal file
7247
gather-broker/log/gather-broker.2022-06-07.log
Normal file
File diff suppressed because it is too large
Load Diff
1714
gather-broker/log/gather-broker.2022-06-08.log
Normal file
1714
gather-broker/log/gather-broker.2022-06-08.log
Normal file
File diff suppressed because it is too large
Load Diff
1761
gather-broker/log/gather-broker.2022-06-28.log
Normal file
1761
gather-broker/log/gather-broker.2022-06-28.log
Normal file
File diff suppressed because it is too large
Load Diff
17905
gather-broker/log/gather-broker.2022-06-29.log
Normal file
17905
gather-broker/log/gather-broker.2022-06-29.log
Normal file
File diff suppressed because it is too large
Load Diff
5575
gather-broker/log/gather-broker.2022-06-30.log
Normal file
5575
gather-broker/log/gather-broker.2022-06-30.log
Normal file
File diff suppressed because it is too large
Load Diff
4225
gather-broker/log/gather-broker.2022-07-01.log
Normal file
4225
gather-broker/log/gather-broker.2022-07-01.log
Normal file
File diff suppressed because it is too large
Load Diff
1387
gather-broker/log/gather-broker.2022-07-08.log
Normal file
1387
gather-broker/log/gather-broker.2022-07-08.log
Normal file
File diff suppressed because it is too large
Load Diff
3300
gather-broker/log/gather-broker.2022-07-11.log
Normal file
3300
gather-broker/log/gather-broker.2022-07-11.log
Normal file
File diff suppressed because it is too large
Load Diff
37657
gather-broker/log/gather-broker.2022-07-12.log
Normal file
37657
gather-broker/log/gather-broker.2022-07-12.log
Normal file
File diff suppressed because it is too large
Load Diff
6228
gather-broker/log/gather-broker.2022-07-13.log
Normal file
6228
gather-broker/log/gather-broker.2022-07-13.log
Normal file
File diff suppressed because it is too large
Load Diff
11132
gather-broker/log/gather-broker.2022-07-15.log
Normal file
11132
gather-broker/log/gather-broker.2022-07-15.log
Normal file
File diff suppressed because it is too large
Load Diff
14922
gather-broker/log/gather-broker.2022-08-02.log
Normal file
14922
gather-broker/log/gather-broker.2022-08-02.log
Normal file
File diff suppressed because it is too large
Load Diff
53937
gather-broker/log/gather-broker.2022-08-09.log
Normal file
53937
gather-broker/log/gather-broker.2022-08-09.log
Normal file
File diff suppressed because it is too large
Load Diff
12107
gather-broker/log/gather-broker.2022-08-12.log
Normal file
12107
gather-broker/log/gather-broker.2022-08-12.log
Normal file
File diff suppressed because it is too large
Load Diff
82120
gather-broker/log/gather-broker.2022-08-16.log
Normal file
82120
gather-broker/log/gather-broker.2022-08-16.log
Normal file
File diff suppressed because it is too large
Load Diff
52315
gather-broker/log/gather-broker.2022-08-17.log
Normal file
52315
gather-broker/log/gather-broker.2022-08-17.log
Normal file
File diff suppressed because it is too large
Load Diff
80587
gather-broker/log/gather-broker.2022-08-18.log
Normal file
80587
gather-broker/log/gather-broker.2022-08-18.log
Normal file
File diff suppressed because it is too large
Load Diff
44592
gather-broker/log/gather-broker.2022-08-19.log
Normal file
44592
gather-broker/log/gather-broker.2022-08-19.log
Normal file
File diff suppressed because it is too large
Load Diff
5246
gather-broker/log/gather-broker.2022-08-22.log
Normal file
5246
gather-broker/log/gather-broker.2022-08-22.log
Normal file
File diff suppressed because it is too large
Load Diff
39267
gather-broker/log/gather-broker.2022-08-23.log
Normal file
39267
gather-broker/log/gather-broker.2022-08-23.log
Normal file
File diff suppressed because one or more lines are too long
115064
gather-broker/log/gather-broker.2022-08-24.log
Normal file
115064
gather-broker/log/gather-broker.2022-08-24.log
Normal file
File diff suppressed because one or more lines are too long
20394
gather-broker/log/gather-broker.2022-08-25.log
Normal file
20394
gather-broker/log/gather-broker.2022-08-25.log
Normal file
File diff suppressed because one or more lines are too long
51981
gather-broker/log/gather-broker.2022-08-26.log
Normal file
51981
gather-broker/log/gather-broker.2022-08-26.log
Normal file
File diff suppressed because one or more lines are too long
131587
gather-broker/log/gather-broker.2022-08-29.log
Normal file
131587
gather-broker/log/gather-broker.2022-08-29.log
Normal file
File diff suppressed because one or more lines are too long
73540
gather-broker/log/gather-broker.2022-08-30.log
Normal file
73540
gather-broker/log/gather-broker.2022-08-30.log
Normal file
File diff suppressed because it is too large
Load Diff
152441
gather-broker/log/gather-broker.2022-08-31.log
Normal file
152441
gather-broker/log/gather-broker.2022-08-31.log
Normal file
File diff suppressed because it is too large
Load Diff
1185934
gather-broker/log/gather-broker.2022-09-01.log
Normal file
1185934
gather-broker/log/gather-broker.2022-09-01.log
Normal file
File diff suppressed because one or more lines are too long
119465
gather-broker/log/gather-broker.2022-09-02.log
Normal file
119465
gather-broker/log/gather-broker.2022-09-02.log
Normal file
File diff suppressed because it is too large
Load Diff
209
gather-broker/pom.xml
Normal file
209
gather-broker/pom.xml
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.6.3</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>gather-broker</artifactId>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis-typehandlers-jsr310</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-support</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
</dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>-->
|
||||||
|
<!---->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.7.16</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-all</artifactId>
|
||||||
|
<version>4.1.42.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.54</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!--quartz依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shardingsphere</groupId>
|
||||||
|
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
|
||||||
|
<version>4.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid</artifactId>
|
||||||
|
<version>1.1.22</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<!-- 指定该Main Class为全局的唯一入口 -->
|
||||||
|
<mainClass>com.idtgz.GatherBrokerApplication</mainClass>
|
||||||
|
<layout>ZIP</layout>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<!--可以把依赖的包都打包到生成的Jar包中-->
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy frontend content</id>
|
||||||
|
<!-- To bind lifecycle of package. -->
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<!-- Copy all build shell resources to ../target -->
|
||||||
|
<outputDirectory>${project.parent.basedir}/target</outputDirectory>
|
||||||
|
<overwrite>true</overwrite>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>target/classes/bin/</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>*.sh</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources/</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>**/*</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>target/classes/templates/</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>**/*</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>dev</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>false</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<profiles.active>dev</profiles.active>
|
||||||
|
<spring.profiles.active>dev</spring.profiles.active>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>test</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>false</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<profiles.active>test</profiles.active>
|
||||||
|
<spring.profiles.active>test</spring.profiles.active>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>pro</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>false</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<profiles.active>pro</profiles.active>
|
||||||
|
<spring.profiles.active>pro</spring.profiles.active>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
package com.idtgz;
|
||||||
|
|
||||||
|
|
||||||
|
import com.idtgz.mqtt.MqttServer;
|
||||||
|
import com.idtgz.mqtt.common.NettyLog;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@EnableScheduling
|
||||||
|
@SpringBootApplication(scanBasePackages = {"com.idtgz"})
|
||||||
|
@MapperScan(basePackages = "com.idtgz.dao.mapper")
|
||||||
|
public class GatherBrokerApplication {
|
||||||
|
|
||||||
|
private static void createAndShowGUI() throws IOException {
|
||||||
|
|
||||||
|
// 确保一个漂亮的外观风格
|
||||||
|
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||||
|
|
||||||
|
// 创建及设置窗口
|
||||||
|
JFrame frame = new JFrame("工数科技数据Broker");
|
||||||
|
frame.setSize(350, 200);
|
||||||
|
frame.setLocationRelativeTo(null);
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
ClassPathResource classPathResource = new ClassPathResource("gs_icon.png");
|
||||||
|
ImageIcon imageIcon = new ImageIcon(classPathResource.getURL());
|
||||||
|
frame.setIconImage(imageIcon.getImage());
|
||||||
|
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
// 添加 "Hello World" 标签
|
||||||
|
JLabel label = new JLabel("工数科技数据Broker运行中");
|
||||||
|
label.setBounds(10, 20, 80, 25);
|
||||||
|
JLabel label2 = new JLabel("浏览器输入:127.0.0.1:20600进入配置页面");
|
||||||
|
label2.setBounds(10, 20, 80, 25);
|
||||||
|
panel.add(label);
|
||||||
|
panel.add(label2);
|
||||||
|
frame.add(panel);
|
||||||
|
|
||||||
|
//监听关闭窗口事件
|
||||||
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
super.windowClosing(e);
|
||||||
|
//do something
|
||||||
|
String os = System.getProperty("os.name");
|
||||||
|
if (os.toLowerCase().startsWith("win")) {
|
||||||
|
//结束相关进程
|
||||||
|
String[] cmd = {"taskkill", "/f", "/im", "GS-Gather.exe"};
|
||||||
|
String[] cmd2 = {"taskkill", "/f", "/im", "javawGS.exe"};
|
||||||
|
Runtime.getRuntime().exec(cmd);
|
||||||
|
Runtime.getRuntime().exec(cmd2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 显示窗口
|
||||||
|
frame.pack();
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mqtt服务器初始化
|
||||||
|
*/
|
||||||
|
private static void mqttInit() {
|
||||||
|
MqttServer scoketServer = new MqttServer();
|
||||||
|
scoketServer.bind(8989);
|
||||||
|
NettyLog.info("mqttBroker启动");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 显示应用 GUI
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
createAndShowGUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//mqtt初始化
|
||||||
|
//mqttInit();
|
||||||
|
SpringApplication.run(GatherBrokerApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.26
|
||||||
|
*/
|
||||||
|
public class ConfigConstant {
|
||||||
|
|
||||||
|
public static Integer CLIENT_STATUS_ON = 1;
|
||||||
|
|
||||||
|
public static Integer CLIENT_STATUS_OFF = 0;
|
||||||
|
|
||||||
|
public static Integer CONNECTION_STATUS_ON = 1;
|
||||||
|
|
||||||
|
public static Integer CONNECTION_STATUS_OFF = 0;
|
||||||
|
|
||||||
|
public static Integer STORTE_STRA = 0;
|
||||||
|
|
||||||
|
public static String CLIENT_PREFIX = "GSGatherClient:";
|
||||||
|
|
||||||
|
public static String CLIENT_TEST_PREFIX = "GSGatherClientTest:";
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.09.01
|
||||||
|
*/
|
||||||
|
public class ConnectionType {
|
||||||
|
public final static int CLIENT_CONNECTION = 1;
|
||||||
|
public final static int BROKER_CONNECTION = 2;
|
||||||
|
}
|
||||||
150
gather-broker/src/main/java/com/idtgz/config/InitConfig.java
Normal file
150
gather-broker/src/main/java/com/idtgz/config/InitConfig.java
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.idtgz.context.ConfigContext;
|
||||||
|
import com.idtgz.dao.entity.ClientEntity;
|
||||||
|
import com.idtgz.dao.entity.ConfigEntity;
|
||||||
|
import com.idtgz.dao.entity.ConnectionEntity;
|
||||||
|
import com.idtgz.dao.entity.ConnectionItemEntity;
|
||||||
|
import com.idtgz.dao.mapper.ClientMapper;
|
||||||
|
import com.idtgz.dao.mapper.ConfigMapper;
|
||||||
|
import com.idtgz.dao.mapper.ConnectionMapper;
|
||||||
|
import com.idtgz.mqtt.MqttServer;
|
||||||
|
import com.idtgz.service.CenterService;
|
||||||
|
import com.idtgz.service.ConnectionItemService;
|
||||||
|
import com.idtgz.service.ConnectionService;
|
||||||
|
import com.idtgz.util.CommonUtil;
|
||||||
|
import org.quartz.Scheduler;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import sun.nio.ch.Net;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class InitConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConfigMapper configMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ClientMapper clientMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionMapper connectionMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CenterService centerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttServer scoketServer;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
Scheduler scheduler;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionService connectionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionItemService connectionItemService;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() throws SchedulerException {
|
||||||
|
//配置通道
|
||||||
|
ConfigEntity configEntity = configMapper.selectOne(new QueryWrapper<ConfigEntity>().eq("config_type", "PIPE_LINE_CONFIG"));
|
||||||
|
if (configEntity != null && StringUtils.isNotEmpty(configEntity.getConfigJson())) {
|
||||||
|
ConfigContext.pipeLineConfig = JSON.parseObject(configEntity.getConfigJson(), PipeLineConfig.class);
|
||||||
|
ConfigContext.isSeted = true;
|
||||||
|
centerService.init();
|
||||||
|
centerService.remoteSyn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//存储配置
|
||||||
|
ConfigEntity storeConfigEntity = configMapper.selectOne(new QueryWrapper<ConfigEntity>().eq("config_type", "STORE_CONFIG"));
|
||||||
|
if (storeConfigEntity != null && StringUtils.isNotEmpty(storeConfigEntity.getConfigJson())) {
|
||||||
|
ConfigContext.storeConfig = JSON.parseObject(storeConfigEntity.getConfigJson(), StoreConfig.class);
|
||||||
|
} else {
|
||||||
|
StoreConfig storeConfig = new StoreConfig(3);
|
||||||
|
ConfigContext.storeConfig = storeConfig;
|
||||||
|
storeConfigEntity.setConfigJson(JSON.toJSONString(storeConfig));
|
||||||
|
configMapper.updateById(storeConfigEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
//本地配置
|
||||||
|
ConfigEntity localConfigEntity = configMapper.selectOne(new QueryWrapper<ConfigEntity>().eq("config_type", "LOCAL_CONFIG"));
|
||||||
|
if (localConfigEntity != null && StringUtils.isNotEmpty(localConfigEntity.getConfigJson())) {
|
||||||
|
ConfigContext.localConfig = JSON.parseObject(localConfigEntity.getConfigJson(), LocalConfig.class);
|
||||||
|
} else {
|
||||||
|
LocalConfig nLocalConfig = new LocalConfig();
|
||||||
|
nLocalConfig.setBrokerId(UUID.randomUUID().toString().replace("-", "").toUpperCase());
|
||||||
|
localConfigEntity.setConfigJson(JSON.toJSONString(nLocalConfig));
|
||||||
|
configMapper.updateById(localConfigEntity);
|
||||||
|
ConfigContext.localConfig = nLocalConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//初始化客户端推送 连接
|
||||||
|
connectionMapper.update(null, new UpdateWrapper<ConnectionEntity>().set("connection_status", ConfigConstant.CONNECTION_STATUS_OFF).eq("connection_status", ConfigConstant.CLIENT_STATUS_ON));
|
||||||
|
List<ClientEntity> clientEntities = clientMapper.selectList(null);
|
||||||
|
clientEntities.forEach(
|
||||||
|
i -> {
|
||||||
|
i.setClientStatus(ConfigConstant.CLIENT_STATUS_OFF);
|
||||||
|
ConfigContext.clients.put(i.getClientId(), i);
|
||||||
|
clientMapper.updateById(i);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//初始化连接
|
||||||
|
List<ConnectionEntity> connectionEntities = connectionMapper.selectList(null);
|
||||||
|
connectionEntities.forEach(
|
||||||
|
i -> {
|
||||||
|
i.setConnectionStatus(ConfigConstant.CONNECTION_STATUS_OFF);
|
||||||
|
ConfigContext.connections.put(i.getDeviceId(), i);
|
||||||
|
//Item上下文
|
||||||
|
List<ConnectionItemEntity> itemEntities = connectionItemService.list(new QueryWrapper<ConnectionItemEntity>().eq("connection_id", i.getId()));
|
||||||
|
Map<String, ConnectionItemEntity> itemEntityMap = new ConcurrentHashMap<>();
|
||||||
|
itemEntities.forEach(
|
||||||
|
n -> {
|
||||||
|
itemEntityMap.put(n.getItemCode(), n);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
ConfigContext.items.put(i.getDeviceId(), itemEntityMap);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//quartz初始化
|
||||||
|
quartzInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void quartzInit() throws SchedulerException {
|
||||||
|
ConfigContext.connections.forEach(
|
||||||
|
(k, v) -> {
|
||||||
|
try {
|
||||||
|
if (v.getIsUploaded() == UploadStatus.UPLOADING && v.getConnectionStatus().equals(ConfigConstant.CONNECTION_STATUS_ON)) {
|
||||||
|
//非中断且连接正常则继续上传
|
||||||
|
connectionService.updateSchedule(v.getConnectionSign(), v.getUploadType(), v.getUploadCycle(), v.getStoreStrategy(), v.getIsUploaded(), false);
|
||||||
|
}
|
||||||
|
} catch (SchedulerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
scheduler.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LocalConfig {
|
||||||
|
private String brokerId;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.23
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class MbatisPlusConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PaginationInterceptor paginationInterceptor() {
|
||||||
|
PaginationInterceptor page = new PaginationInterceptor();
|
||||||
|
page.setDialectType("mysql");
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MqttConnectionConstant {
|
||||||
|
public static final String MQTT_CONNECTION_TOPIC = "mqtt/connection";
|
||||||
|
public static final String METHOD_ITEM_SYN = "item_syn";
|
||||||
|
public static final String METHOD_DATA_PUSH = "data_push";
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.30
|
||||||
|
*/
|
||||||
|
public class MqttTopicConstant {
|
||||||
|
public static final String VERSION = "v1/";
|
||||||
|
public static final String DEVICE_REQUEST_TOPIC = VERSION + "devices/me/rpc/request";
|
||||||
|
public static final String DEVICE_RESPONSE_TOPIC = VERSION + "devices/me/rpc/response";
|
||||||
|
public static final String RPC_RESPONSE_TOPIC = VERSION + "gateway/rpc/response";
|
||||||
|
public static final String RPC_REQUEST_TOPIC = VERSION + "gateway/rpc/request";
|
||||||
|
public static final String DATA_UPLOAD_TOPIC = VERSION + "gateway/telemetry";
|
||||||
|
public static final String REMOTE_SYNC = "syncDeviceChannelConfig";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import com.idtgz.context.ConfigContext;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PipeLineConfig {
|
||||||
|
private String host;
|
||||||
|
private Integer port;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String clientId ;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 存储配置
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class StoreConfig {
|
||||||
|
/**
|
||||||
|
* 数据存储有效期(天)
|
||||||
|
*/
|
||||||
|
public Integer expirationTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.18
|
||||||
|
*/
|
||||||
|
public class StoreStrategyConstant {
|
||||||
|
//不存储
|
||||||
|
public final static int NO_STROE = 1;
|
||||||
|
//失败存储
|
||||||
|
public final static int FAIL_STROE = 2;
|
||||||
|
//全量存储
|
||||||
|
public final static int ALL_STROE = 3;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.09.01
|
||||||
|
*/
|
||||||
|
public class UploadStatus {
|
||||||
|
public static final int STOP_UPLOADING = 0;
|
||||||
|
public static final int UPLOADING = 1;
|
||||||
|
public static final int INTERRUPTED = 2;
|
||||||
|
}
|
||||||
62
gather-broker/src/main/java/com/idtgz/config/WebConfig.java
Normal file
62
gather-broker/src/main/java/com/idtgz/config/WebConfig.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import org.springframework.boot.web.server.ErrorPage;
|
||||||
|
import org.springframework.boot.web.server.ErrorPageRegistrar;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
import org.springframework.web.context.request.RequestContextListener;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||||
|
registry.addResourceHandler("/**");
|
||||||
|
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||||
|
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||||
|
registry.addResourceHandler("view.html").addResourceLocations("classpath:/templates/carqueue/");
|
||||||
|
registry.addResourceHandler("configuration/ui");
|
||||||
|
// 实现静态资源的映射
|
||||||
|
registry.addResourceHandler("/**").addResourceLocations("classpath:/templates/");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RequestContextListener requestContextListener() {
|
||||||
|
return new RequestContextListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
|
||||||
|
ObjectMapper objectMapper = jackson2HttpMessageConverter.getObjectMapper();
|
||||||
|
|
||||||
|
//不显示为null的字段
|
||||||
|
// objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
//序列化枚举是以ordinal()来输出
|
||||||
|
// objectMapper.configure(SerializationFeature.WRITE_ENUMS_USING_INDEX, true);
|
||||||
|
SimpleModule simpleModule = new SimpleModule();
|
||||||
|
// simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
||||||
|
// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
||||||
|
objectMapper.registerModule(simpleModule);
|
||||||
|
|
||||||
|
jackson2HttpMessageConverter.setObjectMapper(objectMapper);
|
||||||
|
//放到第一个
|
||||||
|
converters.add(0, jackson2HttpMessageConverter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ErrorPageRegistrar myErrorPageRegistrar() {
|
||||||
|
return registry -> registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/index.html"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.idtgz.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 说明描述
|
||||||
|
* @author: hanfeng
|
||||||
|
* @date: 2021-4-1
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
public class WebConfigurer {
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter() {
|
||||||
|
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||||
|
corsConfiguration.setAllowedOriginPatterns(Arrays.asList("*"));
|
||||||
|
corsConfiguration.setAllowedMethods(Arrays.asList("*"));
|
||||||
|
corsConfiguration.setAllowedHeaders(Arrays.asList("*"));
|
||||||
|
corsConfiguration.setAllowCredentials(true);
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**", corsConfiguration);
|
||||||
|
return new CorsFilter(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.idtgz.config.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.15
|
||||||
|
*/
|
||||||
|
public class ConnectionConstant {
|
||||||
|
|
||||||
|
public static final int ClientConnection = 1;
|
||||||
|
|
||||||
|
public static final int BrokerConnection = 2;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.idtgz.config.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.12
|
||||||
|
*/
|
||||||
|
public class ProtocolConstant {
|
||||||
|
public final static int OPCDA = 5;
|
||||||
|
public final static int OPCUA = 6;
|
||||||
|
public final static int DB = 7;
|
||||||
|
public final static int IEC104 = 8;
|
||||||
|
public final static int MQTT = 9;
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
package com.idtgz.config.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BaseConntionConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接标识
|
||||||
|
*/
|
||||||
|
String connectionSign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端ID
|
||||||
|
*/
|
||||||
|
String clientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接的设备ID
|
||||||
|
*/
|
||||||
|
Long device;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接名称
|
||||||
|
*/
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上周周期
|
||||||
|
*/
|
||||||
|
int cycle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传类型
|
||||||
|
*/
|
||||||
|
int uploadType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据存储策略
|
||||||
|
*/
|
||||||
|
int storeStrategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
int status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间戳
|
||||||
|
*/
|
||||||
|
Long updateTimestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否上传
|
||||||
|
*/
|
||||||
|
Boolean isUpload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接模式
|
||||||
|
*/
|
||||||
|
int mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听点位
|
||||||
|
*/
|
||||||
|
List<String> items;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.idtgz.config.model;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.digest.MD5;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.idtgz.model.pipeline.ConnectDTO;
|
||||||
|
import com.idtgz.model.pipeline.base.AddConnectRequestDTO;
|
||||||
|
import com.idtgz.model.web.ConnectionDTO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class IEC104Config extends BaseConntionConfig {
|
||||||
|
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
public IEC104Config(ConnectionDTO dto) {
|
||||||
|
this.name = dto.getConnectionName();
|
||||||
|
this.host = dto.getIec104Host();
|
||||||
|
this.port = dto.getIec104Port();
|
||||||
|
this.connectionSign = StringUtils.isEmpty(dto.getConnectionSign()) ? (MD5.create().digestHex16(this.getName() + this.getHost() + this.port)) : dto.getConnectionSign();
|
||||||
|
this.clientId = dto.getClientId();
|
||||||
|
this.device = dto.getDeviceId();
|
||||||
|
if (dto.getUploadType() == null || dto.getUploadCycle() == null) {
|
||||||
|
this.uploadType = 1;
|
||||||
|
this.cycle = 1;
|
||||||
|
} else {
|
||||||
|
this.uploadType = dto.getUploadType();
|
||||||
|
this.cycle = dto.getUploadCycle();
|
||||||
|
}
|
||||||
|
this.updateTimestamp = (new Date()).getTime();
|
||||||
|
this.mode = dto.getConnectionProtocol();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEC104Config(AddConnectRequestDTO dto) {
|
||||||
|
this.clientId = dto.getClientId();
|
||||||
|
this.name = dto.getDaProgId();
|
||||||
|
this.updateTimestamp = (new Date()).getTime();
|
||||||
|
this.mode = dto.getMode();
|
||||||
|
this.host = dto.getIec104Host();
|
||||||
|
this.port = dto.getIec104Port();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEC104Config(ConnectDTO i) {
|
||||||
|
this.name = i.getName();
|
||||||
|
this.host = i.getIec104Host();
|
||||||
|
this.port = i.getIec104Port();
|
||||||
|
this.connectionSign = StringUtils.isEmpty(i.getConnectSign()) ? (MD5.create().digestHex16(this.getName() + this.getHost() + this.port)) : i.getConnectSign();
|
||||||
|
this.clientId = i.getClientId();
|
||||||
|
this.device = i.getDevice();
|
||||||
|
if (i.getUploadType() == null || i.getCycle() == null) {
|
||||||
|
this.uploadType = 1;
|
||||||
|
this.cycle = 1;
|
||||||
|
} else {
|
||||||
|
this.uploadType = i.getUploadType();
|
||||||
|
this.cycle = i.getCycle();
|
||||||
|
}
|
||||||
|
this.updateTimestamp = (new Date()).getTime();
|
||||||
|
this.mode = i.getMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.idtgz.config.model;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.digest.MD5;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.idtgz.config.StoreConfig;
|
||||||
|
import com.idtgz.config.StoreStrategyConstant;
|
||||||
|
import com.idtgz.context.ConfigContext;
|
||||||
|
import com.idtgz.model.pipeline.base.AddConnectRequestDTO;
|
||||||
|
import com.idtgz.model.web.ConnectionDTO;
|
||||||
|
import com.idtgz.util.CommonUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.context.i18n.LocaleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MqttConnectionConfig extends BaseConntionConfig {
|
||||||
|
|
||||||
|
private String connetionName;
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
|
||||||
|
public MqttConnectionConfig(AddConnectRequestDTO dto) {
|
||||||
|
this.mode = dto.getMode();
|
||||||
|
if (dto.getUploadType() == null || dto.getCycle() == null) {
|
||||||
|
this.uploadType = 1;
|
||||||
|
this.uploadType = 1;
|
||||||
|
} else {
|
||||||
|
this.uploadType = dto.getUploadType();
|
||||||
|
this.cycle = dto.getCycle();
|
||||||
|
}
|
||||||
|
this.storeStrategy = StoreStrategyConstant.NO_STROE;
|
||||||
|
this.userName = dto.getMqttUsername();
|
||||||
|
this.password = dto.getMqttPassword();
|
||||||
|
this.clientId = dto.getMqttClientId();
|
||||||
|
this.connetionName = dto.getMqttConnectionName();
|
||||||
|
this.connectionSign = MD5.create().digestHex16(dto.getMqttUsername() + dto.getClientId()).toUpperCase();
|
||||||
|
this.device = CommonUtil.getLongId(this.connectionSign);
|
||||||
|
this.clientId = StringUtils.isNotEmpty(dto.getClientId()) ? dto.getClientId() : ConfigContext.localConfig.getBrokerId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MqttConnectionConfig(ConnectionDTO dto) {
|
||||||
|
this.mode = dto.getConnectionProtocol();
|
||||||
|
if (dto.getUploadType() == null || dto.getUploadCycle() == null) {
|
||||||
|
this.uploadType = 1;
|
||||||
|
this.cycle = 1;
|
||||||
|
} else {
|
||||||
|
this.uploadType = dto.getUploadType();
|
||||||
|
this.uploadType = dto.getUploadCycle();
|
||||||
|
}
|
||||||
|
this.storeStrategy = dto.getStoreStrategy() == null ? StoreStrategyConstant.NO_STROE : dto.getStoreStrategy();
|
||||||
|
this.userName = dto.getMqttUsername();
|
||||||
|
this.password = dto.getMqttPassword();
|
||||||
|
this.clientId = dto.getMqttClientId();
|
||||||
|
this.connetionName = dto.getMqttConnectionName();
|
||||||
|
this.connectionSign = StringUtils.isEmpty(dto.getConnectionSign()) ? MD5.create().digestHex16(dto.getMqttUsername() + dto.getClientId()).toUpperCase() : dto.getConnectionSign();
|
||||||
|
this.device = CommonUtil.getLongId(this.connectionSign);
|
||||||
|
this.clientId = StringUtils.isNotEmpty(dto.getClientId()) ? dto.getClientId() : ConfigContext.localConfig.getBrokerId();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package com.idtgz.config.model;
|
||||||
|
|
||||||
|
import com.idtgz.model.pipeline.ConnectDTO;
|
||||||
|
import com.idtgz.model.pipeline.base.AddConnectRequestDTO;
|
||||||
|
import com.idtgz.model.web.ConnectionDTO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OPCDaConfig extends BaseConntionConfig {
|
||||||
|
|
||||||
|
private String daProgId;
|
||||||
|
|
||||||
|
private String serverUrl;
|
||||||
|
|
||||||
|
public OPCDaConfig(ConnectionDTO dto) {
|
||||||
|
this.connectionSign = dto.getConnectionSign();
|
||||||
|
this.clientId = dto.getClientId();
|
||||||
|
this.name = dto.getConnectionName();
|
||||||
|
this.status = dto.getConnectionStatus() == null ? 0 : dto.getConnectionStatus();
|
||||||
|
this.updateTimestamp = (new Date()).getTime();
|
||||||
|
this.mode = dto.getConnectionProtocol();
|
||||||
|
this.serverUrl = dto.getOpcdaHost();
|
||||||
|
this.daProgId = dto.getOpcdaProgId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public OPCDaConfig(AddConnectRequestDTO dto) {
|
||||||
|
this.clientId = dto.getClientId();
|
||||||
|
this.name = dto.getDaProgId();
|
||||||
|
this.updateTimestamp = (new Date()).getTime();
|
||||||
|
this.mode = dto.getMode();
|
||||||
|
this.daProgId = dto.getDaProgId();
|
||||||
|
this.serverUrl = dto.getServerUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OPCDaConfig(ConnectDTO dto) {
|
||||||
|
this.connectionSign = dto.getConnectSign();
|
||||||
|
this.clientId = dto.getClientId();
|
||||||
|
this.name = dto.getName();
|
||||||
|
this.status = dto.getStatus();
|
||||||
|
this.updateTimestamp = (new Date()).getTime();
|
||||||
|
this.mode = dto.getMode();
|
||||||
|
this.serverUrl = dto.getServerUrl();
|
||||||
|
this.daProgId = dto.getDaProgId();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.idtgz.context;
|
||||||
|
|
||||||
|
import com.idtgz.model.pipeline.ItemUploadDTO;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 数据缓存上下文
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.30
|
||||||
|
*/
|
||||||
|
public class BuffContext {
|
||||||
|
|
||||||
|
//客户端item数据缓存
|
||||||
|
//device=<itemcode,dto>
|
||||||
|
public static Map<Long, Map<String, ItemUploadDTO.Value>> itemBuff = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
//级联客户端保活缓存
|
||||||
|
public static Map<String, Long> clientKeepAlive = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.idtgz.context;
|
||||||
|
|
||||||
|
import com.idtgz.config.LocalConfig;
|
||||||
|
import com.idtgz.config.PipeLineConfig;
|
||||||
|
import com.idtgz.config.StoreConfig;
|
||||||
|
import com.idtgz.dao.entity.ClientEntity;
|
||||||
|
import com.idtgz.dao.entity.ConnectionEntity;
|
||||||
|
import com.idtgz.dao.entity.ConnectionItemEntity;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ConfigContext {
|
||||||
|
|
||||||
|
//public static String brokerId ;
|
||||||
|
//是否已配置通道
|
||||||
|
public static Boolean isSeted = false;
|
||||||
|
|
||||||
|
//是否已连接中心端
|
||||||
|
public static Boolean isConnected = false;
|
||||||
|
|
||||||
|
//通讯管道配置实例
|
||||||
|
public static PipeLineConfig pipeLineConfig;
|
||||||
|
|
||||||
|
//存储配置
|
||||||
|
public static StoreConfig storeConfig;
|
||||||
|
|
||||||
|
//注册上来的客户端
|
||||||
|
public static Map<String, ClientEntity> clients = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
//注册上来的客户端
|
||||||
|
public static Map<String, Channel> clientsChannel = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
//注册上来的连接实例 <DeviceId,Entity>
|
||||||
|
public static Map<Long, ConnectionEntity> connections = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
//实例Item缓存<deviceId,<itemCode,Entity>>
|
||||||
|
public static Map<Long, Map<String, ConnectionItemEntity>> items = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
//本地配置
|
||||||
|
public static LocalConfig localConfig;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.context;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.07
|
||||||
|
*/
|
||||||
|
public class MqttContext {
|
||||||
|
|
||||||
|
public static Map<String,Object> requestMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.idtgz.context;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.17
|
||||||
|
*/
|
||||||
|
public class ScheduleContext {
|
||||||
|
public static Map<Long, Object> schedules = new ConcurrentHashMap<>();
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.idtgz.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.31
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class TemplateController {
|
||||||
|
@RequestMapping("temp" + "/web/**")
|
||||||
|
public String index() {
|
||||||
|
return "index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/")
|
||||||
|
public String index2(HttpServletRequest request) {
|
||||||
|
return "index";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.idtgz.controller;
|
||||||
|
|
||||||
|
import com.idtgz.config.model.OPCDaConfig;
|
||||||
|
import com.idtgz.dao.mapper.ConfigMapper;
|
||||||
|
import com.idtgz.model.pipeline.AvailableOPCServerDTO;
|
||||||
|
import com.idtgz.service.ConnectionService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConfigMapper configMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionService connectionService;
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public int test() {
|
||||||
|
Integer count = configMapper.selectCount(null);
|
||||||
|
System.out.println(count);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/cilentAddConect")
|
||||||
|
public int cilentAddConect() {
|
||||||
|
OPCDaConfig opcDaConfig1 = new OPCDaConfig();
|
||||||
|
opcDaConfig1.setClientId("26c14696-5782-45ac-a7b8-3608dfabda01");
|
||||||
|
opcDaConfig1.setServerUrl("127.0.0.1");
|
||||||
|
opcDaConfig1.setDaProgId("Kepware.KEPServerEX.V6");
|
||||||
|
opcDaConfig1.setName("Kepware.KEPServerEX.V6");
|
||||||
|
opcDaConfig1.setMode(5);
|
||||||
|
opcDaConfig1.setUploadType(0);
|
||||||
|
opcDaConfig1.setCycle(60);
|
||||||
|
opcDaConfig1.setStatus(1);
|
||||||
|
opcDaConfig1.setUpdateTimestamp((new Date()).getTime());
|
||||||
|
connectionService.addClientConnection("26c14696-5782-45ac-a7b8-3608dfabda01", opcDaConfig1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getAvailabableServer")
|
||||||
|
public Object getAvailabableServer() throws InterruptedException {
|
||||||
|
List<AvailableOPCServerDTO> availableOPCDAServer = connectionService.getAvailableOPCDAServer("26c14696-5782-45ac-a7b8-3608dfabda01", "127.0.0.1");
|
||||||
|
return availableOPCDAServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/db/mysql")
|
||||||
|
public Object mysql() {
|
||||||
|
try {
|
||||||
|
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/car_dispatch?characterEncoding=UTF-8", "root", "123456");
|
||||||
|
boolean closed = connection.isClosed();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("select * from car_queue");
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (resultSet.next()) {
|
||||||
|
System.out.println("id=" + resultSet.getLong(1) + " name=" + resultSet.getString(2) + " createTime=" + resultSet.getDate(3) + " " + resultSet.getTime(3));
|
||||||
|
/* Object object = resultSet.getObject(0);
|
||||||
|
System.out.println(object);*/
|
||||||
|
}
|
||||||
|
resultSet.close();
|
||||||
|
preparedStatement.close();
|
||||||
|
connection.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,311 @@
|
|||||||
|
package com.idtgz.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.idtgz.config.PipeLineConfig;
|
||||||
|
import com.idtgz.config.StoreConfig;
|
||||||
|
import com.idtgz.config.constant.ProtocolConstant;
|
||||||
|
import com.idtgz.config.model.IEC104Config;
|
||||||
|
import com.idtgz.config.model.MqttConnectionConfig;
|
||||||
|
import com.idtgz.config.model.OPCDaConfig;
|
||||||
|
import com.idtgz.dao.entity.*;
|
||||||
|
import com.idtgz.dao.mapper.ClientMapper;
|
||||||
|
import com.idtgz.dao.mapper.ConnectionMapper;
|
||||||
|
import com.idtgz.dao.mapper.DataUploadQueueMapper;
|
||||||
|
import com.idtgz.dao.mapper.ItemRecordMapper;
|
||||||
|
import com.idtgz.exception.BussinessException;
|
||||||
|
import com.idtgz.model.pipeline.AddClientConnectionItemResultDTO;
|
||||||
|
import com.idtgz.model.pipeline.AvailableItemResponseDTO;
|
||||||
|
import com.idtgz.model.pipeline.AvailableOPCServerDTO;
|
||||||
|
import com.idtgz.model.web.*;
|
||||||
|
import com.idtgz.service.CenterService;
|
||||||
|
import com.idtgz.service.ConfigService;
|
||||||
|
import com.idtgz.service.ConnectionItemService;
|
||||||
|
import com.idtgz.service.ConnectionService;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.07
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/web")
|
||||||
|
public class WebController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionMapper connectionMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionService connectionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConnectionItemService connectionItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CenterService centerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ClientMapper clientMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataUploadQueueMapper dataUploadQueueMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ItemRecordMapper itemRecordMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取整体配置信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/configInfo")
|
||||||
|
public BaseResponse configInfo() {
|
||||||
|
return BaseResponse.success("success", configService.getConfigInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新配置
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param port
|
||||||
|
* @param username
|
||||||
|
* @param password
|
||||||
|
* @param clientId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/pipeLineConfig")
|
||||||
|
public BaseResponse updatePipeLineConfig(String host, Integer port, String username, String password, String clientId) {
|
||||||
|
PipeLineConfig pipeLineConfig = new PipeLineConfig(host, port, username, password, clientId);
|
||||||
|
if (configService.updatePipeLine(pipeLineConfig)) {
|
||||||
|
return BaseResponse.success("success");
|
||||||
|
} else {
|
||||||
|
return BaseResponse.fail(-1, "fail");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/storeConfig")
|
||||||
|
public BaseResponse updateStoreConfig(Integer expirationTime) {
|
||||||
|
if (expirationTime > 60) {
|
||||||
|
throw new BussinessException("存储有效期不得超过60天");
|
||||||
|
}
|
||||||
|
StoreConfig storeConfig = new StoreConfig(expirationTime);
|
||||||
|
if (configService.updateStoreConfig(storeConfig)) {
|
||||||
|
return BaseResponse.success("success");
|
||||||
|
} else {
|
||||||
|
return BaseResponse.fail(-1, "fail");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/connects")
|
||||||
|
public BaseResponse connectsPageList(BaseRequest request) {
|
||||||
|
IPage<ConnectionEntity> page = connectionMapper.selectPage(new Page<>(request.getPageNo(), request.getPageSize()), null);
|
||||||
|
page.getRecords().forEach(
|
||||||
|
i -> i.setConnectionId(i.getId().toString())
|
||||||
|
);
|
||||||
|
return BaseResponse.success(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/connects")
|
||||||
|
public BaseResponse newConnect(ConnectionDTO dto) {
|
||||||
|
if (dto.getConnectionProtocol() == ProtocolConstant.OPCDA) {
|
||||||
|
connectionService.addClientConnection(dto.getClientId(), new OPCDaConfig(dto));
|
||||||
|
} else if (dto.getConnectionProtocol() == ProtocolConstant.IEC104) {
|
||||||
|
connectionService.addClientConnection(dto.getClientId(), new IEC104Config(dto));
|
||||||
|
} else if (dto.getConnectionProtocol() == ProtocolConstant.MQTT) {
|
||||||
|
connectionService.addBrokerConnection(new MqttConnectionConfig(dto));
|
||||||
|
}
|
||||||
|
centerService.remoteSyn();
|
||||||
|
return BaseResponse.success("success");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/connects")
|
||||||
|
public BaseResponse updateConnect(ConnectionDTO dto) {
|
||||||
|
centerService.remoteSyn();
|
||||||
|
return BaseResponse.success("success");
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/connects")
|
||||||
|
public BaseResponse delConnect(String clientId, Long deviceId, Integer connectionProtocol, String connectionSign) {
|
||||||
|
if (connectionProtocol == ProtocolConstant.OPCDA || connectionProtocol == ProtocolConstant.OPCUA || connectionProtocol == ProtocolConstant.IEC104) {
|
||||||
|
//删除级联客户端连接
|
||||||
|
connectionService.delClientConnection(clientId, deviceId);
|
||||||
|
} else if (connectionProtocol == ProtocolConstant.MQTT || connectionProtocol == ProtocolConstant.DB) {
|
||||||
|
//删除Broker连接
|
||||||
|
connectionService.delBrokerConnection(connectionSign);
|
||||||
|
}
|
||||||
|
//centerService.remoteSyn();
|
||||||
|
return BaseResponse.success("success");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/avilableItem")
|
||||||
|
public BaseResponse avilableItem(Long deviceId, Integer connectionProtocol, String clientId, String currentBranch, Integer move, String moveInBranch, String browserId) throws InterruptedException {
|
||||||
|
if (connectionProtocol == ProtocolConstant.OPCDA || connectionProtocol == ProtocolConstant.OPCUA || connectionProtocol == ProtocolConstant.IEC104) {
|
||||||
|
AvailableItemResponseDTO availableItems = connectionService.getAvailableItems(clientId, deviceId, currentBranch, move, moveInBranch, browserId);
|
||||||
|
return BaseResponse.success(availableItems);
|
||||||
|
}
|
||||||
|
//centerService.remoteSyn();
|
||||||
|
return BaseResponse.fail(-1, "fail");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加级联客户端点位
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
|
@PostMapping("/addClientItem")
|
||||||
|
public BaseResponse addClientItem(@RequestBody AddClientItemDTO dto) throws InterruptedException {
|
||||||
|
AddClientConnectionItemResultDTO dto1 = connectionService.addClientConnectionItem(dto.getClientId(), dto.getDeviceId(), dto.getItems());
|
||||||
|
return BaseResponse.success(dto1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 级联客户端搜索可用服务
|
||||||
|
*
|
||||||
|
* @param clientId
|
||||||
|
* @param connectionProtocol
|
||||||
|
* @param host
|
||||||
|
* @param port
|
||||||
|
* @return
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
|
@GetMapping("/avilableServer")
|
||||||
|
public BaseResponse avilableServer(String clientId, Integer connectionProtocol, String host, Integer port) throws InterruptedException {
|
||||||
|
if (connectionProtocol == ProtocolConstant.OPCDA) {
|
||||||
|
List<AvailableOPCServerDTO> availableOPCDAServer = connectionService.getAvailableOPCDAServer(clientId, host);
|
||||||
|
return BaseResponse.success(availableOPCDAServer);
|
||||||
|
}
|
||||||
|
//centerService.remoteSyn();
|
||||||
|
return BaseResponse.fail(-1, "fail");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接Item
|
||||||
|
*
|
||||||
|
* @param connectionSign
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/connectionItem")
|
||||||
|
public BaseResponse connectionItemPageList(String connectionSign, String keyword, Integer pageNo, Integer pageSize) {
|
||||||
|
if (pageNo == null || pageSize == null) {
|
||||||
|
pageNo = 1;
|
||||||
|
pageSize = 20;
|
||||||
|
}
|
||||||
|
ConnectionEntity connectionEntity = connectionService.getOne(new QueryWrapper<ConnectionEntity>().eq("connection_sign", connectionSign));
|
||||||
|
IPage<ConnectionItemEntity> list = connectionItemService.page(new Page<>(pageNo, pageSize), new QueryWrapper<ConnectionItemEntity>().like(StringUtils.isNotEmpty(keyword), "item_code", keyword.trim()).eq("connection_id", connectionEntity.getId()));
|
||||||
|
return BaseResponse.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/connectionItem")
|
||||||
|
public BaseResponse delConnectionItem(@RequestBody DelConnectionItemDTO dto) throws InterruptedException {
|
||||||
|
Boolean aBoolean = connectionService.delClientConnectionItem(dto.getClientId(), dto.getDeviceId(), dto.getItems());
|
||||||
|
return BaseResponse.success(aBoolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取级联客户端列表
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/clients")
|
||||||
|
public BaseResponse clients(BaseRequest request) {
|
||||||
|
if (request.getPageNo() != null && request.getPageSize() != null) {
|
||||||
|
IPage<ClientEntity> clientEntityIPage = clientMapper.selectPage(new Page<>(request.getPageNo(), request.getPageSize()), new QueryWrapper<ClientEntity>());
|
||||||
|
clientEntityIPage.getRecords().forEach(
|
||||||
|
i -> {
|
||||||
|
String[] split = i.getClientHost().replace("[", "").replace("]", "").split(",");
|
||||||
|
i.setClientHostList(Arrays.asList(split));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return BaseResponse.success(clientEntityIPage);
|
||||||
|
} else {
|
||||||
|
List<ClientEntity> clientEntities = clientMapper.selectList(null);
|
||||||
|
//ip地址处理
|
||||||
|
clientEntities.forEach(
|
||||||
|
i -> {
|
||||||
|
String[] split = i.getClientHost().replace("[", "").replace("]", "").split(",");
|
||||||
|
i.setClientHostList(Arrays.asList(split));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return BaseResponse.success(clientEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传记录
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/uploadQueue")
|
||||||
|
public BaseResponse uploadQueue(UploadQueueDTO dto) {
|
||||||
|
IPage<DataUploadQueueEntity> dataUploadQueueEntityIPage = dataUploadQueueMapper.selectPage(new Page<DataUploadQueueEntity>(dto.getPageNo(), dto.getPageSize()), new QueryWrapper<DataUploadQueueEntity>().eq(StringUtils.isNotEmpty(dto.getConnectionSign()), "connection_sign", dto.getConnectionSign()).orderByDesc("item_timestamp"));
|
||||||
|
return BaseResponse.success(dataUploadQueueEntityIPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据入库记录
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/itemRecord")
|
||||||
|
public BaseResponse itemRecord(ItemRecordDTO dto) {
|
||||||
|
QueryWrapper<ItemRecordEntity> queryWrapper = new QueryWrapper<ItemRecordEntity>()
|
||||||
|
.eq(dto.getUploadQueueId() != null, "upload_queue_id", dto.getUploadQueueId())
|
||||||
|
.eq(dto.getItemSign() != null, "item_sign", dto.getItemSign())
|
||||||
|
.eq(dto.getItemid() != null, "item_index_id", dto.getItemid());
|
||||||
|
IPage<ItemRecordEntity> itemRecordEntityIPage = itemRecordMapper.selectPage(new Page<>(dto.getPageNo(), dto.getPageSize()), queryWrapper);
|
||||||
|
return BaseResponse.success(itemRecordEntityIPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param connectionSign 连接设备ID
|
||||||
|
* @param isUploaded 启动状态
|
||||||
|
* @param uploadType 上传类型
|
||||||
|
* @param uploadCycle 上传周期
|
||||||
|
* @param storeStrategy 存储策略
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateSchedule")
|
||||||
|
public BaseResponse updateSchedule(String connectionSign, Integer isUploaded, Integer uploadType, Integer uploadCycle, Integer storeStrategy) throws SchedulerException {
|
||||||
|
|
||||||
|
Boolean aBoolean = connectionService.updateSchedule(connectionSign, uploadType, uploadCycle, storeStrategy, isUploaded, true);
|
||||||
|
if (aBoolean) {
|
||||||
|
return BaseResponse.success(aBoolean);
|
||||||
|
} else {
|
||||||
|
return BaseResponse.fail(-1, "更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中心端手动同步
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/centerSyn")
|
||||||
|
public BaseResponse centerSyn() {
|
||||||
|
centerService.remoteSyn();
|
||||||
|
return BaseResponse.success("同步命令发送成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.idtgz.dao.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("client")
|
||||||
|
public class ClientEntity {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("client_type")
|
||||||
|
private Integer clientType;
|
||||||
|
|
||||||
|
@TableField("client_id")
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
@TableField("client_status")
|
||||||
|
private Integer clientStatus;
|
||||||
|
|
||||||
|
@TableField("client_name")
|
||||||
|
private String clientName;
|
||||||
|
|
||||||
|
@TableField("client_host")
|
||||||
|
private String clientHost;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> clientHostList;
|
||||||
|
|
||||||
|
@TableField("created_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createdTime;
|
||||||
|
|
||||||
|
@TableField("updated_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.idtgz.dao.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("config")
|
||||||
|
public class ConfigEntity {
|
||||||
|
|
||||||
|
@TableId("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("config_type")
|
||||||
|
private String configType;
|
||||||
|
|
||||||
|
@TableField("config_json")
|
||||||
|
private String configJson;
|
||||||
|
|
||||||
|
@TableField("created_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createdTime;
|
||||||
|
|
||||||
|
@TableField("updated_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.idtgz.dao.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.idtgz.config.constant.ConnectionConstant;
|
||||||
|
import com.idtgz.config.constant.ProtocolConstant;
|
||||||
|
import com.idtgz.config.model.MqttConnectionConfig;
|
||||||
|
import com.idtgz.context.ConfigContext;
|
||||||
|
import com.idtgz.util.CommonUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("connection")
|
||||||
|
public class ConnectionEntity {
|
||||||
|
|
||||||
|
@TableId("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String connectionId;
|
||||||
|
|
||||||
|
@TableField("connection_sign")
|
||||||
|
private String connectionSign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接类型 1: 级联客户端连接 2:Broker连接
|
||||||
|
*/
|
||||||
|
@TableField("connection_type")
|
||||||
|
private int connectionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接协议 5:opcda 6:opcua 7:db 8:iec104 9:Mqtt
|
||||||
|
*/
|
||||||
|
@TableField("connection_protocol")
|
||||||
|
private int connectionProtocol;
|
||||||
|
|
||||||
|
@TableField("connection_name")
|
||||||
|
private String connectionName;
|
||||||
|
|
||||||
|
@TableField("connection_json")
|
||||||
|
private String connectionJson;
|
||||||
|
|
||||||
|
@TableField("connection_status")
|
||||||
|
private Integer connectionStatus;
|
||||||
|
|
||||||
|
@TableField("client_id")
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
@TableField("device_id")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@TableField("upload_type")
|
||||||
|
private Integer uploadType;
|
||||||
|
|
||||||
|
@TableField("upload_cycle")
|
||||||
|
private Integer uploadCycle;
|
||||||
|
|
||||||
|
@TableField("store_strategy")
|
||||||
|
private Integer storeStrategy;
|
||||||
|
|
||||||
|
@TableField("is_uploaded")
|
||||||
|
private int isUploaded;
|
||||||
|
|
||||||
|
@TableField("created_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createdTime;
|
||||||
|
|
||||||
|
@TableField("updated_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
public ConnectionEntity(MqttConnectionConfig connectionConfig) {
|
||||||
|
this.connectionSign = connectionConfig.getConnectionSign();
|
||||||
|
this.connectionType = ConnectionConstant.BrokerConnection;
|
||||||
|
this.connectionProtocol = ProtocolConstant.MQTT;
|
||||||
|
this.connectionName = connectionConfig.getConnetionName();
|
||||||
|
this.connectionJson = JSON.toJSONString(connectionConfig);
|
||||||
|
this.connectionStatus = 1;
|
||||||
|
this.deviceId = CommonUtil.getLongId(this.connectionSign);
|
||||||
|
if (this.uploadType == null || this.uploadType == null) {
|
||||||
|
this.uploadType = 1;
|
||||||
|
this.uploadCycle = 1;
|
||||||
|
} else {
|
||||||
|
this.uploadType = connectionConfig.getUploadType();
|
||||||
|
this.uploadCycle = connectionConfig.getCycle();
|
||||||
|
}
|
||||||
|
this.clientId = connectionConfig.getClientId();
|
||||||
|
this.storeStrategy = connectionConfig.getStoreStrategy();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.idtgz.dao.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("connection_item")
|
||||||
|
public class ConnectionItemEntity {
|
||||||
|
|
||||||
|
@TableId("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("connection_id")
|
||||||
|
private Long connectionId;
|
||||||
|
|
||||||
|
@TableField("item_sign")
|
||||||
|
private String itemSign;
|
||||||
|
|
||||||
|
@TableField("item_code")
|
||||||
|
private String itemCode;
|
||||||
|
|
||||||
|
@TableField("create_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@TableField("update_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package com.idtgz.dao.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("data_upload_queue")
|
||||||
|
public class DataUploadQueueEntity {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("connection_id")
|
||||||
|
private Long connectionId;
|
||||||
|
|
||||||
|
@TableField("item_timestamp")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime itemTimestamp;
|
||||||
|
|
||||||
|
@TableField("is_success")
|
||||||
|
private Boolean isSuccess;
|
||||||
|
|
||||||
|
@TableField("is_stored")
|
||||||
|
private Boolean isStored;
|
||||||
|
|
||||||
|
@TableField("connection_sign")
|
||||||
|
private String connectionSign;
|
||||||
|
|
||||||
|
@TableField("connection_device_id")
|
||||||
|
private Long connectionDeviceId;
|
||||||
|
|
||||||
|
@TableField("connection_type")
|
||||||
|
private Integer connectionType;
|
||||||
|
|
||||||
|
@TableField("store_strategy")
|
||||||
|
private Integer storeStrategy;
|
||||||
|
|
||||||
|
@TableField("update_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.idtgz.dao.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("item_record")
|
||||||
|
public class ItemRecordEntity {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("connection_type")
|
||||||
|
private Integer connectionType;
|
||||||
|
|
||||||
|
@TableField("item_code")
|
||||||
|
private String itemCode;
|
||||||
|
|
||||||
|
@TableField("item_sign")
|
||||||
|
private String itemSign;
|
||||||
|
|
||||||
|
@TableField("item_value")
|
||||||
|
private String itemValue;
|
||||||
|
|
||||||
|
@TableField("item_timestamp")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime itemTimestamp;
|
||||||
|
|
||||||
|
@TableField("item_index_id")
|
||||||
|
private Long itemIndexId;
|
||||||
|
|
||||||
|
@TableField("item_extra_info")
|
||||||
|
private String itemExtraInfo;
|
||||||
|
|
||||||
|
@TableField("connection_index_id")
|
||||||
|
private Long connectionIndexId;
|
||||||
|
|
||||||
|
@TableField("upload_queue_id")
|
||||||
|
private Long uploadQueueId;
|
||||||
|
|
||||||
|
@TableField("connection_sign")
|
||||||
|
private String connectionSign;
|
||||||
|
|
||||||
|
@TableField("created_time")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createdTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.idtgz.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.idtgz.dao.entity.ClientEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
public interface ClientMapper extends BaseMapper<ClientEntity> {
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.idtgz.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.idtgz.dao.entity.ConfigEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
public interface ConfigMapper extends BaseMapper<ConfigEntity> {
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.idtgz.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.idtgz.dao.entity.ConnectionItemEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
public interface ConnectionItemMapper extends BaseMapper<ConnectionItemEntity> {
|
||||||
|
void cleanUp();
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.idtgz.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.idtgz.dao.entity.ConnectionEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.25
|
||||||
|
*/
|
||||||
|
public interface ConnectionMapper extends BaseMapper<ConnectionEntity> {
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.idtgz.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.idtgz.dao.entity.DataUploadQueueEntity;
|
||||||
|
|
||||||
|
public interface DataUploadQueueMapper extends BaseMapper<DataUploadQueueEntity> {
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.idtgz.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.idtgz.dao.entity.DataUploadQueueEntity;
|
||||||
|
import com.idtgz.dao.entity.ItemRecordEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ItemRecordMapper extends BaseMapper<ItemRecordEntity> {
|
||||||
|
/**
|
||||||
|
* 一次批量保存
|
||||||
|
*
|
||||||
|
* @param entities
|
||||||
|
*/
|
||||||
|
void saveByBatch(@Param("entities") List<ItemRecordEntity> entities);
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.idtgz.exception;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.15
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BussinessException extends RuntimeException {
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public BussinessException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = -1;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.idtgz.exception;
|
||||||
|
|
||||||
|
import com.idtgz.model.web.BaseResponse;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.15
|
||||||
|
*/
|
||||||
|
@ControllerAdvice
|
||||||
|
public class ExceptionHandler {
|
||||||
|
|
||||||
|
@org.springframework.web.bind.annotation.ExceptionHandler(BussinessException.class)
|
||||||
|
@ResponseStatus(HttpStatus.OK)//使http返回的状态码是200
|
||||||
|
@ResponseBody//使之返回json格式数据
|
||||||
|
public BaseResponse bussinessException(BussinessException e) {
|
||||||
|
return BaseResponse.fail(-1, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.model.mqttConnection;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MqttConnectionSynDTO {
|
||||||
|
private List<String> itemCodes;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddClientConnectionItemDTO {
|
||||||
|
public List<String> items;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddClientConnectionItemResultDTO {
|
||||||
|
|
||||||
|
public List<String> successList = new ArrayList<>();
|
||||||
|
|
||||||
|
public List<String> failList = new ArrayList<>();
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AvailableItemDTO {
|
||||||
|
private Long device;
|
||||||
|
private String currentBranch;
|
||||||
|
private String moveInBranch;
|
||||||
|
private Integer move;
|
||||||
|
private String browserId;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AvailableItemResponseDTO {
|
||||||
|
private String currentBranch;
|
||||||
|
private int errCode;
|
||||||
|
private String browserId;
|
||||||
|
private List<String> branchs;
|
||||||
|
private List<String> items;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AvailableOPCServerDTO {
|
||||||
|
private String host;
|
||||||
|
private String progId;
|
||||||
|
private String serverId;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AvailableServerDTO {
|
||||||
|
private String host;
|
||||||
|
private String clientId;
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import com.idtgz.service.ConnectionService;
|
||||||
|
import com.idtgz.service.MqttClientService;
|
||||||
|
import com.idtgz.service.MqttInfoService;
|
||||||
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.24
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class CenterMqttCallback implements MqttCallback {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttClientService mqttClientService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable cause) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String topic, MqttMessage message) throws UnsupportedEncodingException, InterruptedException {
|
||||||
|
System.out.println(topic + ":" + message.getPayload().toString());
|
||||||
|
mqttClientService.centerInfoHandler(topic,new String(message.getPayload(),"utf-8"),null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CenterSyncDTO {
|
||||||
|
|
||||||
|
//网关 = 1 Client = 2
|
||||||
|
private int clientType;
|
||||||
|
|
||||||
|
//Json
|
||||||
|
private String clientInfo;
|
||||||
|
|
||||||
|
private List<ConnectDTO> connects;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import com.idtgz.dao.entity.ClientEntity;
|
||||||
|
import com.idtgz.dao.entity.ConnectionEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: \
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ClientInfo {
|
||||||
|
List<ClientEntity> clients;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.idtgz.config.constant.ProtocolConstant;
|
||||||
|
import com.idtgz.config.model.IEC104Config;
|
||||||
|
import com.idtgz.config.model.MqttConnectionConfig;
|
||||||
|
import com.idtgz.config.model.OPCDaConfig;
|
||||||
|
import com.idtgz.dao.entity.ConnectionEntity;
|
||||||
|
import com.idtgz.dao.entity.ConnectionItemEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ConnectDTO {
|
||||||
|
|
||||||
|
public String connectSign;
|
||||||
|
|
||||||
|
public Long device;
|
||||||
|
|
||||||
|
public int mode;
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
|
||||||
|
public Integer uploadType;
|
||||||
|
|
||||||
|
public Integer cycle;
|
||||||
|
|
||||||
|
public Integer storeStrategy;
|
||||||
|
|
||||||
|
public String description;
|
||||||
|
|
||||||
|
public String clientId;
|
||||||
|
|
||||||
|
public long updateTimestamp;
|
||||||
|
|
||||||
|
public int status;
|
||||||
|
|
||||||
|
public Boolean isUpload;
|
||||||
|
|
||||||
|
List<String> items;
|
||||||
|
|
||||||
|
//opcda字段
|
||||||
|
public String serverUrl;
|
||||||
|
public String daProgId;
|
||||||
|
|
||||||
|
//mqtt连接字段
|
||||||
|
public String mqttConnectionName;
|
||||||
|
public String mqttUsername;
|
||||||
|
public String mqttPassword;
|
||||||
|
public String mqttClient;
|
||||||
|
|
||||||
|
//iec104字段
|
||||||
|
String iec104Host;
|
||||||
|
Integer iec104Port;
|
||||||
|
|
||||||
|
public ConnectDTO(ConnectionEntity connectionEntity) {
|
||||||
|
this.connectSign = connectionEntity.getConnectionSign();
|
||||||
|
this.cycle = connectionEntity.getUploadCycle();
|
||||||
|
this.uploadType = connectionEntity.getUploadType();
|
||||||
|
this.name = connectionEntity.getConnectionName();
|
||||||
|
this.device = connectionEntity.getDeviceId();
|
||||||
|
this.mode = connectionEntity.getConnectionProtocol();
|
||||||
|
this.updateTimestamp = connectionEntity.getUpdatedTime().toEpochSecond(ZoneOffset.of("+8")) * 1000;
|
||||||
|
this.isUpload = connectionEntity.getIsUploaded() == 1 ? true : false;
|
||||||
|
this.status = connectionEntity.getConnectionStatus();
|
||||||
|
this.clientId = connectionEntity.getClientId();
|
||||||
|
this.storeStrategy =connectionEntity.getStoreStrategy();
|
||||||
|
switch (this.mode) {
|
||||||
|
case ProtocolConstant.OPCDA:
|
||||||
|
OPCDaConfig opcDaConfig = JSON.parseObject(connectionEntity.getConnectionJson(), OPCDaConfig.class);
|
||||||
|
this.serverUrl = opcDaConfig.getServerUrl();
|
||||||
|
this.daProgId = opcDaConfig.getDaProgId();
|
||||||
|
break;
|
||||||
|
case ProtocolConstant.IEC104:
|
||||||
|
IEC104Config iec104Config = JSON.parseObject(connectionEntity.getConnectionJson(), IEC104Config.class);
|
||||||
|
this.iec104Host = iec104Config.getHost();
|
||||||
|
this.iec104Port = iec104Config.getPort();
|
||||||
|
break;
|
||||||
|
case ProtocolConstant.MQTT:
|
||||||
|
MqttConnectionConfig mqttConnectionConfig = JSON.parseObject(connectionEntity.getConnectionJson(), MqttConnectionConfig.class);
|
||||||
|
this.mqttConnectionName = mqttConnectionConfig.getConnetionName();
|
||||||
|
this.mqttUsername = mqttConnectionConfig.getUserName();
|
||||||
|
this.mqttPassword = mqttConnectionConfig.getPassword();
|
||||||
|
this.mqttClient = mqttConnectionConfig.getClientId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CreateDeviceChannelPointDTO {
|
||||||
|
private List<String> items;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.08.17
|
||||||
|
*/
|
||||||
|
public class DeleteDeviceChannelPointDTO {
|
||||||
|
public List<String> items;
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.06.01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ItemUploadDTO {
|
||||||
|
|
||||||
|
long ts;
|
||||||
|
|
||||||
|
List<Value> values;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Value {
|
||||||
|
|
||||||
|
public String key;
|
||||||
|
|
||||||
|
public String status;
|
||||||
|
|
||||||
|
public Long ts;
|
||||||
|
|
||||||
|
public Object value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.idtgz.model.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SyncDTO {
|
||||||
|
|
||||||
|
private List<String> host;
|
||||||
|
|
||||||
|
private String hostName;
|
||||||
|
|
||||||
|
private String clientId;
|
||||||
|
|
||||||
|
//网关 = 1 Client = 2
|
||||||
|
private int clientType;
|
||||||
|
|
||||||
|
//Json
|
||||||
|
private String clientInfo;
|
||||||
|
|
||||||
|
private List<ConnectDTO> connects;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.idtgz.model.pipeline.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.07.08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddConnectRequestDTO {
|
||||||
|
|
||||||
|
public int mode;
|
||||||
|
|
||||||
|
public Integer uploadType;
|
||||||
|
|
||||||
|
public Integer cycle;
|
||||||
|
|
||||||
|
public int port;
|
||||||
|
|
||||||
|
public String clientId;
|
||||||
|
|
||||||
|
//opcda字段
|
||||||
|
public String serverUrl;
|
||||||
|
|
||||||
|
public String daProgId;
|
||||||
|
|
||||||
|
//mqtt字段
|
||||||
|
public String mqttConnectionName;
|
||||||
|
|
||||||
|
public String mqttUsername;
|
||||||
|
|
||||||
|
public String mqttPassword;
|
||||||
|
|
||||||
|
public String mqttClientId;
|
||||||
|
|
||||||
|
//IEC104字段
|
||||||
|
public String iec104Host;
|
||||||
|
public Integer iec104Port;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.idtgz.model.pipeline.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeviceBaseRequest {
|
||||||
|
public String requestId;
|
||||||
|
public String method;
|
||||||
|
public Object payload;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.idtgz.model.pipeline.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeviceBaseResponse {
|
||||||
|
public String requestId;
|
||||||
|
|
||||||
|
public String method;
|
||||||
|
|
||||||
|
public Object payload;
|
||||||
|
|
||||||
|
public Boolean success;
|
||||||
|
|
||||||
|
public String error;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.idtgz.model.pipeline.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author: GS-HQY
|
||||||
|
* @date: 2022.05.31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RPCBaseRequest {
|
||||||
|
|
||||||
|
public long device;
|
||||||
|
|
||||||
|
public Data data;
|
||||||
|
|
||||||
|
@lombok.Data
|
||||||
|
public static class Data {
|
||||||
|
public String requestId;
|
||||||
|
public String method;
|
||||||
|
public Object payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user