瀏覽代碼

修改无人机代码

bihs 3 天之前
父節點
當前提交
d16030ea39

+ 6 - 14
monitor_ui/src/views/uav/index.vue

@@ -75,7 +75,6 @@
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="序号" align="center" type="index"/>
       <el-table-column label="基站名称" align="center" prop="baseStationName"/>
-      <el-table-column label="机库ID" align="center" prop="baseStationId"/>
       <el-table-column label="机库SN" align="center" prop="baseStationSn"/>
       <el-table-column label="经度" align="center" prop="longitude"/>
       <el-table-column label="纬度" align="center" prop="latitude"/>
@@ -124,9 +123,6 @@
         <el-form-item label="基站名称" prop="baseStationName">
           <el-input v-model="form.baseStationName" placeholder="请输入基站名称"/>
         </el-form-item>
-        <el-form-item label="机库ID" prop="baseStationId">
-          <el-input v-model="form.baseStationId" placeholder="请输入机库ID"/>
-        </el-form-item>
         <el-form-item label="机库SN" prop="baseStationSn">
           <el-input v-model="form.baseStationSn" placeholder="请输入机库SN"/>
         </el-form-item>
@@ -157,7 +153,7 @@
 
     <!-- 部门管理弹框 -->
     <el-dialog title="部门管理列表" :visible.sync="showUavDept" @close="closeDialog">
-      <monitoruavdept v-if="showUavDept" ref="monitorDept" :uavId="uavIdValue" :uavName="uavNameValue"
+      <monitoruavdept v-if="showUavDept" ref="monitorDept" :uavId="uavIdValue" :uavName="uavNameValue" :uavSn="uavSnValue"
                       style="width: 100%;height: 100%;"
       ></monitoruavdept>
     </el-dialog>
@@ -200,15 +196,13 @@ export default {
         pageNum: 1,
         pageSize: 10,
         baseStationName: null,
-        baseStationId: null,
         baseStationSn: null,
         longitude: null,
         latitude: null,
         height: null,
         uavName: null,
         uavId: null,
-        uavSn: null,
-        deptId: null
+        uavSn: null
       },
       // 表单参数
       form: {},
