Explorar el Código

后台开发完成

shs hace 1 año
padre
commit
335d6edcc0

+ 8 - 0
aidex-controller/src/main/java/com/aidex/web/controller/gps/GpsController.java

@@ -3,6 +3,7 @@ package com.aidex.web.controller.gps;
 import com.aidex.common.core.controller.BaseController;
 import com.aidex.common.core.domain.R;
 import com.aidex.common.gps.domain.LocationEntity;
+import com.aidex.common.gps.domain.MileageEntity;
 import com.aidex.common.gps.server.IGpsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -46,4 +47,11 @@ public class GpsController extends BaseController {
     public R<List<LocationEntity>> localtionBatch() {
         return R.data(gpsService.getLocationBatch());
     }
+
+
+    @PreAuthorize("@ss.hasPermi('monit:gps:location')")
+    @GetMapping("/mileage")
+    public R<List<MileageEntity>> mileageStatisics(@RequestParam(defaultValue = "",name = "startTime") String startTime, @RequestParam(defaultValue = "",name = "endTime") String endTime) {
+        return R.data(gpsService.getMileageStatisics(startTime,endTime));
+    }
 }

+ 5 - 0
aidex-system/src/main/java/com/aidex/common/gps/common/GpsApi.java

@@ -17,4 +17,9 @@ public interface GpsApi {
      * 批量查询单个定位信息
      * */
     String findDeviceInfo = "DeviceInfo";
+
+    /*
+     * 批量查询单个定位信息
+     * */
+    String mileageStatustics = "OperationStatistics";
 }

+ 16 - 0
aidex-system/src/main/java/com/aidex/common/gps/domain/MileageEntity.java

@@ -0,0 +1,16 @@
+package com.aidex.common.gps.domain;
+
+import lombok.Data;
+
+@Data
+public class MileageEntity {
+
+    private String objectid;
+    private String macid;
+    private String fullName;
+    private String overspeedTimes;
+    private String parkTimes;
+    private String mil;
+    private String platenumber;
+    private String sim;
+}

+ 3 - 0
aidex-system/src/main/java/com/aidex/common/gps/server/IGpsService.java

@@ -1,6 +1,7 @@
 package com.aidex.common.gps.server;
 
 import com.aidex.common.gps.domain.LocationEntity;
+import com.aidex.common.gps.domain.MileageEntity;
 
 import java.util.List;
 
@@ -13,4 +14,6 @@ public interface IGpsService {
     LocationEntity getLocation(String shipId);
 
     List<LocationEntity> getLocationBatch();
+
+    List<MileageEntity> getMileageStatisics(String startTime, String endTime);
 }

+ 23 - 2
aidex-system/src/main/java/com/aidex/common/gps/server/impl/GpsService.java

@@ -7,15 +7,19 @@ import com.aidex.common.gps.common.GpsApi;
 import com.aidex.common.gps.common.GpsRequest;
 import com.aidex.common.gps.domain.DeviceEntity;
 import com.aidex.common.gps.domain.LocationEntity;
+import com.aidex.common.gps.domain.MileageEntity;
 import com.aidex.common.gps.server.IGpsService;
+import com.aidex.common.utils.StringUtils;
 import com.aidex.system.domain.SysShip;
 import com.aidex.system.service.SysShipService;
-import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -66,4 +70,21 @@ public class GpsService implements IGpsService {
         List<LocationEntity> locationEntities = gpsRequest.postArray(params).toJavaList(LocationEntity.class);
          return locationEntities;
     }
+
+    public List<MileageEntity> getMileageStatisics(String startTime,String endTime){
+        Long startOfDay, endOfDay ;
+        if(StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)){
+            LocalDate today = LocalDate.now();
+            startOfDay = today.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+            endOfDay = LocalDateTime.of(today, LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+        }else {
+            startOfDay = Long.valueOf(startTime);
+            endOfDay = Long.valueOf(endTime);
+        }
+        Map<String, Object> params = generatorGspApi.GeneratorQueryParams(GpsApi.mileageStatustics);
+        params.put("startTime",startTime);
+        params.put("endTime", endOfDay);
+        List<MileageEntity> mileageEntities = gpsRequest.post(params).getJSONArray("rows").toJavaList(MileageEntity.class);
+        return mileageEntities;
+    }
 }

