‘提交’

This commit is contained in:
zhangjinbang 2024-01-02 15:22:37 +08:00
parent 28e36cb4d2
commit e7a0c523ef
92 changed files with 1937 additions and 1 deletions

8
iot-energy/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View 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="iot-energy" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="iot-energy" options="-parameters" />
</option>
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
</remote-repository>
</component>
</project>

14
iot-energy/.idea/misc.xml Normal file
View 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_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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
iot-energy/.idea/vcs.xml Normal file
View 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>

View File

@ -0,0 +1,32 @@
spring.application.name=netty
server.servlet.encoding.force=true
server.port=7781
lombok.var.flagUsage = ALLOW
# Single file max size
multipart.maxFileSize=50Mb
# All files max size
multipart.maxRequestSize=50Mb
spring.datasource.dynamic.datasource.primary=primary
spring.datasource.dynamic.datasource.primary.url=jdbc:mysql://10.16.56.3:3308/jcxt?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.dynamic.datasource.primary.username=root
spring.datasource.dynamic.datasource.primary.password=Unity3du#d112233
spring.datasource.dynamic.datasource.primary.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.dynamic.druid.initial-size=10
spring.datasource.dynamic.druid.max-idle=20
spring.datasource.dynamic.druid.min-idle=5
spring.datasource.dynamic.druid.max-active=50
spring.datasource.dynamic.druid.log-abandoned=true
spring.datasource.dynamic.druid.remove-abandoned=true
spring.datasource.dynamic.druid.remove-abandoned-timeout-millis=120
spring.datasource.dynamic.druid.max-wait=1000
spring.datasource.dynamic.druid.test-while-idle=true
spring.datasource.dynamic.druid.validation-query=select 1 from dual
spring.datasource.dynamic.druid.test-on-borrow=true
spring.datasource.dynamic.druid.min-evictable-idle-time-millis=100000
spring.datasource.dynamic.druid.max-evictable-idle-time-millis=100000
spring.datasource.dynamic.druid.time-between-eviction-runs-millis=100000
spring.datasource.dynamic.druid.break-after-acquire-failure=true
spring.datasource.dynamic.druid.connection-error-retry-attempts=5
spring.datasource.dynamic.druid.fail-fast=true
spring.datasource.dynamic.druid.time-between-connect-error-millis=10000

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
#Created by Apache Maven 3.9.5
groupId=org.example
artifactId=iot-energy
version=1.0-SNAPSHOT

View File

@ -0,0 +1,19 @@
org\example\background\condition\EnergyDataCondition.class
org\example\background\utils\FieldUtils.class
org\example\utils\MyDecoder.class
org\example\utils\MyEncoder.class
org\example\utils\CommonConfig.class
org\example\utils\IdService.class
org\example\druid\DynamicDataSource.class
org\example\socket\BootNettySocketChannelInboundHandler.class
org\example\socket\BootNettySocketServerThread.class
org\example\druid\DbContextHolder.class
org\example\socket\BootNettySocketServer$1.class
org\example\druid\DBTypeEnum.class
org\example\utils\SnowflakeIdGenerator.class
org\example\IotApplication.class
org\example\background\service\MakeInfoService.class
org\example\socket\BootNettySocketServer.class
org\example\druid\DruidProperties.class
org\example\background\entity\EnergyDataEntity.class
org\example\background\dao\EnergyDataDao.class

View File

@ -0,0 +1,18 @@
D:\LGZN-p\iot-energy\src\main\java\org\example\utils\IdService.java
D:\LGZN-p\iot-energy\src\main\java\org\example\background\service\MakeInfoService.java
D:\LGZN-p\iot-energy\src\main\java\org\example\IotApplication.java
D:\LGZN-p\iot-energy\src\main\java\org\example\utils\CommonConfig.java
D:\LGZN-p\iot-energy\src\main\java\org\example\socket\BootNettySocketChannelInboundHandler.java
D:\LGZN-p\iot-energy\src\main\java\org\example\utils\SnowflakeIdGenerator.java
D:\LGZN-p\iot-energy\src\main\java\org\example\utils\MyEncoder.java
D:\LGZN-p\iot-energy\src\main\java\org\example\background\condition\EnergyDataCondition.java
D:\LGZN-p\iot-energy\src\main\java\org\example\druid\DbContextHolder.java
D:\LGZN-p\iot-energy\src\main\java\org\example\druid\DruidProperties.java
D:\LGZN-p\iot-energy\src\main\java\org\example\socket\BootNettySocketServer.java
D:\LGZN-p\iot-energy\src\main\java\org\example\utils\MyDecoder.java
D:\LGZN-p\iot-energy\src\main\java\org\example\socket\BootNettySocketServerThread.java
D:\LGZN-p\iot-energy\src\main\java\org\example\background\entity\EnergyDataEntity.java
D:\LGZN-p\iot-energy\src\main\java\org\example\druid\DBTypeEnum.java
D:\LGZN-p\iot-energy\src\main\java\org\example\druid\DynamicDataSource.java
D:\LGZN-p\iot-energy\src\main\java\org\example\background\dao\EnergyDataDao.java
D:\LGZN-p\iot-energy\src\main\java\org\example\background\utils\FieldUtils.java

8
iot-zhengtai/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View 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="iot-zhengtai" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="iot-zhengtai" options="-parameters" />
</option>
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
</remote-repository>
</component>
</project>

View 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_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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>

View 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>

