Forráskód Böngészése

引入地图、增加APP接口

shs 1 éve
szülő
commit
bf2df16283
21 módosított fájl, 320 hozzáadás és 150 törlés
  1. 2 0
      aidex-admin/src/main/java/com/aidex/AiDexApplication.java
  2. BIN
      aidex-admin/target/classes/com/aidex/AiDexApplication.class
  3. 34 3
      aidex-controller/src/main/java/com/aidex/web/controller/app/AppController.java
  4. 17 2
      aidex-controller/src/main/java/com/aidex/web/controller/gps/GpsController.java
  5. 1 1
      aidex-framework/src/main/java/com/aidex/framework/config/SecurityConfig.java
  6. BIN
      aidex-framework/target/classes/com/aidex/framework/config/SecurityConfig.class
  7. 14 0
      aidex-system/src/main/java/com/aidex/common/app/server/IAppService.java
  8. 35 0
      aidex-system/src/main/java/com/aidex/common/app/server/impl/AppService.java
  9. 6 6
      aidex-system/src/main/java/com/aidex/common/gps/common/GeneratorGspApi.java
  10. 25 76
      aidex-system/src/main/java/com/aidex/common/gps/common/GpsRequest.java
  11. 30 0
      aidex-system/src/main/java/com/aidex/common/gps/domain/LocationEntity.java
  12. 8 0
      aidex-system/src/main/java/com/aidex/common/gps/server/IGpsService.java
  13. 29 0
      aidex-system/src/main/java/com/aidex/common/gps/server/impl/GpsService.java
  14. 3 0
      aidex-system/src/main/java/com/aidex/system/mapper/SysNoticeMapper.xml
  15. 3 0
      aidex-system/target/classes/com/aidex/system/mapper/SysNoticeMapper.xml
  16. 6 5
      aidex-ui/package.json
  17. 7 0
      aidex-ui/public/index.html
  18. 9 1
      aidex-ui/src/api/gps/gps.js
  19. 62 33
      aidex-ui/src/views/operation/location/index.vue
  20. 11 5
      aidex-ui/vue.config.js
  21. 18 18
      pom.xml

+ 2 - 0
aidex-admin/src/main/java/com/aidex/AiDexApplication.java

@@ -3,12 +3,14 @@ package com.aidex;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import springfox.documentation.oas.annotations.EnableOpenApi;
 
 /**
  * 启动程序
  *
  * @author ruoyi
  */
+@EnableOpenApi
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 public class AiDexApplication
 {

BIN
aidex-admin/target/classes/com/aidex/AiDexApplication.class


+ 34 - 3
aidex-controller/src/main/java/com/aidex/web/controller/app/AppController.java

@@ -1,20 +1,51 @@
 package com.aidex.web.controller.app;
 
 
+import com.aidex.common.app.server.IAppService;
 import com.aidex.common.core.domain.R;
+import com.aidex.system.domain.SysNotice;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 
 @RestController
 @RequestMapping("/app")
+@Tag(name = "小程序相关接口", description = "小程序管调用接口")
 public class AppController {
 
 
-    @GetMapping("/test")
-    public R<String> test()
+    @Autowired
+    private IAppService iAppService;
+
+    @GetMapping("/carousel")
+    @ApiOperation(value = "获取轮播信息", notes = "获取轮播信息", produces = "application/json")
+    public R<List<SysNotice>> carousel()
+    {
+        return R.data(iAppService.getCarouselList());
+    }
+
+    @GetMapping("/notice")
+    @ApiOperation(value = "获取通知公告", notes = "获取通知公告", produces = "application/json")
+    public R<List<SysNotice>> notice()
+    {
+        return R.data(iAppService.getNoticeList());
+    }
+
+    @GetMapping("/noticeAndCarouseldetails/{id}")
+    @ApiOperation(value = "获取轮播或公告详情", notes = "获取轮播或公告详情", produces = "application/json")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "数据主键ID", required = true, dataType = "String", paramType = "query")})
+    public R<SysNotice> noticeAndCarouseldetails(@PathVariable("id") String id)
     {
-        return R.data("success");
+        return R.data(iAppService.findCarouselAndNoticeDetails(id));
     }
 }

