jiazx0107@163.com
2023-11-09 eebab358e2882fc7e3aeec152db5151a6bd0be02
重新调整测试页面
已删除2个文件
已修改8个文件
已添加5个文件
2339 ■■■■ 文件已修改
.rules 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/Application.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/entity/GateWayTestParam.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/hx2023/ScConstant.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/hx2023/controller/GatewayDeviceTestController.java 445 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/service/DeviceWeightServiceTest.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java 363 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/service/GatewayDeviceService2.java 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java 407 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/view/GatewayDevice-bak.view.xml 550 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/view/GatewayDevice.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
velocity.log 补丁 | 查看 | 原始文档 | blame | 历史
.rules
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<RuleSet version="1.1"><PackageInfos>
<PackageInfo name="dorado-core" version="7.6.0-SNAPSHOT.180516.1527"/>
<PackageInfo name="dorado-core" version="7.6.0.181212.1654"/>
<PackageInfo name="dorado-uploader" version="1.0.20-SNAPSHOT"/>
<PackageInfo name="dorado-skin-sky" version="2.0.2"/>
<PackageInfo name="dorado-vidor"/></PackageInfos><Rule name="Auxiliary"><Children><Child rule="Import" name="Import"></Child><Child rule="GroupStart" name="GroupStart"></Child><Child rule="GroupEnd" name="GroupEnd"></Child><Child rule="PlaceHolder" name="PlaceHolder"></Child><Child rule="PlaceHolderStart" name="PlaceHolderStart"></Child><Child rule="PlaceHolderEnd" name="PlaceHolderEnd"></Child></Children></Rule><Rule name="Import" scope="public" sortFactor="9001" category="Auxiliary" icon="/com/bstek/dorado/idesupport/icons/Import.png"><PrimitiveProps>
@@ -48,7 +48,7 @@
<Prop name="title" highlight="1"/></Props><ClientEvents>
<ClientEvent name="onLoadData" parameters="self,arg"/>
<ClientEvent name="onComponentRegistered" parameters="self,arg"/>
<ClientEvent name="onComponentUnregistered" parameters="self,arg"/></ClientEvents><Children><Child rule="Component" name="Children" aggregated="true"></Child></Children></Rule><Rule name="DataType" parents="EntityDataTypeSupport" label="DataType" type="com.bstek.dorado.data.type.DefaultEntityDataType" scope="public" sortFactor="1" robots="datatype-reflection|自动创建PropertyDefs" icon="/com/bstek/dorado/data/type/DefaultEntityDataType.png" reserve="default"><Children><Child rule="Reference" name="Reference" aggregated="true"></Child><Child rule="BasePropertyDef" name="PropertyDef" aggregated="true"></Child></Children></Rule><Rule name="NonAggregationDataType" parents="AbstractDataType" abstract="true" type="com.bstek.dorado.data.type.NonAggregationDataType"></Rule><Rule name="EntityDataTypeSupport" parents="NonAggregationDataType" abstract="true" nodeName="DataType" type="com.bstek.dorado.data.type.EntityDataTypeSupport"><PrimitiveProps>
<ClientEvent name="onComponentUnregistered" parameters="self,arg"/></ClientEvents><Children><Child rule="Component" name="Children" aggregated="true"></Child></Children></Rule><Rule name="DataType" parents="EntityDataTypeSupport" label="DataType" type="com.bstek.dorado.data.type.DefaultEntityDataType" scope="public" sortFactor="1" robots="datatype-reflection|自动创建PropertyDefs" icon="/com/bstek/dorado/data/type/DefaultEntityDataType.png" reserve="default"><Children><Child rule="BasePropertyDef" name="PropertyDef" aggregated="true"></Child><Child rule="Reference" name="Reference" aggregated="true"></Child></Children></Rule><Rule name="NonAggregationDataType" parents="AbstractDataType" abstract="true" type="com.bstek.dorado.data.type.NonAggregationDataType"></Rule><Rule name="EntityDataTypeSupport" parents="NonAggregationDataType" abstract="true" nodeName="DataType" type="com.bstek.dorado.data.type.EntityDataTypeSupport"><PrimitiveProps>
<Prop name="impl"/>
<Prop name="parent"/>
<Prop name="listener"/>
@@ -72,13 +72,8 @@
<ClientEvent name="onStateChange" parameters="self,arg"/>
<ClientEvent name="onRemove" parameters="self,arg"/>
<ClientEvent name="onEntityLoad" parameters="self,arg"/>
<ClientEvent name="onInsert" parameters="self,arg"/></ClientEvents></Rule><Rule name="Reference" parents="LazyPropertyDef" label="Reference" type="com.bstek.dorado.data.type.property.Reference" scope="protected" icon="/com/bstek/dorado/data/type/property/Reference.png"><Props>
<Prop name="activeOnNewEntity" type="boolean"/>
<Prop name="dataProvider" highlight="1" type="com.bstek.dorado.data.provider.DataProvider"/>
<Prop name="pageSize" type="int"/>
<Prop name="parameter" highlight="1" editor="pojo" type="java.lang.Object"/></Props><ClientEvents>
<ClientEvent name="beforeLoadData" parameters="self,arg"/>
<ClientEvent name="onLoadData" parameters="self,arg"/></ClientEvents></Rule><Rule name="PropertyDef" abstract="true" type="com.bstek.dorado.data.type.property.PropertyDef"><PrimitiveProps>
<ClientEvent name="onInsert" parameters="self,arg"/></ClientEvents></Rule><Rule name="BasePropertyDef" parents="com.bstek.dorado.data.type.property.PropertyDefSupport" label="PropertyDef" nodeName="PropertyDef" type="com.bstek.dorado.data.type.property.BasePropertyDef" scope="protected" icon="/com/bstek/dorado/data/type/property/BasePropertyDef.png"><Props>
<Prop name="propertyPath"/></Props></Rule><Rule name="PropertyDef" abstract="true" type="com.bstek.dorado.data.type.property.PropertyDef"><PrimitiveProps>
<Prop name="name"/></PrimitiveProps><Props>
<Prop name="acceptUnknownMapKey" type="boolean"/>
<Prop name="dataType" highlight="1" type="com.bstek.dorado.data.type.DataType"/>
@@ -99,10 +94,15 @@
<ClientEvent name="onSet" parameters="self,arg"/>
<ClientEvent name="onValidate" parameters="self,arg"/>
<ClientEvent name="onGetText" parameters="self,arg"/></ClientEvents><Children><Child rule="Validator" name="Validators" aggregated="true"></Child></Children></Rule><Rule name="Validator" abstract="true" nodeName="Validator" type="com.bstek.dorado.data.type.validator.Validator" icon="/com/bstek/dorado/view/type/property/validator/Validator.png"><PrimitiveProps>
<Prop name="name"/></PrimitiveProps></Rule><Rule name="BasePropertyDef" parents="PropertyDefSupport" label="PropertyDef" nodeName="PropertyDef" type="com.bstek.dorado.data.type.property.BasePropertyDef" icon="/com/bstek/dorado/data/type/property/BasePropertyDef.png"><Props>
<Prop name="propertyPath"/></Props></Rule><Rule name="PropertyDefSupport" parents="PropertyDef" abstract="true" type="com.bstek.dorado.data.type.property.PropertyDefSupport"></Rule><Rule name="com.bstek.dorado.data.type.property.PropertyDefSupport" parents="PropertyDef" abstract="true" type="com.bstek.dorado.data.type.property.PropertyDefSupport"></Rule><Rule name="LazyPropertyDef" parents="PropertyDefSupport" abstract="true" type="com.bstek.dorado.data.type.property.LazyPropertyDef"><Props>
<Prop name="name"/></PrimitiveProps></Rule><Rule name="Reference" parents="LazyPropertyDef" label="Reference" type="com.bstek.dorado.data.type.property.Reference" icon="/com/bstek/dorado/data/type/property/Reference.png"><Props>
<Prop name="activeOnNewEntity" type="boolean"/>
<Prop name="dataProvider" highlight="1" type="com.bstek.dorado.data.provider.DataProvider"/>
<Prop name="pageSize" type="int"/>
<Prop name="parameter" highlight="1" editor="pojo" type="java.lang.Object"/></Props><ClientEvents>
<ClientEvent name="beforeLoadData" parameters="self,arg"/>
<ClientEvent name="onLoadData" parameters="self,arg"/></ClientEvents></Rule><Rule name="PropertyDefSupport" parents="PropertyDef" abstract="true" type="com.bstek.dorado.data.type.property.PropertyDefSupport"></Rule><Rule name="LazyPropertyDef" parents="PropertyDefSupport" abstract="true" type="com.bstek.dorado.data.type.property.LazyPropertyDef"><Props>
<Prop name="activeAtClient" defaultValue="true" type="boolean"/>
<Prop name="cacheMode" enumValues="noCache,serverSide,clientSide,bothSides"/></Props></Rule><Rule name="DirectDataProvider" parents="AbstractDataProvider" label="DirectDataProvider" type="com.bstek.dorado.data.provider.DirectDataProvider" scope="public" sortFactor="2" icon="/com/bstek/dorado/data/provider/DirectDataProvider.png" reserve="direct"><PrimitiveProps>
<Prop name="cacheMode" enumValues="noCache,serverSide,clientSide,bothSides"/></Props></Rule><Rule name="com.bstek.dorado.data.type.property.PropertyDefSupport" parents="PropertyDef" abstract="true" type="com.bstek.dorado.data.type.property.PropertyDefSupport"></Rule><Rule name="DirectDataProvider" parents="AbstractDataProvider" label="DirectDataProvider" type="com.bstek.dorado.data.provider.DirectDataProvider" scope="public" sortFactor="2" icon="/com/bstek/dorado/data/provider/DirectDataProvider.png" reserve="direct"><PrimitiveProps>
<Prop name="type" defaultValue="direct" fixed="true" visible="false"/></PrimitiveProps><Props>
<Prop name="result" editor="pojo" type="java.lang.Object"/></Props></Rule><Rule name="DirectDataResolver" parents="AbstractDataResolver" label="DirectDataResolver" type="com.bstek.dorado.data.resolver.DirectDataResolver" scope="public" sortFactor="3" icon="/com/bstek/dorado/data/resolver/DirectDataResolver.png" reserve="direct"><PrimitiveProps>
<Prop name="type" defaultValue="direct" fixed="true" visible="false"/></PrimitiveProps></Rule><Rule name="AbstractValidator" parents="Validator" abstract="true" nodeName="Validator" type="com.bstek.dorado.view.type.property.validator.AbstractValidator" icon="/com/bstek/dorado/view/type/property/validator/Validator.png"><Props>
@@ -265,8 +265,8 @@
<Prop name="dynaHeight" defaultValue="false" type="boolean"/></Props><ClientEvents>
<ClientEvent name="beforeCurrentChange" parameters="self,arg"/>
<ClientEvent name="onCurrentChange" parameters="self,arg"/></ClientEvents><Children><Child rule="com.bstek.dorado.view.widget.Control" name="Controls" aggregated="true"></Child></Children></Rule><Rule name="TabControl" parents="TabBar" label="TabControl" type="com.bstek.dorado.view.widget.base.tab.TabControl" sortFactor="2019" category="General" icon="/com/bstek/dorado/view/widget/base/tab/TabControl.png" clientTypes="desktop"><Props>
<Prop name="dynaHeight" defaultValue="false" type="boolean"/></Props><Children><Child rule="ControlTab" name="ControlTab" aggregated="true"></Child><Child rule="IFrameTab" name="IFrameTab" aggregated="true"></Child></Children></Rule><Rule name="VerticalTabControl" parents="TabColumn" label="VerticalTabControl" type="com.bstek.dorado.view.widget.base.tab.VerticalTabControl" sortFactor="2020" category="General" icon="/com/bstek/dorado/view/widget/base/tab/VerticalTabControl.png" clientTypes="desktop"><Props>
<Prop name="tabColumnWidth" defaultValue="200" type="int"/></Props><Children><Child rule="ControlTab" name="ControlTab" aggregated="true"></Child><Child rule="IFrameTab" name="IFrameTab" aggregated="true"></Child></Children></Rule><Rule name="TabBar" parents="AbstractTabControl" label="TabBar" type="com.bstek.dorado.view.widget.base.tab.TabBar" sortFactor="2021" category="General" icon="/com/bstek/dorado/view/widget/base/tab/TabBar.png" clientTypes="desktop"><Props>
<Prop name="dynaHeight" defaultValue="false" type="boolean"/></Props><Children><Child rule="IFrameTab" name="IFrameTab" aggregated="true"></Child><Child rule="ControlTab" name="ControlTab" aggregated="true"></Child></Children></Rule><Rule name="VerticalTabControl" parents="TabColumn" label="VerticalTabControl" type="com.bstek.dorado.view.widget.base.tab.VerticalTabControl" sortFactor="2020" category="General" icon="/com/bstek/dorado/view/widget/base/tab/VerticalTabControl.png" clientTypes="desktop"><Props>
<Prop name="tabColumnWidth" defaultValue="200" type="int"/></Props><Children><Child rule="IFrameTab" name="IFrameTab" aggregated="true"></Child><Child rule="ControlTab" name="ControlTab" aggregated="true"></Child></Children></Rule><Rule name="TabBar" parents="AbstractTabControl" label="TabBar" type="com.bstek.dorado.view.widget.base.tab.TabBar" sortFactor="2021" category="General" icon="/com/bstek/dorado/view/widget/base/tab/TabBar.png" clientTypes="desktop"><Props>
<Prop name="showMenuButton" type="boolean"/>
<Prop name="tabMinWidth" type="int"/>
<Prop name="tabPlacement" defaultValue="top" enumValues="top,bottom"/></Props><Children><Child rule="Tab" name="Tab" aggregated="true" public="false"></Child></Children></Rule><Rule name="TabColumn" parents="AbstractTabControl" label="TabColumn" type="com.bstek.dorado.view.widget.base.tab.TabColumn" sortFactor="2022" category="General" icon="/com/bstek/dorado/view/widget/base/tab/TabColumn.png" clientTypes="desktop"><Props>
@@ -274,7 +274,7 @@
<Prop name="verticalText" type="boolean"/></Props><Children><Child rule="Tab" name="Tab" aggregated="true" public="false"></Child></Children></Rule><Rule name="ToolBar" parents="com.bstek.dorado.view.widget.Control" label="ToolBar" type="com.bstek.dorado.view.widget.base.toolbar.ToolBar" sortFactor="2023" category="General" icon="/com/bstek/dorado/view/widget/base/toolbar/ToolBar.png" clientTypes="desktop"><Props>
<Prop name="fixRight" type="boolean"/>
<Prop name="height" visible="false"/>
<Prop name="showMenuOnHover" defaultValue="false" type="boolean"/></Props><Children><Child rule="MenuButton" name="MenuButton" aggregated="true"></Child><Child rule="Fill" name="Fill" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.base.toolbar.Label" name="ToolBarLabel" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.base.toolbar.Button" name="ToolBarButton" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.base.toolbar.Separator" name="Separator" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.Control" name="Items" aggregated="true"></Child></Children></Rule><Rule name="SplitPanel" parents="com.bstek.dorado.view.widget.Control" label="SplitPanel" type="com.bstek.dorado.view.widget.base.SplitPanel" sortFactor="2024" category="General" icon="/com/bstek/dorado/view/widget/base/SplitPanel.png" clientTypes="desktop"><Props>
<Prop name="showMenuOnHover" defaultValue="false" type="boolean"/></Props><Children><Child rule="Fill" name="Fill" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.base.toolbar.Button" name="ToolBarButton" aggregated="true"></Child><Child rule="Separator" name="Separator" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.base.toolbar.Label" name="ToolBarLabel" aggregated="true"></Child><Child rule="MenuButton" name="MenuButton" aggregated="true"></Child><Child rule="com.bstek.dorado.view.widget.Control" name="Items" aggregated="true"></Child></Children></Rule><Rule name="SplitPanel" parents="com.bstek.dorado.view.widget.Control" label="SplitPanel" type="com.bstek.dorado.view.widget.base.SplitPanel" sortFactor="2024" category="General" icon="/com/bstek/dorado/view/widget/base/SplitPanel.png" clientTypes="desktop"><Props>
<Prop name="animate" type="java.lang.Boolean"/>
<Prop name="collapseBothSide" defaultValue="false" type="boolean"/>
<Prop name="collapseable" defaultValue="true" type="boolean"/>
@@ -793,7 +793,9 @@
<Prop name="collapsed" defaultValue="false" type="boolean"/>
<Prop name="lazyInitChildren" type="boolean"/></Props><ClientEvents>
<ClientEvent name="onCollapsedChange" parameters="self,arg"/>
<ClientEvent name="beforeCollapsedChange" parameters="self,arg"/></ClientEvents><Children><Child name="Buttons" fixed="true"><Rule name="Wrapper.Buttons" label="Buttons" nodeName="Buttons" icon="/com/bstek/dorado/view/widget/base/Buttons.png"><Children><Child rule="Button" name="Buttons" aggregated="true"></Child></Children></Rule></Child><Child name="Children" fixed="true"><Rule name="Wrapper.Children" label="Children" nodeName="Children" icon="/com/bstek/dorado/view/widget/base/Children.png"><Children><Child rule="Component" name="Children" aggregated="true"></Child></Children></Rule></Child></Children></Rule><Rule name="ControlTab" parents="Tab" label="ControlTab" type="com.bstek.dorado.view.widget.base.tab.ControlTab" scope="protected" icon="/com/bstek/dorado/view/widget/base/tab/ControlTab.png"><Children><Child rule="com.bstek.dorado.view.widget.Control" name="Control"></Child></Children></Rule><Rule name="Tab" parents="ClientEventSupportedElement" label="Tab" type="com.bstek.dorado.view.widget.base.tab.Tab" scope="protected" icon="/com/bstek/dorado/view/widget/base/tab/Tab.png"><Props>
<ClientEvent name="beforeCollapsedChange" parameters="self,arg"/></ClientEvents><Children><Child name="Buttons" fixed="true"><Rule name="Wrapper.Buttons" label="Buttons" nodeName="Buttons" icon="/com/bstek/dorado/view/widget/base/Buttons.png"><Children><Child rule="Button" name="Buttons" aggregated="true"></Child></Children></Rule></Child><Child name="Children" fixed="true"><Rule name="Wrapper.Children" label="Children" nodeName="Children" icon="/com/bstek/dorado/view/widget/base/Children.png"><Children><Child rule="Component" name="Children" aggregated="true"></Child></Children></Rule></Child></Children></Rule><Rule name="IFrameTab" parents="Tab" label="IFrameTab" type="com.bstek.dorado.view.widget.base.tab.IFrameTab" scope="protected" icon="/com/bstek/dorado/view/widget/base/tab/IFrameTab.png"><Props>
<Prop name="iframeHeight" type="java.lang.Integer"/>
<Prop name="path" highlight="1"/></Props></Rule><Rule name="Tab" parents="ClientEventSupportedElement" label="Tab" type="com.bstek.dorado.view.widget.base.tab.Tab" scope="protected" icon="/com/bstek/dorado/view/widget/base/tab/Tab.png"><Props>
<Prop name="caption" highlight="1"/>
<Prop name="className"/>
<Prop name="closeable" type="boolean"/>
@@ -808,15 +810,17 @@
<Prop name="width"/></Props><ClientEvents>
<ClientEvent name="onClose" parameters="self,arg"/>
<ClientEvent name="onClick" parameters="self,arg"/>
<ClientEvent name="beforeClose" parameters="self,arg"/></ClientEvents></Rule><Rule name="IFrameTab" parents="Tab" label="IFrameTab" type="com.bstek.dorado.view.widget.base.tab.IFrameTab" scope="protected" icon="/com/bstek/dorado/view/widget/base/tab/IFrameTab.png"><Props>
<Prop name="iframeHeight" type="java.lang.Integer"/>
<Prop name="path" highlight="1"/></Props></Rule><Rule name="AbstractTabControl" parents="com.bstek.dorado.view.widget.Control" abstract="true" type="com.bstek.dorado.view.widget.base.tab.AbstractTabControl" scope="protected" clientTypes="desktop"><Props>
<ClientEvent name="beforeClose" parameters="self,arg"/></ClientEvents></Rule><Rule name="ControlTab" parents="Tab" label="ControlTab" type="com.bstek.dorado.view.widget.base.tab.ControlTab" scope="protected" icon="/com/bstek/dorado/view/widget/base/tab/ControlTab.png"><Children><Child rule="com.bstek.dorado.view.widget.Control" name="Control"></Child></Children></Rule><Rule name="AbstractTabControl" parents="com.bstek.dorado.view.widget.Control" abstract="true" type="com.bstek.dorado.view.widget.base.tab.AbstractTabControl" scope="protected" clientTypes="desktop"><Props>
<Prop name="alwaysShowNavButtons" type="boolean"/>
<Prop name="currentTab" type="int"/></Props><ClientEvents>
<ClientEvent name="onTabContextMenu" parameters="self,arg"/>
<ClientEvent name="onTabChange" parameters="self,arg"/>
<ClientEvent name="onTabRemove" parameters="self,arg"/>
<ClientEvent name="beforeTabChange" parameters="self,arg"/></ClientEvents></Rule><Rule name="MenuButton" parents="Button" label="MenuButton" nodeName="MenuButton" type="com.bstek.dorado.view.widget.base.toolbar.MenuButton" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/MenuButton.png" clientTypes="desktop"><Props>
<ClientEvent name="beforeTabChange" parameters="self,arg"/></ClientEvents></Rule><Rule name="Fill" parents="com.bstek.dorado.view.widget.Control" label="Fill" type="com.bstek.dorado.view.widget.base.toolbar.Fill" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Fill.png" clientTypes="desktop"></Rule><Rule name="com.bstek.dorado.view.widget.base.toolbar.Button" parents="Button" label="ToolBarButton" nodeName="ToolBarButton" type="com.bstek.dorado.view.widget.base.toolbar.Button" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Button.png" clientTypes="desktop"><Props>
<Prop name="hideMenuOnMouseLeave" type="boolean"/>
<Prop name="hideMenuOnMouseLeaveDelay" defaultValue="300" type="int"/>
<Prop name="showMenuOnHover" defaultValue="false" type="boolean"/></Props></Rule><Rule name="Separator" parents="com.bstek.dorado.view.widget.Control" label="Separator" type="com.bstek.dorado.view.widget.base.toolbar.Separator" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Separator.png" clientTypes="desktop"></Rule><Rule name="com.bstek.dorado.view.widget.base.toolbar.Label" parents="com.bstek.dorado.view.widget.Control" label="Label" nodeName="ToolBarLabel" type="com.bstek.dorado.view.widget.base.toolbar.Label" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Label.png" clientTypes="desktop"><Props>
<Prop name="text"/></Props></Rule><Rule name="MenuButton" parents="Button" label="MenuButton" nodeName="MenuButton" type="com.bstek.dorado.view.widget.base.toolbar.MenuButton" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/MenuButton.png" clientTypes="desktop"><Props>
<Prop name="hideMenuOnMouseLeave" type="boolean"/>
<Prop name="hideMenuOnMouseLeaveDelay" defaultValue="300" type="int"/>
<Prop name="menu" deprecated="true" visible="false"/>
@@ -827,14 +831,17 @@
<Prop name="name"/><Prop name="style" type="java.util.Map" compositeType="Open"></Prop>
<Prop name="tip"/>
<Prop name="visible" defaultValue="true" type="boolean"/>
<Prop name="width"/></Props></Rule><Rule name="MenuItem" parents="TextMenuItem" label="MenuItem" type="com.bstek.dorado.view.widget.base.menu.MenuItem" icon="/com/bstek/dorado/view/widget/base/menu/MenuItem.png" clientTypes="desktop"><Children><Child rule="BaseMenuItem" name="Items" aggregated="true"></Child></Children></Rule><Rule name="TextMenuItem" parents="BaseMenuItem" abstract="true" type="com.bstek.dorado.view.widget.base.menu.TextMenuItem"><Props>
<Prop name="width"/></Props></Rule><Rule name="CheckableMenuItem" parents="MenuItem" label="CheckableMenuItem" type="com.bstek.dorado.view.widget.base.menu.CheckableMenuItem" icon="/com/bstek/dorado/view/widget/base/menu/CheckableMenuItem.png" clientTypes="desktop"><Props>
<Prop name="checked" type="boolean"/>
<Prop name="group"/></Props><ClientEvents>
<ClientEvent name="onCheckedChange" parameters="self,arg"/></ClientEvents></Rule><Rule name="TextMenuItem" parents="BaseMenuItem" abstract="true" type="com.bstek.dorado.view.widget.base.menu.TextMenuItem"><Props>
<Prop name="action" reference="Action:id"/>
<Prop name="caption"/>
<Prop name="disabled" type="boolean"/>
<Prop name="hideOnClick" defaultValue="true" type="boolean"/>
<Prop name="icon"/>
<Prop name="iconClass"/></Props><ClientEvents>
<ClientEvent name="onClick" parameters="self,arg"/></ClientEvents></Rule><Rule name="ControlMenuItem" parents="TextMenuItem" label="ControlMenuItem" type="com.bstek.dorado.view.widget.base.menu.ControlMenuItem" icon="/com/bstek/dorado/view/widget/base/menu/ControlMenuItem.png" clientTypes="desktop"><Children><Child rule="FloatControl" name="Control"></Child></Children></Rule><Rule name="FloatControl" abstract="true" type="com.bstek.dorado.view.widget.FloatControl"><Props>
<ClientEvent name="onClick" parameters="self,arg"/></ClientEvents></Rule><Rule name="MenuItem" parents="TextMenuItem" label="MenuItem" type="com.bstek.dorado.view.widget.base.menu.MenuItem" icon="/com/bstek/dorado/view/widget/base/menu/MenuItem.png" clientTypes="desktop"><Children><Child rule="BaseMenuItem" name="Items" aggregated="true"></Child></Children></Rule><Rule name="ControlMenuItem" parents="TextMenuItem" label="ControlMenuItem" type="com.bstek.dorado.view.widget.base.menu.ControlMenuItem" icon="/com/bstek/dorado/view/widget/base/menu/ControlMenuItem.png" clientTypes="desktop"><Children><Child rule="FloatControl" name="Control"></Child></Children></Rule><Rule name="FloatControl" abstract="true" type="com.bstek.dorado.view.widget.FloatControl"><Props>
<Prop name="align" enumValues="left,innerleft,center,innerright,top" visible="false"/>
<Prop name="anchorTarget" visible="false"/>
<Prop name="animateTarget" visible="false"/>
@@ -855,14 +862,7 @@
<Prop name="shadowMode" enumValues="drop,sides,frame,none"/>
<Prop name="showAnimateType" enumValues="zoom,modernZoom,flip,slide,safeSlide,modernSlide,fade,none"/>
<Prop name="top" type="int"/>
<Prop name="vAlign" enumValues="top,innertop,center,innerbottom,bottom" visible="false"/></Props></Rule><Rule name="CheckableMenuItem" parents="MenuItem" label="CheckableMenuItem" type="com.bstek.dorado.view.widget.base.menu.CheckableMenuItem" icon="/com/bstek/dorado/view/widget/base/menu/CheckableMenuItem.png" clientTypes="desktop"><Props>
<Prop name="checked" type="boolean"/>
<Prop name="group"/></Props><ClientEvents>
<ClientEvent name="onCheckedChange" parameters="self,arg"/></ClientEvents></Rule><Rule name="Separator" parents="BaseMenuItem" label="Separator" type="com.bstek.dorado.view.widget.base.menu.Separator" icon="/com/bstek/dorado/view/widget/base/menu/Separator.png" clientTypes="desktop,touch"></Rule><Rule name="Fill" parents="com.bstek.dorado.view.widget.Control" label="Fill" type="com.bstek.dorado.view.widget.base.toolbar.Fill" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Fill.png" clientTypes="desktop"></Rule><Rule name="com.bstek.dorado.view.widget.base.toolbar.Label" parents="com.bstek.dorado.view.widget.Control" label="Label" nodeName="ToolBarLabel" type="com.bstek.dorado.view.widget.base.toolbar.Label" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Label.png" clientTypes="desktop"><Props>
<Prop name="text"/></Props></Rule><Rule name="com.bstek.dorado.view.widget.base.toolbar.Button" parents="Button" label="ToolBarButton" nodeName="ToolBarButton" type="com.bstek.dorado.view.widget.base.toolbar.Button" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Button.png" clientTypes="desktop"><Props>
<Prop name="hideMenuOnMouseLeave" type="boolean"/>
<Prop name="hideMenuOnMouseLeaveDelay" defaultValue="300" type="int"/>
<Prop name="showMenuOnHover" defaultValue="false" type="boolean"/></Props></Rule><Rule name="com.bstek.dorado.view.widget.base.toolbar.Separator" parents="com.bstek.dorado.view.widget.Control" label="Separator" type="com.bstek.dorado.view.widget.base.toolbar.Separator" scope="protected" category="ToolBar" icon="/com/bstek/dorado/view/widget/base/toolbar/Separator.png" clientTypes="desktop"></Rule><Rule name="Section" parents="ClientEventSupportedElement" label="Section" type="com.bstek.dorado.view.widget.base.accordion.Section" icon="/com/bstek/dorado/view/widget/base/accordion/Section.png"><Props>
<Prop name="vAlign" enumValues="top,innertop,center,innerbottom,bottom" visible="false"/></Props></Rule><Rule name="com.bstek.dorado.view.widget.base.menu.Separator" parents="BaseMenuItem" label="Separator" type="com.bstek.dorado.view.widget.base.menu.Separator" icon="/com/bstek/dorado/view/widget/base/menu/Separator.png" clientTypes="desktop,touch"></Rule><Rule name="Section" parents="ClientEventSupportedElement" label="Section" type="com.bstek.dorado.view.widget.base.accordion.Section" icon="/com/bstek/dorado/view/widget/base/accordion/Section.png"><Props>
<Prop name="caption"/>
<Prop name="className"/>
<Prop name="disabled" type="boolean"/>
@@ -938,14 +938,8 @@
<Prop name="visible" defaultValue="true" type="boolean"/></Props><ClientEvents>
<ClientEvent name="onGetCellEditor" parameters="self,arg"/>
<ClientEvent name="onHeaderClick" parameters="self,arg"/>
<ClientEvent name="onRenderHeaderCell" parameters="self,arg"/></ClientEvents></Rule><Rule name="AbstractDataColumn" parents="Column" abstract="true" type="com.bstek.dorado.view.widget.grid.AbstractDataColumn"><Props>
<Prop name="filterBarRenderer"/>
<Prop name="footerRenderer"/>
<Prop name="renderer"/>
<Prop name="resizeable" defaultValue="true" type="boolean"/>
<Prop name="width"/></Props><ClientEvents>
<ClientEvent name="onRenderFooterCell" parameters="self,arg"/>
<ClientEvent name="onRenderCell" parameters="self,arg"/></ClientEvents></Rule><Rule name="DataColumn" parents="AbstractDataColumn" label="DataColumn" type="com.bstek.dorado.view.widget.grid.DataColumn" icon="/com/bstek/dorado/view/widget/grid/DataColumn.png" labelProperty="name,property"><Props>
<ClientEvent name="onRenderHeaderCell" parameters="self,arg"/></ClientEvents></Rule><Rule name="ColumnGroup" parents="Column" label="ColumnGroup" type="com.bstek.dorado.view.widget.grid.ColumnGroup" icon="/com/bstek/dorado/view/widget/grid/ColumnGroup.png"><Props>
<Prop name="align" enumValues="left,center,right" visible="false"/></Props><Children><Child rule="Column" name="Columns" aggregated="true"></Child></Children></Rule><Rule name="DataColumn" parents="AbstractDataColumn" label="DataColumn" type="com.bstek.dorado.view.widget.grid.DataColumn" icon="/com/bstek/dorado/view/widget/grid/DataColumn.png" labelProperty="name,property"><Props>
<Prop name="align" enumValues="left,center,right"/>
<Prop name="dataType" type="com.bstek.dorado.data.type.DataType"/>
<Prop name="defaultFilterOperator"/>
@@ -960,8 +954,14 @@
<Prop name="summaryType" enumValues="sum,average,count,max,min"/>
<Prop name="trigger" enumValues="triggerClear,autoMappingDropDown1,autoMappingDropDown2,autoOpenMappingDropDown1,autoOpenMappingDropDown2,defaultDateDropDown,defaultDateTimeDropDown,defaultYearMonthDropDown,defaultYearDropDown,defaultMonthDropDown" reference="Trigger:id"/>
<Prop name="typeFormat"/>
<Prop name="wrappable" type="boolean"/></Props><Children><Child name="Editor" fixed="true"><Rule name="Wrapper.Editor" label="Editor" nodeName="Editor" icon="/com/bstek/dorado/view/widget/grid/Editor.png"><Children><Child rule="com.bstek.dorado.view.widget.Control" name="Editor"></Child></Children></Rule></Child></Children></Rule><Rule name="IndicatorColumn" parents="AbstractDataColumn" label="IndicatorColumn" type="com.bstek.dorado.view.widget.grid.IndicatorColumn" icon="/com/bstek/dorado/view/widget/grid/IndicatorColumn.png"></Rule><Rule name="RowNumColumn" parents="AbstractDataColumn" label="RowNumColumn" type="com.bstek.dorado.view.widget.grid.RowNumColumn" icon="/com/bstek/dorado/view/widget/grid/RowNumColumn.png"></Rule><Rule name="RowSelectorColumn" parents="AbstractDataColumn" label="RowSelectorColumn" type="com.bstek.dorado.view.widget.grid.RowSelectorColumn" icon="/com/bstek/dorado/view/widget/grid/RowSelectorColumn.png"></Rule><Rule name="ColumnGroup" parents="Column" label="ColumnGroup" type="com.bstek.dorado.view.widget.grid.ColumnGroup" icon="/com/bstek/dorado/view/widget/grid/ColumnGroup.png"><Props>
<Prop name="align" enumValues="left,center,right" visible="false"/></Props><Children><Child rule="Column" name="Columns" aggregated="true"></Child></Children></Rule><Rule name="AbstractList" parents="com.bstek.dorado.view.widget.Control" abstract="true" type="com.bstek.dorado.view.widget.list.AbstractList" scope="protected" clientTypes="desktop"><Props>
<Prop name="wrappable" type="boolean"/></Props><Children><Child name="Editor" fixed="true"><Rule name="Wrapper.Editor" label="Editor" nodeName="Editor" icon="/com/bstek/dorado/view/widget/grid/Editor.png"><Children><Child rule="com.bstek.dorado.view.widget.Control" name="Editor"></Child></Children></Rule></Child></Children></Rule><Rule name="AbstractDataColumn" parents="Column" abstract="true" type="com.bstek.dorado.view.widget.grid.AbstractDataColumn"><Props>
<Prop name="filterBarRenderer"/>
<Prop name="footerRenderer"/>
<Prop name="renderer"/>
<Prop name="resizeable" defaultValue="true" type="boolean"/>
<Prop name="width"/></Props><ClientEvents>
<ClientEvent name="onRenderFooterCell" parameters="self,arg"/>
<ClientEvent name="onRenderCell" parameters="self,arg"/></ClientEvents></Rule><Rule name="IndicatorColumn" parents="AbstractDataColumn" label="IndicatorColumn" type="com.bstek.dorado.view.widget.grid.IndicatorColumn" icon="/com/bstek/dorado/view/widget/grid/IndicatorColumn.png"></Rule><Rule name="RowSelectorColumn" parents="AbstractDataColumn" label="RowSelectorColumn" type="com.bstek.dorado.view.widget.grid.RowSelectorColumn" icon="/com/bstek/dorado/view/widget/grid/RowSelectorColumn.png"></Rule><Rule name="RowNumColumn" parents="AbstractDataColumn" label="RowNumColumn" type="com.bstek.dorado.view.widget.grid.RowNumColumn" icon="/com/bstek/dorado/view/widget/grid/RowNumColumn.png"></Rule><Rule name="AbstractList" parents="com.bstek.dorado.view.widget.Control" abstract="true" type="com.bstek.dorado.view.widget.list.AbstractList" scope="protected" clientTypes="desktop"><Props>
<Prop name="allowNoCurrent" type="boolean"/>
<Prop name="dragMode" defaultValue="item" enumValues="item,control,itemOrControl"/>
<Prop name="dropMode" defaultValue="insertItems" enumValues="onControl,onItem,insertItems,onOrInsertItems,onAnyWhere"/>
pom.xml
@@ -13,7 +13,6 @@
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.boot.version>2.1.2.RELEASE</spring.boot.version>
        <spring.version>5.1.1.RELEASE</spring.version>
        <dorado.version>7.5.16</dorado.version>
        <druid.version>1.2.8</druid.version>
        <mysql.version>5.1.45</mysql.version>
        <fastjson.version>2.0.10</fastjson.version>