113
iot-zhengtai/pom.xml Normal file
View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath />
</parent>
<groupId>org.example</groupId>
<artifactId>iot-zhengtai</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.6.Final</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.70</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>com.ghgande</groupId>
<artifactId>j2mod</artifactId>
<version>2.5.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 打包成一个可执行jar -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,30 @@
package org.example;
import org.example.socket.BootNettySocketServerThread;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@MapperScan({"org.example.background.dao"})
@EnableScheduling //允许自动调用
public class IotApplication implements CommandLineRunner {
@Autowired
private BootNettySocketServerThread socketServerThread;
public static void main(String[] args) {
SpringApplication app = new SpringApplication(IotApplication.class);
app.run(args);
}
@Override
public void run(String... args) throws Exception {
socketServerThread.start();
}
}

View File

@ -0,0 +1,36 @@
package org.example.background.condition;
import org.apache.ibatis.jdbc.SQL;
import org.example.background.entity.ElectricityData;
import org.example.socket.utils.FieldUtils;
import org.springframework.cglib.beans.BeanMap;
public class ElectricityDataCondition {
public String insert(ElectricityData data){
SQL sql = new SQL();
sql.INSERT_INTO("electricity_data");
BeanMap beanMap = BeanMap.create(data);
for (Object key : beanMap.keySet()) {
Object val = beanMap.get(key);
if (val != null) {
sql.VALUES(FieldUtils.camelToLines(key + ""), "#{" + key + "}");
}
}
return sql.toString();
}
public String updateByPrimaryKey(ElectricityData data) {
SQL sql = new SQL();
sql.UPDATE("electricity_data");
BeanMap beanMap = BeanMap.create(data);
for (Object key : beanMap.keySet()) {
Object val = beanMap.get(key);
if (val != null) {
sql.SET(FieldUtils.camelToLines(key + "") + "=#{" + key + "}");
}
}
sql.WHERE("electricity_id= #{electricityId}");
return sql.toString();
}
}

View File

@ -0,0 +1,19 @@
package org.example.background.dao;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.UpdateProvider;
import org.example.background.condition.ElectricityDataCondition;
import org.example.background.entity.ElectricityData;
public interface ElectricityDataDao {
@InsertProvider(type = ElectricityDataCondition.class, method = "insert")
Integer insert(ElectricityData data);
@Select("SELECT * FROM electricity_data WHERE zd_id = #{zdId} AND acquisition_time = #{acquisitionTime} ORDER BY create_time LIMIT 1")
ElectricityData select(ElectricityData data);
@UpdateProvider(type = ElectricityDataCondition.class, method = "updateByPrimaryKey")
Integer updateByPrimaryKey(ElectricityData data);
}

View File

@ -0,0 +1,109 @@
package org.example.background.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class ElectricityData implements Serializable {
//id
@TableId
private String electricityId;
//终端地址 (设备编号)
private String zdId;
//互感电流倍率
private Float taMultiplier;
//互感电压倍率
private Float tvMultiplier;
//A相电流
private Float aPhaseCurrent;
//B相电流
private Float bPhaseCurrent;
//c相电流
private Float cPhaseCurrent;
//A相电压
private Float aPhaseVoltage;
//B相电压
private Float bPhaseVoltage;
//c相电压
private Float cPhaseVoltage;
//AB相电压
private Float abPhaseVoltage;
//BC相电压
private Float bcPhaseVoltage;
//AC相电压
private Float acPhaseVoltage;
//功率因数
private Float powerFactor;
//总有功功率
private Float totalActivePower;
//总无功功率
private Float totalReactivePower;
//视在功率
private Float apparentPower;
//频率
private Float frequency;
//正向有功电量
private Float positiveActiveCharge;
//反向有功电量
private Float reverseActiveCharge;
//正向有功尖电量
private Float positiveActiveTipCharge;
//正向有功峰电量
private Float forwardActivePeakCharge;
//正向有功平电量
private Float positiveActivePowerLevel;
//正向有功谷电量
private Float positiveActiveValleyCharge;
//反向有功尖电量
private Float reverseActiveTipCharge;
//反向有功峰电量
private Float reverseActivePeakCharge;
//反向有功平电量
private Float reverseActivePowerLevel;
//反向有功谷电量
private Float reverseActiveValleyCharge;
//@ApiModelProperty(value = "入库时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//@ApiModelProperty(value = "整点采集时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date acquisitionTime;
//@ApiModelProperty(value = "终端抄表时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date readTime;
}

View File

@ -0,0 +1,7 @@
package org.example.background.entity;
import lombok.Data;
@Data
public class ElectricityDayData {
}

View File

@ -0,0 +1,7 @@
package org.example.background.entity;
import lombok.Data;
@Data
public class ElectricityMonthData {
}

View File