+ 17 - 2
aidex-controller/src/main/java/com/aidex/web/controller/gps/GpsController.java

@@ -2,11 +2,14 @@ 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.server.IGpsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * Gps相关查询接口
  */
@@ -21,8 +24,20 @@ public class GpsController extends BaseController {
      * 查询报警信息列表
      */
     @PreAuthorize("@ss.hasPermi('monit:gps:location')")
-    @GetMapping("/location")
-    public R<String> list(String shipId) {
+    @GetMapping("/location/web")
+    public R<String> localtionWeb(String shipId) {
         return R.data(gpsService.getLocationUrl(shipId));
     }
+
+    @PreAuthorize("@ss.hasPermi('monit:gps:location')")
+    @GetMapping("/location")
+    public R<LocationEntity> localtion(String shipId) {
+        return R.data(gpsService.getLocation(shipId));
+    }
+
+    @PreAuthorize("@ss.hasPermi('monit:gps:location')")
+    @GetMapping("/location/batch")
+    public R<List<LocationEntity>> localtionBatch() {
+        return R.data(gpsService.getLocationBatch());
+    }
 }

+ 1 - 1
aidex-framework/src/main/java/com/aidex/framework/config/SecurityConfig.java

@@ -148,7 +148,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/webjars/**").anonymous()
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
-                .antMatchers("/app/*").anonymous()
+                .antMatchers("/app/**").anonymous()
                 .antMatchers(anonymousUrls.toArray(new String[0])).anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()

BIN
aidex-framework/target/classes/com/aidex/framework/config/SecurityConfig.class


+ 14 - 0
aidex-system/src/main/java/com/aidex/common/app/server/IAppService.java

@@ -0,0 +1,14 @@
+package com.aidex.common.app.server;
+
+import com.aidex.system.domain.SysNotice;
+
+import java.util.List;
+
+public interface IAppService {
+
+    List<SysNotice> getCarouselList();
+
+    List<SysNotice> getNoticeList();
+
+    SysNotice findCarouselAndNoticeDetails(String id);
+}

+ 35 - 0
aidex-system/src/main/java/com/aidex/common/app/server/impl/AppService.java

@@ -0,0 +1,35 @@
+package com.aidex.common.app.server.impl;
+
+import com.aidex.common.app.server.IAppService;
+import com.aidex.common.gps.common.GeneratorGspApi;
+import com.aidex.system.domain.SysNotice;
+import com.aidex.system.domain.SysShip;
+import com.aidex.system.service.SysNoticeService;
+import com.aidex.system.service.SysShipService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class AppService implements IAppService {
+
+    @Autowired
+    private SysNoticeService sysNoticeService;
+
+
+    public List<SysNotice> getCarouselList(){
+
+        List<SysNotice> carouselList = sysNoticeService.findList(new SysNotice(){{setCarousel("1");}});
+        return carouselList;
+    }
+
+    public List<SysNotice> getNoticeList(){
+        List<SysNotice> noticeList = sysNoticeService.findList(new SysNotice(){{setCarousel("0");setNoticeType("1");}});
+        return noticeList;
+    }
+
+    public SysNotice findCarouselAndNoticeDetails(String id){
+        return sysNoticeService.get(id);
+    }
+}

+ 6 - 6
aidex-system/src/main/java/com/aidex/common/gps/common/GeneratorGspApi.java

@@ -23,7 +23,7 @@ public class GeneratorGspApi {
 
     public String GenerationMapUrl(String method,String macId,String mapType){
         String mds = redisCache.getStringValue(Constants.GPS_TOKEN_PREFIX);
-        Map<String, String> parmas = new HashMap<>();
+        Map<String, Object> parmas = new HashMap<>();
         parmas.put("method",method);
         parmas.put("mds",mds);
         parmas.put("macid",macId);
@@ -38,9 +38,9 @@ public class GeneratorGspApi {
     }
 
 
-    public Map<String, String> GenerationParams(String method,String api){
+    public Map<String, Object> GenerationParams(String method,String api){
         String mds = redisCache.getStringValue(Constants.GPS_TOKEN_PREFIX);
-        Map<String, String> parmas = new HashMap<>();
+        Map<String, Object> parmas = new HashMap<>();
         parmas.put("method",method);
         parmas.put("w",api);
         parmas.put("mds",mds);
@@ -53,11 +53,11 @@ public class GeneratorGspApi {
         return builder.toString();
     }
 
-    public Map<String, String> GeneratorQueryParams(String api){
+    public Map<String, Object> GeneratorQueryParams(String api){
         return GenerationParams(RquestMethod.query,api);
     }
 
-    public Map<String, String> GeneratorSignParams(String api){
+    public Map<String, Object> GeneratorSignParams(String api){
         return GenerationParams(RquestMethod.sign,api);
     }
 
@@ -78,7 +78,7 @@ public class GeneratorGspApi {
     }
 
 
-    public static String GeneratorParams(Map<String, String> params){
+    public static String GeneratorParams(Map<String, Object> params){
         // TODO 如果要编码的话自己加下编码逻辑
         return Joiner.on("&")
                 // 用指定符号代替空值,key 或者value 为null都会被替换

+ 25 - 76
aidex-system/src/main/java/com/aidex/common/gps/common/GpsRequest.java

@@ -2,6 +2,7 @@ package com.aidex.common.gps.common;
 
 import cn.hutool.http.HttpRequest;
 import com.aidex.common.exception.SysException;
+import com.aidex.common.utils.StringUtils;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,8 +19,8 @@ public class GpsRequest<T> {
     private GeneratorGspApi generatorGspApi;
 
 
-    public List<T> postArray(Map<String,Object> params, JSONObject body, Integer timeOut){
-        JSONObject res = postRequest(params,body,timeOut);
+    public List<T> postArray(Map<String,Object> params, Integer timeOut){
+        JSONObject res = postRequest(params,timeOut);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -27,25 +28,12 @@ public class GpsRequest<T> {
         if(status){
             return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
         }
-        throw new SysException(code,msg);
-
-    }
-
-    public List<T> postArray(Map<String,Object> params, JSONObject body){
-        JSONObject res = postRequest(params,body,1000);
-        Boolean status = res.getBoolean("success");
-        Integer code = res.getInteger("errorCode");
-        String msg = res.getString("errorDescribe");
-
-        if(status){
-            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
-        }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
     public List<T> postArray(Map<String,Object> params){
-        JSONObject res = postRequest(params,null,1000);
+        JSONObject res = postRequest(params,1000);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -53,26 +41,13 @@ public class GpsRequest<T> {
         if(status){
             return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
         }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
 
-    public T post(Map<String,Object> params, JSONObject body, Integer timeOut){
-        JSONObject res = postRequest(params,body,timeOut);
-        Boolean status = res.getBoolean("success");
-        Integer code = res.getInteger("errorCode");
-        String msg = res.getString("errorDescribe");
-
-        if(status){
-            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
-        }
-        throw new SysException(code,msg);
-
-    }
-
-    public T post(Map<String,Object> params, JSONObject body){
-        JSONObject res = postRequest(params,body,1000);
+    public T post(Map<String,Object> params, Integer timeOut){
+        JSONObject res = postRequest(params,timeOut);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -80,12 +55,12 @@ public class GpsRequest<T> {
         if(status){
             return (T) JSONObject.parseObject(res.getString("data"), Map.class);
         }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
     public T post(Map<String,Object> params){
-        JSONObject res = postRequest(params,null,1000);
+        JSONObject res = postRequest(params,1000);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -93,12 +68,12 @@ public class GpsRequest<T> {
         if(status){
             return (T) JSONObject.parseObject(res.getString("data"), Map.class);
         }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
-    public List<T> getArray(Map<String,Object> params, JSONObject body, Integer timeOut){
-        JSONObject res = postRequest(params,body,timeOut);
+    public List<T> getArray(Map<String,Object> params, Integer timeOut){
+        JSONObject res = postRequest(params,timeOut);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -106,25 +81,12 @@ public class GpsRequest<T> {
         if(status){
             return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
         }
-        throw new SysException(code,msg);
-
-    }
-
-    public List<T> getArray(Map<String,Object> params, JSONObject body){
-        JSONObject res = postRequest(params,body,1000);
-        Boolean status = res.getBoolean("success");
-        Integer code = res.getInteger("errorCode");
-        String msg = res.getString("errorDescribe");
-
-        if(status){
-            return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
-        }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
     public List<T> getArray(Map<String,Object> params){
-        JSONObject res = postRequest(params,null,1000);
+        JSONObject res = postRequest(params,1000);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -132,26 +94,13 @@ public class GpsRequest<T> {
         if(status){
             return (ArrayList<T>) JSONObject.parseObject(res.getString("data"),List.class);
         }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
 
-    public T get(Map<String,Object> params, JSONObject body, Integer timeOut){
-        JSONObject res = postRequest(params,body,timeOut);
-        Boolean status = res.getBoolean("success");
-        Integer code = res.getInteger("errorCode");
-        String msg = res.getString("errorDescribe");
-
-        if(status){
-            return (T) JSONObject.parseObject(res.getString("data"), Map.class);
-        }
-        throw new SysException(code,msg);
-
-    }
-
-    public T get(Map<String,Object> params, JSONObject body){
-        JSONObject res = postRequest(params,body,1000);
+    public T get(Map<String,Object> params, Integer timeOut){
+        JSONObject res = postRequest(params,timeOut);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -159,12 +108,12 @@ public class GpsRequest<T> {
         if(status){
             return (T) JSONObject.parseObject(res.getString("data"), Map.class);
         }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
     public T get(Map<String,Object> params){
-        JSONObject res = postRequest(params,null,1000);
+        JSONObject res = postRequest(params,1000);
         Boolean status = res.getBoolean("success");
         Integer code = res.getInteger("errorCode");
         String msg = res.getString("errorDescribe");
@@ -172,19 +121,19 @@ public class GpsRequest<T> {
         if(status){
             return (T) JSONObject.parseObject(res.getString("data"), Map.class);
         }
-        throw new SysException(code,msg);
+        throw new SysException(code,"GPS数据获取错误:"+msg);
 
     }
 
-    private JSONObject postRequest(Map<String,Object> params, JSONObject body, Integer timeOut){
+    private JSONObject postRequest(Map<String,Object> params, Integer timeOut){
         String api = generatorGspApi.GeneratorApi();
-        String res = HttpRequest.post(api).form(params).body(body.toString()).timeout(timeOut).execute().body();
+        String res = HttpRequest.post(api).form(params).timeout(timeOut).execute().body();
         return JSON.parseObject(res);
     }
 
-    private JSONObject getRequest(Map<String,Object> params, JSONObject body, Integer timeOut){
+    private JSONObject getRequest(Map<String,Object> params, Integer timeOut){
         String api = generatorGspApi.GeneratorApi();
-        String res = HttpRequest.get(api).form(params).body(body.toString()).timeout(timeOut).execute().body();
+        String res = HttpRequest.get(api).form(params).timeout(timeOut).execute().body();
         return JSON.parseObject(res);
     }
 }

+ 30 - 0
aidex-system/src/main/java/com/aidex/common/gps/domain/LocationEntity.java

@@ -0,0 +1,30 @@
+package com.aidex.common.gps.domain;
+
+import lombok.Data;
+
+@Data
+public class LocationEntity {
+
+    private String objectid;
+    private String macid;
+    private String fullName;
+    private String platenumber;
+    private String blockdate;
+    private String icon;
+    private String server_time;
+    private String updtime;
+    private String gpstime;
+    private String speed;
+    private String lat;
+    private String lon;
+    private String signal;
+    private String hearttime;
+    private String dir;
+    private String macName;
+    private String describe;
+    private String groupid;
+    private String sim;
+    private String device_status;
+    private String device_values;
+    private String todayMil;
+}

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

@@ -1,6 +1,14 @@
 package com.aidex.common.gps.server;
 
+import com.aidex.common.gps.domain.LocationEntity;
+
+import java.util.List;
+
 public interface IGpsService {
 
     String getLocationUrl(String ShipId);
+
+    LocationEntity getLocation(String shipId);
+
+    List<LocationEntity> getLocationBatch();
 }

+ 29 - 0
aidex-system/src/main/java/com/aidex/common/gps/server/impl/GpsService.java

@@ -1,18 +1,28 @@
 package com.aidex.common.gps.server.impl;
 
 import com.aidex.common.gps.common.GeneratorGspApi;
+import com.aidex.common.gps.common.GpsApi;
+import com.aidex.common.gps.common.GpsRequest;
+import com.aidex.common.gps.domain.LocationEntity;
 import com.aidex.common.gps.server.IGpsService;
 import com.aidex.system.domain.SysShip;
 import com.aidex.system.service.SysShipService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 @Service
 public class GpsService implements IGpsService {
 
     @Autowired
     private GeneratorGspApi generatorGspApi;
     @Autowired
+    private GpsRequest<LocationEntity> gpsRequest;
+    @Autowired
     private SysShipService sysShipService;
 
 
@@ -20,4 +30,23 @@ public class GpsService implements IGpsService {
         SysShip sysShip = sysShipService.get(shipId);
         return generatorGspApi.GenerationMapUrl(GeneratorGspApi.RquestMethod.follow,sysShip.getGpsDeviceNum(), GeneratorGspApi.GpsMapType.QQ);
     }
+
+    public LocationEntity getLocation(String shipId){
+        SysShip sysShip = sysShipService.get(shipId);
+        Map<String, Object> params = generatorGspApi.GeneratorQueryParams(GpsApi.findLocationByBatch);
+        params.put("macid",sysShip.getGpsDeviceNum());
+        params.put("mapType", GeneratorGspApi.GpsMapType.QQ);
+        LocationEntity locationEntitie = gpsRequest.post(params);
+        return locationEntitie;
+    }
+
+    public List<LocationEntity> getLocationBatch(){
+        List<SysShip> sysShips = sysShipService.findList(new SysShip());
+        String macIds = sysShips.stream().map(SysShip::getGpsDeviceNum).collect(Collectors.joining(","));
+        Map<String, Object> params = generatorGspApi.GeneratorQueryParams(GpsApi.findLocationByBatch);
+        params.put("macids",macIds);
+        params.put("mapType", GeneratorGspApi.GpsMapType.QQ);
+        List<LocationEntity> locationEntities = gpsRequest.postArray(params);
+         return locationEntities;
+    }
 }

+ 3 - 0
aidex-system/src/main/java/com/aidex/system/mapper/SysNoticeMapper.xml

@@ -52,6 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="noticeType != null and noticeType != ''">
             AND a.notice_type = #{noticeType}
         </if>
+        <if test="carousel != null and carousel != ''">
+            AND a.carousel = #{carousel}
+        </if>
         <if test="createBy != null and createBy != ''">
             AND su.name like concat('%', #{createBy}, '%')
         </if>

+ 3 - 0
aidex-system/target/classes/com/aidex/system/mapper/SysNoticeMapper.xml

@@ -52,6 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="noticeType != null and noticeType != ''">
             AND a.notice_type = #{noticeType}
         </if>
+        <if test="carousel != null and carousel != ''">
+            AND a.carousel = #{carousel}
+        </if>
         <if test="createBy != null and createBy != ''">
             AND su.name like concat('%', #{createBy}, '%')
         </if>

+ 6 - 5
aidex-ui/package.json

@@ -24,21 +24,22 @@
     "mockjs2": "1.0.8",
     "moment": "^2.24.0",
     "nprogress": "^0.2.0",
+    "qmap": "^0.2.3",
+    "sortablejs": "^1.10.2",
     "store": "^2.0.12",
+    "v-viewer": "^1.5.1",
     "vditor": "^3.7.3",
     "vue": "^2.6.12",
     "vue-clipboard2": "^0.2.1",
     "vue-container-query": "^0.1.0",
     "vue-copy-to-clipboard": "^1.0.3",
-    "v-viewer": "^1.5.1",
-    "vue-upload-component": "^2.8.20",
-    "sortablejs": "^1.10.2",
     "vue-cropper": "0.4.9",
+    "vue-grid-layout": "^2.3.12",
     "vue-i18n": "^8.17.4",
     "vue-router": "^3.1.2",
     "vue-svg-component-runtime": "^1.0.1",
-    "vuex": "^3.1.1",
-    "vue-grid-layout": "^2.3.12"
+    "vue-upload-component": "^2.8.20",
+    "vuex": "^3.1.1"
   },
   "devDependencies": {
     "@ant-design/colors": "^3.2.1",

+ 7 - 0
aidex-ui/public/index.html

@@ -11,6 +11,7 @@
     <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
     <link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
     <% } %>
+    <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=ZBMBZ-6JWKD-ANT4O-HCUPI-U6EJF-EIF2Z"></script>
   </head>
   <body>
     <noscript>
@@ -30,4 +31,10 @@
     <% } %>
     <!-- built files will be auto injected -->
   </body>
+  <style>
+    .map-default {
+      width: 100%;
+      height: calc(100% - 60px);
+    }
+  </style>
 </html>

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

@@ -1,10 +1,18 @@
 import request from '@/utils/request'
 
 // 当前定位地点获取
-export function location (query) {
+export function locationUrl (query) {
   return request({
     url: '/monit/gps/location',
     method: 'get',
     params: query
   })
 }
+
+// 获取全部设备定位地点
+export function locationBatch () {
+  return request({
+    url: '/monit/gps/location/batch',
+    method: 'get'
+  })
+}

+ 62 - 33
aidex-ui/src/views/operation/location/index.vue

@@ -17,14 +17,8 @@
             <h2>{{ selShipData.shipNanme }}-实时位置</h2>
           </div>
           <a-divider />
-          <iframe
-            frameborder="0"
-            id="locationIframe"
-            onload="load()"
-            width="100%"
-            style="border: none; height: calc(100% - 65px)"
-            name="ha-main-window"
-            src="http://localhost//user/tracking.html?lang=cn&loginUrl=&requestSource=web&custname=BBZ-01476417&school_id=e63b1e42-172d-42d6-872c-3bc66bbc6e2f&mapType=QQ&custid=e63b1e42-172d-42d6-872c-3bc66bbc6e2f&mds=f685207ebaab46448689c92503043a3d&objectid=f9e21a32-dd6b-4c3d-89a8-227677c91104&r=-1710497635" ></iframe>
+
+          <div id="mapLocation" class="map-default"></div>
         </template>
       </split>
     </a-card>
@@ -33,16 +27,11 @@
 
 <script>
 import { listAllSysShip } from '@/api/system/sysShip'
-import { location } from '@/api/gps/gps'
+import { locationBatch } from '@/api/gps/gps'
 import ShipTree from './modules/ShipTree'
 import Split from '@/components/pt/split/Index'
-// document.domain = 'www.18gps.net'
-function load() {
-    iframe.contentWindow.postMessage('定位', 'http://localhost')
-    window.onmessage = e => {
-      console.log(e.data)
-    }
-  }
+import qq from 'qq'
+
 export default {
   name: 'User',
   components: {
@@ -53,42 +42,82 @@ export default {
     return {
       selShipData: {},
       shipOptions: [],
-      gpsLocalUrl: ''
+      gpsLocalUrl: '',
+      longitude: 103.760104, // 经度
+      latitude: 36.079945, // 纬度
+      batchLocation: [],
+      map: ''
     }
   },
   filters: {},
   created() {
     this.getTreeselect()
   },
+  mounted() {
+    this.$nextTick(() => {
+      this.batchListInit()
+    })
+  },
   computed: {},
   watch: {},
   methods: {
+    batchListInit() {
+      locationBatch().then(res => {
+        this.batchLocation = res.data
+        if (this.batchLocation.length > 0) {
+          this.longitude = '116.380945'// this.batchLocation[0].lon
+          this.latitude = '39.953416'// this.batchLocation[0].lat
+        }
+        this.init()
+      })
+    },
+    init() {
+      // const that = this
+      // 步骤:定义map变量 调用 qq.maps.Map() 构造函数   获取地图显示容器
+      // 设置地图中心点
+      var myLatlng = new qq.maps.LatLng(this.latitude, this.longitude)
+      // 定义工厂模式函数
+      var myOptions = {
+        zoom: 12, // 设置地图缩放级别
+        center: myLatlng, // 设置中心点样式
+        mapTypeId: qq.maps.MapTypeId.ROADMAP // 设置地图样式详情参见MapType
+      }
+      // 获取dom元素添加地图信息
+      var mapDD = new qq.maps.Map(document.getElementById('mapLocation'), myOptions)
+
+      qq.maps.MarkerCluster({
+        map: mapDD,
+        geometries: [
+          // 点标记数据数组
+          {
+            position: new qq.maps.LatLng(39.953416, 116.480945),
+            properties: {
+                assetName: 'dsadsad',
+                assetClassification: 'dddd',
+                userDepartment: '2222'
+            }
+          },
+          {
+            position: new qq.maps.LatLng(39.984104, 116.407503),
+            properties: {
+                assetName: '2222',
+                assetClassification: '3232',
+                userDepartment: 'ssas'
+            }
+          }
+        ]
+      })
+    },
     /** 查询部门下拉树结构 */
     getTreeselect() {
       listAllSysShip().then((response) => {
         this.shipOptions = response.data
-        this.selShipData = this.shipOptions[0]
-        this.getLocation()
-      })
-    },
-    getLocation() {
-      location({ shipId: this.selShipData.id }).then(res => {
-        this.gpsLocalUrl = res.data
-        // const data = {
-        //   method: 'Follow',
-        //   macid: '19171476417',
-        //   mapType: 'QQ',
-        //   mds: 'f685207ebaab46448689c92503043a3d',
-        //   url: 'http://www.18gps.net/'
-        // }
-        // document.getElementById('locationIframe').contentWindow.postMessage(data, '*')
       })
     },
     clickNode(node) {
       var selectItem = node.$options.propsData.dataRef
       if (this.selShipData.id !== selectItem.id) {
         this.selShipData = node.$options.propsData.dataRef
-        this.getLocation()
       }
     }
   }

