flySnail 4 years ago
parent
commit
f568b9a5c0

+ 8 - 0
.idea/artifacts/environment_jar.xml

@@ -0,0 +1,8 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="environment:jar">
+    <output-path>$PROJECT_DIR$/out/artifacts/environment_jar</output-path>
+    <root id="archive" name="environment.jar">
+      <element id="module-output" name="environment" />
+    </root>
+  </artifact>
+</component>

+ 7 - 0
.idea/kotlinc.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Kotlin2JsCompilerArguments">
+    <option name="sourceMapEmbedSources" />
+    <option name="sourceMapPrefix" />
+  </component>
+</project>

+ 9 - 0
.idea/libraries/mysql_connector_java_5_1_44_bin.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="mysql-connector-java-5.1.44-bin">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/mysql-connector-java-5.1.44-bin.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 6 - 0
.idea/misc.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <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>

+ 8 - 0
.idea/modules.xml

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

+ 803 - 0
.idea/workspace.xml

@@ -0,0 +1,803 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ArtifactsWorkspaceSettings">
+    <artifacts-to-build>
+      <artifact name="environment:jar" />
+    </artifacts-to-build>
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="7aad9f36-ff4d-497f-a3ef-f24f4703c514" name="Default" comment="" />
+    <ignored path="$PROJECT_DIR$/out/" />
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+    <option name="TRACKING_ENABLED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="FileEditorManager">
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
+      <file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/src/Main.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="310">
+              <caret line="57" column="18" selection-start-line="57" selection-start-column="18" selection-end-line="57" selection-end-column="18" />
+              <folding>
+                <element signature="imports" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="MysqlTool.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/MysqlTool.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="2403">
+              <caret line="93" column="13" selection-start-line="93" selection-start-column="13" selection-end-line="93" selection-end-column="13" />
+              <folding>
+                <element signature="imports" expanded="true" />
+                <element signature="e#720#721#0" expanded="true" />
+                <element signature="e#742#743#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="EnvironmentList.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/entity/EnvironmentList.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="81">
+              <caret line="3" column="28" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="28" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Statement.java" pinned="false" current-in-tab="false">
+        <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/sql/Statement.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="1107">
+              <caret line="64" column="13" selection-start-line="64" selection-start-column="4" selection-end-line="64" selection-end-column="13" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="HttpClient.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/HttpClient.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="918">
+              <caret line="37" selection-start-line="37" selection-end-line="51" selection-end-column="13" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="UDPServer.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="756">
+              <caret line="37" selection-start-line="37" selection-end-line="41" selection-end-column="21" />
+              <folding>
+                <element signature="e#467#468#0" expanded="true" />
+                <element signature="e#494#495#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Main.class" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="918">
+              <caret line="41" column="13" selection-start-line="41" selection-start-column="13" selection-end-line="41" selection-end-column="13" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="TCPClient.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="54">
+              <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Parser.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="756">
+              <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Packet.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="216">
+              <caret line="8" column="3" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="39" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="IdeDocumentHistory">
+    <option name="CHANGED_PATHS">
+      <list>
+        <option value="$PROJECT_DIR$/src/UDPServer.java" />
+        <option value="$PROJECT_DIR$/src/entity/ElectricEnergy.java" />
+        <option value="$PROJECT_DIR$/src/HttpClient.java" />
+        <option value="$PROJECT_DIR$/src/MysqlTool.java" />
+        <option value="$PROJECT_DIR$/src/Main.java" />
+      </list>
+    </option>
+  </component>
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
+  <component name="JsGulpfileManager">
+    <detection-done>true</detection-done>
+    <sorting>DEFINITION_ORDER</sorting>
+  </component>
+  <component name="NodePackageJsonFileManager">
+    <packageJsonPaths />
+  </component>
+  <component name="ProjectFrameBounds" extendedState="6">
+    <option name="x" value="-3781" />
+    <option name="y" value="21" />
+    <option name="width" value="1741" />
+    <option name="height" value="971" />
+  </component>
+  <component name="ProjectView">
+    <navigator proportions="" version="1">
+      <foldersAlwaysOnTop value="true" />
+    </navigator>
+    <panes>
+      <pane id="PackagesPane" />
+      <pane id="Scope" />
+      <pane id="ProjectPane">
+        <subPane>
+          <expand>
+            <path>
+              <item name="environment" type="b2602c69:ProjectViewProjectNode" />
+              <item name="environment" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="environment" type="b2602c69:ProjectViewProjectNode" />
+              <item name="environment" type="462c0819:PsiDirectoryNode" />
+              <item name="src" type="462c0819:PsiDirectoryNode" />
+            </path>
+          </expand>
+          <select />
+        </subPane>
+      </pane>
+      <pane id="AndroidView" />
+    </panes>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="WebServerToolWindowFactoryState" value="false" />
+    <property name="aspect.path.notification.shown" value="true" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/lib/mysql-connector-java-5.1.44-bin.jar!/" />
+    <property name="project.structure.last.edited" value="Project" />
+    <property name="project.structure.proportion" value="0.15" />
+    <property name="project.structure.side.proportion" value="0.2" />
+    <property name="settings.editor.selected.configurable" value="configurable.group.build" />
+  </component>
+  <component name="RecentsManager">
+    <key name="CopyClassDialog.RECENTS_KEY">
+      <recent name="entity" />
+      <recent name="" />
+    </key>
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="D:\workspace\ideaWorkSpace\environment\lib" />
+    </key>
+  </component>
+  <component name="RunDashboard">
+    <option name="ruleStates">
+      <list>
+        <RuleState>
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
+        </RuleState>
+        <RuleState>
+          <option name="name" value="StatusDashboardGroupingRule" />
+        </RuleState>
+      </list>
+    </option>
+  </component>
+  <component name="RunManager">
+    <configuration default="true" type="Application" factoryName="Application">
+      <option name="MAIN_CLASS_NAME" value="Main" />
+      <module name="environment" />
+      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
+    </configuration>
+    <configuration name="java" type="Application" factoryName="Application">
+      <option name="MAIN_CLASS_NAME" value="Main" />
+      <module name="environment" />
+      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
+    </configuration>
+    <configuration default="true" type="JUnit" factoryName="JUnit">
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="METHOD_NAME" />
+      <option name="TEST_OBJECT" value="class" />
+      <option name="VM_PARAMETERS" value="-ea" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="singleModule" />
+      </option>
+      <patterns />
+    </configuration>
+    <configuration default="true" type="TestNG" factoryName="TestNG">
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="SUITE_NAME" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="METHOD_NAME" />
+      <option name="GROUP_NAME" />
+      <option name="TEST_OBJECT" value="CLASS" />
+      <option name="VM_PARAMETERS" value="-ea" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
+      <option name="OUTPUT_DIRECTORY" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="singleModule" />
+      </option>
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
+      <option name="PROPERTIES_FILE" />
+      <properties />
+      <listeners />
+    </configuration>
+  </component>
+  <component name="SvnConfiguration">
+    <configuration />
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="7aad9f36-ff4d-497f-a3ef-f24f4703c514" name="Default" comment="" />
+      <created>1630849275641</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1630849275641</updated>
+      <workItem from="1630849279726" duration="1396000" />
+      <workItem from="1630983805767" duration="3683000" />
+      <workItem from="1631004888920" duration="283000" />
+      <workItem from="1631009848161" duration="250000" />
+      <workItem from="1631067454893" duration="6404000" />
+      <workItem from="1631174467014" duration="1355000" />
+      <workItem from="1631440029608" duration="599000" />
+      <workItem from="1631441054924" duration="1847000" />
+      <workItem from="1631584155054" duration="654000" />
+      <workItem from="1631586191200" duration="9000" />
+    </task>
+    <servers />
+  </component>
+  <component name="TimeTrackingManager">
+    <option name="totallyTimeSpent" value="16480000" />
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="-3848" y="-8" width="1936" height="1056" extended-state="6" />
+    <layout>
+      <window_info anchor="right" id="Palette" order="3" />
+      <window_info anchor="bottom" id="TODO" order="6" />
+      <window_info anchor="right" id="Palette&#9;" order="3" />
+      <window_info id="Image Layers" order="2" />
+      <window_info anchor="right" id="Capture Analysis" order="3" />
+      <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
+      <window_info anchor="right" id="Maven Projects" order="3" />
+      <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
+      <window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
+      <window_info anchor="bottom" id="Run" order="2" weight="0.49064907" />
+      <window_info anchor="bottom" id="Terminal" order="7" />
+      <window_info id="Capture Tool" order="2" />
+      <window_info id="Designer" order="2" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.18020834" />
+      <window_info anchor="right" id="Database" order="3" />
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
+      <window_info id="UI Designer" order="2" />
+      <window_info anchor="right" id="Theme Preview" order="3" />
+      <window_info id="Favorites" order="2" side_tool="true" />
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
+      <window_info anchor="bottom" id="Messages" order="7" weight="0.32943678" />
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
+      <window_info anchor="bottom" id="Message" order="0" />
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
+      <window_info anchor="bottom" id="Find" order="1" />
+    </layout>
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="1" />
+  </component>
+  <component name="VcsContentAnnotationSettings">
+    <option name="myLimit" value="2678400000" />
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="918">
+          <caret line="41" column="13" selection-start-line="41" selection-start-column="13" selection-end-line="41" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="54">
+          <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="216">
+          <caret line="8" column="3" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="39" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1323">
+          <caret line="54" column="25" lean-forward="true" selection-start-line="54" selection-start-column="25" selection-end-line="54" selection-end-column="25" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/MysqlTool.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="2403">
+          <caret line="93" column="13" selection-start-line="93" selection-start-column="13" selection-end-line="93" selection-end-column="13" />
+          <folding>
+            <element signature="imports" expanded="true" />
+            <element signature="e#720#721#0" expanded="true" />
+            <element signature="e#742#743#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/entity/EnvironmentList.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="3" column="28" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="28" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/sql/Statement.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1107">
+          <caret line="64" column="13" selection-start-line="64" selection-start-column="4" selection-end-line="64" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/HttpClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="918">
+          <caret line="37" selection-start-line="37" selection-end-line="51" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="37" selection-start-line="37" selection-end-line="41" selection-end-column="21" />
+          <folding>
+            <element signature="e#467#468#0" expanded="true" />
+            <element signature="e#494#495#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="918">
+          <caret line="41" column="13" selection-start-line="41" selection-start-column="13" selection-end-line="41" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="54">
+          <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="216">
+          <caret line="8" column="3" lean-forward="true" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="39" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="999">
+          <caret line="42" column="7" lean-forward="true" selection-start-line="42" selection-start-column="7" selection-end-line="42" selection-end-column="7" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/HttpClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="6" column="25" selection-start-line="6" selection-start-column="25" selection-end-line="6" selection-end-column="25" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="37" selection-start-line="37" selection-end-line="41" selection-end-column="21" />
+          <folding>
+            <element signature="e#467#468#0" expanded="true" />
+            <element signature="e#494#495#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="702">
+          <caret line="33" column="48" selection-start-line="33" selection-start-column="48" selection-end-line="33" selection-end-column="48" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="54">
+          <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="3" selection-start-line="3" selection-end-line="3" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/net/DatagramPacket.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4860">
+          <caret line="213" column="31" selection-start-line="213" selection-start-column="31" selection-end-line="213" selection-end-column="31" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="459">
+          <caret line="22" column="27" selection-start-line="22" selection-start-column="27" selection-end-line="22" selection-end-column="27" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/HttpClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="6" column="25" selection-start-line="6" selection-start-column="25" selection-end-line="6" selection-end-column="25" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="37" selection-start-line="37" selection-end-line="41" selection-end-column="21" />
+          <folding>
+            <element signature="e#467#468#0" expanded="true" />
+            <element signature="e#494#495#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="702">
+          <caret line="33" column="48" selection-start-line="33" selection-start-column="48" selection-end-line="33" selection-end-column="48" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="54">
+          <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="3" selection-start-line="3" selection-end-line="3" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/net/DatagramPacket.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4860">
+          <caret line="213" column="31" selection-start-line="213" selection-start-column="31" selection-end-line="213" selection-end-column="31" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="594">
+          <caret line="22" column="27" lean-forward="true" selection-start-line="22" selection-start-column="27" selection-end-line="22" selection-end-column="27" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/HttpClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="162">
+          <caret line="6" column="25" selection-start-line="6" selection-start-column="25" selection-end-line="6" selection-end-column="25" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="37" selection-start-line="37" selection-end-line="41" selection-end-column="21" />
+          <folding>
+            <element signature="e#467#468#0" expanded="true" />
+            <element signature="e#494#495#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="702">
+          <caret line="33" column="48" selection-start-line="33" selection-start-column="48" selection-end-line="33" selection-end-column="48" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="54">
+          <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/net/DatagramPacket.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4914">
+          <caret line="213" column="31" selection-start-line="213" selection-start-column="31" selection-end-line="213" selection-end-column="31" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="351">
+          <caret line="18" column="48" selection-start-line="18" selection-start-column="48" selection-end-line="18" selection-end-column="48" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="891">
+          <caret line="42" column="17" selection-start-line="42" selection-start-column="17" selection-end-line="42" selection-end-column="17" />
+          <folding>
+            <element signature="e#467#468#0" expanded="true" />
+            <element signature="e#494#495#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/net/DatagramPacket.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4860">
+          <caret line="213" column="31" selection-start-line="213" selection-start-column="31" selection-end-line="213" selection-end-column="31" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Parser.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="28" column="35" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/out/production/environment/Main.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="918">
+          <caret line="41" column="13" selection-start-line="41" selection-start-column="13" selection-end-line="41" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/TCPClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="54">
+          <caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/entity/EnvironmentList.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="81">
+          <caret line="3" column="28" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="28" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://D:/software/Android/jdk1_8/src.zip!/java/sql/Statement.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1107">
+          <caret line="64" column="13" selection-start-line="64" selection-start-column="4" selection-end-line="64" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/factoryProtocol/Packet.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="216">
+          <caret line="8" column="3" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="39" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/UDPServer.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="756">
+          <caret line="37" selection-start-line="37" selection-end-line="41" selection-end-column="21" />
+          <folding>
+            <element signature="e#467#468#0" expanded="true" />
+            <element signature="e#494#495#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/HttpClient.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="918">
+          <caret line="37" selection-start-line="37" selection-end-line="51" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/MysqlTool.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="2403">
+          <caret line="93" column="13" selection-start-line="93" selection-start-column="13" selection-end-line="93" selection-end-column="13" />
+          <folding>
+            <element signature="imports" expanded="true" />
+            <element signature="e#720#721#0" expanded="true" />
+            <element signature="e#742#743#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/Main.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="310">
+          <caret line="57" column="18" selection-start-line="57" selection-start-column="18" selection-end-line="57" selection-end-column="18" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+  </component>
+  <component name="masterDetails">
+    <states>
+      <state key="ArtifactsStructureConfigurable.UI">
+        <settings>
+          <artifact-editor />
+          <last-edited>environment:jar</last-edited>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+                <option value="0.5" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+      <state key="FacetStructureConfigurable.UI">
+        <settings>
+          <last-edited>No facets are configured</last-edited>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+      <state key="GlobalLibrariesConfigurable.UI">
+        <settings>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+      <state key="JdkListConfigurable.UI">
+        <settings>
+          <last-edited>1.8</last-edited>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+      <state key="ModuleStructureConfigurable.UI">
+        <settings>
+          <last-edited>environment</last-edited>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+      <state key="ProjectLibrariesConfigurable.UI">
+        <settings>
+          <last-edited>mysql-connector-java-5.1.44-bin</last-edited>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.2" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+    </states>
+  </component>
+</project>