@ -0,0 +1,217 @@
package org.example.background.service;
import com.ghgande.j2mod.modbus.util.ModbusUtil;
import org.example.background.dao.ElectricityDataDao;
import org.example.background.entity.ElectricityData;
import org.example.socket.utils.CommonConfig;
import org.example.socket.utils.IdService;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Component
public class MakeInfoService {
@Resource
private IdService idService;
@Resource
private ElectricityDataDao electricityDataDao;
@Resource
private CommonConfig config;
//F25信息类 电能表
public int[] sendElectricMessage(String ip, int fn) {
return config.sendElectricInstruct(ip, fn);
}
public String convertPlaintext(byte[] data) {
return ModbusUtil.toHex(data);
}
public Integer convertTextToData(String param, String clientIP) {
String[] data = param.split(" ");
return electric0(data, clientIP);
}
public Integer electric0(String[] data, String clientIp) {
Integer typeF = 0;
if(data.length > 12) {
switch (data[12]) {
case "0C":
switch (data[16] + data[17]) {
case "0103": //f25
electric0InStorage0C_25(data, clientIp);
typeF = 25;
break;
case "0110": //f129
electric0InStorage0C_129(data, clientIp);
typeF = 129;
break;
case "0410": //f131:
electric0InStorage0C_131(data, clientIp);
typeF = 131;
break;
}
break;
case "09":
switch (data[16] + data[17]) {
case "0100": //f1 查询终端配置信息
electric0InStorage09_01(data, clientIp);
typeF = 1;
break;
}
break;
}
}
return typeF;
}
public Integer electric0InStorage09_01(String[] data, String clientIp) {
ElectricityData entity = new ElectricityData();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
String s = hexToAscii(data[18] + data[19] + data[20] + data[21]);
String s1 = hexToAscii(data[22] + data[23] + data[24] + data[25] + data[26] + data[27] + data[28] + data[29]);
entity.setElectricityId(idService.gen());
try {
entity.setAcquisitionTime(formatter.parse(formatter.format(new Date())));
}catch (ParseException e) {
e.printStackTrace();
}
entity.setCreateTime(new Date());
return 1;
}
public Integer electric0InStorage0C_25(String[] data, String clientIp) {
ElectricityData entity = new ElectricityData();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
entity.setElectricityId(idService.gen());
entity.setZdId(String.valueOf(Integer.parseInt(data[9]+data[10],16)));
try {
entity.setAcquisitionTime(formatter.parse(formatter.format(new Date())));
}catch (ParseException e) {
e.printStackTrace();
}
entity.setCreateTime(new Date());
entity.setTotalActivePower(Float.parseFloat(data[25]+data[24] + data[23]) / 10000); //总有功功率
entity.setTotalReactivePower(Float.parseFloat(data[37] + data[36] + fixZhi(data[35])) / 10000); //总无功功率
entity.setPowerFactor(Float.parseFloat(data[48] + data[47]) / 10); //功率因数
entity.setAPhaseVoltage(Float.parseFloat(data[56] + data[55]) / 10); //A相电压
entity.setBPhaseVoltage(Float.parseFloat(data[58] + data[57]) / 10); //b相电压
entity.setCPhaseVoltage(Float.parseFloat(data[60] + data[59]) / 10); //c相电压
entity.setAPhaseCurrent(Float.parseFloat(data[63] + data[62] + data[61]) / 1000); //A相电流
entity.setBPhaseCurrent(Float.parseFloat(data[66] + data[65] + data[64]) / 1000); //B相电流
entity.setCPhaseCurrent(Float.parseFloat(data[69] + data[68] + data[67]) / 1000); //C相电流
entity.setAbPhaseVoltage((float)(entity.getAPhaseVoltage() * Math.sqrt(3))); //AB相电压
entity.setBcPhaseVoltage((float)(entity.getBPhaseVoltage() * Math.sqrt(3))); //BC相电压
entity.setAcPhaseVoltage((float)(entity.getCPhaseVoltage() * Math.sqrt(3))); //AC相电压
entity.setApparentPower(Float.parseFloat(data[75] + data[74] + data[73]) / 10000); //视在功率
entity.setFrequency(50f); //频率
entity.setTaMultiplier(20.0f);
entity.setTvMultiplier(1.0f);
Integer insert = electricityDataDao.insert(entity);
System.out.println("已入库");
return insert;
}
public Integer electric0InStorage0C_129(String [] data, String clientIp) {
ElectricityData entity = new ElectricityData();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
entity.setZdId(String.valueOf(Integer.parseInt(data[9]+data[10],16)));
try {
entity.setAcquisitionTime(formatter.parse(formatter.format(new Date())));
}catch (ParseException e) {
e.printStackTrace();
}
ElectricityData electricityData = electricityDataDao.select(entity);
Integer integer = 0;
if(StringUtils.isEmpty(electricityData)){
System.out.println("上一步数据没有载入,无法执行当前入库操作");
}else {
DateFormat sdf1 = new SimpleDateFormat("yyMMddHHmm");
try {
electricityData.setReadTime(sdf1.parse(data[22] + data[21] + data[20] + data[19] + data[18]));
}catch (ParseException e){
e.printStackTrace();
}
electricityData.setPositiveActiveCharge(Float.parseFloat(data[28] + data[27] + data[26] + data[25] + data[24]) / 10000); //正向有功总电能示值
electricityData.setPositiveActiveTipCharge(Float.parseFloat(data[33] + data[32] + data[31] + data[30] + data[29]) / 10000);//
electricityData.setForwardActivePeakCharge(Float.parseFloat(data[38] + data[37] + data[36] + data[35] + data[34]) / 10000);//
electricityData.setPositiveActivePowerLevel(Float.parseFloat(data[43] + data[42] + data[41] + data[40] + data[39]) / 10000); //
electricityData.setPositiveActiveValleyCharge(Float.parseFloat(data[48] + data[47] + data[46] + data[45] + data[44]) / 10000);//
integer = electricityDataDao.updateByPrimaryKey(electricityData);
System.out.println("已经填补剩余数据");
}
return integer;
}
public Integer electric0InStorage0C_131(String [] data, String clientIp) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
ElectricityData entity = new ElectricityData();
entity.setZdId(String.valueOf(Integer.parseInt(data[9]+data[10],16)));
try {
entity.setAcquisitionTime(formatter.parse(formatter.format(new Date())));
}catch (ParseException e) {
e.printStackTrace();
}
ElectricityData electricityData = electricityDataDao.select(entity);
Integer integer = 0;
if(StringUtils.isEmpty(electricityData)){
System.out.println("上一步数据没有载入,无法执行当前入库操作");
}else {
electricityData.setReverseActiveCharge(Float.parseFloat(data[28] + data[27] + data[26] + data[25] + data[24]) / 10000);//反向有功总电能示值
electricityData.setReverseActiveTipCharge(Float.parseFloat(data[33] + data[32] + data[31] + data[30] + data[29]) / 10000); //
electricityData.setReverseActivePeakCharge(Float.parseFloat(data[38] + data[37] + data[36] + data[35] + data[34]) / 10000);//
electricityData.setReverseActivePowerLevel(Float.parseFloat(data[43] + data[42] + data[41] + data[40] + data[39]) / 10000); //
electricityData.setReverseActiveValleyCharge(Float.parseFloat(data[48] + data[47] + data[46] + data[45] + data[44]) / 10000);//
integer = electricityDataDao.updateByPrimaryKey(electricityData);
System.out.println("已经填补剩余数据");
}
return integer;
}
public int[] detectingHeartbeat(String param, String clientIp) {
String[] data = param.split(" ");
int[] ints = new int[0];
if(data.length > 12) {
switch (data[12]) {
case "02":
switch (data[16] + data[17]) {
case "0100":
ints = config.sendElectricInstruct2(clientIp, 1);
break;
}
break;
}
}
return ints;
}
//16进制转ASCII编码
public static String hexToAscii(String hexString) {
StringBuilder asciiString = new StringBuilder();
for (int i = 0; i < hexString.length(); i += 2) {
String hexPair = hexString.substring(i, i + 2);
int charCode = Integer.parseInt(hexPair, 16);
asciiString.append((char) charCode);
}
return asciiString.toString();
}
public static String fixZhi(String data) {
int i = Integer.parseInt(data);
if(i%80 == 0){
return "00";
}else {
return data;
}
}
}