@@ -28,7 +27,7 @@
        <dependency>
            <groupId>com.bstek.dorado</groupId>
            <artifactId>dorado-core</artifactId>
            <version>${dorado.version}</version>
            <version>7.6.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
@@ -419,10 +418,10 @@
    <repositories>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
<!--        <repository>-->
<!--            <id>sonatype</id>-->
<!--            <url>https://oss.sonatype.org/content/groups/public/</url>-->
<!--        </repository>-->
        <repository>
            <id>bsdn-maven-repository</id>
            <url>http://nexus.bsdn.org/content/groups/public/</url>
src/main/java/com/fzzy/Application.java
@@ -16,6 +16,7 @@
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.servlet.ServletContext;
import java.util.LinkedHashSet;
import java.util.Set;
src/main/java/com/fzzy/gateway/entity/GateWayTestParam.java
@@ -3,12 +3,10 @@
import com.bstek.dorado.annotation.PropertyDef;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class GateWayTestParam implements Serializable {
    private static final long serialVersionUID = 1L;
public class GateWayTestParam {
    @PropertyDef(label = "开始时间")
    private Date start;
    @PropertyDef(label = "截止时间")
@@ -19,4 +17,6 @@
    private Double weight;
    @PropertyDef(label = "车牌号")
    private String carNumber;
    private String deviceId;
    private String bizType;
}
src/main/java/com/fzzy/gateway/hx2023/ScConstant.java
@@ -32,4 +32,9 @@
     */
    public static String TOPIC_REPORT = "/${productId}/${deviceId}/properties/report";
    /**
     * è®¾å¤‡ç›¸å…³ä¿¡æ¯æ¢å¤æŠ¥æ–‡-topic
     */
    public static String TOPIC_MESSAGE_REPORT = "/device/${productId}/${deviceId}/message/property/report";
}
src/main/java/com/fzzy/gateway/hx2023/controller/GatewayDeviceTestController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,445 @@
package com.fzzy.gateway.hx2023.controller;
import com.alibaba.fastjson2.JSONObject;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.api.data.GatewayDeviceType;
import com.fzzy.api.utils.DateUtil;
import com.fzzy.async.fzzy40.Fzzy40CommonService;
import com.fzzy.async.fzzy40.entity.Fz40Grain;
import com.fzzy.gateway.GatewayUtils;
import com.fzzy.gateway.api.DeviceReportService;
import com.fzzy.gateway.api.GatewayRemoteManager;
import com.fzzy.gateway.data.BaseResp;
import com.fzzy.gateway.entity.GateWayTestParam;
import com.fzzy.gateway.entity.GatewayDevice;
import com.fzzy.gateway.hx2023.ScConstant;
import com.fzzy.gateway.hx2023.data.*;
import com.fzzy.gateway.service.GatewayDeviceService;
import com.fzzy.gateway.service.repository.GatewayDeviceRep;
import com.fzzy.mqtt.MqttGatewayService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 *
 */