+ 12 - 0
environment.iml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="mysql-connector-java-5.1.44-bin" level="project" />
+  </component>
+</module>

+ 3 - 0
out/production/environment/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Main
+

+ 85 - 0
src/HttpClient.java

@@ -0,0 +1,85 @@
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class HttpClient {
+    public static String doPost(String httpUrl, String param) {
+
+        HttpURLConnection connection = null;
+        InputStream is = null;
+        OutputStream os = null;
+        BufferedReader br = null;
+        String result = null;
+        try {
+            URL url = new URL(httpUrl);
+            // 通过远程url连接对象打开连接
+            connection = (HttpURLConnection) url.openConnection();
+            // 设置连接请求方式
+            connection.setRequestMethod("POST");
+            // 设置连接主机服务器超时时间:15000毫秒
+            connection.setConnectTimeout(15000);
+            // 设置读取主机服务器返回数据超时时间:60000毫秒
+            connection.setReadTimeout(60000);
+
+            // 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true
+            connection.setDoOutput(true);
+            // 默认值为:true,当前向远程服务读取数据时,设置为true,该参数可有可无
+            connection.setDoInput(true);
+            // 设置传入参数的格式:请求参数应该是 name1=value1&name2=value2 的形式。
+            connection.setRequestProperty("Content-Type", "application/json");
+            // 设置鉴权信息:Authorization: Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0
+            //connection.setRequestProperty("Authorization", "Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0");
+            // 通过连接对象获取一个输出流
+            os = connection.getOutputStream();
+            // 通过输出流对象将参数写出去/传输出去,它是通过字节数组写出的
+            os.write(param.getBytes());
+            // 通过连接对象获取一个输入流,向远程读取
+            if (connection.getResponseCode() == 200) {
+
+                is = connection.getInputStream();
+                // 对输入流对象进行包装:charset根据工作项目组的要求来设置
+                br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+                StringBuffer sbf = new StringBuffer();
+                String temp = null;
+                // 循环遍历一行一行读取数据
+                while ((temp = br.readLine()) != null) {
+                    sbf.append(temp);
+                    sbf.append("\r\n");
+                }
+                result = sbf.toString();
+            }
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭资源
+            if (null != br) {
+                try {
+                    br.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != os) {
+                try {
+                    os.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != is) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            // 断开与远程地址url的连接
+            connection.disconnect();
+        }
+        return result;
+    }
+}

+ 3 - 0
src/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Main
+

+ 72 - 0
src/Main.java

@@ -0,0 +1,72 @@
+import factoryProtocol.Packet;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Main {
+    private static UDPServer udpServer;
+    private static int DUP_PORT = 8001;
+    private static HttpClient httpClient;
+    private static MysqlTool mysqlTool;
+    public static byte[]  imei = {0x11,0x22,0x33,0x44,0x55,0x66};
+    public static void main(String[] args) throws IOException {
+
+        System.out.println("start pick...\r\n");
+        mysqlTool = new MysqlTool();
+        httpClient = new HttpClient();
+        udpServer = new UDPServer(DUP_PORT) {
+            @Override
+            protected void onDataReceive(Packet data) {
+                //mysqlTool.queryAll();
+
+                float temperature;
+                float humidity;
+                float negaticeO2Ion;
+                float pm25;
+                float pm10;
+                float db;
+                String HTTP_URL = "http://192.168.161.230:9999/api/environment/recordUpload";
+
+                String code = String.format("%02X%02X%02X%02X%02X%02X",data.imei[0],data.imei[1],data.imei[2],data.imei[3],data.imei[4],data.imei[5]);
+                String name = mysqlTool.queryNameByCade(code);
+                System.out.println(code+"  "+name);
+                ByteBuffer  buff= data.payload.getData();
+
+                temperature=  (buff.get(0)<<24 | buff.get(1)<<16 | buff.get(2)<<8 | buff.get(3))/10.0f;
+                humidity=  (buff.get(4)<<24 | buff.get(5)<<16 | buff.get(6)<<8 | buff.get(7))/10.0f;
+                negaticeO2Ion=  (buff.get(8)<<24 | buff.get(9)<<16 | buff.get(10)<<8 | buff.get(1))/10.0f;
+                pm25=  (buff.get(12)<<24 | buff.get(13)<<16 | buff.get(14)<<8 | buff.get(15))/10.0f;
+                pm10=  (buff.get(16)<<24 | buff.get(17)<<16 | buff.get(18)<<8 | buff.get(19))/10.0f;
+                db=  (buff.get(20)<<24 | buff.get(21)<<16 | buff.get(22)<<8 | buff.get(23))/10.0f;
+
+                String message = httpClient.doPost(HTTP_URL,upLoadData(code,name,temperature, humidity, negaticeO2Ion, pm25, pm10, db));
+                System.out.println(message);
+            }
+        };
+        udpServer.start();
+    }
+
+    /**
+     * 封装成http发送的json参数
+     * @param code
+     * @param name
+     * @param temperature
+     * @param humidity
+     * @param negaticeo2ion
+     * @param pm25
+     * @param pm10
+     * @param db
+     * @return
+     */
+    private static String upLoadData(String code, String name, float temperature, float humidity, float negaticeo2ion, float pm25, float pm10, float db) {
+        Date dNow = new Date( );
+        SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
+        String dataStr = "{\"pointCode\":\""+code+"\",\"pointName\":\""+name+"\",\"temperature\":"+String.format("%.1f",temperature)+",\"humidity\":"+String.format("%.1f",humidity)+",\"negaticeo2ion\":"+String.format("%.1f",negaticeo2ion)+",\"pm25\":"+String.format("%.1f",pm25)+",\"pm10\":"+String.format("%.1f",pm10)+",\"db\":"+String.format("%.1f",db)+",\"updateTime\":\""+ft.format(dNow)+"\"}";
+        System.out.println(dataStr);
+        return dataStr;
+    }
+
+
+}

+ 144 - 0
src/MysqlTool.java

@@ -0,0 +1,144 @@
+import com.sun.org.apache.xerces.internal.xs.StringList;
+
+import java.sql.*;
+
+
+public class MysqlTool {
+
+    // MySQL 8.0 以下版本 - JDBC 驱动名及数据库 URL
+    static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
+    static final String DB_URL = "jdbc:mysql://localhost:3306/new_school";
+
+    // MySQL 8.0 以上版本 - JDBC 驱动名及数据库 URL
+    //static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
+    //static final String DB_URL = "jdbc:mysql://localhost:3306/demo?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
+
+    // 数据库的用户名与密码,需要根据自己的设置
+    static final String USER = "root";
+    static final String PASS = "123456";
+    static Connection conn = null;
+    static Statement stmt = null;
+
+    MysqlTool(){
+        init();
+    }
+    public void init() {
+        try{
+            // 注册 JDBC 驱动
+            Class.forName(JDBC_DRIVER);
+            // 打开链接
+            System.out.println("连接数据库...");
+            conn = DriverManager.getConnection(DB_URL, USER, PASS);
+            // 执行查询
+            System.out.println(" 实例化Statement对象...");
+            stmt = conn.createStatement();
+        }catch(SQLException se){
+            // 处理 JDBC 错误
+            se.printStackTrace();
+        }catch(Exception e){
+            // 处理 Class.forName 错误
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 查询所有数据
+     */
+    public void queryAll(){
+        try{
+            String sql;
+            sql = "SELECT id, point_code, point_name FROM environment_list;";
+            ResultSet rs = stmt.executeQuery(sql);
+
+            // 展开结果集数据库
+            while(rs.next()){
+                // 通过字段检索
+                int id  = rs.getInt("id");
+                String code = rs.getString("point_code");
+                String name = rs.getString("point_name");
+
+                // 输出数据
+                System.out.print("ID: " + id);
+                System.out.print(",名称: " + name);
+                System.out.print(",编号: " + code);
+                System.out.print("\n");
+            }
+            // 完成后关闭
+            rs.close();
+        }catch(SQLException se){
+            // 处理 JDBC 错误
+            se.printStackTrace();
+        }catch(Exception e){
+            // 处理 Class.forName 错误
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 根据code查找名字
+     * @param code
+     * @return
+     */
+    public String queryNameByCade(String code){
+        String name = null;
+        try{
+            String sql;
+            sql = "SELECT point_name FROM environment_list where point_code=\""+code+"\";";
+            ResultSet rs = stmt.executeQuery(sql);
+//            ResultSetMetaData data = rs.getMetaData();  // 获取字段名
+            if(rs.next())
+            {
+                name=rs.getString("point_name");
+                //System.out.print("名称: " + name+"\n");
+            }
+            // 完成后关闭
+            rs.close();
+        }catch(SQLException se){
+            // 处理 JDBC 错误
+            se.printStackTrace();
+        }catch(Exception e){
+            // 处理 Class.forName 错误
+            e.printStackTrace();
+        }
+        return name;
+    }
+
+    /**
+     * 按照ID插入时间信息
+     * @param id
+     * @param time
+     */
+    public void insertTimeListById(int id,  StringList time){
+
+    }
+
+    /**
+     * 根据id修改时间信息
+     * @param id
+     * @param time
+     */
+    public void updateTimeListById(int id,  StringList time){
+
+    }
+
+
+    /**
+     * 删除指定id的时间列表
+     * @param id
+     */
+    public void deleteTimeById(int id){
+
+    }
+
+    /**
+     *查询指定id的时间点
+     * @param id
+     * @return
+     */
+    public StringList queryTimeListById(int id){
+        StringList timeList = null;
+
+        return timeList;
+    }
+}

+ 145 - 0
src/TCPClient.java

@@ -0,0 +1,145 @@
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public abstract class TCPClient {
+
+    private String ip;
+    private int port;
+
+    private Socket mSocket;
+    private SocketAddress mSocketAddress;
+    private OutputStream mOutputStream;
+    private InputStream mInputStream;
+    private ReadThread mReadThread;
+    private boolean _isConnected = false;
+
+
+    public TCPClient(String ip, int port) {
+        this.ip = ip;
+        this.port = port;
+    }
+
+
+    public void connect() {
+        try {
+            this.mSocket = new Socket();
+            this.mSocket.setKeepAlive(true);
+            this.mSocketAddress = new InetSocketAddress(ip, port);
+            this.mSocket.connect( mSocketAddress, 3000);// 设置连接超时时间为3秒
+
+            this.mOutputStream = mSocket.getOutputStream();
+            this.mInputStream = mSocket.getInputStream();
+
+            this.mReadThread = new TCPClient.ReadThread();
+            this.mReadThread.start();
+            this._isConnected = true;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void close() {
+
+        if (this.mReadThread != null) {
+            this.mReadThread.interrupt();
+        }
+        if (this.mSocket != null) {
+            try {
+                this.mSocket.close();
+                this.mSocket = null;
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        this._isConnected = false;
+    }
+
+    public boolean isConnected() {
+        return this._isConnected;
+    }
+
+
+    public void send(byte[] bOutArray) {
+        try {
+            this.mOutputStream.write(bOutArray);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    protected abstract void onDataReceive(byte[] bytes, int size);
+
+    private class ReadThread extends Thread {
+        @Override
+        public void run() {
+            super.run();
+            while (!isInterrupted()) {
+                try {
+                    if (TCPClient.this.mInputStream == null) {
+                        return;
+                    }
+                    int available = TCPClient.this.mInputStream.available();
+                    if (available > 0) {
+                        byte[] buffer = new byte[available];
+                        int size = TCPClient.this.mInputStream.read(buffer);
+                        if (size > 0) {
+                            onDataReceive(buffer, size);
+                        }
+                    } else {
+                        Thread.sleep(50);
+                    }
+
+
+                } catch (Throwable e) {
+                    System.out.println(e.getMessage());
+                    return;
+                }
+            }
+        }
+    }
+}
+
+//// TCP 通信
+//        tcpClient = new TCPClient("192.168.0.110", 10000) {
+//@Override
+//protected void onDataReceive(byte[] bytes, int size) {
+////                String content = "TCPServer say :" + new String(bytes, 0, size);
+//        }
+//        };
+//        tcpClient.connect();//连接TCPServe
+//        if (tcpClient.isConnected()) {
+//        tcpClient.send(upLoadData(1,2,3,4,5,6));
+//        }
+    /**
+     * 封装成http
+     * @param temperature
+     * @param humidity
+     * @param negaticeO2Ion
+     * @param pm25
+     * @param pm10
+     * @param db
+     * @return
+     */
+//    private static byte[] upLoadData(float temperature, float humidity, float negaticeO2Ion, float pm25, float pm10, float db) {
+//        Date dNow = new Date( );
+//        SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");
+//        String dataStr = "{\"temperature\":"+String.format("%.1f",temperature)+",\"humidity\":"+String.format("%.1f",humidity)+",\"negaticeO2Ion\":"+String.format("%.1f",negaticeO2Ion)+",\"pm25\":"+String.format("%.1f",pm25)+",\"pm10\":"+String.format("%.1f",pm10)+",\"db\":"+String.format("%.1f",db)+",\"collect_time\":"+ft.format(dNow)+"}";
+//        //发送数据
+//        String upToHttpContent = "POST /api/environment/id/recordUpload HTTP/1.1\n" +
+//                "Content-Type: text/plain\n" +
+//                "User-Agent: PostmanRuntime/7.28.1\n" +
+//                "Accept: */*\n" +
+//                "Postman-Token: bb1e2ba7-673e-4917-b84a-705e85a94b6f\n" +
+//                "Host: "+HTTP_SERVER+"\n" +
+//                "Accept-Encoding: gzip, deflate, br\n" +
+//                "Connection: keep-alive\n" +
+//                "Content-Length: "+dataStr.length()+"\n" +
+//                "\n" +dataStr;
+//        return upToHttpContent.getBytes();
+//    }

+ 81 - 0
src/UDPServer.java

@@ -0,0 +1,81 @@
+import factoryProtocol.Packet;
+import factoryProtocol.Parser;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.SocketException;
+
+public abstract class UDPServer extends Thread {
+    private Thread thread;
+    private int PORT;
+    private DatagramSocket socket = null;
+    private boolean threadRunFlag = true;
+    private Parser parser = new Parser();
+
+    UDPServer(int port) {
+        PORT = port;
+    }
+
+    protected abstract void onDataReceive(Packet data);
+    public void run() {
+        while (threadRunFlag) {
+            // 创建数据包,用于接收客户端发送的数据
+            byte[] data = new byte[1024];// 创建字节数组,指定接收的数据包的大小
+            DatagramPacket datagramPacket = new DatagramPacket(data, data.length);
+            // 接收客户端发送的数据
+            try {
+                socket.receive(datagramPacket);// 此方法在接收到数据报之前会一直阻塞
+                // 从数据包里取出读取数据
+                byte[] buf = datagramPacket.getData();
+
+                Packet packet = null;
+                // 依次解析数据
+                for (int i=0;i<datagramPacket.getLength();i++)
+                {
+                    System.out.print(String.format("%x ",buf[i]));
+                    packet = parser.message_parse_char(buf[i]);
+                    if(packet != null){
+                        System.out.println("解析成功");
+                        onDataReceive(packet);
+                    }
+                }
+                System.out.print(String.format("\r\n"));
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
+    public void start() {
+        // 创建服务器端DatagramSocket,指定端口
+        try {
+            socket = new DatagramSocket(PORT);
+        } catch (SocketException e) {
+            e.printStackTrace();
+        }
+
+
+        if (thread == null) {
+            thread = new Thread(this);
+            thread.start();
+        }
+    }
+
+    public void sendData(InetAddress ip, int port, byte[] data) {
+        DatagramPacket packet = new DatagramPacket(data, data.length, ip, port);
+        try {
+            socket.send(packet);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    public void mstop() {
+        socket.close();
+        threadRunFlag = false;
+    }
+}

+ 48 - 0
src/chProtocol/Packet.java

@@ -0,0 +1,48 @@
+package chProtocol;
+
+import common.Payload;
+
+public class Packet {
+    public static final byte MESSAGE_STX = (byte) 0xFE;
+
+    public final int len;
+
+    public int type;
+
+    public Payload payload;
+
+    public int fcs;
+
+    public Packet(int payloadLength) {
+        len = payloadLength;
+        payload = new Payload(payloadLength);
+    }
+
+    public boolean payloadIsFilled() {
+        return payload.size() >= len;
+    }
+
+    public byte generateCRC() {
+        byte result =  (byte)type;
+        payload.resetIndex();
+        final int payloadSize = payload.size();
+        for (int i = 0; i < payloadSize; i++) {
+            result += payload.getByte();
+        }
+        fcs = result;
+        return result;
+    }
+
+    public void toBytes(byte[] bytes) {
+        bytes[0] = (byte) 0xfe;
+        bytes[1] = (byte) (len + 1);
+        bytes[2] = (byte) type;
+
+        payload.resetIndex();
+        final int payloadSize = payload.size();
+        for (int i = 0; i < payloadSize; i++) {
+            bytes[i + 3] = payload.getByte();
+        }
+        bytes[payloadSize + 3] = (byte) fcs;
+    }
+}

+ 49 - 0
src/chProtocol/Parser.java

@@ -0,0 +1,49 @@
+package chProtocol;
+
+public class Parser {
+    private static final int IDLE = 1;
+    private static final int STX = 2;
+    private static final int LEN = 3;
+    private static final int TYPE = 4;
+    private static final int DATA = 5;
+    private static final int FCS = 6;
+
+    private static boolean msg_received;
+
+    private Packet packet;
+
+    private int states = IDLE;
+
+    public Packet message_parse_char(byte b) {
+        msg_received = false;
+        switch (states + 1) {
+            case STX:
+                if (b == Packet.MESSAGE_STX) {
+                    states = STX;
+                }
+                break;
+            case LEN:
+                packet = new Packet(b - 1);
+                states = LEN;
+                break;
+            case TYPE:
+                packet.type = b;
+                states = TYPE;
+                break;
+            case DATA:
+                packet.payload.add(b);
+                if (packet.payloadIsFilled()) {
+                    states = DATA;
+                }
+                break;
+            case FCS:
+                if (b == packet.generateCRC()) {
+                    msg_received = true;
+                } else {
+                    states = b == Packet.MESSAGE_STX ? STX : IDLE;
+                }
+                break;
+        }
+        return msg_received ? packet : null;
+    }
+}

+ 198 - 0
src/common/Payload.java

@@ -0,0 +1,198 @@
+package common;
+
+import java.nio.ByteBuffer;
+
+public class Payload {
+
+    private static final byte UNSIGNED_BYTE_MIN_VALUE = 0;
+    private static final short UNSIGNED_BYTE_MAX_VALUE = Byte.MAX_VALUE - Byte.MIN_VALUE;
+
+    private static final short UNSIGNED_SHORT_MIN_VALUE = 0;
+    private static final int UNSIGNED_SHORT_MAX_VALUE = Short.MAX_VALUE - Short.MIN_VALUE;
+
+    private static final int UNSIGNED_INT_MIN_VALUE = 0;
+    private static final long UNSIGNED_INT_MAX_VALUE = (long) Integer.MAX_VALUE - Integer.MIN_VALUE;
+
+    private static final long UNSIGNED_LONG_MIN_VALUE = 0;
+
+    public static final int MAX_PAYLOAD_SIZE = 255;
+
+    public final ByteBuffer payload;
+
+    public int index;
+
+    public Payload(int payloadSize) {
+        if (payloadSize > MAX_PAYLOAD_SIZE) {
+            payload = ByteBuffer.allocate(MAX_PAYLOAD_SIZE);
+        } else {
+            payload = ByteBuffer.allocate(payloadSize);
+        }
+    }
+
+    public ByteBuffer getData() {
+        return payload;
+    }
+
+    public int size() {
+        return payload.position();
+    }
+
+    public void add(byte c) {
+        payload.put(c);
+    }
+
+    public void resetIndex() {
+        index = 0;
+        payload.clear();
+    }
+
+    public byte getByte() {
+        byte result = 0;
+        result |= (payload.get(index + 0) & 0xFF);
+        index += 1;
+        return result;
+    }
+
+    public short getUnsignedByte() {
+        short result = 0;
+        result |= payload.get(index + 0) & 0xFF;
+        index += 1;
+        return result;
+    }
+
+    public short getShort() {
+        short result = 0;
+        result |= (payload.get(index + 1) & 0xFF) << 8;
+        result |= (payload.get(index + 0) & 0xFF);
+        index += 2;
+        return result;
+    }
+
+    public int getUnsignedShort() {
+        int result = 0;
+        result |= (payload.get(index + 1) & 0xFF) << 8;
+        result |= (payload.get(index + 0) & 0xFF);
+        index += 2;
+        return result;
+    }
+
+    public int getInt() {
+        int result = 0;
+        result |= (payload.get(index + 3) & 0xFF) << 24;
+        result |= (payload.get(index + 2) & 0xFF) << 16;
+        result |= (payload.get(index + 1) & 0xFF) << 8;
+        result |= (payload.get(index + 0) & 0xFF);
+        index += 4;
+        return result;
+    }
+
+    public long getUnsignedInt() {
+        long result = 0;
+        result |= (payload.get(index + 3) & 0xFFL) << 24;
+        result |= (payload.get(index + 2) & 0xFFL) << 16;
+        result |= (payload.get(index + 1) & 0xFFL) << 8;
+        result |= (payload.get(index + 0) & 0xFFL);
+        index += 4;
+        return result;
+    }
+
+    public long getLong() {
+        long result = 0;
+        result |= (payload.get(index + 7) & 0xFFL) << 56;
+        result |= (payload.get(index + 6) & 0xFFL) << 48;
+        result |= (payload.get(index + 5) & 0xFFL) << 40;
+        result |= (payload.get(index + 4) & 0xFFL) << 32;
+        result |= (payload.get(index + 3) & 0xFFL) << 24;
+        result |= (payload.get(index + 2) & 0xFFL) << 16;
+        result |= (payload.get(index + 1) & 0xFFL) << 8;
+        result |= (payload.get(index + 0) & 0xFFL);
+        index += 8;
+        return result;
+    }
+
+    public long getUnsignedLong() {
+        return getLong();
+    }
+
+    public long getLongReverse() {
+        long result = 0;
+        result |= (payload.get(index + 0) & 0xFFL) << 56;
+        result |= (payload.get(index + 1) & 0xFFL) << 48;
+        result |= (payload.get(index + 2) & 0xFFL) << 40;
+        result |= (payload.get(index + 3) & 0xFFL) << 32;
+        result |= (payload.get(index + 4) & 0xFFL) << 24;
+        result |= (payload.get(index + 5) & 0xFFL) << 16;
+        result |= (payload.get(index + 6) & 0xFFL) << 8;
+        result |= (payload.get(index + 7) & 0xFFL);
+        index += 8;
+        return result;
+    }
+
+    public float getFloat() {
+        return Float.intBitsToFloat(getInt());
+    }
+
+    public void putByte(byte data) {
+        add(data);
+    }
+
+    public void putUnsignedByte(short data) {
+        if (data < UNSIGNED_BYTE_MIN_VALUE || data > UNSIGNED_BYTE_MAX_VALUE) {
+            throw new IllegalArgumentException("Value is outside of the range of an unsigned byte: " + data);
+        }
+
+        putByte((byte) data);
+    }
+
+    public void putShort(short data) {
+        add((byte) (data >> 0));
+        add((byte) (data >> 8));
+    }
+
+    public void putUnsignedShort(int data) {
+        if (data < UNSIGNED_SHORT_MIN_VALUE || data > UNSIGNED_SHORT_MAX_VALUE) {
+            throw new IllegalArgumentException("Value is outside of the range of an unsigned short: " + data);
+        }
+
+        putShort((short) data);
+    }
+
+    public void putInt(int data) {
+        add((byte) (data >> 0));
+        add((byte) (data >> 8));
+        add((byte) (data >> 16));
+        add((byte) (data >> 24));
+    }
+
+    public void putUnsignedInt(long data) {
+        if (data < UNSIGNED_INT_MIN_VALUE || data > UNSIGNED_INT_MAX_VALUE) {
+            throw new IllegalArgumentException("Value is outside of the range of an unsigned int: " + data);
+        }
+
+        putInt((int) data);
+    }
+
+    public void putLong(long data) {
+        add((byte) (data >> 0));
+        add((byte) (data >> 8));
+        add((byte) (data >> 16));
+        add((byte) (data >> 24));
+        add((byte) (data >> 32));
+        add((byte) (data >> 40));
+        add((byte) (data >> 48));
+        add((byte) (data >> 56));
+    }
+
+    public void putUnsignedLong(long data) {
+        if (data < UNSIGNED_LONG_MIN_VALUE) {
+            throw new IllegalArgumentException("Value is outside of the range of an unsigned long: " + data);
+        }
+
+        putLong(data);
+    }
+
+    public void putFloat(float data) {
+        putInt(Float.floatToIntBits(data));
+    }
+
+}

+ 34 - 0
src/entity/EnvironmentList.java

@@ -0,0 +1,34 @@
+package entity;
+
+
+public class EnvironmentList{
+
+	private String id;
+
+	private String pointCode;
+	private String pointName;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getPointCode() {
+		return pointCode;
+	}
+
+	public void setPointCode(String pointCode) {
+		this.pointCode = pointCode;
+	}
+
+	public String getPointName() {
+		return pointName;
+	}
+
+	public void setPointName(String pointName) {
+		this.pointName = pointName;
+	}
+}

+ 30 - 0
src/factoryProtocol/Packet.java

@@ -0,0 +1,30 @@
+package factoryProtocol;
+
+import common.Payload;
+
+public class Packet {
+    public static final byte STX1 = (byte) 0xFE;
+    public static final byte STX2 = (byte) 0xDC;
+    public  byte version;
+    public  byte[]  imei = new byte[6];
+    public int session;   // 4个字节长度
+    public byte  order = (byte) 0xA8;   // 固定
+    public int len = 0;   // 固定字节长度 24
+    public byte[]  versionFix = {0x00,0x01,0x00,0x01};  // 固定
+    public Payload payload = null;   // 每4个字节合并成一个,如果温度是23.1的话 在报文中的表现是 00 00 00 e7,为231/10.0f
+    public static final byte FCS = (byte) 0x00;  // 固定
+
+
+    public void setPayloadLen(int payloadLength) {
+        len = payloadLength;
+        payload = new Payload(payloadLength);
+    }
+
+    public void cleanPayload() {
+        payload.resetIndex();
+    }
+
+    public boolean payloadIsFilled() {
+        return payload.size() >= len;
+    }
+}

+ 101 - 0
src/factoryProtocol/Parser.java

@@ -0,0 +1,101 @@
+package factoryProtocol;
+
+
+public class Parser {
+    private static final int IDLE = 1;
+    private static final int STX1 = 2;       // 环境设备固定是1字节,固定0xFE
+    private static final int STX2 = 3;       // 环境设备固定是1字节,固定0xDC
+    private static final int VERSION1 = 4;   // 环境设备固定是1字节
+    private static final int IMEI = 5;       // 环境设备固定是6字节, 物联网卡的卡号
+    private static final int SESSION = 6;    // 环境设备固定是4字节, 累加的数字
+    private static final int ORDER = 7;      // 环境设备固定是1字节 {0xA8}
+    private static final int LEN = 8;  //    // 环境设备固定2字节
+    private static final int VERSION2 = 9;   // 环境设备固定是4字节  {0x00,0x01,0x00,0x01}
+    private static final int DATA = 10;      // 环境设备固定是24字节
+    private static final int FCS = 11;       // 环境设备固定是1字节 {0x00}
+
+    private static boolean msg_received;
+
+    private Packet packet = new Packet();
+
+    private int states = IDLE;
+    private int lenTemp = 0;  // 下一个字段字节数
+
+    public Packet message_parse_char(byte b) {
+        msg_received = false;
+        //System.out.println("状态:"+states);
+        switch (states + 1) {
+            case STX1:
+                if (b == Packet.STX1) {
+                    states = STX1;
+                }else{
+                    states = IDLE;
+                }
+                break;
+            case STX2:
+                if (b == Packet.STX2) {
+                    states = STX2;
+                }else{
+                    states = IDLE;
+                }
+                break;
+            case VERSION1:
+                packet.session = b;
+                states = VERSION1;
+                lenTemp = 6;
+                break;
+            case IMEI:
+                packet.imei[6-lenTemp] = b;
+                lenTemp--;
+                if(lenTemp==0){
+                    states = IMEI;
+                    lenTemp = 4;
+                    packet.session = 0;
+                }
+                break;
+            case SESSION:
+                packet.session = packet.session<<8 | b;
+                lenTemp--;
+                if(lenTemp==0){
+                    states = SESSION;
+                }
+                break;
+            case ORDER:
+                packet.order = b;
+                states = ORDER;
+                lenTemp = 2;
+                packet.len = 0;
+                break;
+            case LEN:
+                packet.len = packet.len<<8 | b;
+                lenTemp--;
+                if(lenTemp==0){
+                    states = LEN;
+                    lenTemp = 4;
+                    packet.setPayloadLen(packet.len);
+                }
+                break;
+            case VERSION2:
+                packet.versionFix[4-lenTemp] = b;
+                lenTemp--;
+                if(lenTemp==0){
+                    states = VERSION2;
+                    packet.cleanPayload();
+                }
+                break;
+            case DATA:
+                packet.payload.add(b);
+                if (packet.payload.size()>=packet.len) {
+                    states = DATA;
+                }
+                break;
+            case FCS:
+                if (b == packet.FCS) {
+                    msg_received = true;
+                }
+                states = IDLE;
+                break;
+        }
+        return msg_received ? packet : null;
+    }
+}