View File

@ -0,0 +1,25 @@
package org.example.druid;
public enum DBTypeEnum {
/**
* 主库
*/
MASTER("master"),
/**
* 从库
*/
SLAVE("slave");
private final String value;
DBTypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,33 @@
package org.example.druid;
public class DbContextHolder {
//使用ThreadLocal防止线程安全问题
private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal();
/**
* 设置数据源
*
* @param dbTypeEnum 数据库类型
*/
public static void setDbType(DBTypeEnum dbTypeEnum) {
CONTEXT_HOLDER.set(dbTypeEnum.getValue());
}
/**
* 取得当前数据源
*
* @return dbType
*/
public static String getDbType() {
return (String) CONTEXT_HOLDER.get();
}
/**
* 清除上下文数据
*/
public static void clearDbType() {
CONTEXT_HOLDER.remove();
}
}

View File

@ -0,0 +1,49 @@
package org.example.druid;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;
/**
* druid 配置属性
*/
@Configuration
public class DruidProperties
{
@Bean
@ConfigurationProperties("spring.datasource.dynamic.datasource.primary")
public DataSource primaryDataSource()
{
return DruidDataSourceBuilder.create().build();
}
// @Bean
// @ConfigurationProperties(prefix = "spring.datasource.slave")
// public DataSource slaveDataSource(){
// return new DruidDataSourceBuilder().build();
// }
@Bean
@Primary
public DataSource multipleDataSource(DataSource masterDataSource){
DynamicDataSource multipleDataSource = new DynamicDataSource();
Map<Object, Object> dataSources = new HashMap<>();
dataSources.put(DBTypeEnum.MASTER.getValue(), masterDataSource);
// dataSources.put(DBTypeEnum.SLAVE.getValue(), slaveDataSource);
multipleDataSource.setTargetDataSources(dataSources);
multipleDataSource.setDefaultTargetDataSource(masterDataSource);
return multipleDataSource;
}
}

View File

@ -0,0 +1,10 @@
package org.example.druid;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
public class DynamicDataSource extends AbstractRoutingDataSource {
@Override
protected Object determineCurrentLookupKey() {
return DbContextHolder.getDbType();
}
}

View File

@ -0,0 +1,197 @@
package org.example.socket;
import io.netty.channel.*;
import org.example.background.service.MakeInfoService;
import org.example.socket.utils.CommonConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author zjb
* @since 2023-12-11 10:31:26
*/
@Component
@EnableAsync
@ChannelHandler.Sharable
public class BootNettySocketChannelInboundHandler extends ChannelInboundHandlerAdapter {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
private MakeInfoService makeInfoService;
private Map<String, ChannelHandlerContext> ctxMap = new ConcurrentHashMap<String, ChannelHandlerContext>(16);
/**
* 从客户端收到新的数据时这个方法会在收到消息时被调用
*/
@Override
public void channelRead(ChannelHandlerContext ctx, Object frame) {
// int[] ints = makeInfoService.sendElectricMessage("10.29.16.202", 25);
String result = makeInfoService.convertPlaintext((byte[]) frame);
ChannelFuture channelFuture1;
if(result.equals("-1")){
logger.info("CLIENT:CRC校验错误收到的数据不完整或错误");
System.out.println("CS校验对错误或者长度不符合预定收到的数据不完整或错误");
}else {
logger.info("CLIENT"+getClientIP(ctx)+":"+result);
System.out.println("ip为"+getClientIP(ctx)+"的客户端发送:"+result);
int[] ints = makeInfoService.detectingHeartbeat(result, getClientIP(ctx));
if(ints.length > 0) {
//确认登录
channelFuture1 = ctx.channel().writeAndFlush(ints);
channelFuture1.addListener((ChannelFutureListener) future2 -> {
if (future2.isSuccess()) {
sendEnergyMessages(ints, getClientIP(ctx));
System.out.println("ip为" + getClientIP(ctx) + "确认登录成功");
} else {
System.out.println("ip为" + getClientIP(ctx) + "确认登录失败");
}
});
}else{
Integer res = makeInfoService.convertTextToData(result, getClientIP(ctx));
int[] data2;
switch (res) {
case 25:
//发送补充指令 发送第二条指令
data2 = makeInfoService.sendElectricMessage(getClientIP(ctx), 129);
channelFuture1 = ctx.channel().writeAndFlush(data2);
channelFuture1.addListener((ChannelFutureListener) future2 -> {
if (future2.isSuccess()) {
sendEnergyMessages(data2, getClientIP(ctx));
} else {
logger.info("SERVER:第二条指令发送失败");
System.out.println("ip为" + getClientIP(ctx) + "的第二条指令发送失败");
}
});
break;
case 129:
//发送补充指令 发送第二条指令
data2 = makeInfoService.sendElectricMessage(getClientIP(ctx), 131);
channelFuture1 = ctx.channel().writeAndFlush(data2);
channelFuture1.addListener((ChannelFutureListener) future2 -> {
if (future2.isSuccess()) {
sendEnergyMessages(data2, getClientIP(ctx));
} else {
logger.info("SERVER:第三条指令发送失败");
System.out.println("ip为" + getClientIP(ctx) + "的第三条指令发送失败");
}
});
break;
default:
break;
}
}
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
// 客户端断开连接的处理逻辑
System.out.println("客户端断开连接");
ctxMap.remove(getClientIP(ctx));
super.channelInactive(ctx);
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
System.out.println("客户端(重新)连接:" + ctx.channel().remoteAddress());
ctxMap.put(getClientIP(ctx),ctx);
super.channelActive(ctx);
}
/**
* 客户端与服务端 断连时执行 channelInactive方法之后执行
*/
@Override
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
ctxMap.remove(getClientIP(ctx));
super.channelUnregistered(ctx);
}
/**
* 当出现 Throwable 对象才会被调用即当 Netty 由于 IO 错误或者处理器在处理事件时抛出的异常时
*/
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
super.exceptionCaught(ctx, cause);
}
@Scheduled(cron = "0 0 */1 * * *") //每小时的第0分钟第0秒
// @Scheduled(fixedRate = 10000) //10秒
// @Scheduled(fixedRate = 600000) //600秒
// @Scheduled(cron = "*/5 * * * * *") //每5秒
private void sendIntervals() {
int[] data = makeInfoService.sendElectricMessage(CommonConfig.electric1, 25);
ChannelHandlerContext ctx = ctxMap.get(CommonConfig.electric1);
if(!StringUtils.isEmpty(ctx)) {
ChannelFuture channelFuture = ctx.channel().writeAndFlush(data);
// 添加监听器检查发送是否成功
channelFuture.addListener((ChannelFutureListener) future1 -> {
if(future1.isSuccess()) {
sendEnergyMessages(data,CommonConfig.electric1);
sendIntervals2();
}else{
logger.info("SERVER:第一条指令发送失败");
System.out.println("第一条指令发送失败");
}
});
}else{
logger.info("SERVER:ip为"+CommonConfig.electric2+"的客户端不在线。无法传递指令");
System.out.println("ip为"+CommonConfig.electric1+"的客户端不在线。无法传递指令");
}
}
// @Scheduled(cron = "0 0 */1 * * *") //每小时的第0分钟第0秒
// @Scheduled(cron = "*/5 * * * * *") //每5秒
// @Scheduled(fixedRate = 10000) //10秒
private void sendIntervals2() {
int[] data = makeInfoService.sendElectricMessage(CommonConfig.electric2, 25);
ChannelHandlerContext ctx = ctxMap.get(CommonConfig.electric2);
if(!StringUtils.isEmpty(ctx)) {
ChannelFuture channelFuture = ctx.channel().writeAndFlush(data);
// 添加监听器检查发送是否成功
channelFuture.addListener((ChannelFutureListener) future1 -> {
if(future1.isSuccess()) {
sendEnergyMessages(data,CommonConfig.electric2);
}else{
logger.info("SERVER:第一条指令发送失败");
System.out.println("第一条指令发送失败");
}
});
}else{
logger.info("SERVER:ip为"+CommonConfig.electric2+"的客户端不在线。无法传递指令");
System.out.println("ip为"+CommonConfig.electric2+"的客户端不在线。无法传递指令");
}
}
public void sendEnergyMessages(int [] data,String ip){
StringBuffer stringBuffer = new StringBuffer();
for(int num = 0; num < data.length; num++){
if (num == data.length - 1) {
stringBuffer.append(Integer.toHexString(data[num]));
}else {
stringBuffer.append(Integer.toHexString(data[num])+" ");
}
}
System.out.println("成功发送指令:"+stringBuffer);
logger.info("SERVER:成功发送指令:"+stringBuffer);
}
public String getClientIP(ChannelHandlerContext ctx){
String ip = ctx.channel().remoteAddress().toString();
return ip.substring(1, ip.indexOf(":"));
}
}