@Slf4j
@Controller
@RequestMapping("/sc2023/gateway/test")
public class GatewayDeviceTestController {
    @Resource
    private GatewayDeviceService gatewayDeviceService;
    @Resource
    private Fzzy40CommonService fzzy40CommonService;
    @Resource
    private GatewayRemoteManager gatewayRemoteManager;
    @Resource
    private MqttGatewayService publishService;
    /**
     * æµ‹è¯•入口
     *
     * @param param
     * @return
     */
    @PostMapping("/deviceTest")
    public @ResponseBody
    String deviceTest(@RequestBody GateWayTestParam param) throws Exception {
        if (StringUtils.isEmpty(param.getBizType())) {
            return "ERROR:没有获取到业务类型,执行失败";
        }
        if ("testGrain".equals(param.getBizType())) {
            return testGrain(param);
        }
        if ("ajaxTestKafkaGrain".equals(param.getBizType())) {
            return ajaxTestKafkaGrain(param);
        }
        if ("ajaxTestWeight".equals(param.getBizType())) {
            return ajaxTestWeight(param);
        }
        if ("ajaxTestLpr".equals(param.getBizType())) {
            return ajaxTestLpr(param);
        }
        return "SUCCESS";
    }
    private String testGrain(GateWayTestParam param) {
        String deviceId = param.getDeviceId();
        GatewayDevice device = GatewayUtils.getCacheByDeviceId(deviceId);
        SyncReqData reqData = new SyncReqData();
        reqData.setDevice(device);
        reqData.setAutoReplay(true);
        reqData.setMessageType(ScConstant.MESSAGE_TYPE_INVOKE_FUNCTION);
        reqData.setMessageId(ScConstant.getMessageId());
        reqData.setFunctionId(ScConstant.FUNCTION_getTAndRHInfo);
        if (!GatewayDeviceType.TYPE_07.getCode().equals(device.getType())) {
            return "ERROR:当前设备非粮情设备不支持当前操作";
        }
        if (StringUtils.isEmpty(device.getCableRule())) {
            return "ERROR:当前设备没有配置布线规则,无法执行";
        }
        BaseResp resp = gatewayRemoteManager.getSyncGrainService(device.getSyncProtocol()).syncGrain2(reqData);
        //自动推送
        if (200 == resp.getCode() && reqData.isAutoReplay()) {
            String topic = ScConstant.TOPIC_REPORT;
            topic = topic.replace("${productId}", device.getProductId()).replace("${deviceId}", device.getDeviceId());
            publishService.publishMqttWithTopic(resp.getData(), topic);
            log.info("----------------------------手动推送MQTT粮情信息---------------------------");
            log.info("-----TOPIC-----{}", topic);
            log.info("-----Message-----{}", resp.getData());
        }
        return "SUCCESS:执行完成";
    }
    /**
     * ç²®æƒ…推送测试KAFKA方式
     *
     * @param param
     * @return
     */
    public String ajaxTestKafkaGrain(GateWayTestParam param) throws Exception {
        //获取设备配置,只针对粮情设备进行执行
        List<GatewayDevice> list = gatewayDeviceService.listAll();
        if (null == list || list.isEmpty()) {
            return "ERROR:为获取到系统中设备配置,取消执行";
        }
        Date dayTime = param.getDayTime();
        if (null == dayTime) dayTime = new Date();
        Date start = DateUtil.getCurZero(dayTime);
        Date end = DateUtil.getNextZero(dayTime);
        //如果部署FZZY-IGDS-V40版本系统
        return this.pushByV40(list, start, end);
    }
    private String pushByV40(List<GatewayDevice> list, Date start, Date end) {
        String depotIdSys;
        List<Fz40Grain> listGrain;
        Fz40Grain lastData;
        KafaGrainData pushData;
        DeviceReportService deviceReportService = null;
        for (GatewayDevice device : list) {
            depotIdSys = device.getDepotIdSys();
            if (StringUtils.isEmpty(depotIdSys)) {
                log.info("--------设备--{}-未配置系统相关仓库编码,无法执行当前操作", device.getDeviceName());
                continue;
            }
            listGrain = fzzy40CommonService.listGrain(depotIdSys, start, end);
            if (null == listGrain || listGrain.isEmpty()) {
                log.info("---------设备---{}--未同步到粮情信息,请确认当前条件下是否有数据", device.getDeviceName());
                continue;
            }
            //获取最后一条粮情作为当前数据
            lastData = listGrain.get(listGrain.size() - 1);
            pushData = this.lastData2PushData(lastData, device);
            if (null == deviceReportService) {
                deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getProvinceProtocol());
            }
            deviceReportService.pushGrainData2Cloud(pushData);
        }
        return "SUCCESS";
    }
    /**
     * å°†ç²®æƒ…数据转换为推送需要的数据格式
     *
     * @param lastData
     * @return
     */
    private KafaGrainData lastData2PushData(Fz40Grain lastData, GatewayDevice device) {
        KafaGrainData result = new KafaGrainData();
        result.setMessageId(ScConstant.getMessageId());
        result.setMessgeId(result.getMessageId());
        result.setDeviceID(device.getDeviceId());
        result.setAvgTemperature(lastData.getTempAve() + "");
        result.setMinTemperature(lastData.getTempMin() + "");
        result.setMaxTemperature(lastData.getTempMax() + "");
        result.setCollectTime(DateFormatUtils.format(lastData.getReceiveDate(), "yyyy-MM-dd HH:mm:ss"));
        //层-行-列
        String[] attrCable = lastData.getCable().split("-");
        if (StringUtils.isNotEmpty(lastData.getCableCir())) {
            return lastData2PushData2(lastData, device);
        }
        //层行列
        int cableZ = Integer.valueOf(attrCable[0]);
        int cableY = Integer.valueOf(attrCable[1]);
        int cableX = Integer.valueOf(attrCable[2]);
        //温度集合
        String[] attr = lastData.getPoints().split(",");
        //根号
        int cableNum = 1, position = 0;
        String curTemp;
        List<KafkaGrainDataDetail1> temperature = new ArrayList<>();
        int x = 0, y = 0, z = 0;
        for (int i = 0; i < attr.length; i++) {
            position = i;
            z = i % cableZ + 1;
            x = i / (cableZ * cableY);
            y = x * (cableZ * cableY);
            y = (i - y) / cableZ;
            // å€’转Xè½´
            x = cableX - 1 - x;
            //根号
            cableNum = (i / cableZ) + 1;
            curTemp = attr[i];
            //判断最大
            if (curTemp.equals(result.getMaxTemperature())) {
                result.setMaxX(x + "");
                result.setMaxY(y + "");
                result.setMaxZ(position + "");
            }
            //判断最小
            if (curTemp.equals(result.getMinTemperature())) {
                result.setMinX(x + "");
                result.setMinY(y + "");
                result.setMinZ(position + "");
            }
            temperature.add(new KafkaGrainDataDetail1(cableNum + "", z + "", curTemp, position + "", x + "", y + ""));
        }
        //粮温信息
        JSONObject trhInfo = new JSONObject();
        // TRHInfo trhInfo = new TRHInfo();
        trhInfo.put("temperature", temperature);
        //仓温度信息
        KafkaGrainTH grainTH = new KafkaGrainTH();
        grainTH.setHumidity(lastData.getHumidityIn() + "");
        grainTH.setTemperature(lastData.getTempIn() + "");
        grainTH.setAirHumidity(lastData.getHumidityOut() + "");
        grainTH.setAirTemperature(lastData.getTempOut() + "");
        List<KafkaGrainTH> temperatureAndhumidity = new ArrayList<>();
        temperatureAndhumidity.add(grainTH);
        trhInfo.put("temperatureAndhumidity", temperatureAndhumidity);
        //trhInfo.put("temperatureAndhumidity",grainTH);
        JSONObject params = new JSONObject();
        params.put("TRHInfo", trhInfo);
        result.setParams(params);
        return result;
    }
    /**
     * é’ˆå¯¹ç­’仓  TODO -----
     *
     * @param lastData
     * @param device
     * @return
     */
    private KafaGrainData lastData2PushData2(Fz40Grain lastData, GatewayDevice device) {
        return null;
    }
    /**
     * åœ°ç£…推送测试
     *
     * @param param
     * @return
     */
    @Expose
    public String ajaxTestWeight(GateWayTestParam param) throws Exception {
//        double weigh = (double) data.get("weight");
//        double deviceId = (double) data.get("deviceId");
        double weigh = param.getWeight();
        String deviceId = param.getDeviceId();
        List<GatewayDevice> list = gatewayDeviceService.listAll();
        if (list == null || list.size() <= 0) {
            return "ERROR:没有配置设备信息,执行失败";
        }
        List<GatewayDevice> weights = list.stream().filter(s -> (GatewayDeviceType.TYPE_01.getCode().equals(s.getType()))).collect(Collectors.toList());
        if (weights == null || weights.size() <= 0) {
            return "ERROR:ERROR:没有配置设备信息,执行失败";
        }
        String topic;
        for (GatewayDevice device : weights) {
            WebSocketPacket packet = new WebSocketPacket();
            WebSocketPacketHeader header = new WebSocketPacketHeader();
            header.setDeviceName(device.getDeviceName());
            header.setProductId(device.getProductId());
            //header.set
            packet.setHeaders(header);
            packet.setMessageType(ScConstant.MESSAGE_TYPE_REPORT_PROPERTY);
            packet.setDeviceId(device.getDeviceId());
            //设置信息主体
            WeightInfo weightInfo = new WeightInfo();
            weightInfo.setGrossWeight(weigh);
            weightInfo.setNetWeight(weigh);
            weightInfo.setNetWeight(weigh);
            weightInfo.setWeightUnit("KG");
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("weightInfo", JSONObject.toJSONString(weightInfo));
            packet.setProperties(jsonObject);
            packet.setTimestamp(System.currentTimeMillis());
            topic = ScConstant.TOPIC_MESSAGE_REPORT;
            topic = topic.replace("{${productId}}", device.getProductId()).replace("{deviceId}", device.getDeviceId());
            // topic = "/device/" + header.getProductId() + "/" + device.getDeviceId() + "/message/property/report";
            String message = JSONObject.toJSONString(packet);
            publishService.publishMqttWithTopic(message, topic);
            log.info("----------------------------手动推送MQTT地磅信息---------------------------");
            log.info("-----TOPIC-----{}", topic);
            log.info("-----Message-----{}", message);
        }
        return "SUCCESS";
    }
    /**
     * åœ°ç£…推送测试
     *
     * @return
     */
    @Expose
    public String ajaxTestLpr(GateWayTestParam param) throws Exception {
        //String carNumber = (String) data.get("carNumber");
        // String carNumber = "川A12345";
        String carNumber = param.getCarNumber();
        List<GatewayDevice> list = gatewayDeviceService.listAll();
        if (list == null || list.size() <= 0) {
            log.error("ERROR:没有配置设备信息,执行失败");
            return "ERROR:没有配置设备信息,执行失败";
        }
        List<GatewayDevice> weights = list.stream().filter(s -> (GatewayDeviceType.TYPE_02.getCode().equals(s.getType()))).collect(Collectors.toList());
        if (weights == null || weights.size() <= 0) {
            log.error("ERROR:没有配置设备信息,执行失败");
            return "ERROR:没有配置设备信息,执行失败";
        }
        String topic;
        for (GatewayDevice device : weights) {
            WebSocketPacket packet = new WebSocketPacket();
            //productId的值在webSocket执行发送方法中补充
            WebSocketPacketHeader header = new WebSocketPacketHeader();
            header.setDeviceName(device.getDeviceName());
            header.setProductId(device.getProductId());
            //header.set
            packet.setHeaders(header);
            packet.setMessageType(ScConstant.MESSAGE_TYPE_REPORT_PROPERTY);
            packet.setDeviceId(device.getDeviceId());
            packet.setMessageId(System.currentTimeMillis() + "");
            //设置信息主体
            LprData lpr = new LprData();
            lpr.setDeviceId(device.getDeviceId());
            lpr.setCarNumber(carNumber);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("carNumber", carNumber);
            jsonObject.put("position", "big");
            packet.setProperties(jsonObject);
            packet.setTimestamp(System.currentTimeMillis());
            topic = ScConstant.TOPIC_MESSAGE_REPORT;
            topic = topic.replace("{${productId}}", device.getProductId()).replace("{deviceId}", device.getDeviceId());
            // topic = "/device/" + header.getProductId() + "/" + device.getDeviceId() + "/message/property/report";
            String message = JSONObject.toJSONString(packet);
            publishService.publishMqttWithTopic(message, topic);
            log.info("----------------------------手动推送MQTT车牌识别信息---------------------------");
            log.info("-----TOPIC-----{}", topic);
            log.info("-----Message-----{}", message);
        }
        return "SUCCESS";
    }
}
src/main/java/com/fzzy/gateway/service/DeviceWeightServiceTest.java
ÎļþÒÑɾ³ý
src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java
@@ -1,38 +1,23 @@
package com.fzzy.gateway.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.api.data.GatewayDeviceType;
import com.fzzy.api.utils.ContextUtil;
import com.fzzy.api.utils.DateUtil;
import com.fzzy.async.fzzy40.Fzzy40CommonService;
import com.fzzy.async.fzzy40.entity.Fz40Grain;
import com.fzzy.gateway.GatewayUtils;
import com.fzzy.gateway.api.DeviceReportService;
import com.fzzy.gateway.api.GatewayRemoteManager;
import com.fzzy.gateway.entity.GateWayTestParam;
import com.fzzy.gateway.entity.GatewayDevice;
import com.fzzy.gateway.hx2023.ScConstant;
import com.fzzy.gateway.hx2023.data.*;
import com.fzzy.gateway.service.repository.GatewayDeviceRep;
import com.fzzy.mqtt.MqttProviderConfig;
import com.fzzy.mqtt.MqttPublishService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
@Slf4j
@Component
@@ -40,14 +25,6 @@
    @Resource
    private GatewayDeviceRep gatewayDeviceRep;
    @Resource
    private Fzzy40CommonService fzzy40CommonService;
    @Resource
    private GatewayRemoteManager gatewayRemoteManager;
    @Resource
    private MqttPublishService mqttPublishService;
    @Resource
    private MqttProviderConfig providerClient;
    /**
     * gatewayDeviceService#listAll
@@ -59,20 +36,23 @@
        Sort sort = new Sort(Sort.Direction.ASC, "deviceId");
        return gatewayDeviceRep.findAll(sort);
    }
    /**
     * gatewayDeviceService#getQuery
     * @return
     */
    @DataProvider
    public GateWayTestParam getQuery() {
        GateWayTestParam param = new GateWayTestParam();
        param.setDayTime(new Date());
        param.setCarNumber("川A12345");
        param.setEnd(new Date());
        param.setStart(new Date());
        param.setWeight(25000.00);
        return param;
    }
