#update
This commit is contained in:
117
.idea/workspace.xml
generated
117
.idea/workspace.xml
generated
@@ -6,16 +6,21 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="84ac1b15-3cfa-4375-9957-45b7b581d04e" name="Changes" comment="# commit">
|
<list default="true" id="84ac1b15-3cfa-4375-9957-45b7b581d04e" name="Changes" comment="# commit">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-debug.2026-04-28.log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-debug.log" beforeDir="false" afterPath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-debug.log" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-error.2026-04-28.log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-error.log" beforeDir="false" afterPath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-error.log" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-info.2026-04-28.log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-info.log" beforeDir="false" afterPath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-info.log" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-user.2026-04-28.log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-user.2026-04-29.log" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-user.log" beforeDir="false" afterPath="$PROJECT_DIR$/log.path_IS_UNDEFINED/sys-user.log" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/resources/application-dev.yml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/maibu-admin/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-admin/src/main/resources/application-dev.yml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/business/Device.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/business/Device.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/controller/UAVController.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/controller/UAVController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/dto/UavDeviceStateResponseDetailDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/dto/UavDeviceStateResponseDetailDTO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/service/UAVService.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/service/UAVService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-framework/src/main/java/com/maibu/config/SecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-framework/src/main/java/com/maibu/config/SecurityConfig.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/NettyServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/NettyServer.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/handler/DeviceConnectHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/handler/DeviceConnectHandler.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/handler/HeaderFooterDecoder.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/handler/HeaderFooterDecoder.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/handler/HexEncoder.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-netty-server/src/main/java/com/maibu/netty/handler/HexEncoder.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/DeviceController.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller/DeviceController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/IDeviceService.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/IDeviceService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl/DeviceServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl/DeviceServiceImpl.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/resources/mapper/iot/DeviceMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/resources/mapper/iot/DeviceMapper.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/maibu-web-middleware/src/main/java/com/maibu/common/MiddleConstant.java" beforeDir="false" afterPath="$PROJECT_DIR$/maibu-web-middleware/src/main/java/com/maibu/common/MiddleConstant.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -94,10 +99,10 @@
|
|||||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
||||||
"Spring Boot.MiddlePlatformApplication.executor": "Run",
|
"Spring Boot.MiddlePlatformApplication.executor": "Debug",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "/home/maibu/Test/MiddlePlatform/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller",
|
"last_opened_file_path": "/home/maibu/Test/MiddlePlatform/maibu-external/src/main/java/com/maibu/uav",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
@@ -116,7 +121,7 @@
|
|||||||
<window_info id="Commit_Guest" show_stripe_button="false" />
|
<window_info id="Commit_Guest" show_stripe_button="false" />
|
||||||
<window_info id="Pull Requests" />
|
<window_info id="Pull Requests" />
|
||||||
<window_info id="Learn" show_stripe_button="false" />
|
<window_info id="Learn" show_stripe_button="false" />
|
||||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2463386" />
|
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.23286468" />
|
||||||
<window_info id="Commit" order="1" weight="0.2463386" />
|
<window_info id="Commit" order="1" weight="0.2463386" />
|
||||||
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
|
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Database Changes" />
|
<window_info anchor="bottom" id="Database Changes" />
|
||||||
@@ -124,16 +129,16 @@
|
|||||||
<window_info anchor="bottom" id="Profiler" />
|
<window_info anchor="bottom" id="Profiler" />
|
||||||
<window_info anchor="bottom" id="TODO" />
|
<window_info anchor="bottom" id="TODO" />
|
||||||
<window_info anchor="bottom" id="File Transfer" />
|
<window_info anchor="bottom" id="File Transfer" />
|
||||||
<window_info active="true" anchor="bottom" id="Version Control" order="0" visible="true" weight="0.36555445" />
|
<window_info anchor="bottom" id="Version Control" order="0" weight="0.37634936" />
|
||||||
<window_info anchor="bottom" id="Problems" order="1" />
|
<window_info anchor="bottom" id="Problems" order="1" />
|
||||||
<window_info anchor="bottom" id="Problems View" order="2" weight="0.5019627" />
|
<window_info anchor="bottom" id="Problems View" order="2" weight="0.5019627" />
|
||||||
<window_info anchor="bottom" id="Terminal" order="3" />
|
<window_info anchor="bottom" id="Terminal" order="3" />
|
||||||
<window_info anchor="bottom" id="Services" order="4" />
|
<window_info anchor="bottom" id="Services" order="4" />
|
||||||
<window_info anchor="bottom" id="SQL Generator" order="5" weight="0.4044193" />
|
<window_info anchor="bottom" id="SQL Generator" order="5" weight="0.4044193" />
|
||||||
<window_info anchor="bottom" id="Build" order="5" weight="0.3302257" />
|
<window_info anchor="bottom" id="Build" order="5" weight="0.3302257" />
|
||||||
<window_info active="true" anchor="bottom" id="Run" order="6" visible="true" weight="0.36555445" />
|
<window_info active="true" anchor="bottom" id="Run" order="6" visible="true" weight="0.3498528" />
|
||||||
<window_info anchor="bottom" id="Find" order="7" weight="0.3302257" />
|
<window_info anchor="bottom" id="Find" order="7" weight="0.3302257" />
|
||||||
<window_info anchor="bottom" id="Debug" order="8" weight="0.36555445" />
|
<window_info anchor="bottom" id="Debug" order="8" weight="0.3498528" />
|
||||||
<window_info anchor="right" id="PR AI Assistant" />
|
<window_info anchor="right" id="PR AI Assistant" />
|
||||||
<window_info anchor="right" id="Endpoints" />
|
<window_info anchor="right" id="Endpoints" />
|
||||||
<window_info anchor="right" id="documentation.v2" show_stripe_button="false" side_tool="true" />
|
<window_info anchor="right" id="documentation.v2" show_stripe_button="false" side_tool="true" />
|
||||||
@@ -148,18 +153,18 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
|
<recent name="$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav" />
|
||||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller" />
|
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/controller" />
|
||||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl" />
|
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl" />
|
||||||
<recent name="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/business/dto" />
|
<recent name="$PROJECT_DIR$/maibu-common/src/main/java/com/maibu/core/business/dto" />
|
||||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service" />
|
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service" />
|
||||||
<recent name="$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/mapper" />
|
|
||||||
</key>
|
</key>
|
||||||
<key name="CopyClassDialog.RECENTS_KEY">
|
<key name="CopyClassDialog.RECENTS_KEY">
|
||||||
<recent name="com.maibu.web.controller.system" />
|
<recent name="com.maibu.core.business.dto" />
|
||||||
<recent name="com.maibu.controller" />
|
<recent name="com.maibu.uav.dto" />
|
||||||
<recent name="com.maibu.core.business" />
|
<recent name="com.maibu.uav.controller" />
|
||||||
<recent name="com.maibu.memory" />
|
<recent name="com.maibu.mapper" />
|
||||||
<recent name="com.maibu.service" />
|
<recent name="com.maibu.core.business.uav" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Spring Boot.MiddlePlatformApplication">
|
<component name="RunManager" selected="Spring Boot.MiddlePlatformApplication">
|
||||||
@@ -280,7 +285,15 @@
|
|||||||
<workItem from="1778656021238" duration="1535000" />
|
<workItem from="1778656021238" duration="1535000" />
|
||||||
<workItem from="1778658354887" duration="2629000" />
|
<workItem from="1778658354887" duration="2629000" />
|
||||||
<workItem from="1778660995906" duration="54560000" />
|
<workItem from="1778660995906" duration="54560000" />
|
||||||
<workItem from="1779237276134" duration="3842000" />
|
<workItem from="1779237276134" duration="8298000" />
|
||||||
|
<workItem from="1779259345649" duration="16809000" />
|
||||||
|
<workItem from="1779338615819" duration="4772000" />
|
||||||
|
<workItem from="1779343892766" duration="11256000" />
|
||||||
|
<workItem from="1779409886768" duration="28176000" />
|
||||||
|
<workItem from="1779670470757" duration="9341000" />
|
||||||
|
<workItem from="1779683678663" duration="17250000" />
|
||||||
|
<workItem from="1779755672380" duration="9935000" />
|
||||||
|
<workItem from="1779770107645" duration="17442000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="#update">
|
<task id="LOCAL-00001" summary="#update">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -522,7 +535,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1779241701909</updated>
|
<updated>1779241701909</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="31" />
|
<task id="LOCAL-00031" summary="# commit">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1779242181619</created>
|
||||||
|
<option name="number" value="00031" />
|
||||||
|
<option name="presentableId" value="LOCAL-00031" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1779242181619</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="32" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -627,11 +648,6 @@
|
|||||||
<line>166</line>
|
<line>166</line>
|
||||||
<option name="timeStamp" value="18" />
|
<option name="timeStamp" value="18" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
|
||||||
<url>file://$PROJECT_DIR$/maibu-framework/src/main/java/com/maibu/web/exception/GlobalExceptionHandler.java</url>
|
|
||||||
<line>34</line>
|
|
||||||
<option name="timeStamp" value="19" />
|
|
||||||
</line-breakpoint>
|
|
||||||
<line-breakpoint enabled="true" type="java-line">
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
<url>file://$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysMenuController.java</url>
|
<url>file://$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysMenuController.java</url>
|
||||||
<line>127</line>
|
<line>127</line>
|
||||||
@@ -652,6 +668,51 @@
|
|||||||
<line>112</line>
|
<line>112</line>
|
||||||
<option name="timeStamp" value="34" />
|
<option name="timeStamp" value="34" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-web-middleware/src/main/java/com/maibu/netty/handler/ClientHandler.java</url>
|
||||||
|
<line>108</line>
|
||||||
|
<option name="timeStamp" value="39" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-web-middleware/src/main/java/com/maibu/netty/handler/ClientHandler.java</url>
|
||||||
|
<line>114</line>
|
||||||
|
<option name="timeStamp" value="40" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-webrtc-server/src/main/java/com/maibu/service/impl/PlaySessionServiceImpl.java</url>
|
||||||
|
<line>26</line>
|
||||||
|
<option name="timeStamp" value="41" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/service/UAVService.java</url>
|
||||||
|
<line>651</line>
|
||||||
|
<option name="timeStamp" value="45" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/service/UAVService.java</url>
|
||||||
|
<line>640</line>
|
||||||
|
<option name="timeStamp" value="46" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-external/src/main/java/com/maibu/uav/service/UAVService.java</url>
|
||||||
|
<line>642</line>
|
||||||
|
<option name="timeStamp" value="47" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl/DeviceServiceImpl.java</url>
|
||||||
|
<line>234</line>
|
||||||
|
<option name="timeStamp" value="51" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl/DeviceServiceImpl.java</url>
|
||||||
|
<line>247</line>
|
||||||
|
<option name="timeStamp" value="52" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="java-line">
|
||||||
|
<url>file://$PROJECT_DIR$/maibu-service/maibu-iot-service/src/main/java/com/maibu/service/impl/DeviceServiceImpl.java</url>
|
||||||
|
<line>282</line>
|
||||||
|
<option name="timeStamp" value="61" />
|
||||||
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="java-method">
|
<line-breakpoint enabled="true" type="java-method">
|
||||||
<url>file://$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysQrCodeController.java</url>
|
<url>file://$PROJECT_DIR$/maibu-admin/src/main/java/com/maibu/web/controller/system/SysQrCodeController.java</url>
|
||||||
<line>75</line>
|
<line>75</line>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ spring:
|
|||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/maibu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/maibu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: satabot
|
username: fastbee
|
||||||
password: satabot
|
password: maibu520
|
||||||
|
|
||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.maibu.core.business;
|
package com.maibu.core.business;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.maibu.annotation.Excel;
|
import com.maibu.annotation.Excel;
|
||||||
@@ -71,13 +68,6 @@ public class Device extends BaseDO {
|
|||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户ID
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("租户ID")
|
|
||||||
@Excel(name = "租户ID")
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户名称
|
* 租户名称
|
||||||
*/
|
*/
|
||||||
@@ -100,11 +90,6 @@ public class Device extends BaseDO {
|
|||||||
@Excel(name = "HTTP推送固件版本")
|
@Excel(name = "HTTP推送固件版本")
|
||||||
private BigDecimal wirelessVersion;
|
private BigDecimal wirelessVersion;
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备类型(1-直连设备、2-网关设备、3-监控设备)
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("设备类型(1-直连设备、2-网关设备、3-监控设备 4-网关子设备)")
|
|
||||||
private Integer deviceType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
* 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
||||||
@@ -204,22 +189,7 @@ public class Device extends BaseDO {
|
|||||||
@ApiModelProperty("设备摘要")
|
@ApiModelProperty("设备摘要")
|
||||||
private String summary;
|
private String summary;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组ID,用于分组查询
|
|
||||||
**/
|
|
||||||
@ApiModelProperty("分组ID,用于分组查询")
|
|
||||||
private Long groupId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否设备所有者,用于查询
|
|
||||||
**/
|
|
||||||
@ApiModelProperty("是否设备所有者,用于查询")
|
|
||||||
private Integer isOwner;
|
|
||||||
/**
|
|
||||||
* 子设备数量
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("子设备数量")
|
|
||||||
private Integer subDeviceCount;
|
|
||||||
/**
|
/**
|
||||||
* 是否是模拟设备
|
* 是否是模拟设备
|
||||||
*/
|
*/
|
||||||
@@ -230,32 +200,21 @@ public class Device extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("子设备地址")
|
@ApiModelProperty("子设备地址")
|
||||||
private Integer slaveId;
|
private Integer slaveId;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Long siteId;
|
||||||
|
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Long orgId;
|
||||||
/**
|
/**
|
||||||
* 设备传输协议
|
* 租户ID
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("设备传输协议")
|
@ApiModelProperty("租户ID")
|
||||||
private String transport;
|
@Excel(name = "租户ID")
|
||||||
//
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
// @Transient
|
private Long tenantId;
|
||||||
// @ApiModelProperty("机构id")
|
|
||||||
// private Long deptId;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
@ApiModelProperty("是否显示下级")
|
|
||||||
private Boolean showChild;
|
|
||||||
|
|
||||||
private List<Device> subDeviceList;
|
|
||||||
|
|
||||||
|
|
||||||
private Long orgId; //组织id
|
|
||||||
|
|
||||||
private Long siteId; //场站id
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 协议
|
|
||||||
*/
|
|
||||||
private String protocolCode;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private DeviceRunningStatusHistory lastRunningStatus;
|
private DeviceRunningStatusHistory lastRunningStatus;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.maibu.core.business.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceBindDTO {
|
||||||
|
;
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
private List<String> deviceIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private Long siteId;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer type; //1清除人 2清除场站 3清除组织
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.maibu.core.business.uav;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.maibu.core.domain.BaseDO;
|
||||||
|
import com.maibu.core.domain.TenantBaseDO;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("iot_uav_device")
|
||||||
|
public class IotUAVDevice extends BaseDO {
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
private String droneSn;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer olineStatus = 1; // 外部查询所有 没有的直接更新成未在线
|
||||||
|
|
||||||
|
private Integer syncStatus;
|
||||||
|
|
||||||
|
private LocalDateTime lastSyncTime;
|
||||||
|
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Long siteId;
|
||||||
|
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Long tenantId; //配置可以设置null 不自动过滤
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,10 +2,8 @@ package com.maibu.uav.controller;
|
|||||||
|
|
||||||
import com.maibu.core.controller.BaseController;
|
import com.maibu.core.controller.BaseController;
|
||||||
import com.maibu.core.domain.AjaxResult;
|
import com.maibu.core.domain.AjaxResult;
|
||||||
import com.maibu.uav.dto.CameraLiveParamDTO;
|
import com.maibu.core.page.TableDataInfo;
|
||||||
import com.maibu.uav.dto.FlightTaskCommandDTO;
|
import com.maibu.uav.dto.*;
|
||||||
import com.maibu.uav.dto.FlightTaskCreateDTO;
|
|
||||||
import com.maibu.uav.dto.UavDeviceStateResponseDTO;
|
|
||||||
import com.maibu.uav.service.UAVService;
|
import com.maibu.uav.service.UAVService;
|
||||||
import io.minio.errors.*;
|
import io.minio.errors.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -15,6 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/iot/UAV")
|
@RequestMapping("/iot/UAV")
|
||||||
@@ -30,6 +29,29 @@ public class UAVController extends BaseController {
|
|||||||
return AjaxResult.success(result);
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getSiteUAVList")
|
||||||
|
public TableDataInfo getSiteUAVList(@RequestParam(required = false) Long siteId,
|
||||||
|
@RequestParam(required = false) Integer status,
|
||||||
|
@RequestParam(required = false) String sn) {
|
||||||
|
startPage();
|
||||||
|
Long roleId = getLoginUser().getRoleId();
|
||||||
|
Long userId = getLoginUser().getUserId();
|
||||||
|
return getDataTable(uavService.getSiteUAVList(siteId, roleId, userId, status, sn));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getUAVList")
|
||||||
|
public TableDataInfo getUAVList(@RequestParam(required = false) Integer status,
|
||||||
|
@RequestParam(required = false) String sn) {
|
||||||
|
startPage();
|
||||||
|
Long roleId = getLoginUser().getRoleId();
|
||||||
|
Long orgId = getLoginUser().getOrgId();
|
||||||
|
Long sId = getLoginUser().getSiteId();
|
||||||
|
Long userId = getLoginUser().getUserId();
|
||||||
|
List<UavDeviceStateResponseDetailDTO> result = uavService.getUAVList(sId, orgId, roleId, userId, status, sn);
|
||||||
|
return getDataTable(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/getDeviceHMS")
|
@GetMapping("/getDeviceHMS")
|
||||||
public String getDeviceHMS(@RequestParam String deviceSn) {
|
public String getDeviceHMS(@RequestParam String deviceSn) {
|
||||||
return uavService.getDeviceHMS(deviceSn);
|
return uavService.getDeviceHMS(deviceSn);
|
||||||
@@ -71,9 +93,9 @@ public class UAVController extends BaseController {
|
|||||||
return AjaxResult.success(uavService.liveStream(dto));
|
return AjaxResult.success(uavService.liveStream(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getFlightTask")
|
@PostMapping("/getFlightTask")
|
||||||
public String getFlightTask(@RequestParam String sn) {
|
public AjaxResult getFlightTask(@RequestBody FlightTaskDTO dto) {
|
||||||
return uavService.flightTaskList(sn);
|
return AjaxResult.success(uavService.flightTaskList(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getFlightTaskDetail")
|
@GetMapping("/getFlightTaskDetail")
|
||||||
@@ -130,9 +152,40 @@ public class UAVController extends BaseController {
|
|||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机场相机切换
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PostMapping("/changeCamera")
|
@PostMapping("/changeCamera")
|
||||||
public String changeCamera(@RequestParam String sn, @RequestParam String cameraIndex, @RequestParam String cameraPosition) {
|
public AjaxResult changeCamera(@RequestBody CameraLiveStreamParamDTO dto) {
|
||||||
return uavService.changeCamera(sn, cameraIndex, cameraPosition);
|
return AjaxResult.success(uavService.changeCamera(dto.getSn(), dto.getCameraIndex(), dto.getCameraPosition(), dto.getQualityType(), dto.getVideoExpire()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞行器镜头切换
|
||||||
|
*/
|
||||||
|
@PostMapping("/changeLens")
|
||||||
|
public AjaxResult changeLens(@RequestBody CameraLiveStreamParamDTO dto) {
|
||||||
|
return AjaxResult.success(uavService.changeLens(dto.getSn(), dto.getCameraIndex(), dto.getLensType(), dto.getQualityType(), dto.getVideoExpire()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定设备
|
||||||
|
*/
|
||||||
|
@PostMapping("/bind")
|
||||||
|
public AjaxResult bind(@RequestBody UavBindDTO dto) {
|
||||||
|
return AjaxResult.success(uavService.bind(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑设备
|
||||||
|
*/
|
||||||
|
@PostMapping("/unbind")
|
||||||
|
public AjaxResult unbind(@RequestBody UavUnBindDTO dto) {
|
||||||
|
return AjaxResult.success(uavService.unbind(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.maibu.uav.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CameraLiveStreamParamDTO {
|
||||||
|
private String sn;
|
||||||
|
private String cameraIndex;
|
||||||
|
private Long videoExpire;
|
||||||
|
private String qualityType; //adaptive 自动 smooth流畅 ultra_high_definition超清
|
||||||
|
private String cameraPosition;
|
||||||
|
private String lensType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.maibu.uav.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FlightTaskDTO {
|
||||||
|
private List<String> sns;
|
||||||
|
private Long beginAt;
|
||||||
|
private Long endAt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.maibu.uav.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UavBindDTO {
|
||||||
|
private Long siteId;
|
||||||
|
private Long orgId;
|
||||||
|
private List<String> sns;
|
||||||
|
private Long userId;
|
||||||
|
}
|
||||||
@@ -27,4 +27,8 @@ public class UavDeviceStateResponseDetailDTO {
|
|||||||
|
|
||||||
private List<CameraInfo> gateway_camera_list;
|
private List<CameraInfo> gateway_camera_list;
|
||||||
private List<CameraInfo> drone_camera_list;
|
private List<CameraInfo> drone_camera_list;
|
||||||
|
|
||||||
|
private Long orgId;
|
||||||
|
private Long siteId;
|
||||||
|
private Long userId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.maibu.uav.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UavUnBindDTO {
|
||||||
|
|
||||||
|
private List<String> sns;
|
||||||
|
private Integer type; //1清除人 2清除场站 3清除组织
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.maibu.uav.scheduled;
|
||||||
|
|
||||||
|
import com.maibu.core.business.uav.IotUAVDevice;
|
||||||
|
import com.maibu.mapper.UAVDeviceMapper;
|
||||||
|
import com.maibu.uav.dto.UavDeviceStateResponseDTO;
|
||||||
|
import com.maibu.uav.dto.UavDeviceStateResponseDetailDTO;
|
||||||
|
import com.maibu.uav.service.UAVService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class UAVScheduled {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UAVService uavService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UAVDeviceMapper uavDeviceMapper;
|
||||||
|
|
||||||
|
|
||||||
|
//10分钟执行一次同步无人机设备
|
||||||
|
@Scheduled(cron = "0 */10 * * * ?")
|
||||||
|
public void updateUAVDevice() {
|
||||||
|
UavDeviceStateResponseDTO dto = uavService.getProjectDeviceList();
|
||||||
|
List<IotUAVDevice> removeList = new ArrayList<>();
|
||||||
|
List<IotUAVDevice> addList = new ArrayList<>();
|
||||||
|
List<IotUAVDevice> list = uavDeviceMapper.selectList();
|
||||||
|
if (dto != null && !CollectionUtils.isEmpty(dto.getDetail())) {
|
||||||
|
|
||||||
|
List<UavDeviceStateResponseDetailDTO> detailList = dto.getDetail();
|
||||||
|
|
||||||
|
// 数据库 SN 集合
|
||||||
|
Set<String> dbSnSet = list.stream()
|
||||||
|
.map(IotUAVDevice::getSn)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 远程 SN 集合
|
||||||
|
Set<String> remoteSnSet = detailList.stream()
|
||||||
|
.map(UavDeviceStateResponseDetailDTO::getGateway_sn)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// ========================
|
||||||
|
// 1. 获取新增设备
|
||||||
|
// 远程有,数据库没有
|
||||||
|
// ========================
|
||||||
|
detailList.stream()
|
||||||
|
.filter(x -> !dbSnSet.contains(x.getGateway_sn()))
|
||||||
|
.forEach(x -> {
|
||||||
|
IotUAVDevice device = new IotUAVDevice();
|
||||||
|
device.setSn(x.getGateway_sn());
|
||||||
|
device.setName(x.getGateway_sn());
|
||||||
|
device.setDroneSn(x.getDevice_sn());
|
||||||
|
device.setLastSyncTime(LocalDateTime.now());
|
||||||
|
device.setOlineStatus(1);
|
||||||
|
device.setCreateTime(LocalDateTime.now());
|
||||||
|
device.setCreateBy("system");
|
||||||
|
addList.add(device);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ========================
|
||||||
|
// 2. 获取删除设备
|
||||||
|
// 数据库有,远程没有
|
||||||
|
// ========================
|
||||||
|
list.stream()
|
||||||
|
.filter(x -> !remoteSnSet.contains(x.getSn()))
|
||||||
|
.forEach(removeList::add);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//数据库有 则跟更新不在
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
removeList.addAll(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uavDeviceMapper.saveOrUpdateBatch(addList);
|
||||||
|
if (!CollectionUtils.isEmpty(removeList)) {
|
||||||
|
removeList.forEach(y -> {
|
||||||
|
y.setOlineStatus(2);
|
||||||
|
// y.setDelFlag(true);
|
||||||
|
});
|
||||||
|
uavDeviceMapper.saveOrUpdateBatch(removeList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
package com.maibu.uav.service;
|
package com.maibu.uav.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.maibu.core.business.uav.IotUAVDevice;
|
||||||
|
import com.maibu.core.domain.entity.SysRole;
|
||||||
|
import com.maibu.mapper.UAVDeviceMapper;
|
||||||
|
import com.maibu.service.ISysRoleService;
|
||||||
import com.maibu.uav.dto.*;
|
import com.maibu.uav.dto.*;
|
||||||
import com.maibu.uav.entity.UavDevice;
|
import com.maibu.uav.entity.UavDevice;
|
||||||
import com.maibu.uav.entity.UavDeviceState;
|
import com.maibu.uav.entity.UavDeviceState;
|
||||||
@@ -24,15 +29,10 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.concurrent.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -45,6 +45,12 @@ public class UAVService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UavHttpUtils httpService;
|
private UavHttpUtils httpService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UAVDeviceMapper uavDeviceMapper;
|
||||||
|
|
||||||
|
|
||||||
public static final Map<String, Long> latestActiveTime = new ConcurrentHashMap<>();
|
public static final Map<String, Long> latestActiveTime = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@@ -52,6 +58,95 @@ public class UAVService {
|
|||||||
|
|
||||||
public static final Long outTime = 30000L;
|
public static final Long outTime = 30000L;
|
||||||
|
|
||||||
|
public List<UavDeviceStateResponseDetailDTO> getSiteUAVList(Long siteId, Long roleId, Long userId, Integer status, String sn) {
|
||||||
|
SysRole sysRole = roleService.selectRoleById(roleId);
|
||||||
|
if (sysRole != null) {
|
||||||
|
String roleKey = sysRole.getRoleKey();
|
||||||
|
LambdaQueryWrapper<IotUAVDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (!StringUtils.isEmpty(roleKey)) {
|
||||||
|
if ("manager".equals(roleKey) || "siteManager".equals(roleKey) || "admin".equals(roleKey)) {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getSiteId, siteId);
|
||||||
|
} else {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getTenantId, userId);
|
||||||
|
}
|
||||||
|
if (!StringUtils.isEmpty(sn)) {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getSn, sn);
|
||||||
|
}
|
||||||
|
queryWrapper.eq(IotUAVDevice::getOlineStatus, 1);
|
||||||
|
List<IotUAVDevice> list = uavDeviceMapper.selectList(queryWrapper);
|
||||||
|
List<UavDeviceStateResponseDetailDTO> res = transferData(list);
|
||||||
|
if (status!=null && !CollectionUtils.isEmpty(res)) {
|
||||||
|
return res.stream().filter(x->status.equals(x.getOnlineStatus())).collect(Collectors.toList());
|
||||||
|
}else {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UavDeviceStateResponseDetailDTO> getUAVList(Long siteId, Long orgId, Long roleId, Long userId,Integer status, String sn) {
|
||||||
|
SysRole sysRole = roleService.selectRoleById(roleId);
|
||||||
|
if (sysRole != null) {
|
||||||
|
String roleKey = sysRole.getRoleKey();
|
||||||
|
LambdaQueryWrapper<IotUAVDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (!StringUtils.isEmpty(roleKey)) {
|
||||||
|
if ("manager".equals(roleKey)) {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getOrgId, orgId);
|
||||||
|
} else if ("siteManager".equals(roleKey)) {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getSiteId, siteId);
|
||||||
|
} else if (!"admin".equals(roleKey)) {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getTenantId, userId);
|
||||||
|
}
|
||||||
|
queryWrapper.eq(IotUAVDevice::getOlineStatus, 1);
|
||||||
|
if (!StringUtils.isEmpty(sn)) {
|
||||||
|
queryWrapper.eq(IotUAVDevice::getSn, sn);
|
||||||
|
}
|
||||||
|
List<IotUAVDevice> list;
|
||||||
|
// if ("admin".equals(roleKey)) {
|
||||||
|
// list = uavDeviceMapper.selectList(queryWrapper);
|
||||||
|
// } else {
|
||||||
|
// list = uavDeviceMapper.selectList(queryWrapper);
|
||||||
|
// }
|
||||||
|
list = uavDeviceMapper.selectList(queryWrapper);
|
||||||
|
List<UavDeviceStateResponseDetailDTO> res = transferData(list);
|
||||||
|
if (status!=null && !CollectionUtils.isEmpty(res)) {
|
||||||
|
return res.stream().filter(x->status.equals(x.getOnlineStatus())).collect(Collectors.toList());
|
||||||
|
}else {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UavDeviceStateResponseDetailDTO> transferData(List<IotUAVDevice> list) {
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
Map<String, IotUAVDevice> deviceMap = list.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
IotUAVDevice::getSn,
|
||||||
|
item -> item
|
||||||
|
));
|
||||||
|
UavDeviceStateResponseDTO dto = getProjectDeviceList();
|
||||||
|
List<UavDeviceStateResponseDetailDTO> details = dto.getDetail();
|
||||||
|
if (!CollectionUtils.isEmpty(details)) {
|
||||||
|
List<UavDeviceStateResponseDetailDTO> fiList = details.stream().filter(x -> deviceMap.containsKey(x.getGateway_sn())).collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(fiList)) {
|
||||||
|
fiList.forEach(k -> {
|
||||||
|
IotUAVDevice device = deviceMap.get(k.getGateway_sn());
|
||||||
|
if (device != null) {
|
||||||
|
k.setSiteId(device.getSiteId());
|
||||||
|
k.setOrgId(device.getOrgId());
|
||||||
|
k.setUserId(device.getTenantId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return fiList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public UavDeviceStateResponseDTO getProjectDeviceList() {
|
public UavDeviceStateResponseDTO getProjectDeviceList() {
|
||||||
try {
|
try {
|
||||||
@@ -277,13 +372,46 @@ public class UAVService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String flightTaskList(String sn) {
|
public Map<String, Object> flightTaskList(FlightTaskDTO dto) {
|
||||||
|
List<String> sns = dto.getSns();
|
||||||
|
Long beginAt = dto.getBeginAt() == null ? 1735692484 : dto.getBeginAt();
|
||||||
|
Long endAt = dto.getEndAt() == null ? 1830306933 : dto.getEndAt();
|
||||||
|
|
||||||
String url = baseUrl + "/openapi/v0.1/flight-task/list";
|
String url = baseUrl + "/openapi/v0.1/flight-task/list";
|
||||||
Map<String, Object> map = new HashMap<>();
|
// 线程池
|
||||||
map.put("begin_at", 1735692484); //2025-1-1
|
ExecutorService executor = Executors.newFixedThreadPool(10);
|
||||||
map.put("end_at", 1830306933);//2028-1-1
|
try {
|
||||||
map.put("sn", sn);
|
List<CompletableFuture<Map<String, Object>>> futures = sns.stream()
|
||||||
return httpService.doGet(url, map);
|
.map(sn -> CompletableFuture.supplyAsync(() -> {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("begin_at", beginAt);
|
||||||
|
map.put("end_at", endAt);
|
||||||
|
map.put("sn", sn);
|
||||||
|
try {
|
||||||
|
String res = httpService.doGet(url, map);
|
||||||
|
SK2ResultDTO sk2ResultDTO = JsonUtils.parseObject(res, SK2ResultDTO.class);
|
||||||
|
Object data = null;
|
||||||
|
if (sk2ResultDTO != null && sk2ResultDTO.getCode() == 0) {
|
||||||
|
data = sk2ResultDTO.getData();
|
||||||
|
}
|
||||||
|
Map<String, Object> m = new HashMap<>();
|
||||||
|
m.put(sn, data);
|
||||||
|
return m;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}, executor))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// 等待全部完成
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
futures.stream()
|
||||||
|
.map(CompletableFuture::join)
|
||||||
|
.forEach(result::putAll);
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
executor.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String flightTaskDetail(String taskId) {
|
public String flightTaskDetail(String taskId) {
|
||||||
@@ -395,13 +523,136 @@ public class UAVService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String changeCamera(String sn, String cameraIndex, String cameraPosition) {
|
public CameraLiveResultDTO changeCamera(String sn, String cameraIndex, String cameraPosition, String qualityType, Long videoExpire) {
|
||||||
String url = baseUrl + "/openapi/v0.1/device/change-camera";
|
String url = baseUrl + "/openapi/v0.1/device/change-camera";
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("sn", sn);
|
map.put("sn", sn);
|
||||||
map.put("camera_index", cameraIndex);
|
map.put("camera_index", cameraIndex);
|
||||||
map.put("camera_position", cameraPosition);
|
map.put("camera_position", cameraPosition);
|
||||||
return httpService.doPut(url, map);
|
String result = httpService.doPost(url, map);
|
||||||
|
if (!StringUtils.isEmpty(result)) {
|
||||||
|
SK2ResultDTO sk2ResultDTO = JsonUtils.parseObject(result, SK2ResultDTO.class);
|
||||||
|
if (sk2ResultDTO != null && sk2ResultDTO.getCode() == 0) {
|
||||||
|
return singleLiveStream(sn, cameraIndex, qualityType, videoExpire);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CameraLiveResultDTO changeLens(String sn, String cameraIndex, String lensType, String qualityType, Long videoExpire) {
|
||||||
|
String result = droneCameraControl(sn, cameraIndex);
|
||||||
|
if (!StringUtils.isEmpty(result)) {
|
||||||
|
SK2ResultDTO sk2ResultDTO = JsonUtils.parseObject(result, SK2ResultDTO.class);
|
||||||
|
if (sk2ResultDTO != null && sk2ResultDTO.getCode() == 0) {
|
||||||
|
String url = baseUrl + "/openapi/v0.1/device/change-lens";
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("sn", sn);
|
||||||
|
map.put("camera_index", cameraIndex);
|
||||||
|
map.put("lens_type", lensType);
|
||||||
|
String str = httpService.doPost(url, map);
|
||||||
|
SK2ResultDTO sk2Str = JsonUtils.parseObject(str, SK2ResultDTO.class);
|
||||||
|
if (sk2Str != null && sk2ResultDTO.getCode() == 0) {
|
||||||
|
return singleLiveStream(sn, cameraIndex, qualityType, videoExpire);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取控制权
|
||||||
|
*/
|
||||||
|
public String droneCameraControl(String sn, String cameraIndex) {
|
||||||
|
String url = baseUrl + "/openapi/v0.1/device/control";
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("drone_sn", sn);
|
||||||
|
map.put("payload_index", Arrays.asList(cameraIndex));
|
||||||
|
return httpService.doPost(url, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CameraLiveResultDTO singleLiveStream(String sn, String cameraIndex, String qualityType, Long videoExpire) {
|
||||||
|
try {
|
||||||
|
String url = baseUrl + "/openapi/v0.1/live-stream/start";
|
||||||
|
CameraLiveResultDTO cameraLiveResultDTO = null;
|
||||||
|
CameraLiveStreamDTO d = new CameraLiveStreamDTO();
|
||||||
|
d.setSn(sn);
|
||||||
|
d.setCamera_index(cameraIndex);
|
||||||
|
d.setQuality_type(qualityType);
|
||||||
|
d.setVideo_expire(videoExpire);
|
||||||
|
String res = httpService.doPost(url, d);
|
||||||
|
if (!StringUtils.isEmpty(res)) {
|
||||||
|
SK2ResultDTO sk2ResultDTO = JsonUtils.parseObject(res, SK2ResultDTO.class);
|
||||||
|
if (sk2ResultDTO != null && sk2ResultDTO.getData() != null) {
|
||||||
|
CameraLiveStreamResultDTO resultDTO = JsonUtils.parseObject(
|
||||||
|
JsonUtils.toJsonString(sk2ResultDTO.getData()), // 先转JSON字符串
|
||||||
|
new TypeReference<CameraLiveStreamResultDTO>() {
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (resultDTO != null) {
|
||||||
|
cameraLiveResultDTO = new CameraLiveResultDTO();
|
||||||
|
cameraLiveResultDTO.setUrl(resultDTO.getUrl());
|
||||||
|
cameraLiveResultDTO.setExpire_ts(resultDTO.getExpire_ts());
|
||||||
|
cameraLiveResultDTO.setUrl_type(resultDTO.getUrl_type());
|
||||||
|
cameraLiveResultDTO.setSn(sn);
|
||||||
|
cameraLiveResultDTO.setCamera_index(cameraIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cameraLiveResultDTO;
|
||||||
|
} catch (
|
||||||
|
Exception e) {
|
||||||
|
log.error("开启直播发生错误", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//todo 更新同步状态
|
||||||
|
|
||||||
|
|
||||||
|
public boolean bind(UavBindDTO dto) {
|
||||||
|
List<String> sns = dto.getSns();
|
||||||
|
if (!CollectionUtils.isEmpty(sns)) {
|
||||||
|
Long orgId = dto.getOrgId();
|
||||||
|
Long siteId = dto.getSiteId();
|
||||||
|
Long userId = dto.getUserId();
|
||||||
|
|
||||||
|
LambdaQueryWrapper<IotUAVDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(IotUAVDevice::getSn, sns);
|
||||||
|
List<IotUAVDevice> list = uavDeviceMapper.selectList(queryWrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
list.forEach(x -> {
|
||||||
|
x.setOrgId(orgId);
|
||||||
|
x.setSiteId(siteId);
|
||||||
|
x.setTenantId(userId);
|
||||||
|
});
|
||||||
|
return uavDeviceMapper.saveOrUpdateBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean unbind(UavUnBindDTO dto) {
|
||||||
|
List<String> sns = dto.getSns();
|
||||||
|
if (!CollectionUtils.isEmpty(sns)) {
|
||||||
|
LambdaQueryWrapper<IotUAVDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(IotUAVDevice::getSn, sns);
|
||||||
|
List<IotUAVDevice> list = uavDeviceMapper.selectList(queryWrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
list.forEach(x -> {
|
||||||
|
x.setTenantId(null);
|
||||||
|
if (dto.getType() == 2) {
|
||||||
|
x.setSiteId(null);
|
||||||
|
}
|
||||||
|
if (dto.getType() == 3) {
|
||||||
|
x.setSiteId(null);
|
||||||
|
x.setOrgId(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return uavDeviceMapper.saveOrUpdateBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
CorsConfiguration config = new CorsConfiguration();
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
// 关键:设置允许的前端源(替换为你的实际前端域名,如https://ri.satabot.com)
|
// 关键:设置允许的前端源(替换为你的实际前端域名,如https://ri.satabot.com)
|
||||||
// 填* 会有问题
|
// 填* 会有问题
|
||||||
// config.setAllowedOrigins(Arrays.asList("https://ri.satabot.com", "https://ai.satabot.com",
|
// config.setAllowedOrigins(Arrays.asList("https://ri.satabot.com", "https://pvcloud.satabot.com","https://ai.satabot.com",
|
||||||
// "https://serviceai.satabot.com", "https://serviceri.satabot.com", "https://pvs.satabot.com",
|
// "https://serviceai.satabot.com", "https://serviceri.satabot.com", "https://pvs.satabot.com",
|
||||||
// "https://servicepvs.satabot.com", "https://servicepathplan.satabot.com", "https://solar.satabot.com",
|
// "https://servicepvs.satabot.com", "https://servicepathplan.satabot.com", "https://solar.satabot.com",
|
||||||
// "https://servicestream.satabot.com", "http://192.168.2.58", "http://192.168.2.58"));
|
// "https://servicestream.satabot.com", "http://192.168.2.58", "http://192.168.2.58"));
|
||||||
|
|||||||
@@ -43,11 +43,12 @@ public class NettyServer {
|
|||||||
pipeline.addLast(new IdleStateHandler(10, 0, 0, TimeUnit.SECONDS));
|
pipeline.addLast(new IdleStateHandler(10, 0, 0, TimeUnit.SECONDS));
|
||||||
pipeline.addLast(new HeaderFooterDecoder());
|
pipeline.addLast(new HeaderFooterDecoder());
|
||||||
pipeline.addLast(new HexDecoder());
|
pipeline.addLast(new HexDecoder());
|
||||||
pipeline.addLast(new HexEncoder());
|
// pipeline.addLast(new HexEncoder());
|
||||||
pipeline.addLast(deviceConnectHandler);
|
pipeline.addLast(deviceConnectHandler);
|
||||||
pipeline.addLast(heartbeatHandler);
|
pipeline.addLast(heartbeatHandler);
|
||||||
pipeline.addLast(dataToDataBaseHandler);
|
pipeline.addLast(dataToDataBaseHandler);
|
||||||
pipeline.addLast(commandForwardHandler);
|
pipeline.addLast(commandForwardHandler);
|
||||||
|
pipeline.addLast(new HexEncoder());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
System.out.println("聊天室服务器启动了...");
|
System.out.println("聊天室服务器启动了...");
|
||||||
|
|||||||
@@ -423,6 +423,7 @@ public class DeviceConnectHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
sysUserClientService.updateAliveStatus(masterDevice.getConnectorId(), slaveId, 1);
|
sysUserClientService.updateAliveStatus(masterDevice.getConnectorId(), slaveId, 1);
|
||||||
if (masterDevice.getChannel() != null && masterDevice.getChannel().isActive()) {
|
if (masterDevice.getChannel() != null && masterDevice.getChannel().isActive()) {
|
||||||
DeviceRequestDTO reDto = new DeviceRequestDTO();
|
DeviceRequestDTO reDto = new DeviceRequestDTO();
|
||||||
|
reDto.setPlatform(requestDTO.getPlatform());
|
||||||
DeviceRespondDTO respond = new DeviceRespondDTO();
|
DeviceRespondDTO respond = new DeviceRespondDTO();
|
||||||
respond.setSwitchResult(true);
|
respond.setSwitchResult(true);
|
||||||
respond.setHolder("you");
|
respond.setHolder("you");
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||||
import org.apache.commons.codec.binary.Hex;
|
import org.apache.commons.codec.binary.Hex;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -14,8 +16,16 @@ public class HeaderFooterDecoder extends ByteToMessageDecoder {
|
|||||||
private static final byte[] FOOTER = {(byte) 0xAA, (byte) 0xAB};
|
private static final byte[] FOOTER = {(byte) 0xAA, (byte) 0xAB};
|
||||||
private static final int MAX_FRAME_LENGTH = 4096;
|
private static final int MAX_FRAME_LENGTH = 4096;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(HeaderFooterDecoder.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
|
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
|
||||||
|
// 获取处理前的原始数据
|
||||||
|
if (in.readableBytes() > 0) {
|
||||||
|
byte[] rawData = new byte[in.readableBytes()];
|
||||||
|
in.getBytes(in.readerIndex(), rawData);
|
||||||
|
logger.debug("【处理前原始数据】长度:{},内容:{}",rawData.length,Hex.encodeHexString(rawData).toUpperCase());
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
int readerIndex = in.readerIndex();
|
int readerIndex = in.readerIndex();
|
||||||
int writerIndex = in.writerIndex();
|
int writerIndex = in.writerIndex();
|
||||||
@@ -48,9 +58,9 @@ public class HeaderFooterDecoder extends ByteToMessageDecoder {
|
|||||||
byte[] frameBytes = new byte[frame.readableBytes()];
|
byte[] frameBytes = new byte[frame.readableBytes()];
|
||||||
frame.getBytes(frame.readerIndex(), frameBytes);
|
frame.getBytes(frame.readerIndex(), frameBytes);
|
||||||
|
|
||||||
System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"))
|
// System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"))
|
||||||
+ " 收到原始数据:" + Hex.encodeHexString(frameBytes).toUpperCase());
|
// + " 收到原始数据:" + Hex.encodeHexString(frameBytes).toUpperCase());
|
||||||
|
logger.debug("【处理后原始数据】长度:{},内容:{}",frameBytes.length,Hex.encodeHexString(frameBytes).toUpperCase());
|
||||||
out.add(frame);
|
out.add(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,27 @@ import org.apache.commons.codec.binary.Hex;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
// 编码器:16进制字符串 → ByteBuf
|
// 编码器:16进制字符串 → ByteBuf
|
||||||
public class HexEncoder extends MessageToByteEncoder<String> {
|
public class HexEncoder extends MessageToByteEncoder<Object> {
|
||||||
|
// @Override
|
||||||
|
// protected void encode(ChannelHandlerContext ctx, String msg, ByteBuf out) throws Exception {
|
||||||
|
// byte[] bytes = Hex.decodeHex(msg.toCharArray()); // 16进制字符串转字节数组
|
||||||
|
// out.writeBytes(bytes);
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(ChannelHandlerContext ctx, String msg, ByteBuf out) throws Exception {
|
protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
|
||||||
byte[] bytes = Hex.decodeHex(msg.toCharArray()); // 16进制字符串转字节数组
|
if (msg instanceof String) {
|
||||||
out.writeBytes(bytes);
|
// 16进制字符串转字节数组
|
||||||
|
byte[] bytes = Hex.decodeHex(((String) msg).toCharArray());
|
||||||
|
out.writeBytes(bytes);
|
||||||
|
} else if (msg instanceof ByteBuf) {
|
||||||
|
// 直接写入 ByteBuf
|
||||||
|
ByteBuf buf = (ByteBuf) msg;
|
||||||
|
out.writeBytes(buf);
|
||||||
|
} else if (msg instanceof byte[]) {
|
||||||
|
// 直接写入字节数组
|
||||||
|
out.writeBytes((byte[]) msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.maibu.controller;
|
|||||||
import com.maibu.annotation.Log;
|
import com.maibu.annotation.Log;
|
||||||
import com.maibu.core.business.Device;
|
import com.maibu.core.business.Device;
|
||||||
import com.maibu.core.business.DeviceRunStatistics;
|
import com.maibu.core.business.DeviceRunStatistics;
|
||||||
|
import com.maibu.core.business.dto.DeviceBindDTO;
|
||||||
import com.maibu.core.controller.BaseController;
|
import com.maibu.core.controller.BaseController;
|
||||||
import com.maibu.core.domain.AjaxResult;
|
import com.maibu.core.domain.AjaxResult;
|
||||||
import com.maibu.core.page.TableDataInfo;
|
import com.maibu.core.page.TableDataInfo;
|
||||||
@@ -14,13 +15,13 @@ import com.maibu.utils.StringUtils;
|
|||||||
import com.maibu.utils.poi.ExcelUtil;
|
import com.maibu.utils.poi.ExcelUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -228,4 +229,40 @@ public class DeviceController extends BaseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("bind")
|
||||||
|
public AjaxResult bind(@RequestBody DeviceBindDTO bindDTO) {
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(bindDTO.getDeviceIds())) {
|
||||||
|
return AjaxResult.error("deviceIds为空!");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(deviceService.bind(bindDTO, getLoginUser().getUsername()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("unbind")
|
||||||
|
public AjaxResult unbind(@RequestBody DeviceBindDTO bindDTO) {
|
||||||
|
if (CollectionUtils.isEmpty(bindDTO.getDeviceIds())) {
|
||||||
|
return AjaxResult.error("deviceId为空!");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(deviceService.unbind(bindDTO, getLoginUser().getUsername()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/getSiteList")
|
||||||
|
public TableDataInfo getSiteList(Device device) {
|
||||||
|
startPage();
|
||||||
|
return getDataTable(deviceService.getSiteList(getLoginUser(), device));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备列表 分配页面
|
||||||
|
*/
|
||||||
|
@GetMapping("/getDeviceList")
|
||||||
|
public TableDataInfo getDeviceList(Device device) {
|
||||||
|
startPage();
|
||||||
|
return getDataTable(deviceService.getDeviceList(getLoginUser(), device));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.maibu.mapper;
|
||||||
|
|
||||||
|
import com.maibu.core.business.uav.IotUAVDevice;
|
||||||
|
import com.maibu.mybatis.mapper.BaseMapperX;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备历史状态
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface UAVDeviceMapper extends BaseMapperX<IotUAVDevice> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.maibu.service;
|
package com.maibu.service;
|
||||||
|
|
||||||
import com.maibu.core.business.Device;
|
import com.maibu.core.business.Device;
|
||||||
|
import com.maibu.core.business.dto.DeviceBindDTO;
|
||||||
import com.maibu.core.domain.AjaxResult;
|
import com.maibu.core.domain.AjaxResult;
|
||||||
|
import com.maibu.core.domain.model.LoginUser;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -78,4 +80,15 @@ public interface IDeviceService {
|
|||||||
*/
|
*/
|
||||||
public List<String> selectSerialNumbersByProductId(Long productId);
|
public List<String> selectSerialNumbersByProductId(Long productId);
|
||||||
|
|
||||||
|
|
||||||
|
public boolean bind(DeviceBindDTO bindDTO, String username);
|
||||||
|
|
||||||
|
|
||||||
|
public boolean unbind(DeviceBindDTO bindDTO, String username);
|
||||||
|
|
||||||
|
|
||||||
|
public List<Device> getSiteList(LoginUser loginUser, Device device);
|
||||||
|
|
||||||
|
public List<Device> getDeviceList(LoginUser loginUser, Device device);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import com.maibu.core.business.Device;
|
|||||||
import com.maibu.core.business.DevicePlan;
|
import com.maibu.core.business.DevicePlan;
|
||||||
import com.maibu.core.business.DeviceRunningStatusHistory;
|
import com.maibu.core.business.DeviceRunningStatusHistory;
|
||||||
import com.maibu.core.business.DeviceStatusRecordDTO;
|
import com.maibu.core.business.DeviceStatusRecordDTO;
|
||||||
|
import com.maibu.core.business.dto.DeviceBindDTO;
|
||||||
|
import com.maibu.core.business.uav.IotUAVDevice;
|
||||||
import com.maibu.core.domain.AjaxResult;
|
import com.maibu.core.domain.AjaxResult;
|
||||||
|
import com.maibu.core.domain.entity.SysRole;
|
||||||
import com.maibu.core.domain.model.LoginUser;
|
import com.maibu.core.domain.model.LoginUser;
|
||||||
import com.maibu.core.enums.DeviceTaskStaus;
|
import com.maibu.core.enums.DeviceTaskStaus;
|
||||||
import com.maibu.core.redis.RedisCache;
|
import com.maibu.core.redis.RedisCache;
|
||||||
@@ -13,7 +16,9 @@ import com.maibu.mapper.DeviceMapper;
|
|||||||
import com.maibu.mapper.DevicePlanMapper;
|
import com.maibu.mapper.DevicePlanMapper;
|
||||||
import com.maibu.mapper.DeviceStatusHistoryMapper;
|
import com.maibu.mapper.DeviceStatusHistoryMapper;
|
||||||
import com.maibu.service.IDeviceService;
|
import com.maibu.service.IDeviceService;
|
||||||
|
import com.maibu.service.ISysRoleService;
|
||||||
import com.maibu.utils.SecurityUtils;
|
import com.maibu.utils.SecurityUtils;
|
||||||
|
import com.maibu.utils.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -22,10 +27,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Comparator;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +53,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DeviceStatusHistoryMapper deviceStatusHistoryMapper;
|
private DeviceStatusHistoryMapper deviceStatusHistoryMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编号查询设备
|
* 根据设备编号查询设备
|
||||||
@@ -218,4 +225,104 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
return deviceMapper.selectSerialNumbersByProductId(productId);
|
return deviceMapper.selectSerialNumbersByProductId(productId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean bind(DeviceBindDTO bindDTO,String username) {
|
||||||
|
try {
|
||||||
|
List<String> deviceIds = bindDTO.getDeviceIds();
|
||||||
|
LambdaQueryWrapper<Device> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(Device::getSerialNumber,deviceIds);
|
||||||
|
List<Device> list =deviceMapper.selectList(queryWrapper);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
list.forEach(device -> {
|
||||||
|
if(bindDTO.getUserId()!=null){
|
||||||
|
device.setTenantId(bindDTO.getUserId());
|
||||||
|
}
|
||||||
|
device.setOrgId(bindDTO.getOrgId());
|
||||||
|
device.setSiteId(bindDTO.getSiteId());
|
||||||
|
device.setUpdateTime(LocalDateTime.now());
|
||||||
|
device.setUpdateBy(username);
|
||||||
|
});
|
||||||
|
return deviceMapper.saveOrUpdateBatch(list);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("设备绑定失败: {}", e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean unbind(DeviceBindDTO dto,String username) {
|
||||||
|
List<String> deviceIds = dto.getDeviceIds();
|
||||||
|
if (!CollectionUtils.isEmpty(deviceIds)) {
|
||||||
|
LambdaQueryWrapper<Device> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(Device::getSerialNumber,deviceIds);
|
||||||
|
List<Device> list = deviceMapper.selectList(queryWrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
list.forEach(x -> {
|
||||||
|
x.setTenantId(-1L);
|
||||||
|
if (dto.getType() == 2) {
|
||||||
|
x.setSiteId(null);
|
||||||
|
}
|
||||||
|
if (dto.getType() == 3) {
|
||||||
|
x.setSiteId(null);
|
||||||
|
x.setOrgId(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return deviceMapper.saveOrUpdateBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Device> getSiteList(LoginUser loginUser,Device device) {
|
||||||
|
SysRole sysRole = roleService.selectRoleById(loginUser.getRoleId());
|
||||||
|
List<Device> deviceList = new ArrayList<>();
|
||||||
|
if (sysRole != null) {
|
||||||
|
String roleKey = sysRole.getRoleKey();
|
||||||
|
if (!StringUtils.isEmpty(roleKey)) {
|
||||||
|
if ("manager".equals(roleKey) || "siteManager".equals(roleKey) || "admin".equals(roleKey)) {
|
||||||
|
// device.setSiteId(siteId);
|
||||||
|
} else {
|
||||||
|
device.setTenantId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
deviceList = deviceMapper.selectDeviceList(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Device> getDeviceList(LoginUser loginUser,Device device) {
|
||||||
|
SysRole sysRole = roleService.selectRoleById(loginUser.getRoleId());
|
||||||
|
List<Device> deviceList = new ArrayList<>();
|
||||||
|
if (sysRole != null) {
|
||||||
|
String roleKey = sysRole.getRoleKey();
|
||||||
|
if (!StringUtils.isEmpty(roleKey)) {
|
||||||
|
if ("manager".equals(roleKey)) {
|
||||||
|
device.setOrgId(loginUser.getOrgId());
|
||||||
|
} else if ("siteManager".equals(roleKey)) {
|
||||||
|
device.setSiteId(loginUser.getSiteId());
|
||||||
|
} else if (!"admin".equals(roleKey)) {
|
||||||
|
device.setTenantId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
// if ("admin".equals(roleKey)) {
|
||||||
|
// deviceList = deviceMapper.selectList();
|
||||||
|
// } else {
|
||||||
|
// deviceList = deviceMapper.selectDeviceList(device);
|
||||||
|
// }
|
||||||
|
deviceList = deviceMapper.selectDeviceList(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
<result property="serialNumber" column="serial_number"/>
|
<result property="serialNumber" column="serial_number"/>
|
||||||
<result property="firmwareVersion" column="firmware_version"/>
|
<result property="firmwareVersion" column="firmware_version"/>
|
||||||
<result property="status" column="status"/>
|
<result property="status" column="status"/>
|
||||||
<result property="deviceType" column="device_type"/>
|
|
||||||
<result property="rssi" column="rssi"/>
|
<result property="rssi" column="rssi"/>
|
||||||
<result property="isShadow" column="is_shadow"/>
|
<result property="isShadow" column="is_shadow"/>
|
||||||
<result property="locationWay" column="location_way"/>
|
<result property="locationWay" column="location_way"/>
|
||||||
@@ -72,8 +71,7 @@
|
|||||||
d.img_url,
|
d.img_url,
|
||||||
d.summary,
|
d.summary,
|
||||||
d.remark,
|
d.remark,
|
||||||
d.slave_id,
|
d.slave_id
|
||||||
p.device_type
|
|
||||||
from iot_device d
|
from iot_device d
|
||||||
left join device_product p on d.product_id = p.id
|
left join device_product p on d.product_id = p.id
|
||||||
</sql>
|
</sql>
|
||||||
@@ -123,7 +121,6 @@
|
|||||||
<select id="selectDeviceList" parameterType="com.maibu.core.business.Device" resultMap="DeviceResult">
|
<select id="selectDeviceList" parameterType="com.maibu.core.business.Device" resultMap="DeviceResult">
|
||||||
<include refid="selectDeviceVo"/>
|
<include refid="selectDeviceVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="deviceType != null">and p.device_type = #{deviceType}</if>
|
|
||||||
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
||||||
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -204,7 +201,6 @@
|
|||||||
d.device_name,
|
d.device_name,
|
||||||
d.product_id,
|
d.product_id,
|
||||||
p.product_name,
|
p.product_name,
|
||||||
p.device_type,
|
|
||||||
d.tenant_id,
|
d.tenant_id,
|
||||||
d.tenant_name,
|
d.tenant_name,
|
||||||
d.serial_number,
|
d.serial_number,
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ public class MiddleConstant {
|
|||||||
|
|
||||||
public static final AttributeKey<String> ATT_MASTER_KEY = AttributeKey.valueOf("ATT_MASTER_KEY");
|
public static final AttributeKey<String> ATT_MASTER_KEY = AttributeKey.valueOf("ATT_MASTER_KEY");
|
||||||
|
|
||||||
// public static String nettyApiUrl = "http://127.0.0.1:8081";
|
// public static String nettyApiUrl = "https://serviceri.satabot.com";
|
||||||
public static String nettyApiUrl = "https://serviceri.satabot.com";
|
// public static String vertxIp = "1.95.137.212";
|
||||||
public static String vertxIp = "1.95.137.212";
|
public static String nettyApiUrl = "http://127.0.0.1:8081";
|
||||||
// public static String nettyApiUrl = "http://127.0.0.1:8081";
|
public static String vertxIp = "127.0.0.1";
|
||||||
// public static String vertxIp = "127.0.0.1";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user