View File

@ -0,0 +1,78 @@
package org.example.socket;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LoggingHandler;
import org.example.socket.utils.MyDecoder;
import org.example.socket.utils.MyEncoder;
import org.mybatis.logging.Logger;
import org.mybatis.logging.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author zjb
* @since 2023-12-11 10:39:00
*/
@Component
public class BootNettySocketServer {
private static final Logger logger = LoggerFactory.getLogger(BootNettySocketServer.class);
private NioEventLoopGroup bossGroup;
private NioEventLoopGroup workGroup;
@Autowired
private BootNettySocketChannelInboundHandler bootNettySocketChannelInboundHandler;
/**
* 启动服务
*/
public void startup(int port) {
try {
bossGroup = new NioEventLoopGroup(1);
workGroup = new NioEventLoopGroup();
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.group(bossGroup, workGroup);
bootstrap.channel(NioServerSocketChannel.class);
bootstrap.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, 1024)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.SO_RCVBUF, 10485760);
bootstrap.childOption(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.SO_KEEPALIVE, true)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
bootstrap.childHandler(new ChannelInitializer<SocketChannel>() {
protected void initChannel(SocketChannel ch) {
ChannelPipeline channelPipeline = ch.pipeline();
channelPipeline.addLast("encoder", new MyEncoder());
channelPipeline.addLast("decoder", new MyDecoder());
channelPipeline.addLast(new LoggingHandler());
channelPipeline.addLast(bootNettySocketChannelInboundHandler);
}
});
ChannelFuture f = bootstrap.bind(port).sync();
if(f.isSuccess()){
System.out.println("成功侦听端口:" + port);
f.channel().closeFuture().sync();
} else {
System.out.println("侦听端口失败:" + port);
}
} catch (Exception e) {
System.out.println("start exception"+e.toString());
}
}
}