//    /**
//     * gatewayDeviceService#getQuery
//     *
//     * @return
//     */
//    @DataProvider
//    public GateWayTestParam getQuery() {
//        GateWayTestParam param = new GateWayTestParam();
//        param.setDayTime(new Date());
//        param.setCarNumber("川A12345");
//        param.setEnd(new Date());
//        param.setStart(new Date());
//        param.setWeight(25000.00);
//        return param;
//    }
    /**
     * gatewayDeviceService#updateSave
     *
@@ -117,7 +97,6 @@
        return null;
    }
    public void flushCache() {
        List<GatewayDevice> list = listAll();
        if (null == list || list.isEmpty()) return;
@@ -127,311 +106,9 @@
    }
    /**
     * gatewayDeviceService#ajaxTestWeight
     * åœ°ç£…推送测试
     *
     * @param parameter
     * @return
     */
    @Expose
    public String ajaxTestWeight(Map<String ,Object> parameter) {
        double weigh = (double) parameter.get("weight");
        //sdouble weigh = Math.random() * (35000 - 16000 + 1) + 16000;
        List<GatewayDevice> devices = listAll();
        if (devices == null || devices.size() <= 0) {
            return "没有设备";
        }
        List<GatewayDevice> weights = devices.stream().filter(s -> (GatewayDeviceType.TYPE_01.getCode().equals(s.getType()))).collect(Collectors.toList());
        if (weights == null || weights.size() <= 0) {
            return "没有获取到地磅设备";
        }
        String topic = "/device/hx-weigh-big-01/91511424746940066Y001_91511424746940066Y0010000_002_004_002_001/message/property/report";
        for (GatewayDevice device : weights) {
            WebSocketPacket packet = new WebSocketPacket();
            //productId的值在webSocket执行发送方法中补充
            WebSocketPacketHeader header = new WebSocketPacketHeader();
            header.setDeviceName(device.getDeviceName());
            header.setProductId("hx-weigh-big-01");
            //header.set
            packet.setHeaders(header);
            packet.setMessageType(ScConstant.MESSAGE_TYPE_REPORT_PROPERTY);
            packet.setDeviceId(device.getDeviceId());
            //设置信息主体
            WeightInfo weightInfo = new WeightInfo();
            weightInfo.setGrossWeight(weigh);
            weightInfo.setNetWeight(weigh);
            weightInfo.setNetWeight(weigh);
            weightInfo.setWeightUnit("KG");
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("weightInfo", JSONObject.toJSONString(weightInfo));
            packet.setProperties(jsonObject);
            packet.setTimestamp(System.currentTimeMillis());
            topic = "/device/" + header.getProductId() + "/" + device.getDeviceId() + "/message/property/report";
            mqttPublishService.publishMsg(topic, JSON.toJSONString(packet));
        }
    public String test() {
        log.info("-----------test-------------------");
        return "SUCCESS";
    }
    /**
     * gatewayDeviceService#ajaxTestLpr
     * åœ°ç£…推送测试
     *
     * @return
     */
    @Expose
    public String ajaxTestLpr(Map<String ,Object> parameter) {
        String carNumber = (String) parameter.get("carNumber");
        //String carNumber = "川A12345";
        List<GatewayDevice> devices = listAll();
        if (devices == null || devices.size() <= 0) {
            return "没有设备";
        }
        List<GatewayDevice> weights = devices.stream().filter(s -> (GatewayDeviceType.TYPE_02.getCode().equals(s.getType()))).collect(Collectors.toList());
        if (weights == null || weights.size() <= 0) {
            return "没有获取到设备";
        }
        String topic = "/device/hx-weigh-big-01/91511424746940066Y001_91511424746940066Y0010000_002_004_002_001/message/property/report";
        for (GatewayDevice device : weights) {
            WebSocketPacket packet = new WebSocketPacket();
            //productId的值在webSocket执行发送方法中补充
            WebSocketPacketHeader header = new WebSocketPacketHeader();
            header.setDeviceName(device.getDeviceName());
            header.setProductId("hx-catch-01");
            //header.set
            packet.setHeaders(header);
            packet.setMessageType(ScConstant.MESSAGE_TYPE_REPORT_PROPERTY);
            packet.setDeviceId(device.getDeviceId());
            packet.setMessageId(System.currentTimeMillis() + "");
            //设置信息主体
            LprData lpr = new LprData();
            lpr.setDeviceId(device.getDeviceId());
            lpr.setCarNumber(carNumber);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("carNumber", carNumber);
            jsonObject.put("position", "big");
            packet.setProperties(jsonObject);
            packet.setTimestamp(System.currentTimeMillis());
            topic = "/device/" + header.getProductId() + "/" + device.getDeviceId() + "/message/property/report";
            mqttPublishService.publishMsg(topic, JSON.toJSONString(packet));
        }
        return "SUCCESS";
    }
    /**
     * gatewayDeviceService#ajaxTestGrain
     * ç²®æƒ…推送测试
     *
     * @param parameter
     * @return
     */
    @Expose
    public String ajaxTestGrain(Map<String ,Object> parameter) {
        //获取设备配置,只针对粮情设备进行执行
        List<GatewayDevice> list = this.listAll();
        if (null == list || list.isEmpty()) {
            return "ERROR:为获取到系统中设备配置,取消执行";
        }
        Date dayTime = (Date) parameter.get("dayTime");
        if (null == dayTime) dayTime = new Date();
        Date start = DateUtil.getCurZero(dayTime);
        Date end = DateUtil.getNextZero(dayTime);
        //如果部署FZZY-IGDS-V40版本系统
        return this.pushByV40(list, start, end);
    }
    private String pushByV40(List<GatewayDevice> list, Date start, Date end) {
        String depotIdSys;
        List<Fz40Grain> listGrain;
        Fz40Grain lastData;
        KafaGrainData pushData;
        DeviceReportService deviceReportService = null;
        for (GatewayDevice device : list) {
            depotIdSys = device.getDepotIdSys();
            if (StringUtils.isEmpty(depotIdSys)) {
                log.info("--------设备--{}-未配置系统相关仓库编码,无法执行当前操作", device.getDeviceName());
                continue;
            }
            listGrain = fzzy40CommonService.listGrain(depotIdSys, start, end);
            if (null == listGrain || listGrain.isEmpty()) {
                log.info("---------设备---{}--未同步到粮情信息,请确认当前条件下是否有数据", device.getDeviceName());
                continue;
            }
            //获取最后一条粮情作为当前数据
            lastData = listGrain.get(listGrain.size() - 1);
            pushData = this.lastData2PushData(lastData, device);
            if (null == deviceReportService) {
                deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getProvinceProtocol());
            }
            deviceReportService.pushGrainData2Cloud(pushData);
        }
        return "SUCCESS";
    }
    /**
     * å°†ç²®æƒ…数据转换为推送需要的数据格式
     *
     * @param lastData
     * @return
     */
    private KafaGrainData lastData2PushData(Fz40Grain lastData, GatewayDevice device) {
        KafaGrainData result = new KafaGrainData();
        result.setMessageId(ScConstant.getMessageId());
        result.setMessgeId(result.getMessageId());
        result.setDeviceID(device.getDeviceId());
        result.setAvgTemperature(lastData.getTempAve() + "");
        result.setMinTemperature(lastData.getTempMin() + "");
        result.setMaxTemperature(lastData.getTempMax() + "");
        result.setCollectTime(DateFormatUtils.format(lastData.getReceiveDate(), "yyyy-MM-dd HH:mm:ss"));
        //层-行-列
        String[] attrCable = lastData.getCable().split("-");
        if (StringUtils.isNotEmpty(lastData.getCableCir())) {
            return lastData2PushData2(lastData, device);
        }
        //层行列
        int cableZ = Integer.valueOf(attrCable[0]);
        int cableY = Integer.valueOf(attrCable[1]);
        int cableX = Integer.valueOf(attrCable[2]);
        //温度集合
        String[] attr = lastData.getPoints().split(",");
        //根号
        int cableNum = 1, position = 0;
        String curTemp;
        List<KafkaGrainDataDetail1> temperature = new ArrayList<>();
        int x = 0, y = 0, z = 0;
        for (int i = 0; i < attr.length; i++) {
            position = i;
            z = i % cableZ + 1;
            x = i / (cableZ * cableY);
            y = x * (cableZ * cableY);
            y = (i - y) / cableZ;
            // å€’转Xè½´
            x = cableX - 1 - x;
            //根号
            cableNum = (i / cableZ) + 1;
            curTemp = attr[i];
            //判断最大
            if (curTemp.equals(result.getMaxTemperature())) {
                result.setMaxX(x + "");
                result.setMaxY(y + "");
                result.setMaxZ(position + "");
            }
            //判断最小
            if (curTemp.equals(result.getMinTemperature())) {
                result.setMinX(x + "");
                result.setMinY(y + "");
                result.setMinZ(position + "");
            }
            temperature.add(new KafkaGrainDataDetail1(cableNum + "", z + "", curTemp, position + "", x + "", y + ""));
        }
        //粮温信息
        JSONObject trhInfo = new JSONObject();
        // TRHInfo trhInfo = new TRHInfo();
        trhInfo.put("temperature", temperature);
        //仓温度信息
        KafkaGrainTH grainTH = new KafkaGrainTH();
        grainTH.setHumidity(lastData.getHumidityIn() + "");
        grainTH.setTemperature(lastData.getTempIn() + "");
        grainTH.setAirHumidity(lastData.getHumidityOut() + "");
        grainTH.setAirTemperature(lastData.getTempOut() + "");
        List<KafkaGrainTH> temperatureAndhumidity = new ArrayList<>();
        temperatureAndhumidity.add(grainTH);
        trhInfo.put("temperatureAndhumidity", temperatureAndhumidity);
        //trhInfo.put("temperatureAndhumidity",grainTH);
        JSONObject params = new JSONObject();
        params.put("TRHInfo", trhInfo);
        result.setParams(params);
        return result;
    }
    /**
     * é’ˆå¯¹ç­’仓  TODO -----
     *
     * @param lastData
     * @param device
     * @return
     */
    private KafaGrainData lastData2PushData2(Fz40Grain lastData, GatewayDevice device) {
        return null;
    }
    private int getCurCir(int curRoot, String[] cableRuleAtt) {
        int sum = 0;
        for (int i = 0; i < cableRuleAtt.length; i++) {
            sum += Integer.valueOf(cableRuleAtt[i]);
            if (curRoot <= sum) return i + 1;
        }
        return 1;
    }
}
src/main/java/com/fzzy/gateway/service/GatewayDeviceService2.java
ÎļþÒÑɾ³ý
src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,407 @@
package com.fzzy.gateway.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.api.data.GatewayDeviceType;
import com.fzzy.api.utils.DateUtil;
import com.fzzy.async.fzzy40.Fzzy40CommonService;
import com.fzzy.async.fzzy40.entity.Fz40Grain;
import com.fzzy.gateway.api.DeviceReportService;
import com.fzzy.gateway.api.GatewayRemoteManager;
import com.fzzy.gateway.data.BaseResp;
import com.fzzy.gateway.entity.GatewayDevice;
import com.fzzy.gateway.hx2023.ScConstant;
import com.fzzy.gateway.hx2023.data.*;
import com.fzzy.gateway.service.repository.GatewayDeviceRep;
import com.fzzy.mqtt.MqttGatewayService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 *
 */