+ 10 - 1
aidex-ui/src/api/gps/gps.js

@@ -17,7 +17,7 @@ export function locationBatch () {
   })
 }
 
-// 获取全部设备定位地点
+// 获取轨迹
 export function locationPlay (query) {
   return request({
     url: '/monit/gps/location/play',
@@ -25,3 +25,12 @@ export function locationPlay (query) {
     params: query
   })
 }
+
+// 获取全部设备定位地点
+export function mileage (query) {
+  return request({
+    url: '/monit/gps/mileage',
+    method: 'get',
+    params: query
+  })
+}

+ 119 - 0
aidex-ui/src/views/operation/mileage/index.vue

@@ -0,0 +1,119 @@
+<template>
+  <div>
+    <a-card :bordered="false" style="margin-bottom: 10px;">
+      <!-- 条件搜索 -->
+      <div class="table-page-search-wrapper">
+        <a-form>
+          <a-row :gutter="48">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="统计时间">
+                <a-range-picker show-time v-model="selDate">
+                  <template slot="renderExtraFooter">
+                    请选择日期时间
+                  </template>
+                </a-range-picker>
+              </a-form-item>
+            </a-col>
+            <a-col>
+              <span class="table-page-search-submitButtons" style="float: right;">
+                <a-button type="primary" @click="handleQuery"><a-icon type="search" />查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetQuery"><a-icon type="redo" />重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-card>
+    <a-card :bordered="false" class="table-card">
+      <advance-table
+        :columns="columns"
+        :data-source="list"
+        title="行驶里程统计(默认为当天数据)"
+        :loading="loading"
+        rowKey="objectid"
+        tableKey="monitor-online-index-table"
+        :isTableConfig="false"
+        :isShowSetBtn="false"
+        size="middle"
+        :format-conditions="true"
+      >
+      </advance-table>
+
+    </a-card>
+  </div>
+</template>
+
+<script>
+
+import { mileage } from '@/api/gps/gps'
+import AdvanceTable from '@/components/pt/table/AdvanceTable'
+
+export default {
+  name: 'Online',
+  components: {
+    AdvanceTable
+  },
+  data () {
+    return {
+      startTime: '',
+      endTime: '',
+      list: [],
+      loading: false,
+      selDate: [],
+      columns: [
+        {
+          title: '船只名称',
+          dataIndex: 'platenumber',
+          ellipsis: true,
+          align: 'center'
+        },
+        {
+          title: '超速次数',
+          dataIndex: 'overspeedTimes',
+          align: 'center'
+        },
+        {
+          title: '停留次数',
+          dataIndex: 'parkTimes',
+          align: 'center'
+        },
+        {
+          title: '行驶里程(单位:km)',
+          dataIndex: 'mil',
+          ellipsis: true,
+          align: 'center'
+        }
+      ]
+    }
+  },
+  filters: {
+  },
+  created () {
+    this.mileageStatisics()
+  },
+  computed: {
+  },
+  watch: {
+  },
+  methods: {
+    mileageStatisics() {
+      mileage({ startTime: this.startTime,
+        endTime: this.endTime }).then(res => {
+          this.list = res.data
+      })
+    },
+    /** 搜索按钮操作 */
+    handleQuery () {
+      this.startTime = new Date(this.selDate[0]).getTime()
+      this.endTime = new Date(this.selDate[0]).getTime()
+      this.mileageStatisics()
+    },
+    /** 重置按钮操作 */
+    resetQuery () {
+      this.startTime = ''
+      this.endTime = ''
+      this.mileageStatisics()
+    }
+  }
+}
+</script>