+ 11 - 5
aidex-ui/vue.config.js

@@ -27,7 +27,9 @@ const assetsCDN = {
     vue: 'Vue',
     'vue-router': 'VueRouter',
     vuex: 'Vuex',
-    axios: 'axios'
+    axios: 'axios',
+    qq: 'qq',
+		TMap: 'TMap'
   },
   css: [],
   // https://unpkg.com/browse/vue@2.6.10/
@@ -60,7 +62,11 @@ const vueConfig = {
       })
     ],
     // if prod, add externals
-    externals: isProd ? assetsCDN.externals : {}
+    externals: isProd ? assetsCDN.externals
+    : {
+      qq: 'qq',
+      TMap: 'TMap'
+    }
   },
 
   chainWebpack: (config) => {
@@ -100,9 +106,9 @@ const vueConfig = {
       less: {
         modifyVars: {
           // less vars,customize ant design theme
-          'primary-color': '#2f54eb',
+          'primary-color': '#2f54eb'
           // 'link-color': '#F5222D',
-          //'border-radius-base': '2px'
+          // 'border-radius-base': '2px'
         },
         // DO NOT REMOVE THIS LINE
         javascriptEnabled: true
@@ -125,7 +131,7 @@ const vueConfig = {
         }
       }
     },
-    disableHostCheck: true //增加该设置是为了解决使用外网映射工具映射时报错--可以删除
+    disableHostCheck: true // 增加该设置是为了解决使用外网映射工具映射时报错--可以删除
   },
 
   // disable source map in production