@Slf4j
@Component
public class GatewayDeviceTestPR {
    @Resource
    private GatewayDeviceRep gatewayDeviceRep;
//    @Resource
//    private Fzzy40CommonService fzzy40CommonService;
    @Resource
    private GatewayRemoteManager gatewayRemoteManager;
//    @Resource
//    private MqttGatewayService publishService;
    public List<GatewayDevice> listAll() {
        Sort sort = new Sort(Sort.Direction.ASC, "deviceId");
        return gatewayDeviceRep.findAll(sort);
    }
    /**
     * æµ‹è¯•MQTT粮情检测
     * ç²®æƒ…推送测试
     *
     * @param data
     * @return
     */
    @Expose
    public String ajaxTestGrain2(GatewayDevice data) {
        SyncReqData reqData = new SyncReqData();
        reqData.setDevice(data);
        reqData.setAutoReplay(true);
        reqData.setMessageType(ScConstant.MESSAGE_TYPE_INVOKE_FUNCTION);
        reqData.setMessageId(ScConstant.getMessageId());
        reqData.setFunctionId(ScConstant.FUNCTION_getTAndRHInfo);
        if (!GatewayDeviceType.TYPE_07.getCode().equals(data.getType())) {
            return "ERROR:当前设备非粮情设备不支持当前操作";
        }
        if (StringUtils.isEmpty(data.getCableRule())) {
            return "ERROR:当前设备没有配置布线规则,无法执行";
        }
        BaseResp resp = gatewayRemoteManager.getSyncGrainService(data.getSyncProtocol()).syncGrain2(reqData);
        //自动推送
        if (200 == resp.getCode() && reqData.isAutoReplay()) {
            String topic = ScConstant.TOPIC_REPORT;
            topic = topic.replace("${productId}", data.getProductId()).replace("${deviceId}", data.getDeviceId());
          //  publishService.publishMqttWithTopic(resp.getData(), topic);
            log.info("----------------------------手动推送MQTT粮情信息---------------------------");
            log.info("-----TOPIC-----{}", topic);
            log.info("-----Message-----{}", resp.getData());
        }
        return "SUCCESS:执行完成";
    }
    /**
     * ç²®æƒ…推送测试KAFKA方式
     *
     * @param data
     * @return
     */
    @Expose
    public String ajaxTestKafkaGrain(Map<String,Object> data) throws Exception {
        //获取设备配置,只针对粮情设备进行执行
        List<GatewayDevice> list = this.listAll();
        if (null == list || list.isEmpty()) {
            return "ERROR:为获取到系统中设备配置,取消执行";
        }
        Date dayTime = (Date) data.get("dayTime");
        if (null == dayTime) dayTime = new Date();
        Date start = DateUtil.getCurZero(dayTime);
        Date end = DateUtil.getNextZero(dayTime);
        //如果部署FZZY-IGDS-V40版本系统
        return this.pushByV40(list, start, end);
    }
    private String pushByV40(List<GatewayDevice> list, Date start, Date end) {
        String depotIdSys;
        List<Fz40Grain> listGrain;
        Fz40Grain lastData;
        KafaGrainData pushData;
        DeviceReportService deviceReportService = null;
        for (GatewayDevice device : list) {
            depotIdSys = device.getDepotIdSys();
            if (StringUtils.isEmpty(depotIdSys)) {
                log.info("--------设备--{}-未配置系统相关仓库编码,无法执行当前操作", device.getDeviceName());
                continue;
            }
            //TODO ----》
           // listGrain = fzzy40CommonService.listGrain(depotIdSys, start, end);
            listGrain = null;
            if (null == listGrain || listGrain.isEmpty()) {
                log.info("---------设备---{}--未同步到粮情信息,请确认当前条件下是否有数据", device.getDeviceName());
                continue;
            }
            //获取最后一条粮情作为当前数据
            lastData = listGrain.get(listGrain.size() - 1);
            pushData = this.lastData2PushData(lastData, device);
            if (null == deviceReportService) {
                deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getProvinceProtocol());
            }
            deviceReportService.pushGrainData2Cloud(pushData);
        }
        return "SUCCESS";
    }
    /**
     * å°†ç²®æƒ…数据转换为推送需要的数据格式
     *
     * @param lastData
     * @return
     */
    private KafaGrainData lastData2PushData(Fz40Grain lastData, GatewayDevice device) {
        KafaGrainData result = new KafaGrainData();
        result.setMessageId(ScConstant.getMessageId());
        result.setMessgeId(result.getMessageId());
        result.setDeviceID(device.getDeviceId());
        result.setAvgTemperature(lastData.getTempAve() + "");
        result.setMinTemperature(lastData.getTempMin() + "");
        result.setMaxTemperature(lastData.getTempMax() + "");
        result.setCollectTime(DateFormatUtils.format(lastData.getReceiveDate(), "yyyy-MM-dd HH:mm:ss"));
        //层-行-列
        String[] attrCable = lastData.getCable().split("-");
        if (StringUtils.isNotEmpty(lastData.getCableCir())) {
            return lastData2PushData2(lastData, device);
        }
        //层行列
        int cableZ = Integer.valueOf(attrCable[0]);
        int cableY = Integer.valueOf(attrCable[1]);
        int cableX = Integer.valueOf(attrCable[2]);
        //温度集合
        String[] attr = lastData.getPoints().split(",");
        //根号
        int cableNum = 1, position = 0;
        String curTemp;
        List<KafkaGrainDataDetail1> temperature = new ArrayList<>();
        int x = 0, y = 0, z = 0;
        for (int i = 0; i < attr.length; i++) {
            position = i;
            z = i % cableZ + 1;
            x = i / (cableZ * cableY);
            y = x * (cableZ * cableY);
            y = (i - y) / cableZ;
            // å€’转Xè½´
            x = cableX - 1 - x;
            //根号
            cableNum = (i / cableZ) + 1;
            curTemp = attr[i];
            //判断最大
            if (curTemp.equals(result.getMaxTemperature())) {
                result.setMaxX(x + "");
                result.setMaxY(y + "");
                result.setMaxZ(position + "");
            }
            //判断最小
            if (curTemp.equals(result.getMinTemperature())) {
                result.setMinX(x + "");
                result.setMinY(y + "");
                result.setMinZ(position + "");
            }
            temperature.add(new KafkaGrainDataDetail1(cableNum + "", z + "", curTemp, position + "", x + "", y + ""));
        }
        //粮温信息
        JSONObject trhInfo = new JSONObject();
        // TRHInfo trhInfo = new TRHInfo();
        trhInfo.put("temperature", temperature);
        //仓温度信息
        KafkaGrainTH grainTH = new KafkaGrainTH();
        grainTH.setHumidity(lastData.getHumidityIn() + "");
        grainTH.setTemperature(lastData.getTempIn() + "");
        grainTH.setAirHumidity(lastData.getHumidityOut() + "");
        grainTH.setAirTemperature(lastData.getTempOut() + "");
        List<KafkaGrainTH> temperatureAndhumidity = new ArrayList<>();
        temperatureAndhumidity.add(grainTH);
        trhInfo.put("temperatureAndhumidity", temperatureAndhumidity);
        //trhInfo.put("temperatureAndhumidity",grainTH);
        JSONObject params = new JSONObject();
        params.put("TRHInfo", trhInfo);
        result.setParams(params);
        return result;
    }
    /**
     * é’ˆå¯¹ç­’仓  TODO -----
     *
     * @param lastData
     * @param device
     * @return
     */
    private KafaGrainData lastData2PushData2(Fz40Grain lastData, GatewayDevice device) {
        return null;
    }
    /**
     * åœ°ç£…推送测试
     *
     * @param data
     * @return
     */
    @Expose
    public String ajaxTestWeight(Map<String,Object> data) throws Exception {
        double weigh = (double) data.get("weight");
        double deviceId = (double) data.get("deviceId");
        List<GatewayDevice> devices = listAll();
        if (devices == null || devices.size() <= 0) {
            return "ERROR:没有配置设备信息,执行失败";
        }
        List<GatewayDevice> weights = devices.stream().filter(s -> (GatewayDeviceType.TYPE_01.getCode().equals(s.getType()))).collect(Collectors.toList());
        if (weights == null || weights.size() <= 0) {
            return "ERROR:ERROR:没有配置设备信息,执行失败";
        }
        String topic;
        for (GatewayDevice device : weights) {
            WebSocketPacket packet = new WebSocketPacket();
            //productId的值在webSocket执行发送方法中补充
            WebSocketPacketHeader header = new WebSocketPacketHeader();
            header.setDeviceName(device.getDeviceName());
            header.setProductId(device.getProductId());
            //header.set
            packet.setHeaders(header);
            packet.setMessageType(ScConstant.MESSAGE_TYPE_REPORT_PROPERTY);
            packet.setDeviceId(device.getDeviceId());
            //设置信息主体
            WeightInfo weightInfo = new WeightInfo();
            weightInfo.setGrossWeight(weigh);
            weightInfo.setNetWeight(weigh);
            weightInfo.setNetWeight(weigh);
            weightInfo.setWeightUnit("KG");
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("weightInfo", JSONObject.toJSONString(weightInfo));
            packet.setProperties(jsonObject);
            packet.setTimestamp(System.currentTimeMillis());
            topic = ScConstant.TOPIC_MESSAGE_REPORT;
            topic = topic.replace("{${productId}}", device.getProductId()).replace("{deviceId}", device.getDeviceId());
            // topic = "/device/" + header.getProductId() + "/" + device.getDeviceId() + "/message/property/report";
           // publishService.publishMqttWithTopic(JSON.toJSONString(packet), topic);
        }
        return "SUCCESS";
    }
    /**
     * åœ°ç£…推送测试
     *
     * @return
     */
    @Expose
    public String ajaxTestLpr(Map<String,Object> data) throws Exception {
        String carNumber = (String) data.get("carNumber");
       // String carNumber = "川A12345";
        List<GatewayDevice> devices = listAll();
        if (devices == null || devices.size() <= 0) {
            return "ERROR:没有配置设备信息,执行失败";
        }
        List<GatewayDevice> weights = devices.stream().filter(s -> (GatewayDeviceType.TYPE_02.getCode().equals(s.getType()))).collect(Collectors.toList());
        if (weights == null || weights.size() <= 0) {
            return "ERROR:ERROR:没有配置设备信息,执行失败";
        }
        String topic;
        for (GatewayDevice device : weights) {
            WebSocketPacket packet = new WebSocketPacket();
            //productId的值在webSocket执行发送方法中补充
            WebSocketPacketHeader header = new WebSocketPacketHeader();
            header.setDeviceName(device.getDeviceName());
            header.setProductId(device.getProductId());
            //header.set
            packet.setHeaders(header);
            packet.setMessageType(ScConstant.MESSAGE_TYPE_REPORT_PROPERTY);
            packet.setDeviceId(device.getDeviceId());
            packet.setMessageId(System.currentTimeMillis() + "");
            //设置信息主体
            LprData lpr = new LprData();
            lpr.setDeviceId(device.getDeviceId());
            lpr.setCarNumber(carNumber);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("carNumber", carNumber);
            jsonObject.put("position", "big");
            packet.setProperties(jsonObject);
            packet.setTimestamp(System.currentTimeMillis());
            topic = ScConstant.TOPIC_MESSAGE_REPORT;
            topic = topic.replace("{${productId}}", device.getProductId()).replace("{deviceId}", device.getDeviceId());
            // topic = "/device/" + header.getProductId() + "/" + device.getDeviceId() + "/message/property/report";
          //  publishService.publishMqttWithTopic(JSON.toJSONString(packet), topic);
        }
        return "SUCCESS";
    }
    @Expose
    public String test(GatewayDevice data) {
        log.info("-----------test-------------------");
        return "SUCCESS";
    }
}
src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml
@@ -82,37 +82,12 @@
        <Property name="label">粮库系统中库区编码</Property>
      </PropertyDef>
    </DataType>
    <DataType name="dtParam">
      <Property name="creationType">com.fzzy.gateway.entity.GateWayTestParam</Property>
      <PropertyDef name="start">
        <Property name="dataType">DateTime</Property>
      </PropertyDef>
      <PropertyDef name="end">
        <Property name="dataType">DateTime</Property>
      </PropertyDef>
      <PropertyDef name="dayTime">
        <Property name="dataType">DateTime</Property>
        <Property name="label">选择时间</Property>
      </PropertyDef>
      <PropertyDef name="weight">
        <Property name="label">重量</Property>
        <Property name="dataType">Double</Property>
        <Property name="defaultValue">0.0</Property>
      </PropertyDef>
      <PropertyDef name="carNumber">
        <Property name="label">车牌</Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="regionPadding:10">
    <Property name="packages">font-awesome,css-common</Property>
    <DataSet id="dsMain">
      <Property name="dataType">[dtMain]</Property>
      <Property name="dataProvider">gatewayConfService#listAll</Property>
    </DataSet>
    <DataSet id="dsQuery">
      <Property name="dataType">dtParam</Property>
      <Property name="dataProvider">gatewayDeviceService#getQuery</Property>
    </DataSet>
    <ToolBar>
      <ToolBarLabel>
