ard-admin/src/main/java/com/ard/web/controller/work/UavBaseController.java
@@ -1,6 +1,8 @@ package com.ard.web.controller.work; import com.ard.common.core.controller.BaseController; import com.ard.common.core.domain.AjaxResult; import com.ard.common.core.page.TableDataInfo; import com.ard.work.domain.dto.BoxHistoryDTO; import com.ard.work.domain.dto.BoxPhotosDTO; import com.ard.work.domain.dto.BoxSettingsDTO; @@ -17,6 +19,8 @@ import javax.annotation.Resource; import java.util.List; import static com.ard.common.utils.PageUtils.startPage; /** * UavBaseController * @@ -27,7 +31,7 @@ @ApiSort(value = 2) @RequestMapping("/uav/base") @RestController public class UavBaseController { public class UavBaseController extends BaseController { @Resource private ITyService tyService; @@ -79,12 +83,13 @@ return AjaxResult.success(state); } @ApiOperation("根据boxSn获取六合盒子列表") @ApiOperation("根据[服务器id]获取六合盒子列表") @ApiOperationSupport(order = 7) @GetMapping("/getBoxSnToList") public AjaxResult getBoxSnToList(String boxSn) { List<BoxInfoReceiver> boxList = tyService.getBoxSnToList(boxSn); return AjaxResult.success(boxList); @GetMapping("/getBoxSnToList/{id}") public TableDataInfo getBoxSnToList(@PathVariable("id") String id) { startPage(); List<BoxInfoReceiver> boxList = tyService.getBoxSnToList(id); return getDataTable(boxList); } } ard-common/src/main/java/com/ard/common/utils/file/MimeTypeUtils.java
@@ -38,7 +38,10 @@ "pdf", // kmz "kmz"}; "kmz", // glb "glb" }; public static String getExtension(String prefix) { ard-work/src/main/java/com/ard/work/domain/entity/ArdServerInfo.java
@@ -52,6 +52,9 @@ /** 部门ID */ private Long deptId; /** 服务器状态 */ private Long serverStatus; private List<ArdDroneInfo> ardDroneInfoList; } ard-work/src/main/java/com/ard/work/service/ITyService.java
@@ -284,6 +284,6 @@ * 根据boxSn获取六合盒子列表 * @return List<BoxInfoReceiver> */ List<BoxInfoReceiver> getBoxSnToList(String boxSn); List<BoxInfoReceiver> getBoxSnToList(String id); } ard-work/src/main/java/com/ard/work/service/impl/TyServiceImpl.java
@@ -59,6 +59,7 @@ import javax.annotation.Resource; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -843,11 +844,17 @@ * @return List<BoxInfoReceiver> */ @Override public List<BoxInfoReceiver> getBoxSnToList(String boxSn) { ArdServerInfo serverInfo = new ArdServerInfo(); serverInfo.setHost(boxSn); List<ArdServerInfo> ardServerInfos = ardServerService.selectArdServerManagementList(serverInfo); return getBoxList(ardServerInfos); public List<BoxInfoReceiver> getBoxSnToList(String id) { ArdServerInfo ardServerInfos = ardServerService.selectArdServerManagementById(id); String baseUrl = "http://" + ardServerInfos.getHost() + ":" + ardServerInfos.getHttpPort(); List<BoxInfoReceiver> lisbox = new ArrayList<>(); try { lisbox = tyClient.getBoxList(baseUrl).getContent(); return lisbox; } catch (Exception e) { log.error("获取云盒列表失败: {}", baseUrl, e); return lisbox; } } private List<BoxInfoReceiver> getBoxList(List<ArdServerInfo> ls) { ard-work/src/main/resources/mapper/ArdServerInfoMapper.xml
@@ -17,35 +17,47 @@ <result property="altitude" column="altitude" /> <result property="userId" column="user_id" /> <result property="deptId" column="dept_id" /> <result property="serverStatus" column="server_status" /> </resultMap> <sql id="selectArdServerManagementVo"> select id, server_name, host, tcp_port, http_port, access_key_id, access_key_secret, longitude, latitude, altitude, user_id, dept_id from ard_server_info select c.id, c.server_name, c.host, c.tcp_port, c.http_port, c.access_key_id, c.access_key_secret, c.longitude, c.latitude, c.altitude, c.user_id, c.dept_id, c.server_status from ard_server_info c left join sys_dept d on d.dept_id = c.dept_id left join sys_user u on u.user_id = c.user_id </sql> <select id="selectArdServerManagementList" parameterType="ArdServerInfo" resultMap="ArdServerManagementResult"> <include refid="selectArdServerManagementVo"/> <where> <if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if> <if test="host != null and host != ''"> and host = #{host}</if> <where> <if test="id != null and id != ''"> and c.id = #{id}</if> <if test="serverName != null and serverName != ''"> and server_name like c.concat('%', #{serverName}, '%')</if> <if test="accessKeyId != null and accessKeyId != ''"> and c.access_key_id = #{accessKeyId}</if> <if test="accessKeySecret != null and accessKeySecret != ''"> and c.access_key_secret = #{accessKeySecret}</if> <if test="serverStatus != null and serverStatus != ''"> and c.server_status = #{serverStatus}</if> <if test="deptId != null and deptId != 0"> AND (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) </if> <!-- 数据范围过滤 --> ${params.dataScope} </where> </select> <select id="selectArdServerManagementById" parameterType="String" resultMap="ArdServerManagementResult"> <include refid="selectArdServerManagementVo"/> where id = #{id} where c.id = #{id} </select> <insert id="insertArdServerManagement" parameterType="ArdServerInfo"> @@ -63,6 +75,7 @@ <if test="altitude != null">altitude,</if> <if test="userId != null">user_id,</if> <if test="deptId != null">dept_id,</if> <if test="serverStatus != null">server_status,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> @@ -77,6 +90,7 @@ <if test="altitude != null">#{altitude},</if> <if test="userId != null">#{userId},</if> <if test="deptId != null">#{deptId},</if> <if test="serverStatus != null">#{serverStatus},</if> </trim> </insert> @@ -94,6 +108,7 @@ <if test="altitude != null">altitude = #{altitude},</if> <if test="userId != null">user_id = #{userId},</if> <if test="deptId != null">dept_id = #{deptId},</if> <if test="serverStatus != null">server_status = #{serverStatus},</if> </trim> where id = #{id} </update>