View File

@ -0,0 +1,21 @@
package org.example.socket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author zjb
* @since 2023-12-11 10:35:00
*/
@Component
public class BootNettySocketServerThread extends Thread {
private final int port = 7779;
@Autowired
private BootNettySocketServer bootNettySocketServer;
public void run() {
bootNettySocketServer.startup(this.port);
}
}

View File

@ -0,0 +1,117 @@
package org.example.socket.utils;
import org.springframework.stereotype.Component;
@Component
public class CommonConfig {
public static final String electric0 = "127.0.0.1";
public static final String electric1 = "10.29.16.202";
public static final String electric2 = "10.29.16.244";
public int [] sendElectricInstruct (String ip,int fn) {
int [] arr = new int[20];
arr[0] = 0x68;
arr[1] = 0x00;
arr[2] = 0x00;
arr[3] = 0x00;
arr[4] = 0x00;
arr[5] = 0x68;
arr[6] = 0x4B;
arr[7] = 0x22; // 地址域
arr[8] = 0x20;
arr[9] = 0xFE;
arr[10] = 0x52;
arr[11] = 0x00;
arr[12] = 0x0C;
arr[13] = 0x70;
arr[14] = 0xFF; // Pn
arr[15] = 0x00;
arr[16] = 0x00; //Fn
arr[17] = 0x00;
arr[18] = 0x00;
arr[19] = 0x16;
getAddress(arr,ip,fn);
getCSAndLength(arr);
return arr;
}
public int [] sendElectricInstruct2 (String ip,int fn) {
int [] arr = new int[20];
arr[0] = 0x68;
arr[1] = 0x00;
arr[2] = 0x00;
arr[3] = 0x00;
arr[4] = 0x00;
arr[5] = 0x68;
arr[6] = 0x4B;
arr[7] = 0x22; // 地址域
arr[8] = 0x20;
arr[9] = 0xFE;
arr[10] = 0x52;
arr[11] = 0x00;
arr[12] = 0x00;
arr[13] = 0x70;
arr[14] = 0x00; // Pn
arr[15] = 0x00;
arr[16] = 0x01; //Fn
arr[17] = 0x00;
arr[18] = 0x00;
arr[19] = 0x16;
getAddress(arr,ip,fn);
getCSAndLength(arr);
return arr;
}
public void getAddress (int [] arr,String ip,int fn) {
switch (ip) {
case electric1:
arr[7] = 0x22;
arr[8] = 0x20;
arr[9] = 0xFE;
arr[10] = 0x52;
arr[11] = 0x00;
break;
case electric2:
arr[7] = 0x22;
arr[8] = 0x20;
arr[9] = 0xFD;
arr[10] = 0x52;
arr[11] = 0x00;
break;
}
arr[16] = get8421(fn - (fn / 8) * 8);
arr[17] = fn / 8;
}
public int get8421(int DT1) {
int dt = 00;
switch (DT1) {
case 1 : dt = 0x01; break;
case 2 : dt = 0x02; break;
case 3 : dt = 0x04; break;
case 4 : dt = 0x08; break;
case 5 : dt = 0x10; break;
case 6 : dt = 0x20; break;
case 7 : dt = 0x40; break;
case 8 : dt = 0x80; break;
}
return dt;
}
public void getCSAndLength (int [] arr) {
arr[1] =Integer.parseInt(Integer.toHexString(Integer.parseInt(Integer.toBinaryString(arr.length - 8) + "10", 2)),16);
arr[3] = arr[1];
for (int i = 6; i < arr.length - 2; i++) {
arr[arr.length - 2] += arr[i];
}
if(arr[arr.length - 2] > 255) {
String s = Integer.toHexString(arr[arr.length - 2]);
arr[arr.length - 2] = Integer.parseInt(s.substring(s.length() - 2,s.length()),16);
}
}
}