@@ -158,24 +133,6 @@
        <Property name="exClassName">toolbar-button-warn</Property>
      </ToolBarButton>
      <Separator/>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogGrain&quot;).show();</ClientEvent>
        <Property name="caption">粮情推送测试</Property>
        <Property name="iconClass">fa fa-search</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogWeight&quot;).show();</ClientEvent>
        <Property name="caption">地磅推送测试</Property>
        <Property name="iconClass">fa fa-search</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogLpr&quot;).show();</ClientEvent>
        <Property name="caption">车牌识别推送测试</Property>
        <Property name="iconClass">fa fa-search</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <Property name="caption">网关初始化</Property>
        <Property name="iconClass">fa fa-search</Property>
@@ -389,85 +346,9 @@
      </Children>
      <Tools/>
    </Dialog>
    <AjaxAction id="ajaxTestGrain">
      <Property name="service">gatewayDeviceService#ajaxTestGrain</Property>
      <Property name="executingMessage">在努力执行中……</Property>
    </AjaxAction>
    <AjaxAction id="ajaxInit">
      <Property name="service">apiInitService#init</Property>
      <Property name="executingMessage">在努力执行中……</Property>
    </AjaxAction>
    <Dialog id="dialogWeight">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">输入重量</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
view.get(&quot;#ajaxTestWeight&quot;).set(&quot;parameter&quot;,data.toJSON()).execute(function(result){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
    $alert(result);&#xD;
});</ClientEvent>
          <Property name="caption">确定执行</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogWeight&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">weight</Property>
            <Property name="property">weight</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
    <AjaxAction id="ajaxTestWeight">
      <Property name="service">gatewayDeviceService#ajaxTestWeight</Property>
      <Property name="executingMessage">在努力执行中……</Property>
    </AjaxAction>
    <Dialog id="dialogLpr">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">输入车牌</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
