Эх сурвалжийг харах

+ 增加室内、室外两个维度

chen.cheng 8 сар өмнө
parent
commit
e987a412a9

+ 21 - 0
bd-location/src/main/java/com/ruoyi/bd/domain/BdFenceInfo.java

@@ -47,6 +47,26 @@ public class BdFenceInfo extends BaseEntity {
 
     private String fenceType;
 
+    private String locationId;
+
+    private Integer altitude;
+
+
+    public String getLocationId() {
+        return locationId;
+    }
+
+    public void setLocationId(String locationId) {
+        this.locationId = locationId;
+    }
+
+    public Integer getAltitude() {
+        return altitude;
+    }
+
+    public void setAltitude(Integer altitude) {
+        this.altitude = altitude;
+    }
 
     public void setId(Long id) {
         this.id = id;
@@ -104,6 +124,7 @@ public class BdFenceInfo extends BaseEntity {
         this.fenceType = fenceType;
     }
 
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 67 - 51
bd-location/src/main/java/com/ruoyi/bd/domain/BdFenceVioEvt.java

@@ -11,35 +11,48 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * @author ruoyi
  * @date 2024-10-14
  */
-public class BdFenceVioEvt extends BaseEntity
-{
+public class BdFenceVioEvt extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /**  */
+    /**
+     *
+     */
     private Long id;
 
-    /**  */
+    /**
+     *
+     */
     @Excel(name = "")
     private String evtKey;
 
-    /** 事件类型
-01 围栏闯禁事件 */
+    /**
+     * 事件类型
+     * 01 围栏闯禁事件
+     */
     @Excel(name = "事件类型01 围栏闯禁事件")
     private String evtType;
 
-    /** 事件描述 */
+    /**
+     * 事件描述
+     */
     @Excel(name = "事件描述")
     private String evtDesc;
 
-    /** 经度 */
+    /**
+     * 经度
+     */
     @Excel(name = "经度")
     private Double lng;
 
-    /** 维度 */
+    /**
+     * 维度
+     */
     @Excel(name = "维度")
     private Double lat;
 
-    /** 围栏id */
+    /**
+     * 围栏id
+     */
     @Excel(name = "围栏id")
     private Long fenceId;
 
@@ -47,67 +60,70 @@ public class BdFenceVioEvt extends BaseEntity
 
     private String evtTime;
 
-    public void setId(Long id)
-    {
+    private Long locationId;
+
+    public Long getLocationId() {
+        return locationId;
+    }
+
+    public void setLocationId(Long locationId) {
+        this.locationId = locationId;
+    }
+
+
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId()
-    {
+    public Long getId() {
         return id;
     }
-    public void setEvtKey(String evtKey)
-    {
+
+    public void setEvtKey(String evtKey) {
         this.evtKey = evtKey;
     }
 
-    public String getEvtKey()
-    {
+    public String getEvtKey() {
         return evtKey;
     }
-    public void setEvtType(String evtType)
-    {
+
+    public void setEvtType(String evtType) {
         this.evtType = evtType;
     }
 
-    public String getEvtType()
-    {
+    public String getEvtType() {
         return evtType;
     }
-    public void setEvtDesc(String evtDesc)
-    {
+
+    public void setEvtDesc(String evtDesc) {
         this.evtDesc = evtDesc;
     }
 
-    public String getEvtDesc()
-    {
+    public String getEvtDesc() {
         return evtDesc;
     }
-    public void setLng(Double lng)
-    {
+
+    public void setLng(Double lng) {
         this.lng = lng;
     }
 
-    public Double getLng()
-    {
+    public Double getLng() {
         return lng;
     }
-    public void setLat(Double lat)
-    {
+
+    public void setLat(Double lat) {
         this.lat = lat;
     }
 
-    public Double getLat()
-    {
+    public Double getLat() {
         return lat;
     }
-    public void setFenceId(Long fenceId)
-    {
+
+    public void setFenceId(Long fenceId) {
         this.fenceId = fenceId;
     }
 
-    public Long getFenceId()
-    {
+    public Long getFenceId() {
         return fenceId;
     }
 
@@ -129,18 +145,18 @@ public class BdFenceVioEvt extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("evtKey", getEvtKey())
-            .append("evtType", getEvtType())
-            .append("evtDesc", getEvtDesc())
-            .append("lng", getLng())
-            .append("lat", getLat())
-            .append("fenceId", getFenceId())
-            .append("updateTime", getUpdateTime())
-            .append("createTime", getCreateTime())
-            .append("createBy", getCreateBy())
-            .append("updateBy", getUpdateBy())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("evtKey", getEvtKey())
+                .append("evtType", getEvtType())
+                .append("evtDesc", getEvtDesc())
+                .append("lng", getLng())
+                .append("lat", getLat())
+                .append("fenceId", getFenceId())
+                .append("updateTime", getUpdateTime())
+                .append("createTime", getCreateTime())
+                .append("createBy", getCreateBy())
+                .append("updateBy", getUpdateBy())
+                .toString();
     }
 }

+ 2 - 0
bd-location/src/main/java/com/ruoyi/bd/service/engine/impl/RoomBreakInEngine.java

@@ -115,6 +115,7 @@ public class RoomBreakInEngine extends EvtFusionEngine {
         bdFenceVioEvt.setFenceId(msg.getMsg().getLong("fenceId"));
         bdFenceVioEvt.setLat(msg.getLatitude());
         bdFenceVioEvt.setLng(msg.getLongitude());
+        bdFenceVioEvt.setLocationId(msg.getMsg().getLong("roomId"));
         bdFenceVioEvt.setEvtStatus(EvtStatus.NEW.getCode());
         bdFenceVioEvt.setEvtType(EvtType.FENCE_ROOM_IN.getCode());
         bdFenceVioEvt.setEvtTime(DateTimeUtil.getDateFromMills(msg.getSrcTimestamp()));
@@ -151,6 +152,7 @@ public class RoomBreakInEngine extends EvtFusionEngine {
                 logger.info("?>>>>>fence info size: {}", msg);
                 msg.put("fenceId", fenceInfo.getId());
                 msg.put("fenceName", fenceInfo.getDefenceName());
+                msg.put("roomId", fenceInfo.getLocationId());
                 client.publish(BDConst.MQTT_TOPIC.EVT_ROOM_LOCATION_TOPIC, JSON.toJSONBytes(msg));
                 break;
             }

+ 6 - 0
bd-location/src/main/java/com/ruoyi/web/controller/bd/BdFenceVioEvtController.java

@@ -47,6 +47,12 @@ public class BdFenceVioEvtController extends BaseController {
         return getDataTable(list);
     }
 
+    @GetMapping("/listAll")
+    public TableDataInfo listAll(BdFenceVioEvt bdFenceVioEvt) {
+        List<BdFenceVioEvt> list = bdFenceVioEvtService.selectBdFenceVioEvtList(bdFenceVioEvt);
+        return getDataTable(list);
+    }
+
     /**
      * 导出围栏闯禁事件列表
      */

+ 11 - 0
bd-location/src/main/resources/mapper/bd/BdFenceInfoMapper.xml

@@ -11,6 +11,8 @@
         <result property="centerLng" column="center_lng"/>
         <result property="centerLat" column="center_lat"/>
         <result property="fenceType" column="fence_type"/>
+        <result property="locationId" column="location_id"/>
+        <result property="altitude" column="altitude"/>
         <result property="updateTime" column="update_time"/>
         <result property="createTime" column="create_time"/>
         <result property="createBy" column="create_by"/>
@@ -24,6 +26,8 @@
                center_lng,
                center_lat,
                fence_type,
+               location_id,
+               altitude,
                update_time,
                create_time,
                create_by,
@@ -38,6 +42,7 @@
                 '%')
             </if>
             <if test="fenceType != null  and fenceType != ''">and fence_type = #{fenceType}</if>
+            <if test="locationId != null ">and location_id = #{locationId}</if>
         </where>
     </select>
 
@@ -54,6 +59,8 @@
             <if test="centerLng != null">center_lng,</if>
             <if test="centerLat != null">center_lat,</if>
             <if test="fenceType !=null">fence_type,</if>
+            <if test="locationId !=null">location_id,</if>
+            <if test="altitude != null">altitude,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="createTime != null">create_time,</if>
             <if test="createBy != null">create_by,</if>
@@ -65,6 +72,8 @@
             <if test="centerLng != null">#{centerLng},</if>
             <if test="centerLat != null">#{centerLat},</if>
             <if test="fenceType != null">#{fenceType},</if>
+            <if test="locationId != null">#{locationId},</if>
+            <if test="altitude != null">#{altitude},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -80,6 +89,8 @@
             <if test="centerLng != null">center_lng = #{centerLng},</if>
             <if test="centerLat != null">center_lat = #{centerLat},</if>
             <if test="fenceType != null">fence_type = #{fenceType},</if>
+            <if test="locationId != null">location_id = #{locationId},</if>
+            <if test="altitude != null">altitude = #{altitude},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>

+ 7 - 0
bd-location/src/main/resources/mapper/bd/BdFenceVioEvtMapper.xml

@@ -14,6 +14,7 @@
         <result property="fenceId" column="fence_id"/>
         <result property="evtStatus" column="evt_status"/>
         <result property="evtTime" column="evt_time"/>
+        <result property="locationId" column="location_id"/>
         <result property="updateTime" column="update_time"/>
         <result property="createTime" column="create_time"/>
         <result property="createBy" column="create_by"/>
@@ -30,6 +31,7 @@
                fence_id,
                evt_status,
                evt_time,
+               location_id,
                update_time,
                create_time,
                create_by,
@@ -43,6 +45,8 @@
             <if test="evtType != null  and evtType != ''">and evt_type = #{evtType}</if>
             <if test="evtDesc != null  and evtDesc != ''">and evt_desc = #{evtDesc}</if>
             <if test="evtStatus !=null and evtStatus!=''">and evt_status = #{evtStatus}</if>
+            <if test="locationId !=null">and location_id = #{locationId}</if>
+            <if test="evtTime !=null  and evtTime!=''">and evt_time >= #{evtTime}</if>
         </where>
         order by id desc
     </select>
@@ -63,6 +67,7 @@
             <if test="fenceId != null">fence_id,</if>
             <if test="evtStatus !=null">evt_status,</if>
             <if test="evtTime !=null">evt_time,</if>
+            <if test="locationId != null">location_id,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="createTime != null">create_time,</if>
             <if test="createBy != null">create_by,</if>
@@ -77,6 +82,7 @@
             <if test="fenceId != null">#{fenceId},</if>
             <if test="evtStatus !=null">#{evtStatus},</if>
             <if test="evtTime !=null">#{evtTime},</if>
+            <if test="locationId != null">#{locationId},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -95,6 +101,7 @@
             <if test="fenceId != null">fence_id = #{fenceId},</if>
             <if test="evtStatus !=null">evt_status = #{evtStatus},</if>
             <if test="evtTime !=null">evt_time = #{evtTime},</if>
+            <if test="locationId != null">location_id = #{locationId},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>

+ 1 - 1
bd-location/version

@@ -1 +1 @@
-2.3
+2.4

+ 4 - 4
ruoyi-ui/babel.config.js

@@ -7,19 +7,19 @@ module.exports = {
     'development': {
       // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
       // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
-      'plugins': ['dynamic-import-node']
+      'plugins': ['dynamic-import-node',["transform-es2015-arrow-functions", { spec: true }]]
     },
-    // 测试环境
+    // 锟斤拷锟皆伙拷锟斤拷
     'staging': {
       'plugins': ['@babel/plugin-syntax-dynamic-import']
     },
-    // 生产环境
+    // 锟斤拷锟斤拷锟斤拷锟斤拷
     'production': {
       'plugins': ['@babel/plugin-syntax-dynamic-import']
     },
     // test
     'test': {
       'plugins': ['@babel/plugin-syntax-dynamic-import']
-    }
+    },
   }
 }

+ 1 - 0
ruoyi-ui/package.json

@@ -73,6 +73,7 @@
     "@vue/cli-service": "4.4.6",
     "babel-eslint": "10.1.0",
     "babel-plugin-dynamic-import-node": "^2.3.3",
+    "babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
     "chalk": "4.1.0",
     "compression-webpack-plugin": "6.1.2",
     "connect": "3.6.6",

+ 8 - 0
ruoyi-ui/src/api/bd/fenceVioEvt.js

@@ -9,6 +9,14 @@ export function listFenceVioEvt(query) {
   })
 }
 
+export function listAllFenceVioEvt(query) {
+  return request({
+    url: '/bd/fenceVioEvt/listAll',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询围栏闯禁事件详细
 export function getFenceVioEvt(id) {
   return request({

+ 29 - 23
ruoyi-ui/src/views/bd/fence/index.vue

@@ -30,12 +30,9 @@
       <div class="location-list">
         <template v-for="fence in fenceList">
           <div :key="`fence_${fence.id}`" class="list-item">
-            <span class="over-flow-hidden" style="width: 40%">
+            <span class="over-flow-hidden" style="width: 80%;cursor: pointer;" @click="()=>fenceClick(fence)">
               {{ fence.name }}
             </span>
-            <span class="over-flow-hidden" style="width: 40%">
-             {{ fence.updateTime }}
-            </span>
             <span class="over-flow-hidden" style="width: 20%">
               <el-popconfirm
                 confirm-button-text='好的'
@@ -177,6 +174,11 @@ export default {
     this.getFenceList({});
   },
   methods: {
+    fenceClick(fence) {
+      const {polygon} = fence;
+      map.setPitch(0);
+      map.fitExtent(polygon.getExtent(), 0);
+    },
     async getFenceList(params) {
       const {rows} = await listFenceInfo({
         pageNum: 1,
@@ -206,7 +208,7 @@ export default {
           },
           bizAttr: {
             id,
-            name: defenceName,
+            name: defenceName
           },
         });
         result.push({
@@ -229,7 +231,7 @@ export default {
       this.dialogVisible = false;
     },
     saveEdit() {
-      this.$refs.form.validate((valid) => {
+      this.$refs.form.validate(async (valid) => {
         if (valid) {
           const resultCoor = [];
           const coordinates = [];
@@ -244,23 +246,22 @@ export default {
           resultCoor.push(resultCoor[0]);
           this.form.poly = `POLYGON((${resultCoor.join(',')}))`;
           if (!this.form.id) {
-            addFenceInfo(this.formatParams(this.form)).then(response => {
-              this.$message({
-                type: 'success',
-                message: '围栏保存成功',
-              });
+            await addFenceInfo(this.formatParams(this.form))
+            this.$message({
+              type: 'success',
+              message: '围栏保存成功',
             });
           } else {
-            updateFenceInfo(this.formatParams(this.form)).then(response => {
-              this.$message({
-                type: 'success',
-                message: '围栏编辑成功',
-              });
+            await updateFenceInfo(this.formatParams(this.form))
+            this.$message({
+              type: 'success',
+              message: '围栏编辑成功',
             });
+            this.polyLayer.removeGeometry(this.form.polygonId);
           }
           this.dialogVisible = false;
           this.drawtool.clear();
-          const polygon = this.drawPoly({
+          this.drawPoly({
             coordinates: coordinates,
             symbol: {
               lineColor: 'rgba(241,0,23,0.49)',
@@ -273,7 +274,6 @@ export default {
             },
             bizAttr: this.form,
           });
-          this.polyLayer.addGeometry(polygon);
           this.editingDrawGeom = null;
           this.editState = false;
           this.$refs.form.resetFields();
@@ -349,10 +349,6 @@ export default {
             this.editingDrawGeom.remove();
             this.editState = false;
             this.editingDrawGeom = null;
-            this.$message({
-              type: 'info',
-              message: '删除围栏',
-            });
           });
           // 点击地图 图形取消编辑状态
           window.map.map.once('click', () => {
@@ -367,7 +363,17 @@ export default {
       fence.polygon.geom.remove();
     },
     editFence(fence) {
-
+      this.editingDrawGeom = fence.polygon.geom;
+      this.form.name = fence.polygon.options.bizAttr.name;
+      this.form.id = fence.polygon.options.bizAttr.id;
+      this.form.polygonId = fence.polygon.options.bizAttr.polygonId;
+      this.editState = true;
+      this.editingDrawGeom.startEdit();
+      // 点击地图 图形取消编辑状态
+      window.map.map.once('click', () => {
+        this.editingDrawGeom.endEdit();
+        this.dialogVisible = true;
+      });
     },
   },
 };

+ 16 - 1
ruoyi-ui/src/views/bd/fenceEvt/index.vue

@@ -14,7 +14,7 @@
         <el-tab-pane label="室外围栏" :name="Tabs.outside.id">
         </el-tab-pane>
         <el-tab-pane label="室内围栏" :name="Tabs.inside.id">
-          <room-layer v-if="activeName === Tabs.inside.id"/>
+          <room-layer v-if="activeName === Tabs.inside.id" :onclick="onRoomClick"/>
         </el-tab-pane>
       </el-tabs>
       <div class="location-list">
@@ -81,6 +81,7 @@ export default {
       fp: null,
       ws: null,
       markLayer: null,
+      heatlayer: null,
       listParam: Tabs.outside.param,
     };
   },
@@ -90,6 +91,12 @@ export default {
   },
   created() {
     this.markLayer = new BDLayers.Lib.Layer.CBVectorLayer('real_time_markerLayer', true);
+    this.heatlayer = new BDLayers.LibViz.Layer.HeatLayer('heatlayer', [], {
+      heatValueScale: 0.5,
+      heatRadius: 10,
+      heatOpacity: 0.8,
+    });
+    window.map.addCustomLayers(this.heatlayer, 4);
     window.map.addCustomLayers(this.markLayer, 5);
   },
   mounted() {
@@ -132,6 +139,14 @@ export default {
         this.markLayer.addMarker(marker);
       });
     },
+    onRoomClick(item) {
+      this.listParam = {
+        ...this.listParam,
+        locationId: item.bizId,
+      };
+      this.getFenceVioEvtList();
+      this.getFenceList();
+    },
     async getFenceList() {
       this.clearLayer()
       const {rows} = await listFenceInfo({

+ 1 - 0
ruoyi-ui/src/views/bd/index.vue

@@ -101,6 +101,7 @@ export default {
         offset: [13.4, -3.5],
         mapView: this.mapView,
         maxCacheSize: 10000,
+        loadingLimit: 10,
         services: [
           {
             url: `${protocolAndHost}${process.env.VUE_APP_BD_BASE_API}/folder/zy9/tileset.json`, //"http://resource.dvgis.cn/data/3dtiles/dayanta/tileset.json",

+ 2 - 1
ruoyi-ui/src/views/bd/map/maphandle.js

@@ -27,6 +27,7 @@ export default {
                polyOnClick = () => {
                },
              }, polyLayer) {
+      const polygonId =`auto_poly_id${uuid()}`;
       let symbolParam = {
         lineColor: '#34495e',
         lineWidth: 2,
@@ -45,7 +46,7 @@ export default {
         altitude,
         symbol: symbolParam,
         labelSymbol: labelSymbolParam,
-        bizAttr: bizAttr,
+        bizAttr: {...bizAttr,polygonId},
       });
       //多边形的点击事件
       polygon.on('click', polyOnClick);

+ 16 - 1
ruoyi-ui/src/views/bd/rooms/index.vue

@@ -15,11 +15,13 @@
 const Layers = {
   cyy: {
     id: 'cyy',
+    bizId: 2,
     label: '创研院',
     layer: "http://bd.xt.wenhq.top:8083/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=bdlayers:bdl_cyy_pingmian&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&Format=image/jpeg&TILECOL={x}&TILEROW={y}",
   },
   cyy1: {
     id: 'cyy1',
+    bizId: 1,
     label: '创研院1',
     layer: "http://bd.xt.wenhq.top:8083/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=bdlayers:bdl_cyy_pingmian&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&Format=image/jpeg&TILECOL={x}&TILEROW={y}",
   }
@@ -27,6 +29,14 @@ const Layers = {
 export default {
   name: 'room-layer',
   components: {},
+  props: {
+    onclick: {
+      type: Function,
+      default: () => {
+      },
+      required: false,
+    },
+  },
   data() {
     return {
       Layers,
@@ -42,19 +52,24 @@ export default {
 
   },
   mounted() {
+    this.init();
   },
   methods: {
     roomTagClick(layer) {
       window.map.removeLayersById(this.layerId);
       const vtLayer = new BDLayers.Lib.Layer.CBTileLayer(this.layerId, {
         url: layer.layer,
-        maxZoom: 24,
         minZoom: 15,
+        maxZoom: 24,
       });
       window.map.addCustomLayers(vtLayer);
       window.map.setPitch(0);
       this.activeTag = layer.id;
+      this.onclick(layer);
     },
+    init() {
+      this.roomTagClick(Layers['cyy']);
+    }
   },
 };
 </script>