View File

@ -1,4 +1,4 @@
package org.example.background.utils;
package org.example.socket.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@ -0,0 +1,16 @@
package org.example.socket.utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class IdService {
@Autowired
private SnowflakeIdGenerator generator;
public String gen() {
return String.valueOf(generator.nextId());
}
}

View File

@ -0,0 +1,47 @@
package org.example.socket.utils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.List;
/**
* @author ZJB
* @since 2023-12-11 10:50:00
*/
public class MyDecoder extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
byte[] b = new byte[buffer.readableBytes()];
buffer.readBytes(b);
out.add(b);
}
public String bytesToHexString(byte[] bArray) {
StringBuffer sb = new StringBuffer(bArray.length);
String sTemp;
for (int i = 0; i < bArray.length; i++) {
sTemp = Integer.toHexString(0xFF & bArray[i]);
if (sTemp.length() < 2)
sb.append(0);
if(i < bArray.length - 1){
sb.append(sTemp.toUpperCase()).append(" ");
}else{
sb.append(sTemp.toUpperCase());
}
}
return sb.toString();
}
public static String toHexString1(byte b) {
String s = Integer.toHexString(b & 0xFF);
if (s.length() == 1) {
return "0" + s;
} else {
return s;
}
}
}

View File

@ -0,0 +1,44 @@
package org.example.socket.utils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
/**
* @author zjb
* @since 2023-12-11 10:49:32
*/
public class MyEncoder extends ChannelOutboundHandlerAdapter {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
// 对消息进行编码
ByteBuf encodedMsg = encode2(msg);
// 将编码后的消息发送到下一个 ChannelHandler
ctx.write(encodedMsg, promise);
}
// 自定义的编码方法
private ByteBuf encode(Object msg) throws DecoderException {
// 实现编码逻辑
ByteBuf buf = Unpooled.buffer();
buf.writeBytes(Hex.decodeHex(msg.toString().replaceAll(" ", "").toCharArray()));
return buf;
}
//编码 十进制数组编码
private ByteBuf encode2(Object msg) throws DecoderException {
// 创建一个新的ByteBuf对象
ByteBuf byteBuf = Unpooled.buffer();
// 遍历数组并写入到ByteBuf中
for (int i : (int [])msg) {
byteBuf.writeByte(i);
}
return byteBuf;
}
}

View File

@ -0,0 +1,131 @@
package org.example.socket.utils;
import org.springframework.stereotype.Component;
@Component
public class SnowflakeIdGenerator {
// ==============================Fields===========================================
/**
* 开始时间截 (2015-01-01)
*/
private final long twepoch = 1420041600000L;
/**
* 机器id所占的位数
*/
private final long workerIdBits = 5L;
/**
* 数据标识id所占的位数
*/
private final long datacenterIdBits = 5L;
/**
* 支持的最大机器id结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数)
*/
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
/**
* 支持的最大数据标识id结果是31
*/
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
/**
* 序列在id中占的位数
*/
private final long sequenceBits = 12L;
/**
* 机器ID向左移12位
*/
private final long workerIdShift = sequenceBits;
/**
* 数据标识id向左移17位(12+5)
*/
private final long datacenterIdShift = sequenceBits + workerIdBits;
/**
* 时间截向左移22位(5+5+12)
*/
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
/**
* 生成序列的掩码这里为4095 (0b111111111111=0xfff=4095)
*/
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
/**
* 工作机器ID(0~31)
*/
private long workerId;
/**
* 数据中心ID(0~31)
*/
private long datacenterId;
/**
* 毫秒内序列(0~4095)
*/
private long sequence = 0L;
/**
* 上次生成ID的时间截
*/
private long lastTimestamp = -1L;
//==============================Constructors=====================================
/**
* 构造函数 * @param workerId 工作ID (0~31) * @param datacenterId 数据中心ID (0~31)
*/
public SnowflakeIdGenerator(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
} // ==============================Methods==========================================
public SnowflakeIdGenerator() {
}
/**
* 获得下一个ID (该方法是线程安全的) * @return SnowflakeId
*/
public synchronized long nextId() {
long timestamp = timeGen();
//如果当前时间小于上一次ID生成的时间戳说明系统时钟回退过这个时候应当抛出异常
// if (timestamp < lastTimestamp) {
// throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
// }
//如果是同一时间生成的则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
}
//时间戳改变毫秒内序列重置
else {
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
return ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift) | (workerId << workerIdShift) | sequence;
}
/**
* 阻塞到下一个毫秒直到获得新的时间戳 * @param lastTimestamp 上次生成ID的时间截 * @return 当前时间戳
*/
protected long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
* 返回以毫秒为单位的当前时间 * @return 当前时间(毫秒)
*/
protected long timeGen() {
return System.currentTimeMillis();
}
}

View File