+ 18 - 18
pom.xml

@@ -3,7 +3,7 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
-	
+
     <groupId>com.aidex</groupId>
     <artifactId>aidex</artifactId>
     <version>3.4.0</version>
@@ -11,7 +11,7 @@
     <name>aidex</name>
     <url>http://www.ruoyi.vip</url>
     <description>AiDex Sharp 快速开发平台</description>
-    
+
     <properties>
         <aidex.version>3.4.0</aidex.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -39,11 +39,11 @@
         <xstream-version>1.3.1</xstream-version>
         <com.squareup.retrofit2.version>2.4.0</com.squareup.retrofit2.version>
     </properties>
-	
+
     <!-- 依赖声明 -->
     <dependencyManagement>
         <dependencies>
-        
+
             <!-- SpringBoot的依赖配置-->
             <dependency>
                 <groupId>org.springframework.boot</groupId>
@@ -52,7 +52,7 @@
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            
+
             <!--阿里数据库连接池 -->
             <dependency>
                 <groupId>com.alibaba</groupId>
@@ -84,14 +84,14 @@
                 <artifactId>mybatis-spring-boot-starter</artifactId>
                 <version>${mybatis-spring-boot.version}</version>
             </dependency>
-			
+
             <!-- pagehelper 分页插件 -->
             <dependency>
                 <groupId>com.github.pagehelper</groupId>
                 <artifactId>pagehelper-spring-boot-starter</artifactId>
                 <version>${pagehelper.boot.version}</version>
             </dependency>