console.log(data.toJSON());&#xD;
view.get(&quot;#ajaxTestLpr&quot;).set(&quot;parameter&quot;,data.toJSON()).execute(function(result){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
    $alert(result);&#xD;
});</ClientEvent>
          <Property name="caption">确定执行</Property>
          <Property name="action">updateAction1</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogLpr&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">carNumber</Property>
            <Property name="property">carNumber</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
    <AjaxAction id="ajaxTestLpr">
      <Property name="executingMessage">在努力执行中……</Property>
      <Property name="service">gatewayDeviceService#ajaxTestLpr</Property>
    </AjaxAction>
  </View>
</ViewConfig>
src/main/java/com/fzzy/gateway/view/GatewayDevice-bak.view.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,550 @@
<?xml version="1.0" encoding="UTF-8"?>
<ViewConfig>
  <Arguments/>
  <Context/>
  <Model>
    <DataType name="dtMain">
      <Property name="creationType">com.fzzy.gateway.entity.GatewayDevice</Property>
      <PropertyDef name="id">
        <Property></Property>
        <Property name="label">系统ID</Property>
      </PropertyDef>
      <PropertyDef name="deviceId">
        <Property></Property>
        <Property name="label">设备ID</Property>
        <Property name="required">true</Property>
      </PropertyDef>
      <PropertyDef name="deviceName">
        <Property></Property>
        <Property name="label">设备名称</Property>
        <Property name="required">true</Property>
      </PropertyDef>
      <PropertyDef name="depotName">
        <Property></Property>
        <Property name="label">仓库名称</Property>
      </PropertyDef>
      <PropertyDef name="depotId">
        <Property></Property>
        <Property name="label">所属仓库编码</Property>
      </PropertyDef>
      <PropertyDef name="type">
        <Property></Property>
        <Property name="label">设备类型</Property>
        <Property name="mapping">
          <Property name="keyProperty">code</Property>
          <Property name="valueProperty">name</Property>
          <Property name="mapValues">${dorado.getDataProvider(&quot;apiTriggerService#triggerGatewayDeviceType&quot;).getResult()}</Property>
        </Property>
      </PropertyDef>
      <PropertyDef name="ip">
        <Property></Property>
        <Property name="label">通讯IP</Property>
      </PropertyDef>
      <PropertyDef name="port">
        <Property name="dataType">Integer</Property>
        <Property name="label">通讯端口</Property>
      </PropertyDef>
      <PropertyDef name="rtsp">
        <Property></Property>
        <Property name="label">视频RTSP</Property>
      </PropertyDef>
      <PropertyDef name="provinceProtocol">
        <Property></Property>
        <Property name="label">省平台协议</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;apiTriggerService#triggerPushProtocol&quot;).getResult()}</Property>
          <Property name="keyProperty">code</Property>
          <Property name="valueProperty">name</Property>
        </Property>
        <Property name="required">true</Property>
      </PropertyDef>
      <PropertyDef name="pushProtocol">
        <Property></Property>
        <Property name="label">与系统通讯协议</Property>
        <Property name="mapping">
          <Property name="mapValues">${dorado.getDataProvider(&quot;apiTriggerService#triggerGatewayProtocol&quot;).getResult()}</Property>
          <Property name="keyProperty">code</Property>
          <Property name="valueProperty">name</Property>
        </Property>
        <Property name="required">true</Property>
      </PropertyDef>
      <PropertyDef name="syncProtocol">
        <Property></Property>
        <Property name="label">与设备通讯协议</Property>
        <Property name="mapping">
          <Property name="keyProperty">code</Property>
          <Property name="valueProperty">name</Property>
          <Property name="mapValues">${dorado.getDataProvider(&quot;apiTriggerService#triggerGatewayDeviceProtocol&quot;).getResult()}</Property>
        </Property>
        <Property name="required">true</Property>
      </PropertyDef>
      <PropertyDef name="orgId">
        <Property></Property>
        <Property name="label">组织编码</Property>
      </PropertyDef>
      <PropertyDef name="remark">
        <Property></Property>
        <Property name="label">备注</Property>
      </PropertyDef>
      <PropertyDef name="httpUrl">
        <Property></Property>
        <Property name="label">HTTP地址</Property>
      </PropertyDef>
      <PropertyDef name="deviceSn">
        <Property></Property>
        <Property name="label">设备序列号</Property>
      </PropertyDef>
      <PropertyDef name="serPort">
        <Property name="dataType">int</Property>
        <Property name="label">TCP服务端口</Property>
      </PropertyDef>
      <PropertyDef name="userName">
        <Property></Property>
        <Property name="label">设备用户名</Property>
      </PropertyDef>
      <PropertyDef name="password">
        <Property></Property>
        <Property name="label">设备密码</Property>
      </PropertyDef>
      <PropertyDef name="depotIdSys">
        <Property></Property>
        <Property name="label">自定义仓库编码</Property>
      </PropertyDef>
      <PropertyDef name="productId">
        <Property></Property>
        <Property name="label">设备类型KEY</Property>
      </PropertyDef>
      <PropertyDef name="cableRule">
        <Property></Property>
        <Property name="label">布线规则</Property>
      </PropertyDef>
      <PropertyDef name="cableCir">
        <Property></Property>
        <Property name="label">筒仓层规则</Property>
      </PropertyDef>
    </DataType>
    <DataType name="dtParam" parent="Map">
      <PropertyDef name="start">
        <Property name="dataType">DateTime</Property>
      </PropertyDef>
      <PropertyDef name="end">
        <Property name="dataType">DateTime</Property>
      </PropertyDef>
      <PropertyDef name="dayTime">
        <Property name="dataType">Date</Property>
        <Property name="label">选择时间</Property>
      </PropertyDef>
      <PropertyDef name="weight">
        <Property name="label">重量</Property>
        <Property name="dataType">Double</Property>
        <Property name="defaultValue">0.0</Property>
      </PropertyDef>
      <PropertyDef name="carNumber">
        <Property name="label">车牌</Property>
      </PropertyDef>
      <PropertyDef name="deviceId">
        <Property></Property>
        <Property name="label">设备ID</Property>
        <Property name="required">true</Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="regionPadding:10">
    <Property name="packages">font-awesome,css-common</Property>
    <DataSet id="dsMain">
      <Property name="dataType">[dtMain]</Property>
      <Property name="dataProvider">gatewayDeviceService#listAll</Property>
    </DataSet>
    <DataSet id="dsQuery">
      <ClientEvent name="onReady">self.insert({&#xD;
    weigh:2500,&#xD;
    carNumber:&quot;川A15U7M&quot;&#xD;
});</ClientEvent>
      <Property name="dataType">dtParam</Property>
    </DataSet>
    <ToolBar>
      <ToolBarLabel>
        <Property name="text">工具栏:</Property>
        <Property name="style">
          <Property name="font-weight">bold</Property>
        </Property>
      </ToolBarLabel>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dsMain&quot;).insert();&#xD;
view.get(&quot;#dialogMain&quot;).show();</ClientEvent>
        <Property name="caption">新增</Property>
        <Property name="iconClass">fa fa-plus</Property>
        <Property name="width">90</Property>
        <Property name="exClassName">toolbar-button</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dsMain&quot;).flushAsync();&#xD;
</ClientEvent>
        <Property name="caption">刷新</Property>
        <Property name="iconClass">fa fa-search</Property>
        <Property name="width">100</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">var cur = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
if(cur){&#xD;
    view.get(&quot;#dialogMain&quot;).show();&#xD;
}else{&#xD;
    $alert(&quot;请勾选需要修改的数据!&quot;);&#xD;
}&#xD;
</ClientEvent>
        <Property name="caption">修改</Property>
        <Property name="iconClass">fa fa-pencil</Property>
        <Property name="width">90</Property>
        <Property name="exClassName">toolbar-button-warm</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">var cur = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
view.get(&quot;#ajaxDel&quot;).set(&quot;parameter&quot;,cur).execute(function(result){&#xD;
    if(result){&#xD;
        $alert(result);&#xD;
    } else{&#xD;
        cur.remove();&#xD;
    }&#xD;
});&#xD;
</ClientEvent>
        <Property name="caption">删除</Property>
        <Property name="iconClass">fa fa-minus</Property>
        <Property name="width">90</Property>
        <Property name="exClassName">toolbar-button-warn</Property>
      </ToolBarButton>
      <Separator/>
      <ToolBarButton>
        <ClientEvent name="onClick">var data = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
view.get(&quot;#ajaxTestGrain&quot;).set(&quot;parameter&quot;,data).execute(function(result){&#xD;
    $alert(result);&#xD;
});&#xD;
</ClientEvent>
        <Property name="caption">粮情调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogGrain&quot;).show();</ClientEvent>
        <Property name="caption">kafka粮情推送调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogWeight&quot;).show();</ClientEvent>
        <Property name="caption">地磅调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogLpr&quot;).show();&#xD;
</ClientEvent>
        <Property name="caption">车牌识别调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
    </ToolBar>
    <DataGrid id="dgMain">
      <Property name="dataSet">dsMain</Property>
      <Property name="selectionMode">multiRows</Property>
      <Property name="readOnly">true</Property>
      <RowNumColumn/>
      <DataColumn name="deviceName">
        <Property name="property">deviceName</Property>
      </DataColumn>
      <DataColumn name="type">
        <Property name="property">type</Property>
        <Property name="align">center</Property>
      </DataColumn>
      <DataColumn name="productId">
        <Property name="property">productId</Property>
      </DataColumn>
      <DataColumn name="deviceId">
        <Property name="property">deviceId</Property>
        <Property name="align">center</Property>
        <Property name="width">550</Property>
      </DataColumn>
      <DataColumn name="syncProtocol">
        <Property name="property">syncProtocol</Property>
        <Property name="align">center</Property>
      </DataColumn>
      <DataColumn name="pushProtocol">
        <Property name="property">pushProtocol</Property>
        <Property name="align">center</Property>
      </DataColumn>
    </DataGrid>
    <Dialog id="dialogMain">
      <Property name="width">1300</Property>
      <Property name="caption">设备配置</Property>
      <Property name="iconClass">fa fa-sliders</Property>
      <Property name="closeable">false</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#updateSave&quot;).execute(function(){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
});</ClientEvent>
          <Property name="caption">保存修改</Property>
          <Property name="iconClass">fa fa-check</Property>
          <Property name="exClassName">toolbar-button</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">var cur = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