@ -0,0 +1,32 @@
spring.application.name=netty
server.servlet.encoding.force=true
server.port=7782
lombok.var.flagUsage = ALLOW
# Single file max size
multipart.maxFileSize=50Mb
# All files max size
multipart.maxRequestSize=50Mb
spring.datasource.dynamic.datasource.primary=primary
spring.datasource.dynamic.datasource.primary.url=jdbc:mysql://10.16.56.3:3308/jcxt?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.dynamic.datasource.primary.username=root
spring.datasource.dynamic.datasource.primary.password=Unity3du#d112233
spring.datasource.dynamic.datasource.primary.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.dynamic.druid.initial-size=10
spring.datasource.dynamic.druid.max-idle=20
spring.datasource.dynamic.druid.min-idle=5
spring.datasource.dynamic.druid.max-active=50
spring.datasource.dynamic.druid.log-abandoned=true
spring.datasource.dynamic.druid.remove-abandoned=true
spring.datasource.dynamic.druid.remove-abandoned-timeout-millis=120
spring.datasource.dynamic.druid.max-wait=1000
spring.datasource.dynamic.druid.test-while-idle=true
spring.datasource.dynamic.druid.validation-query=select 1 from dual
spring.datasource.dynamic.druid.test-on-borrow=true
spring.datasource.dynamic.druid.min-evictable-idle-time-millis=100000
spring.datasource.dynamic.druid.max-evictable-idle-time-millis=100000
spring.datasource.dynamic.druid.time-between-eviction-runs-millis=100000
spring.datasource.dynamic.druid.break-after-acquire-failure=true
spring.datasource.dynamic.druid.connection-error-retry-attempts=5
spring.datasource.dynamic.druid.fail-fast=true
spring.datasource.dynamic.druid.time-between-connect-error-millis=10000

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>electricLog/electricLog.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>electricLog/electricLog-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>180</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.example" level="DEBUG" additivity="false">
<appender-ref ref="FILE" />
</logger>
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>

View File

@ -0,0 +1,32 @@
spring.application.name=netty
server.servlet.encoding.force=true
server.port=7782
lombok.var.flagUsage = ALLOW
# Single file max size
multipart.maxFileSize=50Mb
# All files max size
multipart.maxRequestSize=50Mb
spring.datasource.dynamic.datasource.primary=primary
spring.datasource.dynamic.datasource.primary.url=jdbc:mysql://10.16.56.3:3308/jcxt?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.dynamic.datasource.primary.username=root
spring.datasource.dynamic.datasource.primary.password=Unity3du#d112233
spring.datasource.dynamic.datasource.primary.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.dynamic.druid.initial-size=10
spring.datasource.dynamic.druid.max-idle=20
spring.datasource.dynamic.druid.min-idle=5
spring.datasource.dynamic.druid.max-active=50
spring.datasource.dynamic.druid.log-abandoned=true
spring.datasource.dynamic.druid.remove-abandoned=true
spring.datasource.dynamic.druid.remove-abandoned-timeout-millis=120
spring.datasource.dynamic.druid.max-wait=1000
spring.datasource.dynamic.druid.test-while-idle=true
spring.datasource.dynamic.druid.validation-query=select 1 from dual
spring.datasource.dynamic.druid.test-on-borrow=true
spring.datasource.dynamic.druid.min-evictable-idle-time-millis=100000
spring.datasource.dynamic.druid.max-evictable-idle-time-millis=100000
spring.datasource.dynamic.druid.time-between-eviction-runs-millis=100000
spring.datasource.dynamic.druid.break-after-acquire-failure=true
spring.datasource.dynamic.druid.connection-error-retry-attempts=5
spring.datasource.dynamic.druid.fail-fast=true
spring.datasource.dynamic.druid.time-between-connect-error-millis=10000

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>electricLog/electricLog.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>electricLog/electricLog-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>180</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.example" level="DEBUG" additivity="false">
<appender-ref ref="FILE" />
</logger>
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>

Binary file not shown.

View File

@ -0,0 +1,4 @@
#Created by Apache Maven 3.9.5
groupId=org.example
artifactId=iot-zhengtai
version=1.0-SNAPSHOT

View File

@ -0,0 +1,21 @@
org\example\background\entity\ElectricityData.class
org\example\socket\utils\SnowflakeIdGenerator.class
org\example\background\condition\ElectricityDataCondition.class
org\example\socket\utils\CommonConfig.class
org\example\socket\utils\MyDecoder.class
org\example\background\entity\ElectricityDayData.class
org\example\druid\DynamicDataSource.class
org\example\socket\utils\IdService.class
org\example\socket\BootNettySocketChannelInboundHandler.class
org\example\socket\utils\MyEncoder.class
org\example\socket\BootNettySocketServerThread.class
org\example\druid\DbContextHolder.class
org\example\socket\BootNettySocketServer$1.class
org\example\druid\DBTypeEnum.class
org\example\IotApplication.class
org\example\background\service\MakeInfoService.class
org\example\socket\BootNettySocketServer.class
org\example\socket\utils\FieldUtils.class
org\example\druid\DruidProperties.class
org\example\background\dao\ElectricityDataDao.class
org\example\background\entity\ElectricityMonthData.class

View File

@ -0,0 +1,20 @@
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\BootNettySocketServerThread.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\utils\MyDecoder.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\BootNettySocketServer.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\utils\CommonConfig.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\utils\IdService.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\IotApplication.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\utils\SnowflakeIdGenerator.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\utils\MyEncoder.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\background\condition\ElectricityDataCondition.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\background\entity\ElectricityMonthData.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\utils\FieldUtils.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\druid\DBTypeEnum.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\background\entity\ElectricityData.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\background\entity\ElectricityDayData.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\druid\DbContextHolder.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\druid\DruidProperties.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\background\service\MakeInfoService.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\druid\DynamicDataSource.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\socket\BootNettySocketChannelInboundHandler.java
D:\LGZN-p\iot-zhengtai\src\main\java\org\example\background\dao\ElectricityDataDao.java