-			
+
             <!-- 获取系统信息 -->
             <dependency>
                 <groupId>com.github.oshi</groupId>
@@ -144,21 +144,21 @@
                     </exclusion>
                 </exclusions>
             </dependency>
-            
+
             <!--io常用工具类 -->
             <dependency>
                 <groupId>commons-io</groupId>
                 <artifactId>commons-io</artifactId>
                 <version>${commons.io.version}</version>
             </dependency>
-	
+
             <!--文件上传工具类 -->
             <dependency>
                 <groupId>commons-fileupload</groupId>
                 <artifactId>commons-fileupload</artifactId>
                 <version>${commons.fileupload.version}</version>
             </dependency>
-			
+
             <!-- excel工具 -->
             <dependency>
                 <groupId>org.apache.poi</groupId>
@@ -172,7 +172,7 @@
                 <artifactId>velocity-engine-core</artifactId>
                 <version>${velocity.version}</version>
             </dependency>
-	        
+
             <!-- 阿里JSON解析器 -->
             <dependency>
                 <groupId>com.alibaba.fastjson2</groupId>
@@ -193,42 +193,42 @@
                 <artifactId>jjwt</artifactId>
                 <version>${jwt.version}</version>
             </dependency>
-			
+
             <!--验证码 -->
             <dependency>
                 <groupId>com.github.penggle</groupId>
                 <artifactId>kaptcha</artifactId>
                 <version>${kaptcha.version}</version>
             </dependency>
-            
+
             <!-- 定时任务-->
             <dependency>
                 <groupId>com.aidex</groupId>
                 <artifactId>aidex-quartz</artifactId>
                 <version>${aidex.version}</version>
             </dependency>
-	
+
             <!-- 代码生成-->
             <dependency>
                 <groupId>com.aidex</groupId>
                 <artifactId>aidex-generator</artifactId>
                 <version>${aidex.version}</version>
             </dependency>
-			
+
             <!-- 核心模块-->
             <dependency>
                 <groupId>com.aidex</groupId>
                 <artifactId>aidex-framework</artifactId>
                 <version>${aidex.version}</version>
             </dependency>
-			
+
             <!-- 系统模块-->
             <dependency>
                 <groupId>com.aidex</groupId>
                 <artifactId>aidex-system</artifactId>
                 <version>${aidex.version}</version>
             </dependency>
-			
+
             <!-- 通用工具-->
             <dependency>
                 <groupId>com.aidex</groupId>
@@ -306,4 +306,4 @@
         </pluginRepository>
     </pluginRepositories>
 
-</project>
+</project>