@@ -217,9 +211,6 @@ export default {
         baseStationName: [
           {required: true, message: "基站名称不能为空", trigger: "blur"},
         ],
-        baseStationId: [
-          {required: true, message: "机库ID不能为空", trigger: "blur"},
-        ],
         baseStationSn: [
           {required: true, message: "机库SN不能为空", trigger: "blur"},
         ],
@@ -254,6 +245,7 @@ export default {
       showUavDept: false,
       uavIdValue: null,
       uavNameValue: null,
+      uavSnValue: null,
     };
   },
   created() {
@@ -264,8 +256,10 @@ export default {
     handleUavDept(row) {
       const id = row.id
       const uavName = row.uavName
+      const uavSn = row.uavSn
       this.uavIdValue = id
       this.uavNameValue = uavName
+      this.uavSnValue = uavSn
       this.showUavDept = true
       this.getDeptTree()
     },
@@ -310,15 +304,13 @@ export default {
       this.form = {
         id: null,
         baseStationName: null,
-        baseStationId: null,
         baseStationSn: null,
         longitude: null,
         latitude: null,
         height: null,
         uavName: null,
         uavId: null,
-        uavSn: null,
-        deptId: null
+        uavSn: null
       };
       this.resetForm("form");
     },

+ 78 - 41
monitor_ui/src/views/uav/uavdept/monitoruavdept.vue

@@ -33,22 +33,14 @@
         >删除
         </el-button>
       </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-        >导出
-        </el-button>
-      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="uavdeptList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center"/>
-      <el-table-column label="部门名称" align="center" prop="deptName"/>
+      <el-table-column label="部门名称" align="center" prop="mapDeptName"/>
+      <el-table-column label="部门类型" align="center" prop="deptProtype" :formatter="deptProtypeFormat" />
+      <el-table-column label="指挥中心" align="center" prop="isCommandCenter" :formatter="isCommandCenterFormat" />
       <el-table-column label="添加时间" align="center" prop="createTime"/>
       <el-table-column label="修改时间" align="center" prop="updateTime"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -82,10 +74,24 @@
     <!-- 添加或修改AI对应部门对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="部门名称" prop="deptId">
-          <treeselect :options="deptOptions" v-model="form.deptId" :show-count="true" placeholder="请选择部门名称"
+        <el-form-item label="部门名称" prop="mapDeptId">
+          <treeselect :options="deptOptions" v-model="form.mapDeptId" :show-count="true" placeholder="请选择部门名称"
                       @select="hx"/>
         </el-form-item>
+        <el-form-item label="部门类型" prop="deptProtype">
+          <el-select v-model="form.deptProtype" placeholder="请输入部门类型">
+            <el-option
+              v-for="item in deptProtypeOptions"
+              :key="item.value"
+              :value="item.value"
+              :label="item.label"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="指挥中心" prop="isCommandCenter">
+          <el-radio v-model='form.isCommandCenter' :label='0'>否</el-radio>
+          <el-radio v-model='form.isCommandCenter' :label='1'>是</el-radio>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -97,12 +103,12 @@
 
 <script>
 import {
-  listUavdept,
-  getUavdept,
-  delUavdept,
-  addUavdept,
-  updateUavdept
-} from "@/api/uav/uavdept/uavdept";
+  listAidevicedept,
+  getAidevicedept,
+  delAidevicedept,
+  addAidevicedept,
+  updateAidevicedept
+} from "@/api/centerMonitor/aidevicedept/aidevicedept";
 import {treeselect} from "@/api/system/dept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@@ -138,34 +144,70 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        uavId: null,
-        uavName: null,
-        deptId: null,
+        deviceId: null,
+        deviceName: null,
+        mapDeptId: null,
+        mapDeptName: null,
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
-        deptId: [
+        mapDeptId: [
           {required: true, message: "部门名称不能为空", trigger: "blur"}
         ],
+        deptProtype: [
+          { required: true, message: "部门类型不能为空", trigger: "blur" }
+        ],
+        isCommandCenter: [
+          { required: true, message: "请选择是否指挥中心", trigger: "blur" }
+        ],
       },
+      deptProtypeOptions: [
+        {value: "1", label: '责任单位,接收推送'},
+        {value: "2", label: '查看单位'}
+      ],
+      isCommandCenterOptions: [
+        {value: "0", label: '否'},
+        {value: "1", label: '是'}
+      ],
     };
   },
   props: {
     uavId: null,
     uavName: null,
+    uavSn: null,
   },
   created() {
     this.getList();
     this.getTreeselect();
   },
   methods: {
+    // 部门类型字典翻译
+    deptProtypeFormat(row, column) {
+      var name = "";
+      this.deptProtypeOptions.forEach(function (item, index) {
+        if (row.deptProtype == item.value) {
+          name = item.label;
+        }
+      });
+      return name;
+    },
+    // 是否指挥中心字典翻译
+    isCommandCenterFormat(row, column) {
+      var name = "";
+      this.isCommandCenterOptions.forEach(function (item, index) {
+        if (row.isCommandCenter == item.value) {
+          name = item.label;
+        }
+      });
+      return name;
+    },
     /** 查询AI对应部门列表 */
     getList() {
       this.loading = true;
-      this.queryParams.uavId = this.uavId;
-      listUavdept(this.queryParams).then(response => {
+      this.queryParams.deviceId = this.uavId;
+      listAidevicedept(this.queryParams).then(response => {
         this.uavdeptList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -179,8 +221,8 @@ export default {
     },
     //部门ID、部门名称赋值
     hx(node) {
-      this.form.deptId = node.id;
-      this.form.deptName = node.label
+      this.form.mapDeptId = node.id;
+      this.form.mapDeptName = node.label
     },
     // 取消按钮
     cancel() {
@@ -191,8 +233,8 @@ export default {
     reset() {
       this.form = {
         id: null,
-        uavId: null,
-        deptId: null,
+        deviceId: null,
+        mapDeptId: null,
       };
       this.resetForm("form");
     },
@@ -215,8 +257,9 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.form.uavId = this.uavId;
-      this.form.uavName = this.uavName
+      this.form.deviceId = this.uavId;
+      this.form.deviceName = this.uavName;
+      this.form.deviceCode = this.uavSn;
       this.open = true;
       this.title = "添加无人机对应部门";
     },
@@ -224,7 +267,7 @@ export default {
     handleUpdate(row) {
       this.reset();
       const id = row.id || this.ids
-      getUavdept(id).then(response => {
+      getAidevicedept(id).then(response => {
         this.form = response.data;
         this.open = true;
         this.title = "修改无人机对应部门";
@@ -235,13 +278,13 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-            updateUavdept(this.form).then(response => {
+            updateAidevicedept(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
             });
           } else {
-            addUavdept(this.form).then(response => {
+            addAidevicedept(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
@@ -254,19 +297,13 @@ export default {
     handleDelete(row) {
       const ids = row.id || this.ids;
       this.$modal.confirm('是否确认删除数据项?').then(function () {
-        return delUavdept(ids);
+        return delAidevicedept(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {
       });
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('center-monitor/aidevicedept/export', {
-        ...this.queryParams
-      }, `aidevicedept_${new Date().getTime()}.xlsx`)
-    }
   }
 };
 </script>

+ 10 - 8
src/main/java/com/sooka/sponest/monitor/uav/controller/CentermonitorTUavController.java

@@ -35,10 +35,12 @@ import javax.annotation.Resource;
 import javax.net.ssl.SSLContext;
 import javax.servlet.http.HttpServletResponse;
 import javax.websocket.*;
-import java.io.IOException;
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -684,7 +686,7 @@ public class CentermonitorTUavController extends BaseController {
             log.error("发生未知异常", e);
         }
         //todo websocket
-        WebSocketUsers.sendMessageToUsersByText(JSON.toJSONString(AjaxResult.success("10002",new ArrayList<>())));
+        WebSocketUsers.sendMessageToUsersByText(JSON.toJSONString(AjaxResult.success("10002", new ArrayList<>())));
         return AjaxResult.success("操作成功,暂无数据");
     }
 
@@ -747,7 +749,7 @@ public class CentermonitorTUavController extends BaseController {
      */
     //todo 未测试接口连通性
     @GetMapping("/getHangarRealTimeData")
-    public String getHangarRealTimeData(@RequestParam(value = "copterSn") String copterSn,@RequestParam(value = "boxSn") String boxSn) {
+    public String getHangarRealTimeData(@RequestParam(value = "copterSn") String copterSn, @RequestParam(value = "boxSn") String boxSn) {
         final CountDownLatch latch = new CountDownLatch(1);
         final StringBuilder response = new StringBuilder();
         try {
@@ -782,7 +784,7 @@ public class CentermonitorTUavController extends BaseController {
      */
     //todo 未测试接口连通性
     @GetMapping("/getHangarLog")
-    public String getHangarLog(@RequestParam(value = "copterSn") String copterSn,@RequestParam(value = "boxSn") String boxSn) {
+    public String getHangarLog(@RequestParam(value = "copterSn") String copterSn, @RequestParam(value = "boxSn") String boxSn) {
         final CountDownLatch latch = new CountDownLatch(1);
         final StringBuilder response = new StringBuilder();
         try {
@@ -907,9 +909,9 @@ public class CentermonitorTUavController extends BaseController {
     /**
      * 根据uavSn获取无人机及所属部门集合
      */
-    @GetMapping("/selectUavByUavId/{uavSn}")
-    public AjaxResult selectUavByUavId(@PathVariable("uavSn") String uavSn) {
-        return AjaxResult.success(centermonitorTUavService.selectUavByUavSn(uavSn));
+    @GetMapping("/selectUavByUavId/{uavSn}/{isCommandCenter}")
+    public AjaxResult selectUavByUavId(@PathVariable("uavSn") String uavSn, @PathVariable("isCommandCenter") Integer isCommandCenter) {
+        return AjaxResult.success(centermonitorTUavService.selectUavByUavSn(uavSn,isCommandCenter));
     }
 
 }

+ 0 - 85
src/main/java/com/sooka/sponest/monitor/uav/controller/CentermonitorTUavdeptController.java

@@ -1,85 +0,0 @@
-package com.sooka.sponest.monitor.uav.controller;
-
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-import com.ruoyi.common.core.web.page.TableDataInfo;
-import com.ruoyi.common.log.annotation.Log;
-import com.ruoyi.common.log.enums.BusinessType;
-import com.ruoyi.common.security.annotation.RequiresPermissions;
-import com.sooka.sponest.monitor.uav.domain.CentermonitorTUavdept;
-import com.sooka.sponest.monitor.uav.service.ICentermonitorTUavdeptService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 无人机部门关联Controller
- *
- * @author ruoyi
- * @date 2025-03-19
- */
-@RestController
-@RequestMapping("/uavdept")
-public class CentermonitorTUavdeptController extends BaseController {
-    @Autowired
-    private ICentermonitorTUavdeptService centermonitorTUavdeptService;
-
-    /**
-     * 查询无人机部门关联列表
-     */
-    @GetMapping("/list")
-    public TableDataInfo list(CentermonitorTUavdept centermonitorTUavdept) {
-        startPage();
-        List<CentermonitorTUavdept> list = centermonitorTUavdeptService.selectCentermonitorTUavdeptList(centermonitorTUavdept);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出无人机部门关联列表
-     */
-    @Log(title = "无人机部门关联", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, CentermonitorTUavdept centermonitorTUavdept) {
-        List<CentermonitorTUavdept> list = centermonitorTUavdeptService.selectCentermonitorTUavdeptList(centermonitorTUavdept);
-        ExcelUtil<CentermonitorTUavdept> util = new ExcelUtil<CentermonitorTUavdept>(CentermonitorTUavdept.class);
-        util.exportExcel(response, list, "无人机部门关联数据");
-    }
-
-    /**
-     * 获取无人机部门关联详细信息
-     */
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return AjaxResult.success(centermonitorTUavdeptService.selectCentermonitorTUavdeptById(id));
-    }
-
-    /**
-     * 新增无人机部门关联
-     */
-    @Log(title = "无人机部门关联", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody CentermonitorTUavdept centermonitorTUavdept) {
-        return toAjax(centermonitorTUavdeptService.insertCentermonitorTUavdept(centermonitorTUavdept));
-    }
-
-    /**
-     * 修改无人机部门关联
-     */
-    @Log(title = "无人机部门关联", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody CentermonitorTUavdept centermonitorTUavdept) {
-        return toAjax(centermonitorTUavdeptService.updateCentermonitorTUavdept(centermonitorTUavdept));
-    }
-
-    /**
-     * 删除无人机部门关联
-     */
-    @Log(title = "无人机部门关联", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(centermonitorTUavdeptService.deleteCentermonitorTUavdeptByIds(ids));
-    }
-}

+ 7 - 20
src/main/java/com/sooka/sponest/monitor/uav/domain/CentermonitorTUav.java

@@ -2,6 +2,7 @@ package com.sooka.sponest.monitor.uav.domain;
 
 import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
+import com.sooka.sponest.monitor.aidevicedept.domain.CenterdataTAidevicedept;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
@@ -19,7 +20,7 @@ public class CentermonitorTUav extends BaseEntity {
     /**
      * 主键id
      */
-    private Long id;
+    private String id;
 
     /**
      * 基站名称
@@ -27,11 +28,6 @@ public class CentermonitorTUav extends BaseEntity {
     @Excel(name = "基站名称")
     private String baseStationName;
 
-    /**
-     * 机库ID
-     */
-    @Excel(name = "机库ID")
-    private String baseStationId;
 
     /**
      * 机库SN
@@ -91,13 +87,13 @@ public class CentermonitorTUav extends BaseEntity {
      * 部门集合
      */
     @Excel(name = "部门集合")
-    private List<CentermonitorTUavdept> deptList;
+    private List<CenterdataTAidevicedept> deptList;
 
-    public void setId(Long id) {
+    public void setId(String id) {
         this.id = id;
     }
 
-    public Long getId() {
+    public String getId() {
         return id;
     }
 
@@ -109,14 +105,6 @@ public class CentermonitorTUav extends BaseEntity {
         return baseStationName;
     }
 
-    public void setBaseStationId(String baseStationId) {
-        this.baseStationId = baseStationId;
-    }
-
-    public String getBaseStationId() {
-        return baseStationId;
-    }
-
     public void setBaseStationSn(String baseStationSn) {
         this.baseStationSn = baseStationSn;
     }
@@ -189,11 +177,11 @@ public class CentermonitorTUav extends BaseEntity {
         this.deptName = deptName;
     }
 
-    public List<CentermonitorTUavdept> getDeptList() {
+    public List<CenterdataTAidevicedept> getDeptList() {
         return deptList;
     }
 
-    public void setDeptList(List<CentermonitorTUavdept> deptList) {
+    public void setDeptList(List<CenterdataTAidevicedept> deptList) {
         this.deptList = deptList;
     }
 
@@ -202,7 +190,6 @@ public class CentermonitorTUav extends BaseEntity {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                 .append("id", getId())
                 .append("baseStationName", getBaseStationName())
-                .append("baseStationId", getBaseStationId())
                 .append("baseStationSn", getBaseStationSn())
                 .append("longitude", getLongitude())
                 .append("latitude", getLatitude())

+ 0 - 65
src/main/java/com/sooka/sponest/monitor/uav/mapper/CentermonitorTUavdeptMapper.java

@@ -1,65 +0,0 @@
-package com.sooka.sponest.monitor.uav.mapper;
-
-import com.sooka.sponest.monitor.uav.domain.CentermonitorTUavdept;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 无人机部门关联Mapper接口
- *
- * @author ruoyi
- * @date 2025-03-19
- */
-public interface CentermonitorTUavdeptMapper {
-    /**
-     * 查询无人机部门关联
-     *
-     * @param id 无人机部门关联主键
-     * @return 无人机部门关联
-     */
-    public CentermonitorTUavdept selectCentermonitorTUavdeptById(Long id);
-
-    /**
-     * 查询无人机部门关联列表
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 无人机部门关联集合
-     */
-    public List<CentermonitorTUavdept> selectCentermonitorTUavdeptList(CentermonitorTUavdept centermonitorTUavdept);
-
-    /**
-     * 新增无人机部门关联
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 结果
-     */
-    public int insertCentermonitorTUavdept(CentermonitorTUavdept centermonitorTUavdept);
-
-    /**
-     * 修改无人机部门关联
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 结果
-     */
-    public int updateCentermonitorTUavdept(CentermonitorTUavdept centermonitorTUavdept);
-
-    /**
-     * 删除无人机部门关联
-     *
-     * @param id 无人机部门关联主键
-     * @return 结果
-     */
-    public int deleteCentermonitorTUavdeptById(Long id);
-
-    /**
-     * 批量删除无人机部门关联
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    public int deleteCentermonitorTUavdeptByIds(Long[] ids);
-
-    public List<CentermonitorTUavdept> selectUavdeptByUavId(@Param("uavId") Long uavId);
-
-}

+ 2 - 1
src/main/java/com/sooka/sponest/monitor/uav/service/ICentermonitorTUavService.java

@@ -61,9 +61,10 @@ public interface ICentermonitorTUavService {
 
     /**
      * 根据部门id查询无人机列表
+     *
      * @return
      */
     List<CentermonitorTUav> selectCentermonitorTUavByDeptId();
 
-    CentermonitorTUav selectUavByUavSn(String uavSn);
+    CentermonitorTUav selectUavByUavSn(String uavSn, Integer isCommandCenter);
 }

+ 0 - 61
src/main/java/com/sooka/sponest/monitor/uav/service/ICentermonitorTUavdeptService.java

@@ -1,61 +0,0 @@
-package com.sooka.sponest.monitor.uav.service;
-
-import com.sooka.sponest.monitor.uav.domain.CentermonitorTUavdept;
-
-import java.util.List;
-
-/**
- * 无人机部门关联Service接口
- *
- * @author ruoyi
- * @date 2025-03-19
- */
-public interface ICentermonitorTUavdeptService {
-    /**
-     * 查询无人机部门关联
-     *
-     * @param id 无人机部门关联主键
-     * @return 无人机部门关联
-     */
-    public CentermonitorTUavdept selectCentermonitorTUavdeptById(Long id);
-
-    /**
-     * 查询无人机部门关联列表
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 无人机部门关联集合
-     */
-    public List<CentermonitorTUavdept> selectCentermonitorTUavdeptList(CentermonitorTUavdept centermonitorTUavdept);
-
-    /**
-     * 新增无人机部门关联
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 结果
-     */
-    public int insertCentermonitorTUavdept(CentermonitorTUavdept centermonitorTUavdept);
-
-    /**
-     * 修改无人机部门关联
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 结果
-     */
-    public int updateCentermonitorTUavdept(CentermonitorTUavdept centermonitorTUavdept);
-
-    /**
-     * 批量删除无人机部门关联
-     *
-     * @param ids 需要删除的无人机部门关联主键集合
-     * @return 结果
-     */
-    public int deleteCentermonitorTUavdeptByIds(Long[] ids);
-
-    /**
-     * 删除无人机部门关联信息
-     *
-     * @param id 无人机部门关联主键
-     * @return 结果
-     */
-    public int deleteCentermonitorTUavdeptById(Long id);
-}

+ 12 - 5
src/main/java/com/sooka/sponest/monitor/uav/service/impl/CentermonitorTUavServiceImpl.java

@@ -1,14 +1,17 @@
 package com.sooka.sponest.monitor.uav.service.impl;
 
+import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.sooka.sponest.monitor.aidevicedept.domain.CenterdataTAidevicedept;
+import com.sooka.sponest.monitor.aidevicedept.mapper.CenterdataTAidevicedeptMapper;
 import com.sooka.sponest.monitor.uav.domain.CentermonitorTUav;
 import com.sooka.sponest.monitor.uav.mapper.CentermonitorTUavMapper;
-import com.sooka.sponest.monitor.uav.mapper.CentermonitorTUavdeptMapper;
 import com.sooka.sponest.monitor.uav.service.ICentermonitorTUavService;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 
@@ -22,8 +25,8 @@ import java.util.List;
 public class CentermonitorTUavServiceImpl implements ICentermonitorTUavService {
     @Autowired
     private CentermonitorTUavMapper centermonitorTUavMapper;
-    @Autowired
-    private CentermonitorTUavdeptMapper centermonitorTUavdeptMapper;
+    @Resource
+    private CenterdataTAidevicedeptMapper centerdataTAidevicedeptMapper;
 
     /**
      * 查询无人机
@@ -55,6 +58,7 @@ public class CentermonitorTUavServiceImpl implements ICentermonitorTUavService {
      */
     @Override
     public int insertCentermonitorTUav(CentermonitorTUav centermonitorTUav) {
+        centermonitorTUav.setId(IdUtils.simpleUUID());
         return centermonitorTUavMapper.insertCentermonitorTUav(centermonitorTUav);
     }
 
@@ -103,10 +107,13 @@ public class CentermonitorTUavServiceImpl implements ICentermonitorTUavService {
     }
 
     @Override
-    public CentermonitorTUav selectUavByUavSn(String uavSn) {
+    public CentermonitorTUav selectUavByUavSn(String uavSn, Integer isCommandCenter) {
         CentermonitorTUav centermonitorTUav = centermonitorTUavMapper.selectUavByUavSn(uavSn);
         if (ObjectUtils.isNotEmpty(centermonitorTUav)) {
-            centermonitorTUav.setDeptList(centermonitorTUavdeptMapper.selectUavdeptByUavId(centermonitorTUav.getId()));
+            CenterdataTAidevicedept centerdataTAidevicedept = new CenterdataTAidevicedept();
+            centerdataTAidevicedept.setDeviceId(centermonitorTUav.getId());
+            centerdataTAidevicedept.setIsCommandCenter(isCommandCenter);
+            centermonitorTUav.setDeptList(centerdataTAidevicedeptMapper.selectCenterdataTAidevicedeptList(centerdataTAidevicedept));
         }
         return centermonitorTUav;
     }

+ 0 - 91
src/main/java/com/sooka/sponest/monitor/uav/service/impl/CentermonitorTUavdeptServiceImpl.java

@@ -1,91 +0,0 @@
-package com.sooka.sponest.monitor.uav.service.impl;
-
-import com.sooka.sponest.monitor.uav.domain.CentermonitorTUavdept;
-import com.sooka.sponest.monitor.uav.mapper.CentermonitorTUavdeptMapper;
-import com.sooka.sponest.monitor.uav.service.ICentermonitorTUavdeptService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.List;
-
-
-/**
- * 无人机部门关联Service业务层处理
- *
- * @author ruoyi
- * @date 2025-03-19
- */
-@Service
-public class CentermonitorTUavdeptServiceImpl implements ICentermonitorTUavdeptService {
-    @Autowired
-    private CentermonitorTUavdeptMapper centermonitorTUavdeptMapper;
-
-    /**
-     * 查询无人机部门关联
-     *
-     * @param id 无人机部门关联主键
-     * @return 无人机部门关联
-     */
-    @Override
-    public CentermonitorTUavdept selectCentermonitorTUavdeptById(Long id) {
-        return centermonitorTUavdeptMapper.selectCentermonitorTUavdeptById(id);
-    }
-
-    /**
-     * 查询无人机部门关联列表
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 无人机部门关联
-     */
-    @Override
-    public List<CentermonitorTUavdept> selectCentermonitorTUavdeptList(CentermonitorTUavdept centermonitorTUavdept) {
-        return centermonitorTUavdeptMapper.selectCentermonitorTUavdeptList(centermonitorTUavdept);
-    }
-
-    /**
-     * 新增无人机部门关联
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 结果
-     */
-    @Override
-    public int insertCentermonitorTUavdept(CentermonitorTUavdept centermonitorTUavdept) {
-        centermonitorTUavdept.setCreateTime(new Date());
-        return centermonitorTUavdeptMapper.insertCentermonitorTUavdept(centermonitorTUavdept);
-    }
-
-    /**
-     * 修改无人机部门关联
-     *
-     * @param centermonitorTUavdept 无人机部门关联
-     * @return 结果
-     */
-    @Override
-    public int updateCentermonitorTUavdept(CentermonitorTUavdept centermonitorTUavdept) {
-        centermonitorTUavdept.setUpdateTime(new Date());
-        return centermonitorTUavdeptMapper.updateCentermonitorTUavdept(centermonitorTUavdept);
-    }
-
-    /**
-     * 批量删除无人机部门关联
-     *
-     * @param ids 需要删除的无人机部门关联主键
-     * @return 结果
-     */
-    @Override
-    public int deleteCentermonitorTUavdeptByIds(Long[] ids) {
-        return centermonitorTUavdeptMapper.deleteCentermonitorTUavdeptByIds(ids);
-    }
-
-    /**
-     * 删除无人机部门关联信息
-     *
-     * @param id 无人机部门关联主键
-     * @return 结果
-     */
-    @Override
-    public int deleteCentermonitorTUavdeptById(Long id) {
-        return centermonitorTUavdeptMapper.deleteCentermonitorTUavdeptById(id);
-    }
-}

+ 7 - 11
src/main/resources/mapper/monitor/uav/CentermonitorTUavMapper.xml

@@ -7,7 +7,6 @@
     <resultMap type="CentermonitorTUav" id="CentermonitorTUavResult">
         <result property="id" column="id"/>
         <result property="baseStationName" column="base_station_name"/>
-        <result property="baseStationId" column="base_station_id"/>
         <result property="baseStationSn" column="base_station_sn"/>
         <result property="longitude" column="longitude"/>
         <result property="latitude" column="latitude"/>
@@ -22,7 +21,6 @@
     <sql id="selectCentermonitorTUavVo">
         select id,
                base_station_name,
-               base_station_id,
                base_station_sn,
                longitude,
                latitude,
@@ -39,7 +37,6 @@
             <if test="baseStationName != null  and baseStationName != ''">and base_station_name like concat('%',
                 #{baseStationName}, '%')
             </if>
-            <if test="baseStationId != null  and baseStationId != ''">and base_station_id = #{baseStationId}</if>
             <if test="baseStationSn != null  and baseStationSn != ''">and base_station_sn = #{baseStationSn}</if>
             <if test="longitude != null  and longitude != ''">and longitude = #{longitude}</if>
             <if test="latitude != null  and latitude != ''">and latitude = #{latitude}</if>
@@ -58,8 +55,8 @@
     <insert id="insertCentermonitorTUav" parameterType="CentermonitorTUav" useGeneratedKeys="true" keyProperty="id">
         insert into centermonitor_t_uav
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
             <if test="baseStationName != null">base_station_name,</if>
-            <if test="baseStationId != null">base_station_id,</if>
             <if test="baseStationSn != null">base_station_sn,</if>
             <if test="longitude != null">longitude,</if>
             <if test="latitude != null">latitude,</if>
@@ -69,8 +66,8 @@
             <if test="uavSn != null">uav_sn,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
             <if test="baseStationName != null">#{baseStationName},</if>
-            <if test="baseStationId != null">#{baseStationId},</if>
             <if test="baseStationSn != null">#{baseStationSn},</if>
             <if test="longitude != null">#{longitude},</if>
             <if test="latitude != null">#{latitude},</if>
@@ -85,7 +82,6 @@
         update centermonitor_t_uav
         <trim prefix="SET" suffixOverrides=",">
             <if test="baseStationName != null">base_station_name = #{baseStationName},</if>
-            <if test="baseStationId != null">base_station_id = #{baseStationId},</if>
             <if test="baseStationSn != null">base_station_sn = #{baseStationSn},</if>
             <if test="longitude != null">longitude = #{longitude},</if>
             <if test="latitude != null">latitude = #{latitude},</if>
@@ -115,17 +111,17 @@
             ctu.*
         FROM
             centermonitor_t_uav ctu
-                LEFT JOIN centermonitor_t_uavdept ctud ON ctud.uav_id = ctu.id
+                LEFT JOIN centermonitor_t_aidevicedept ctad ON ctad.device_id = ctu.id
         WHERE
-            ctud.dept_id = #{deptId}
+            ctad.map_dept_id = #{deptId}
     </select>
 
     <select id="selectUavByUavSn" parameterType="String" resultMap="CentermonitorTUavResult">
         SELECT ctu.*,
-               GROUP_CONCAT(ctud.dept_id) dept_id,
-               GROUP_CONCAT(ctud.dept_name) dept_name
+               GROUP_CONCAT(ctad.map_dept_id) dept_id,
+               GROUP_CONCAT(ctad.map_dept_name) dept_name
         FROM centermonitor_t_uav ctu
-                 LEFT JOIN centermonitor_t_uavdept ctud ON ctud.uav_id = ctu.id
+                 LEFT JOIN centermonitor_t_aidevicedept ctad ON ctad.device_id = ctu.id
         where ctu.uav_sn = #{uavSn}
         group by ctu.uav_id
     </select>

+ 0 - 90
src/main/resources/mapper/monitor/uav/CentermonitorTUavdeptMapper.xml

@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.sooka.sponest.monitor.uav.mapper.CentermonitorTUavdeptMapper">
-    
-    <resultMap type="CentermonitorTUavdept" id="CentermonitorTUavdeptResult">
-        <result property="id"    column="id"    />
-        <result property="uavId"    column="uav_id"    />
-        <result property="uavName"    column="uav_name"    />
-        <result property="deptId"    column="dept_id"    />
-        <result property="deptName"    column="dept_name"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
-    </resultMap>
-
-    <sql id="selectCentermonitorTUavdeptVo">
-        select id, uav_id,uav_name, dept_id,dept_name, create_by, create_time, update_by,update_time from centermonitor_t_uavdept
-    </sql>
-
-    <select id="selectCentermonitorTUavdeptList" parameterType="CentermonitorTUavdept" resultMap="CentermonitorTUavdeptResult">
-        <include refid="selectCentermonitorTUavdeptVo"/>
-        <where>
-            <if test="uavId != null ">and uav_id = #{uavId}</if>
-            <if test="deptId != null ">and dept_id = #{deptId}</if>
-        </where>
-    </select>
-    
-    <select id="selectCentermonitorTUavdeptById" parameterType="Long" resultMap="CentermonitorTUavdeptResult">
-        <include refid="selectCentermonitorTUavdeptVo"/>
-        where id = #{id}
-    </select>
-        
-    <insert id="insertCentermonitorTUavdept" parameterType="CentermonitorTUavdept" useGeneratedKeys="true" keyProperty="id">
-        insert into centermonitor_t_uavdept
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="uavId != null">uav_id,</if>
-            <if test="uavName != null">uav_name,</if>
-            <if test="deptId != null">dept_id,</if>
-            <if test="deptName != null">dept_name,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="uavId != null">#{uavId},</if>
-            <if test="uavName != null">#{uavName},</if>
-            <if test="deptId != null">#{deptId},</if>
-            <if test="deptName != null">#{deptName},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-         </trim>
-    </insert>
-
-    <update id="updateCentermonitorTUavdept" parameterType="CentermonitorTUavdept">
-        update centermonitor_t_uavdept
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="uavId != null">uav_id = #{uavId},</if>
-            <if test="uavName != null">uav_name = #{uavName},</if>
-            <if test="deptId != null">dept_id = #{deptId},</if>
-            <if test="deptName != null">dept_name = #{deptName},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateBy != null">update_by = #{updateBy},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteCentermonitorTUavdeptById" parameterType="Long">
-        delete from centermonitor_t_uavdept where id = #{id}
-    </delete>
-
-    <delete id="deleteCentermonitorTUavdeptByIds" parameterType="String">
-        delete from centermonitor_t_uavdept where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-
-    <select id="selectUavdeptByUavId" parameterType="Long" resultMap="CentermonitorTUavdeptResult">
-        <include refid="selectCentermonitorTUavdeptVo"/>
-        where uav_id = #{uavId}
-    </select>
-</mapper>