self.get(&quot;parent&quot;).hide();&#xD;
if(cur) cur.cancel();</ClientEvent>
          <Property name="caption">取消修改</Property>
          <Property name="iconClass">fa fa-times</Property>
          <Property name="exClassName">toolbar-button-warn</Property>
        </Button>
      </Buttons>
      <Children>
        <Container layout="regionPadding:10;padding:10">
          <AutoForm>
            <Property name="dataSet">dsMain</Property>
            <Property name="cols">*,*,*</Property>
            <Property name="labelWidth">125</Property>
            <Property name="labelAlign">right</Property>
            <Property name="labelSeparator">:</Property>
            <Property name="labelPosition">left</Property>
            <AutoFormElement layoutConstraint="colSpan:2">
              <Property name="name">deviceId</Property>
              <Property name="property">deviceId</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">deviceSn</Property>
              <Property name="property">deviceSn</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">deviceName</Property>
              <Property name="property">deviceName</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">type</Property>
              <Property name="property">type</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">productId</Property>
              <Property name="property">productId</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">orgId</Property>
              <Property name="property">orgId</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">depotId</Property>
              <Property name="property">depotId</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">depotIdSys</Property>
              <Property name="property">depotIdSys</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">ip</Property>
              <Property name="property">ip</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">port</Property>
              <Property name="property">port</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">userName</Property>
              <Property name="property">userName</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">password</Property>
              <Property name="property">password</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">provinceProtocol</Property>
              <Property name="property">provinceProtocol</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">pushProtocol</Property>
              <Property name="property">pushProtocol</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">syncProtocol</Property>
              <Property name="property">syncProtocol</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">serPort</Property>
              <Property name="property">serPort</Property>
              <Property name="labelWidth">150</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement layoutConstraint="colSpan:2">
              <Property name="name">rtsp</Property>
              <Property name="property">rtsp</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement layoutConstraint="colSpan:2">
              <Property name="name">httpUrl</Property>
              <Property name="property">httpUrl</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement layoutConstraint="colSpan:3">
              <Property name="name">remark</Property>
              <Property name="property">remark</Property>
              <Property name="editorType">TextArea</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">cableRule</Property>
              <Property name="property">cableRule</Property>
              <Editor/>
            </AutoFormElement>
            <AutoFormElement>
              <Property name="name">cableCir</Property>
              <Property name="property">cableCir</Property>
              <Editor/>
            </AutoFormElement>
          </AutoForm>
        </Container>
      </Children>
      <Tools/>
    </Dialog>
    <UpdateAction id="updateSave">
      <Property name="dataResolver">gatewayDeviceService#updateSave</Property>
      <UpdateItem>
        <Property name="dataPath">[#current]</Property>
        <Property name="dataSet">dsMain</Property>
        <Property name="alias">data</Property>
      </UpdateItem>
    </UpdateAction>
    <AjaxAction id="ajaxDel">
      <Property name="service">gatewayDeviceService#delData</Property>
      <Property name="confirmMessage">确定要删除么?</Property>
    </AjaxAction>
    <AjaxAction id="ajaxTestGrain">
      <Property name="service">gatewayDeviceTestPR#ajaxTestGrain2</Property>
      <Property name="confirmMessage">确定要手动执行粮情么?</Property>
    </AjaxAction>
    <AjaxAction id="ajaxTestKafkaGrain">
      <Property name="service">gatewayDeviceTestPR#ajaxTestKafkaGrain</Property>
      <Property name="executingMessage">在努力执行中……</Property>
      <Property name="confirmMessage">确定要执行么?需要有V4.0系统支持?</Property>
    </AjaxAction>
    <AjaxAction id="ajaxTestLpr">
      <Property name="executingMessage">在努力执行中……</Property>
      <Property name="service">gatewayDeviceTestPR#ajaxTestLpr</Property>
    </AjaxAction>
    <AjaxAction id="ajaxTestWeight">
      <Property name="service">gatewayDeviceTestPR#ajaxTestWeight</Property>
      <Property name="executingMessage">在努力执行中……</Property>
    </AjaxAction>
    <Dialog id="dialogGrain">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">选择条件</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
view.get(&quot;#ajaxTestKafkaGrain&quot;).set(&quot;parameter&quot;,data).execute(function(result){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
    $alert(result);&#xD;
});</ClientEvent>
          <Property name="caption">确定执行</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogGrain&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">dayTime</Property>
            <Property name="property">dayTime</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
    <Dialog id="dialogWeight">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">输入重量</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
var cur = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
data.set(&quot;deviceId&quot;,cur.get(&quot;deviceId&quot;));&#xD;
&#xD;
view.get(&quot;#ajaxTestWeight&quot;).set(&quot;parameter&quot;,data).execute(function(result){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
    $alert(result);&#xD;
});</ClientEvent>
          <Property name="caption">确定执行</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogWeight&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">weight</Property>
            <Property name="property">weight</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
    <Dialog id="dialogLpr">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">输入车牌</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
var cur = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
data.set(&quot;deviceId&quot;,cur.get(&quot;deviceId&quot;));&#xD;
&#xD;
view.get(&quot;#ajaxTestLpr&quot;).set(&quot;parameter&quot;,data).execute(function(result){&#xD;
    self.get(&quot;parent&quot;).hide();&#xD;
    $alert(result);&#xD;
});</ClientEvent>
          <Property name="caption">确定执行</Property>
          <Property name="action">updateAction1</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogLpr&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">carNumber</Property>
            <Property name="property">carNumber</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
  </View>
</ViewConfig>
src/main/java/com/fzzy/gateway/view/GatewayDevice.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
/**
 *
 * @param param
 */
testDevice = function(param){
    $.ajax({
        type:"POST",
        contentType:"application/json;charset=UTF-8",
        url:"/sc2023/gateway/test/deviceTest",
        data:JSON.stringify(param),
        success:function(result){
             $alert(result);
        },
        error:function(result){
             $alert(result);
        }
    })
}
src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml
@@ -123,12 +123,45 @@
        <Property name="label">筒仓层规则</Property>
      </PropertyDef>
    </DataType>
    <DataType name="dtParam" parent="Map">
      <PropertyDef name="start">
        <Property name="dataType">DateTime</Property>
      </PropertyDef>
      <PropertyDef name="end">
        <Property name="dataType">DateTime</Property>
      </PropertyDef>
      <PropertyDef name="dayTime">
        <Property name="dataType">Date</Property>
        <Property name="label">选择时间</Property>
      </PropertyDef>
      <PropertyDef name="weight">
        <Property name="label">重量</Property>
        <Property name="dataType">Double</Property>
        <Property name="defaultValue">0.0</Property>
      </PropertyDef>
      <PropertyDef name="carNumber">
        <Property name="label">车牌</Property>
      </PropertyDef>
      <PropertyDef name="deviceId">
        <Property></Property>
        <Property name="label">设备ID</Property>
        <Property name="required">true</Property>
      </PropertyDef>
    </DataType>
  </Model>
  <View layout="regionPadding:10">
    <Property name="packages">font-awesome,css-common</Property>
    <Property name="styleSheetFile">./static/lib/jquery/jquery-3.4.1.min.js</Property>
    <DataSet id="dsMain">
      <Property name="dataType">[dtMain]</Property>
      <Property name="dataProvider">gatewayDeviceService#listAll</Property>
    </DataSet>
    <DataSet id="dsQuery">
      <ClientEvent name="onReady">self.insert({&#xD;
    weight:2500,&#xD;
    carNumber:&quot;川A15U7M&quot;&#xD;
});</ClientEvent>
      <Property name="dataType">dtParam</Property>
    </DataSet>
    <ToolBar>
      <ToolBarLabel>
@@ -183,19 +216,38 @@
      </ToolBarButton>
      <Separator/>
      <ToolBarButton>
        <ClientEvent name="onClick">var cur = view.get(&quot;#dgMain&quot;).getCurrentItem();&#xD;
view.get(&quot;#ajaxTestGrain&quot;).set(&quot;parameter&quot;,cur).execute(function(result){&#xD;
    $alert(result);&#xD;
});&#xD;
        <ClientEvent name="onClick">view.get(&quot;#dialogGrain&quot;).show();</ClientEvent>
        <Property name="caption">kafka粮情推送调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
var param = {&#xD;
    deviceId:data.get(&quot;deviceId&quot;),&#xD;
    bizType:&quot;testGrain&quot;&#xD;
}&#xD;
testDevice(param);</ClientEvent>
        <Property name="caption">粮情调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogWeight&quot;).show();</ClientEvent>
        <Property name="caption">地磅调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
      <ToolBarButton>
        <ClientEvent name="onClick">view.get(&quot;#dialogLpr&quot;).show();&#xD;
</ClientEvent>
        <Property name="caption">测试粮情</Property>
        <Property name="iconClass">fa fa-minus</Property>
        <Property name="exClassName">toolbar-button-warn</Property>
        <Property name="caption">车牌识别调试</Property>
        <Property name="iconClass">fa fa-wrench</Property>
        <Property name="exClassName">toolbar-button-push</Property>
      </ToolBarButton>
    </ToolBar>
    <DataGrid id="dgMain">
      <Property name="dataSet">dsMain</Property>
      <Property name="selectionMode">multiRows</Property>
      <Property name="readOnly">true</Property>
      <RowNumColumn/>
      <DataColumn name="deviceName">
@@ -367,7 +419,7 @@
      <Tools/>
    </Dialog>
    <UpdateAction id="updateSave">
      <Property name="dataResolver">gatewayDeviceService2#updateSave</Property>
      <Property name="dataResolver">gatewayDeviceService#updateSave</Property>
      <UpdateItem>
        <Property name="dataPath">[#current]</Property>
        <Property name="dataSet">dsMain</Property>
@@ -378,9 +430,108 @@
      <Property name="service">gatewayDeviceService#delData</Property>
      <Property name="confirmMessage">确定要删除么?</Property>
    </AjaxAction>
    <AjaxAction id="ajaxTestGrain">
      <Property name="service">gatewayDeviceService2#ajaxTestGrain2</Property>
      <Property name="confirmMessage">确定要手动执行粮情么?</Property>
    </AjaxAction>
    <Dialog id="dialogGrain">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">选择条件</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
var query = view.get(&quot;#dsQuery.data&quot;);&#xD;
var param = {&#xD;
    deviceId:data.get(&quot;deviceId&quot;),&#xD;
    dayTime:query.get(&quot;dayTime&quot;),&#xD;
    bizType:&quot;ajaxTestKafkaGrain&quot;&#xD;
}&#xD;
testDevice(param);</ClientEvent>
          <Property name="caption">确定执行</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogGrain&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">dayTime</Property>
            <Property name="property">dayTime</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
    <Dialog id="dialogWeight">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">输入重量</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
var query = view.get(&quot;#dsQuery.data&quot;);&#xD;
var param = {&#xD;
    deviceId:data.get(&quot;deviceId&quot;),&#xD;
    weight:query.get(&quot;weight&quot;),&#xD;
    bizType:&quot;ajaxTestWeight&quot;&#xD;
}&#xD;
testDevice(param);</ClientEvent>
          <Property name="caption">确定执行</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogWeight&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">weight</Property>
            <Property name="property">weight</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
    <Dialog id="dialogLpr">
      <Property name="width">400</Property>
      <Property name="height">300</Property>
      <Property name="caption">输入车牌</Property>
      <Buttons>
        <Button>
          <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
var query = view.get(&quot;#dsQuery.data&quot;);&#xD;
var param = {&#xD;
    deviceId:data.get(&quot;deviceId&quot;),&#xD;
    carNumber:query.get(&quot;carNumber&quot;),&#xD;
    bizType:&quot;ajaxTestLpr&quot;&#xD;
}&#xD;
testDevice(param);</ClientEvent>
          <Property name="caption">确定执行</Property>
          <Property name="action">updateAction1</Property>
        </Button>
        <Button>
          <ClientEvent name="onClick">view.get(&quot;#dialogLpr&quot;).hide();</ClientEvent>
          <Property name="caption">取消执行</Property>
        </Button>
      </Buttons>
      <Children>
        <AutoForm>
          <Property name="dataSet">dsQuery</Property>
          <Property name="cols">*</Property>
          <AutoFormElement>
            <Property name="name">carNumber</Property>
            <Property name="property">carNumber</Property>
            <Editor/>
          </AutoFormElement>
        </AutoForm>
      </Children>
      <Tools/>
    </Dialog>
  </View>
</ViewConfig>
velocity.log