From eebab358e2882fc7e3aeec152db5151a6bd0be02 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期四, 09 十一月 2023 17:24:39 +0800 Subject: [PATCH] 重新调整测试页面 --- src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java | 407 ++++++++++ src/main/java/com/fzzy/gateway/hx2023/controller/GatewayDeviceTestController.java | 445 +++++++++++ src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java | 363 -------- src/main/java/com/fzzy/gateway/entity/GateWayTestParam.java | 6 src/main/java/com/fzzy/Application.java | 1 velocity.log | 0 src/main/java/com/fzzy/gateway/hx2023/ScConstant.java | 5 src/main/java/com/fzzy/gateway/view/GatewayDevice-bak.view.xml | 550 ++++++++++++++ src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml | 177 ++++ pom.xml | 11 src/main/java/com/fzzy/gateway/view/GatewayDevice.js | 18 /dev/null | 126 --- .rules | 80 +- src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml | 119 --- 14 files changed, 1,658 insertions(+), 650 deletions(-) diff --git a/.rules b/.rules index 57b823c..1cc2689 100644 --- a/.rules +++ b/.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"/> diff --git a/pom.xml b/pom.xml index dbf365c..42d0362 100644 --- a/pom.xml +++ b/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> diff --git a/src/main/java/com/fzzy/Application.java b/src/main/java/com/fzzy/Application.java index 6f9f2e6..c691174 100644 --- a/src/main/java/com/fzzy/Application.java +++ b/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; diff --git a/src/main/java/com/fzzy/gateway/entity/GateWayTestParam.java b/src/main/java/com/fzzy/gateway/entity/GateWayTestParam.java index 0dac24d..48c2ba5 100644 --- a/src/main/java/com/fzzy/gateway/entity/GateWayTestParam.java +++ b/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; } diff --git a/src/main/java/com/fzzy/gateway/hx2023/ScConstant.java b/src/main/java/com/fzzy/gateway/hx2023/ScConstant.java index 03b0885..72ad561 100644 --- a/src/main/java/com/fzzy/gateway/hx2023/ScConstant.java +++ b/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"; + } diff --git a/src/main/java/com/fzzy/gateway/hx2023/controller/GatewayDeviceTestController.java b/src/main/java/com/fzzy/gateway/hx2023/controller/GatewayDeviceTestController.java new file mode 100644 index 0000000..9930cbd --- /dev/null +++ b/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("----------------------------鎵嬪姩鎺ㄩ�丮QTT绮儏淇℃伅---------------------------"); + log.info("-----TOPIC-----{}", topic); + log.info("-----Message-----{}", resp.getData()); + + } + + return "SUCCESS锛氭墽琛屽畬鎴�"; + } + + + /** + * 绮儏鎺ㄩ�佹祴璇昁AFKA鏂瑰紡 + * + * @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锛欵RROR锛氭病鏈夐厤缃澶囦俊鎭紝鎵ц澶辫触"; + } + + 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("----------------------------鎵嬪姩鎺ㄩ�丮QTT鍦扮淇℃伅---------------------------"); + 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 = "宸滱12345"; + 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("----------------------------鎵嬪姩鎺ㄩ�丮QTT杞︾墝璇嗗埆淇℃伅---------------------------"); + log.info("-----TOPIC-----{}", topic); + log.info("-----Message-----{}", message); + + } + return "SUCCESS"; + } +} diff --git a/src/main/java/com/fzzy/gateway/service/DeviceWeightServiceTest.java b/src/main/java/com/fzzy/gateway/service/DeviceWeightServiceTest.java deleted file mode 100644 index bff7ee5..0000000 --- a/src/main/java/com/fzzy/gateway/service/DeviceWeightServiceTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.fzzy.gateway.service; - - -import com.fzzy.api.data.GatewayDeviceProtocol; -import com.fzzy.gateway.api.GatewaySyncWeightService; -import com.fzzy.gateway.hx2023.data.SyncReqData; -import com.fzzy.gateway.hx2023.data.WeightInfo; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - - -/** - * 璁惧榛樿鍗忚锛屼粈涔堥兘涓嶅仛 - */ -@Slf4j -@Component -public class DeviceWeightServiceTest implements GatewaySyncWeightService { - - - @Override - public String getWeightProtocol() { - return GatewayDeviceProtocol.DEVICE_TEST.getCode(); - } - - @Override - public WeightInfo syncWeightInfo(SyncReqData reqData) { - - log.info("----------DO NOTHING---------"); - return null; - } -} diff --git a/src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java b/src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java index cd59c8f..2210aed 100644 --- a/src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java +++ b/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("宸滱12345"); - 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("宸滱12345"); +// 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 = "宸滱12345"; - 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; - } - } diff --git a/src/main/java/com/fzzy/gateway/service/GatewayDeviceService2.java b/src/main/java/com/fzzy/gateway/service/GatewayDeviceService2.java deleted file mode 100644 index f30ac51..0000000 --- a/src/main/java/com/fzzy/gateway/service/GatewayDeviceService2.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.fzzy.gateway.service; - -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.gateway.GatewayUtils; -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.SyncReqData; -import com.fzzy.gateway.service.repository.GatewayDeviceRep; -import com.fzzy.mqtt.MqttGatewayService; -import com.fzzy.mqtt.MqttProviderConfig; -import com.fzzy.mqtt.MqttPublishService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.data.domain.Sort; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.List; - -@Slf4j -@Component -public class GatewayDeviceService2 { - - @Resource - private GatewayDeviceRep gatewayDeviceRep; - - @Resource - private GatewayRemoteManager gatewayRemoteManager; - @Resource - private MqttGatewayService publishService; - - public List<GatewayDevice> listAll() { - Sort sort = new Sort(Sort.Direction.ASC, "deviceId"); - return gatewayDeviceRep.findAll(sort); - } - - - /** - * gatewayDeviceService2#updateSave - * - * @param data - */ - @DataResolver - public void updateSave(GatewayDevice data) { - GatewayDevice data2 = new GatewayDevice(); - BeanUtils.copyProperties(data, data2); - - if (null == data2.getDeviceSn()) { - if (null != data2.getIp()) { - data.setDeviceSn(data2.getIp()); - } else { - data.setDeviceSn(data2.getDeviceId()); - } - } - - if (null == data2.getId()) { - data2.setId(ContextUtil.getUUID()); - gatewayDeviceRep.save(data2); - } else { - gatewayDeviceRep.save(data2); - } - flushCache(); - } - - public void flushCache() { - List<GatewayDevice> list = listAll(); - if (null == list || list.isEmpty()) return; - for (GatewayDevice device : list) { - GatewayUtils.add2Cache(device); - } - } - - - /** - * 娴嬭瘯MQTT绮儏妫�娴� - * gatewayDeviceService#ajaxTestGrain2 - * 绮儏鎺ㄩ�佹祴璇� - * - * @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("----------------------------鎵嬪姩鎺ㄩ�丮QTT绮儏淇℃伅---------------------------"); - log.info("-----TOPIC-----{}",topic); - log.info("-----Message-----{}",resp.getData()); - - } - - return "SUCCESS锛氭墽琛屽畬鎴�"; - } - -} diff --git a/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java b/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java new file mode 100644 index 0000000..44e8349 --- /dev/null +++ b/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("----------------------------鎵嬪姩鎺ㄩ�丮QTT绮儏淇℃伅---------------------------"); + log.info("-----TOPIC-----{}", topic); + log.info("-----Message-----{}", resp.getData()); + + } + + return "SUCCESS锛氭墽琛屽畬鎴�"; + } + + + /** + * 绮儏鎺ㄩ�佹祴璇昁AFKA鏂瑰紡 + * + * @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锛欵RROR锛氭病鏈夐厤缃澶囦俊鎭紝鎵ц澶辫触"; + } + + 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 = "宸滱12345"; + + 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锛欵RROR锛氭病鏈夐厤缃澶囦俊鎭紝鎵ц澶辫触"; + } + + 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"; + } + +} diff --git a/src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml b/src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml index 3e6254f..4f26326 100644 --- a/src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml +++ b/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("#dialogGrain").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("#dialogWeight").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("#dialogLpr").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("#dsQuery.data");
 -view.get("#ajaxTestWeight").set("parameter",data.toJSON()).execute(function(result){
 - self.get("parent").hide();
 - $alert(result);
 -});</ClientEvent> - <Property name="caption">纭畾鎵ц</Property> - </Button> - <Button> - <ClientEvent name="onClick">view.get("#dialogWeight").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("#dsQuery.data");
 -console.log(data.toJSON());
 -view.get("#ajaxTestLpr").set("parameter",data.toJSON()).execute(function(result){
 - self.get("parent").hide();
 - $alert(result);
 -});</ClientEvent> - <Property name="caption">纭畾鎵ц</Property> - <Property name="action">updateAction1</Property> - </Button> - <Button> - <ClientEvent name="onClick">view.get("#dialogLpr").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> diff --git a/src/main/java/com/fzzy/gateway/view/GatewayDevice-bak.view.xml b/src/main/java/com/fzzy/gateway/view/GatewayDevice-bak.view.xml new file mode 100644 index 0000000..448af1f --- /dev/null +++ b/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("apiTriggerService#triggerGatewayDeviceType").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("apiTriggerService#triggerPushProtocol").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("apiTriggerService#triggerGatewayProtocol").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("apiTriggerService#triggerGatewayDeviceProtocol").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({
 + weigh:2500,
 + carNumber:"宸滱15U7M"
 +});</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("#dsMain").insert();
 +view.get("#dialogMain").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("#dsMain").flushAsync();
 +</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("#dgMain").getCurrentItem();
 +if(cur){
 + view.get("#dialogMain").show();
 +}else{
 + $alert("璇峰嬀閫夐渶瑕佷慨鏀圭殑鏁版嵁锛�");
 +}
 +</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("#dgMain").getCurrentItem();
 +view.get("#ajaxDel").set("parameter",cur).execute(function(result){
 + if(result){
 + $alert(result);
 + } else{
 + cur.remove();
 + }
 +});
 +</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("#dgMain").getCurrentItem();
 +view.get("#ajaxTestGrain").set("parameter",data).execute(function(result){
 + $alert(result);
 +});
 +</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("#dialogGrain").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("#dialogWeight").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("#dialogLpr").show();
 +</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("#updateSave").execute(function(){
 + self.get("parent").hide();
 +});</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("#dgMain").getCurrentItem();
 +self.get("parent").hide();
 +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("#dsQuery.data");
 +view.get("#ajaxTestKafkaGrain").set("parameter",data).execute(function(result){
 + self.get("parent").hide();
 + $alert(result);
 +});</ClientEvent> + <Property name="caption">纭畾鎵ц</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dialogGrain").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("#dsQuery.data");
 +var cur = view.get("#dgMain").getCurrentItem();
 +data.set("deviceId",cur.get("deviceId"));
 +
 +view.get("#ajaxTestWeight").set("parameter",data).execute(function(result){
 + self.get("parent").hide();
 + $alert(result);
 +});</ClientEvent> + <Property name="caption">纭畾鎵ц</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dialogWeight").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("#dsQuery.data");
 +var cur = view.get("#dgMain").getCurrentItem();
 +data.set("deviceId",cur.get("deviceId"));
 +
 +view.get("#ajaxTestLpr").set("parameter",data).execute(function(result){
 + self.get("parent").hide();
 + $alert(result);
 +});</ClientEvent> + <Property name="caption">纭畾鎵ц</Property> + <Property name="action">updateAction1</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dialogLpr").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> diff --git a/src/main/java/com/fzzy/gateway/view/GatewayDevice.js b/src/main/java/com/fzzy/gateway/view/GatewayDevice.js new file mode 100644 index 0000000..0cd48e7 --- /dev/null +++ b/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); + } + }) +} \ No newline at end of file diff --git a/src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml b/src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml index 75ba1bf..d56a8b3 100644 --- a/src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml +++ b/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({
 + weight:2500,
 + carNumber:"宸滱15U7M"
 +});</ClientEvent> + <Property name="dataType">dtParam</Property> </DataSet> <ToolBar> <ToolBarLabel> @@ -183,19 +216,38 @@ </ToolBarButton> <Separator/> <ToolBarButton> - <ClientEvent name="onClick">var cur = view.get("#dgMain").getCurrentItem();
 -view.get("#ajaxTestGrain").set("parameter",cur).execute(function(result){
 - $alert(result);
 -});
 + <ClientEvent name="onClick">view.get("#dialogGrain").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("#dsMain.data:#");
 +var param = {
 + deviceId:data.get("deviceId"),
 + bizType:"testGrain"
 +}
 +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("#dialogWeight").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("#dialogLpr").show();
 </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("#dsMain.data:#");
 +var query = view.get("#dsQuery.data");
 +var param = {
 + deviceId:data.get("deviceId"),
 + dayTime:query.get("dayTime"),
 + bizType:"ajaxTestKafkaGrain"
 +}
 +testDevice(param);</ClientEvent> + <Property name="caption">纭畾鎵ц</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dialogGrain").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("#dsMain.data:#");
 +var query = view.get("#dsQuery.data");
 +var param = {
 + deviceId:data.get("deviceId"),
 + weight:query.get("weight"),
 + bizType:"ajaxTestWeight"
 +}
 +testDevice(param);</ClientEvent> + <Property name="caption">纭畾鎵ц</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dialogWeight").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("#dsMain.data:#");
 +var query = view.get("#dsQuery.data");
 +var param = {
 + deviceId:data.get("deviceId"),
 + carNumber:query.get("carNumber"),
 + bizType:"ajaxTestLpr"
 +}
 +testDevice(param);</ClientEvent> + <Property name="caption">纭畾鎵ц</Property> + <Property name="action">updateAction1</Property> + </Button> + <Button> + <ClientEvent name="onClick">view.get("#dialogLpr").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> diff --git a/velocity.log b/velocity.log new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/velocity.log -- Gitblit v1.9.3