瀏覽代碼

update content/geo

reghao 10 月之前
父節點
當前提交
11f6bb6308
共有 26 個文件被更改,包括 507 次插入411 次删除
  1. 0 98
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/MapController.java
  2. 50 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/controller/MapController.java
  3. 73 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/controller/PhotoMapController.java
  4. 2 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/CameraPhotoMapper.java
  5. 4 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoChinaMapper.java
  6. 0 14
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoEarthMapper.java
  7. 0 13
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoItemMapper.java
  8. 3 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoPointMapper.java
  9. 24 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/constant/GeoItem.java
  10. 0 13
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/GeoEarth.java
  11. 0 16
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/GeoItem.java
  12. 4 9
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/GeoPoint.java
  13. 17 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/GeoMarker.java
  14. 3 1
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MapMarker.java
  15. 6 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MapPoint.java
  16. 1 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MarkerInfo.java
  17. 1 10
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/EarthService.java
  18. 0 37
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/GeoService.java
  19. 65 142
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/MapService.java
  20. 168 0
      content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/PhotoMapService.java
  21. 7 2
      content/content-service/src/main/resources/mapper/geo/CameraPhotoMapper.xml
  22. 6 0
      content/content-service/src/main/resources/mapper/geo/GeoChinaMapper.xml
  23. 0 17
      content/content-service/src/main/resources/mapper/geo/GeoEarthMapper.xml
  24. 0 16
      content/content-service/src/main/resources/mapper/geo/GeoItemMapper.xml
  25. 8 8
      content/content-service/src/main/resources/mapper/geo/GeoPointMapper.xml
  26. 65 14
      content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/GeoTest.java

+ 0 - 98
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/MapController.java

@@ -1,98 +0,0 @@
-package cn.reghao.tnb.content.app.geo;
-
-import cn.reghao.jutil.web.WebResult;
-import cn.reghao.tnb.common.db.SelectOption;
-import cn.reghao.tnb.content.api.dto.geo.MallReplyDto;
-import cn.reghao.tnb.content.api.dto.geo.MallReplyPhotoDto;
-import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
-import cn.reghao.tnb.content.app.geo.model.vo.MapPoint;
-import cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo;
-import cn.reghao.tnb.content.app.geo.service.EarthService;
-import cn.reghao.tnb.content.app.geo.service.MapService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2023-08-31 10:32:28
- */
-@Api(tags = "地图接口")
-@RestController
-@RequestMapping("/api/geo/map")
-public class MapController {
-    private final MapService mapService;
-    private final EarthService earthService;
-
-    public MapController(MapService mapService, EarthService earthService) {
-        this.mapService = mapService;
-        this.earthService = earthService;
-    }
-
-    @ApiOperation(value = "检查淘宝商品评论是否存在", notes = "N")
-    @GetMapping(value = "/reply/{replyId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String checkReply(@PathVariable("replyId") String replyId) {
-        boolean exist = mapService.checkReplyId(replyId);
-        return WebResult.success(exist);
-    }
-
-    @ApiOperation(value = "添加淘宝商品评论", notes = "N")
-    @PostMapping(value = "/reply", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addReply(@RequestBody @Validated MallReplyDto mallReplyDto) {
-        mapService.addTmallReply(mallReplyDto);
-        return WebResult.success();
-    }
-
-    @ApiOperation(value = "添加淘宝商品评论中的照片", notes = "N")
-    @PostMapping(value = "/photo", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addPhoto(@RequestBody List<MallReplyPhotoDto> list) {
-        mapService.addCameraPhotos(list);
-        return WebResult.success();
-    }
-
-    @ApiOperation(value = "获取地图中标记的点", notes = "N")
-    @GetMapping(value = "/markers", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getMapMarkers(@RequestParam("type") Integer type) {
-        List<MapMarker> list = mapService.getMapMarkers(type);
-        return WebResult.success(list);
-    }
-
-    @ApiOperation(value = "获取 GoogleEarth kml 文件", notes = "N")
-    @GetMapping(value = "/markers/earth", produces = MediaType.APPLICATION_JSON_VALUE)
-    public void getEarthMarkers(@RequestParam("type") Integer type) throws Exception {
-        List<MapMarker> list = mapService.getMapMarkers(type);
-        earthService.getEarthKml(list);
-    }
-
-    @ApiOperation(value = "获取地图中标记点的详情", notes = "N")
-    @GetMapping(value = "/marker", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getMarkerInfo(@RequestParam("id") int id) {
-        MarkerInfo markerInfo = mapService.getMarkerInfo(id);
-        return WebResult.success(markerInfo);
-    }
-
-    @ApiOperation(value = "获取地图中标记点分类的 select options 列表", notes = "N")
-    @GetMapping(value = "/item", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getGeoItems() {
-        List<SelectOption> selectOptions = mapService.getGeoItems();
-        return WebResult.success(selectOptions);
-    }
-
-    @ApiOperation(value = "添加一个经纬度坐标", notes = "N")
-    @PostMapping(value = "/point", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addGeoPoint(@RequestBody @Validated MapPoint mapPoint) {
-        mapService.addGeoPoint(mapPoint);
-        return WebResult.success();
-    }
-
-    @ApiOperation(value = "获取经纬度坐标列表", notes = "N")
-    @GetMapping(value = "/point", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getGeoPoint() {
-        List list = mapService.getGeoPoints();
-        return WebResult.success(list);
-    }
-}

+ 50 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/controller/MapController.java

@@ -0,0 +1,50 @@
+package cn.reghao.tnb.content.app.geo.controller;
+
+import cn.reghao.jutil.web.WebResult;
+import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
+import cn.reghao.tnb.content.app.geo.model.vo.MapPoint;
+import cn.reghao.tnb.content.app.geo.service.MapService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2023-08-31 10:32:28
+ */
+@Api(tags = "地图接口")
+@RestController
+@RequestMapping("/api/geo/map")
+public class MapController {
+    private final MapService mapService;
+
+    public MapController(MapService mapService) {
+        this.mapService = mapService;
+    }
+
+    @ApiOperation(value = "添加一个经纬度坐标", notes = "N")
+    @PostMapping(value = "/position", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String addGeoPoint(@RequestBody @Validated MapPoint mapPoint) {
+        mapService.addGeoPoint(mapPoint);
+        return WebResult.success();
+    }
+
+    @ApiOperation(value = "获取坐标列表构成的路径", notes = "N")
+    @GetMapping(value = "/trail", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String getTrailPath() {
+        List list = mapService.getTrailPath();
+        return WebResult.success(list);
+    }
+
+    @ApiOperation(value = "获取地图标记", notes = "N")
+    @GetMapping(value = "/marks", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String getTrailMarks() {
+        List<MapMarker> list = mapService.getTrailMarks();
+        //List<MapMarker> list = mapService.getStationMarks().subList(0, 1000);
+        return WebResult.success(list);
+    }
+}

+ 73 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/controller/PhotoMapController.java

@@ -0,0 +1,73 @@
+package cn.reghao.tnb.content.app.geo.controller;
+
+import cn.reghao.jutil.web.WebResult;
+import cn.reghao.tnb.common.db.SelectOption;
+import cn.reghao.tnb.content.api.dto.geo.MallReplyDto;
+import cn.reghao.tnb.content.api.dto.geo.MallReplyPhotoDto;
+import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
+import cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo;
+import cn.reghao.tnb.content.app.geo.service.PhotoMapService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2023-08-31 10:32:28
+ */
+@Api(tags = "照片地图接口")
+@RestController
+@RequestMapping("/api/geo/photo")
+public class PhotoMapController {
+    private final PhotoMapService photoMapService;
+
+    public PhotoMapController(PhotoMapService photoMapService) {
+        this.photoMapService = photoMapService;
+    }
+
+    @ApiOperation(value = "检查淘宝商品评论是否存在", notes = "N")
+    @GetMapping(value = "/reply/{replyId}", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String checkReply(@PathVariable("replyId") String replyId) {
+        boolean exist = photoMapService.checkReplyId(replyId);
+        return WebResult.success(exist);
+    }
+
+    @ApiOperation(value = "添加淘宝商品评论", notes = "N")
+    @PostMapping(value = "/reply", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String addReply(@RequestBody @Validated MallReplyDto mallReplyDto) {
+        photoMapService.addTmallReply(mallReplyDto);
+        return WebResult.success();
+    }
+
+    @ApiOperation(value = "添加淘宝商品评论中的照片", notes = "N")
+    @PostMapping(value = "/photo", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String addPhoto(@RequestBody List<MallReplyPhotoDto> list) {
+        photoMapService.addCameraPhotos(list);
+        return WebResult.success();
+    }
+
+    @ApiOperation(value = "获取照片分类", notes = "N")
+    @GetMapping(value = "/item", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String getGeoItems() {
+        List<SelectOption> selectOptions = photoMapService.getGeoItems();
+        return WebResult.success(selectOptions);
+    }
+
+    @ApiOperation(value = "获取照片地图中标记", notes = "N")
+    @GetMapping(value = "/marks", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String getPhotoMarks(@RequestParam("type") Integer type) {
+        List<MapMarker> list = photoMapService.getPhotoMarks(type);
+        return WebResult.success(list);
+    }
+
+    @ApiOperation(value = "获取地图中标记点的详情", notes = "N")
+    @GetMapping(value = "/mark/info", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String getMarkerInfo(@RequestParam("id") int id) {
+        MarkerInfo markerInfo = photoMapService.getMarkerInfo(id);
+        return WebResult.success(markerInfo);
+    }
+}

+ 2 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/CameraPhotoMapper.java

@@ -20,6 +20,7 @@ public interface CameraPhotoMapper extends BaseMapper<CameraPhoto> {
     List<MapMarker> findByWestGeoGroup(int pageSize, int itemType);
     List<MapMarker> findAllByReplyIdGroup(int pageSize);
     List<MapMarker> findByWestChina(int pageSize, int itemType);
-    MarkerInfo findMarkerInfoById(int id);
+    MarkerInfo findCommentMarkerInfo(int id);
     MarkerInfo findMarkerInfo(int id);
+    MarkerInfo findAlbumMarkerInfo(int id);
 }

+ 4 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoChinaMapper.java

@@ -2,12 +2,16 @@ package cn.reghao.tnb.content.app.geo.db.mapper;
 
 import cn.reghao.jutil.jdk.db.BaseMapper;
 import cn.reghao.tnb.content.app.geo.model.po.GeoChina;
+import cn.reghao.tnb.content.app.geo.model.vo.GeoMarker;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * @author reghao
  * @date 2025-03-17 17:14:34
  */
 @Mapper
 public interface GeoChinaMapper extends BaseMapper<GeoChina> {
+    List<GeoMarker> findByDeep(int deep);
 }

+ 0 - 14
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoEarthMapper.java

@@ -1,14 +0,0 @@
-package cn.reghao.tnb.content.app.geo.db.mapper;
-
-import cn.reghao.jutil.jdk.db.BaseMapper;
-import cn.reghao.tnb.content.app.geo.model.po.GeoEarth;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2023-09-12 11:44:17
- */
-@Mapper
-public interface GeoEarthMapper extends BaseMapper<GeoEarth> {
-    GeoEarth findByName(String name);
-}

+ 0 - 13
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoItemMapper.java

@@ -1,13 +0,0 @@
-package cn.reghao.tnb.content.app.geo.db.mapper;
-
-import cn.reghao.jutil.jdk.db.BaseMapper;
-import cn.reghao.tnb.content.app.geo.model.po.GeoItem;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2024-09-10 14:30:23
- */
-@Mapper
-public interface GeoItemMapper extends BaseMapper<GeoItem> {
-}

+ 3 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/GeoPointMapper.java

@@ -4,10 +4,13 @@ import cn.reghao.jutil.jdk.db.BaseMapper;
 import cn.reghao.tnb.content.app.geo.model.po.GeoPoint;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * @author reghao
  * @date 2024-09-10 17:37:19
  */
 @Mapper
 public interface GeoPointMapper extends BaseMapper<GeoPoint> {
+    List<GeoPoint> findByUserId(long userId);
 }

+ 24 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/constant/GeoItem.java

@@ -0,0 +1,24 @@
+package cn.reghao.tnb.content.app.geo.model.constant;
+
+/**
+ * @author reghao
+ * @date 2023-11-30 14:01:03
+ */
+public enum GeoItem {
+    All(1),
+    Comment(2),
+    Photo(3);
+
+    private final int value;
+    GeoItem(int value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return this.name();
+    }
+
+    public int getValue() {
+        return value;
+    }
+}

+ 0 - 13
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/GeoEarth.java

@@ -1,13 +0,0 @@
-package cn.reghao.tnb.content.app.geo.model.po;
-
-import lombok.Getter;
-
-/**
- * @author reghao
- * @date 2023-09-12 11:43:50
- */
-@Getter
-public class GeoEarth {
-    private String name;
-    private String template;
-}

+ 0 - 16
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/GeoItem.java

@@ -1,16 +0,0 @@
-package cn.reghao.tnb.content.app.geo.model.po;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * @author reghao
- * @date 2024-09-10 14:29:32
- */
-@AllArgsConstructor
-@Getter
-public class GeoItem {
-    private Integer id;
-    private String name;
-    private Integer total;
-}

+ 4 - 9
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/GeoPoint.java

@@ -6,6 +6,7 @@ import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.app.geo.model.vo.MapPoint;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
@@ -15,27 +16,21 @@ import java.time.LocalDateTime;
  * @date 2024-09-10 17:37:07
  */
 @NoArgsConstructor
+@Setter
 @Getter
 public class GeoPoint extends BaseObject<Integer> {
     // 经度
     private BigDecimal longitude;
     // 纬度
     private BigDecimal latitude;
-    private String title;
+    private String deviceId;
     private Long createBy;
     private LocalDateTime createAt;
 
     public GeoPoint(MapPoint mapPoint) {
         this.longitude = BigDecimal.valueOf(mapPoint.getLng());
         this.latitude = BigDecimal.valueOf(mapPoint.getLat());
-        this.createBy = UserContext.getUser();
-        this.createAt = DateTimeConverter.localDateTime(System.currentTimeMillis());
-    }
-
-    public GeoPoint(MapPoint mapPoint, String title) {
-        this.longitude = BigDecimal.valueOf(mapPoint.getLng());
-        this.latitude = BigDecimal.valueOf(mapPoint.getLat());
-        this.title = title;
+        this.deviceId = "xxx";
         this.createBy = UserContext.getUser();
         this.createAt = DateTimeConverter.localDateTime(System.currentTimeMillis());
     }

+ 17 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/GeoMarker.java

@@ -0,0 +1,17 @@
+package cn.reghao.tnb.content.app.geo.model.vo;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author reghao
+ * @date 2025-05-30 22:51:12
+ */
+@NoArgsConstructor
+@Getter
+public class GeoMarker {
+    private Integer id;
+    private String name;
+    private Double lng;
+    private Double lat;
+}

+ 3 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MapMarker.java

@@ -1,15 +1,17 @@
 package cn.reghao.tnb.content.app.geo.model.vo;
 
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 
 /**
- * 百度地图标记
+ * 地图标记
  *
  * @author reghao
  * @date 2023-08-31 10:38:26
  */
+@AllArgsConstructor
 @NoArgsConstructor
 @Setter
 @Getter

+ 6 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MapPoint.java

@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
 import lombok.Setter;
 
 import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
 
 /**
  * @author reghao
@@ -28,4 +29,9 @@ public class MapPoint {
         this.lng = Double.parseDouble(lng);
         this.lat = Double.parseDouble(lat);
     }
+
+    public MapPoint(double lng, double lat) {
+        this.lng = lng;
+        this.lat = lat;
+    }
 }

+ 1 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MarkerInfo.java

@@ -10,6 +10,7 @@ import lombok.Setter;
 @Setter
 @Getter
 public class MarkerInfo {
+    private Integer type;
     private String itemId;
     private String replyId;
     private String sku;

+ 1 - 10
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/EarthService.java

@@ -1,8 +1,6 @@
 package cn.reghao.tnb.content.app.geo.service;
 
 import cn.reghao.jutil.web.ServletUtil;
-import cn.reghao.tnb.content.app.geo.db.mapper.GeoEarthMapper;
-import cn.reghao.tnb.content.app.geo.model.po.GeoEarth;
 import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
 import org.dom4j.Document;
 import org.dom4j.Element;
@@ -26,15 +24,8 @@ import java.util.List;
  */
 @Service
 public class EarthService {
-    private final GeoEarthMapper geoEarthMapper;
-
-    public EarthService(GeoEarthMapper geoEarthMapper) {
-        this.geoEarthMapper = geoEarthMapper;
-    }
-
     public void getEarthKml(List<MapMarker> list) throws Exception {
-        GeoEarth geoEarth = geoEarthMapper.findByName("default");
-        String template = geoEarth.getTemplate();
+        String template = "";
         ByteArrayInputStream inputStream = new ByteArrayInputStream(template.getBytes(StandardCharsets.UTF_8));
         SAXReader reader = new SAXReader();
         Document document = reader.read(inputStream);

+ 0 - 37
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/GeoService.java

@@ -1,37 +0,0 @@
-package cn.reghao.tnb.content.app.geo.service;
-
-import cn.reghao.tnb.content.app.geo.db.mapper.GeoChinaMapper;
-import cn.reghao.tnb.content.app.geo.db.mapper.GeoPolygonMapper;
-import cn.reghao.tnb.content.app.geo.model.po.GeoChina;
-import cn.reghao.tnb.content.app.geo.model.po.GeoPolygon;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
-
-/**
- * @author reghao
- * @date 2024-09-09 15:39:46
- */
-@Slf4j
-@Service
-public class GeoService {
-    private final GeoChinaMapper geoChinaMapper;
-    private final GeoPolygonMapper geoPolygonMapper;
-
-    public GeoService(GeoChinaMapper geoChinaMapper, GeoPolygonMapper geoPolygonMapper) {
-        this.geoChinaMapper = geoChinaMapper;
-        this.geoPolygonMapper = geoPolygonMapper;
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void add(GeoChina geoChina, GeoPolygon geoPolygon) {
-        try {
-            geoChinaMapper.save(geoChina);
-            geoPolygonMapper.save(geoPolygon);
-        } catch (Exception e) {
-            log.info("insert {} -> {} error", geoChina.getId(), geoChina.getExtName());
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-        }
-    }
-}

+ 65 - 142
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/MapService.java

@@ -1,24 +1,20 @@
 package cn.reghao.tnb.content.app.geo.service;
 
-import cn.reghao.file.api.iface.OssService;
 import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.tnb.common.db.SelectOption;
-import cn.reghao.tnb.content.api.dto.geo.MallReplyDto;
-import cn.reghao.tnb.content.api.dto.geo.MallReplyPhotoDto;
+import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.app.geo.db.mapper.*;
-import cn.reghao.tnb.content.app.geo.model.po.CameraPhoto;
+import cn.reghao.tnb.content.app.geo.model.po.BusStation;
+import cn.reghao.tnb.content.app.geo.model.po.GeoChina;
 import cn.reghao.tnb.content.app.geo.model.po.GeoPoint;
-import cn.reghao.tnb.content.app.geo.model.po.MallReply;
+import cn.reghao.tnb.content.app.geo.model.po.GeoPolygon;
+import cn.reghao.tnb.content.app.geo.model.vo.GeoMarker;
 import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
 import cn.reghao.tnb.content.app.geo.model.vo.MapPoint;
-import cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
-import java.time.LocalDateTime;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -31,154 +27,81 @@ import java.util.stream.Collectors;
 @Slf4j
 @Service
 public class MapService {
-    @DubboReference(check = false, retries = 0)
-    private OssService ossService;
-
-    private final MallReplyMapper mallReplyMapper;
-    private final GeoItemMapper geoItemMapper;
+    private final GeoChinaMapper geoChinaMapper;
+    private final GeoPolygonMapper geoPolygonMapper;
     private final GeoPointMapper geoPointMapper;
-    private final CameraPhotoMapper cameraPhotoMapper;
+    private final BusStationMapper busStationMapper;
 
-    public MapService(MallReplyMapper mallReplyMapper, GeoItemMapper geoItemMapper,
-                      GeoPointMapper geoPointMapper, CameraPhotoMapper cameraPhotoMapper) {
-        this.mallReplyMapper = mallReplyMapper;
-        this.geoItemMapper = geoItemMapper;
+    public MapService(GeoChinaMapper geoChinaMapper, GeoPolygonMapper geoPolygonMapper,
+                      GeoPointMapper geoPointMapper, BusStationMapper busStationMapper) {
+        this.geoChinaMapper = geoChinaMapper;
+        this.geoPolygonMapper = geoPolygonMapper;
         this.geoPointMapper = geoPointMapper;
-        this.cameraPhotoMapper = cameraPhotoMapper;
-    }
-
-    public boolean checkReplyId(String replyId) {
-        MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
-        return mallReply != null;
+        this.busStationMapper = busStationMapper;
     }
 
-    public synchronized void addTmallReply(MallReplyDto mallReplyDto) {
-        String replyId = mallReplyDto.getReplyId();
-        MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
-        if (mallReply != null) {
-            log.info("{} 已存在", replyId);
-            return;
-        }
-
-        mallReply = new MallReply(mallReplyDto);
-        List<CameraPhoto> list = mallReplyDto.getPhotos().stream()
-                .map(mallReplyPhotoDto -> {
-                    CameraPhoto cameraPhoto = new CameraPhoto(mallReplyPhotoDto);
-                    try {
-                        String shotAtStr = mallReplyPhotoDto.getShotAt();
-                        if (shotAtStr != null) {
-                            LocalDateTime shotAt = DateTimeConverter.localDateTime2(mallReplyPhotoDto.getShotAt());
-                            cameraPhoto.setShotAt(shotAt);
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-
-                    return cameraPhoto;
-                })
-                .collect(Collectors.toList());
-
-        if (!list.isEmpty()) {
-            saveTmallReply(mallReply, list);
-        }
-    }
-
-    public void addCameraPhotos(List<MallReplyPhotoDto> list) {
-        List<CameraPhoto> locations = list.stream().map(mallReplyPhotoDto -> {
-            CameraPhoto cameraPhoto = new CameraPhoto(mallReplyPhotoDto);
-            try {
-                String shotAtStr = mallReplyPhotoDto.getShotAt();
-                if (shotAtStr != null) {
-                    LocalDateTime shotAt = DateTimeConverter.localDateTime2(mallReplyPhotoDto.getShotAt());
-                    cameraPhoto.setShotAt(shotAt);
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            return cameraPhoto;
-        }).collect(Collectors.toList());
-
-        if (!locations.isEmpty()) {
-            cameraPhotoMapper.saveAll(locations);
+    @Transactional(rollbackFor = Exception.class)
+    public void add(GeoChina geoChina, GeoPolygon geoPolygon) {
+        try {
+            //geoChinaMapper.save(geoChina);
+            geoPolygonMapper.save(geoPolygon);
+        } catch (Exception e) {
+            log.info("insert {} -> {} error", geoChina.getId(), geoChina.getExtName());
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         }
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    public void saveTmallReply(MallReply mallReply, List<CameraPhoto> list) {
-        mallReplyMapper.save(mallReply);
-        cameraPhotoMapper.saveAll(list);
+    public void addGeoPoint(MapPoint mapPoint) {
+        GeoPoint geoPoint = new GeoPoint(mapPoint);
+        geoPointMapper.save(geoPoint);
     }
 
-    public List<MapMarker> getMapMarkers(int itemType) {
-        int pageSize = 1000;
-        if (itemType == 1) {
-            List<MapMarker> list = cameraPhotoMapper.findAllByReplyIdGroup(pageSize);
-            return list;
-        } else if (itemType == 2) {
-            List<MapMarker> list = cameraPhotoMapper.findByWestChina(pageSize, itemType);
-            return list;
-        } else if (itemType == 3) {
-            List<MapMarker> list = cameraPhotoMapper.findByWestGeoGroup(pageSize, itemType);
-            return list;
-        } else if (itemType == 4) {
-            List<MapMarker> list = cameraPhotoMapper.findByWestGeoGroup(pageSize, itemType);
-            list.forEach(mapMarker -> {
-                String objectId = mapMarker.getId();
-            });
-            return list;
-        }
-
-        return Collections.emptyList();
+    public List<MapMarker> getCityMarks() {
+        int deep = 2;
+        List<GeoMarker> list = geoChinaMapper.findByDeep(deep);
+        return list.stream().map(geoMarker -> {
+            String id = String.valueOf(geoMarker.getId());
+            String name = geoMarker.getName();
+            double lng = geoMarker.getLng();
+            double lat = geoMarker.getLat();
+            MapPoint mapPoint = new MapPoint(lng, lat);
+            return new MapMarker(id, name, mapPoint);
+        }).collect(Collectors.toList());
     }
 
-    public MarkerInfo getMarkerInfo(int id) {
-        CameraPhoto cameraPhoto = cameraPhotoMapper.findById(id);
-        if (cameraPhoto == null) {
-            return null;
-        }
-        
-        int type = cameraPhoto.getType();
-        MarkerInfo markerInfo;
-        if (type == 1) {
-            markerInfo = cameraPhotoMapper.findMarkerInfo(id);
-        } else if (type == 2) {
-            markerInfo = cameraPhotoMapper.findMarkerInfoById(id);    
-        } else {
-            markerInfo = cameraPhotoMapper.findMarkerInfo(id);
-        }
-        
-        int channelId = markerInfo.getChannelId();
-        if (channelId != 0) {
-            String uploadId = markerInfo.getUploadId();
-            try {
-                String signedUrl = ossService.getSignedUrl(channelId, uploadId);
-                if (signedUrl != null) {
-                    markerInfo.setPhotoUrl(signedUrl);
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        return markerInfo;
-    }
-    
-    public List<SelectOption> getGeoItems() {
-        return geoItemMapper.findAll().stream()
-                .map(geoItem -> {
-                    String name = geoItem.getName();
-                    int id = geoItem.getId();
-                    return new SelectOption(name, id);
-                }).collect(Collectors.toList());
+    public List<MapMarker> getTrailMarks() {
+        long userId = UserContext.getUserId();
+        List<GeoPoint> list = geoPointMapper.findByUserId(userId);
+        return list.stream().map(geoPoint -> {
+            String id = String.valueOf(geoPoint.getId());
+            String dateStr = DateTimeConverter.format(geoPoint.getCreateAt());
+            double lng = geoPoint.getLongitude().doubleValue();
+            double lat = geoPoint.getLatitude().doubleValue();
+            MapPoint mapPoint = new MapPoint(lng, lat);
+            return new MapMarker(id, dateStr, mapPoint);
+        }).collect(Collectors.toList());
     }
 
-    public void addGeoPoint(MapPoint mapPoint) {
-        GeoPoint geoPoint = new GeoPoint(mapPoint);
-        geoPointMapper.save(geoPoint);
+    public List<MapMarker> getStationMarks() {
+        List<BusStation> list = busStationMapper.findAll();
+        return list.stream().map(busStation -> {
+            String id = busStation.getId()+"";
+            String stationName = busStation.getStationName();
+            String latStr = String.valueOf(busStation.getLat());
+            String latStr1 = String.format("%s.%s", latStr.substring(0, 2), latStr.substring(2));
+            double lat = Double.parseDouble(latStr1);
+
+            String lngStr = String.valueOf(busStation.getLng());
+            String lngStr1 = String.format("%s.%s", lngStr.substring(0, 3), lngStr.substring(3));
+            double lng = Double.parseDouble(lngStr1);
+            MapPoint mapPoint = new MapPoint(lng, lat);
+            return new MapMarker(id, stationName, mapPoint);
+        }).collect(Collectors.toList());
     }
 
-    public List getGeoPoints() {
-        List<GeoPoint> list = geoPointMapper.findAll();
+    public List getTrailPath() {
+        long userId = UserContext.getUser();
+        List<GeoPoint> list = geoPointMapper.findByUserId(userId);
         List<List<Double>> list1 = list.stream().map(geoPoint -> {
             Double lng = geoPoint.getLongitude().doubleValue();
             Double lat = geoPoint.getLatitude().doubleValue();

+ 168 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/PhotoMapService.java

@@ -0,0 +1,168 @@
+package cn.reghao.tnb.content.app.geo.service;
+
+import cn.reghao.file.api.iface.OssService;
+import cn.reghao.jutil.jdk.converter.DateTimeConverter;
+import cn.reghao.tnb.common.db.SelectOption;
+import cn.reghao.tnb.content.api.dto.geo.MallReplyDto;
+import cn.reghao.tnb.content.api.dto.geo.MallReplyPhotoDto;
+import cn.reghao.tnb.content.app.geo.db.mapper.CameraPhotoMapper;
+import cn.reghao.tnb.content.app.geo.db.mapper.MallReplyMapper;
+import cn.reghao.tnb.content.app.geo.model.constant.GeoItem;
+import cn.reghao.tnb.content.app.geo.model.po.CameraPhoto;
+import cn.reghao.tnb.content.app.geo.model.po.MallReply;
+import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
+import cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author reghao
+ * @date 2023-08-31 17:49:48
+ */
+@Slf4j
+@Service
+public class PhotoMapService {
+    @DubboReference(check = false, retries = 0)
+    private OssService ossService;
+
+    private final MallReplyMapper mallReplyMapper;
+    private final CameraPhotoMapper cameraPhotoMapper;
+
+    public PhotoMapService(MallReplyMapper mallReplyMapper, CameraPhotoMapper cameraPhotoMapper) {
+        this.mallReplyMapper = mallReplyMapper;
+        this.cameraPhotoMapper = cameraPhotoMapper;
+    }
+
+    public boolean checkReplyId(String replyId) {
+        MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
+        return mallReply != null;
+    }
+
+    public synchronized void addTmallReply(MallReplyDto mallReplyDto) {
+        String replyId = mallReplyDto.getReplyId();
+        MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
+        if (mallReply != null) {
+            log.info("{} 已存在", replyId);
+            return;
+        }
+
+        mallReply = new MallReply(mallReplyDto);
+        List<CameraPhoto> list = mallReplyDto.getPhotos().stream()
+                .map(mallReplyPhotoDto -> {
+                    CameraPhoto cameraPhoto = new CameraPhoto(mallReplyPhotoDto);
+                    try {
+                        String shotAtStr = mallReplyPhotoDto.getShotAt();
+                        if (shotAtStr != null) {
+                            LocalDateTime shotAt = DateTimeConverter.localDateTime2(mallReplyPhotoDto.getShotAt());
+                            cameraPhoto.setShotAt(shotAt);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                    return cameraPhoto;
+                })
+                .collect(Collectors.toList());
+
+        if (!list.isEmpty()) {
+            saveTmallReply(mallReply, list);
+        }
+    }
+
+    public void addCameraPhotos(List<MallReplyPhotoDto> list) {
+        List<CameraPhoto> locations = list.stream().map(mallReplyPhotoDto -> {
+            CameraPhoto cameraPhoto = new CameraPhoto(mallReplyPhotoDto);
+            try {
+                String shotAtStr = mallReplyPhotoDto.getShotAt();
+                if (shotAtStr != null) {
+                    LocalDateTime shotAt = DateTimeConverter.localDateTime2(mallReplyPhotoDto.getShotAt());
+                    cameraPhoto.setShotAt(shotAt);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return cameraPhoto;
+        }).collect(Collectors.toList());
+
+        if (!locations.isEmpty()) {
+            cameraPhotoMapper.saveAll(locations);
+        }
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void saveTmallReply(MallReply mallReply, List<CameraPhoto> list) {
+        mallReplyMapper.save(mallReply);
+        cameraPhotoMapper.saveAll(list);
+    }
+
+    public List<MapMarker> getPhotoMarks(int itemType) {
+        int pageSize = 1000;
+        if (itemType == 1) {
+            List<MapMarker> list = cameraPhotoMapper.findAllByReplyIdGroup(pageSize);
+            return list;
+        } else if (itemType == 2) {
+            List<MapMarker> list = cameraPhotoMapper.findByWestChina(pageSize, itemType);
+            return list;
+        } else if (itemType == 3) {
+            List<MapMarker> list = cameraPhotoMapper.findByWestGeoGroup(pageSize, itemType);
+            return list;
+        } else if (itemType == 4) {
+            List<MapMarker> list = cameraPhotoMapper.findByWestGeoGroup(pageSize, itemType);
+            list.forEach(mapMarker -> {
+                String objectId = mapMarker.getId();
+            });
+            return list;
+        }
+
+        return Collections.emptyList();
+    }
+
+    public MarkerInfo getMarkerInfo(int id) {
+        CameraPhoto cameraPhoto = cameraPhotoMapper.findById(id);
+        if (cameraPhoto == null) {
+            return null;
+        }
+        
+        int type = cameraPhoto.getType();
+        MarkerInfo markerInfo;
+        if (type == 1) {
+            markerInfo = cameraPhotoMapper.findMarkerInfo(id);
+        } else if (type == 2) {
+            markerInfo = cameraPhotoMapper.findCommentMarkerInfo(id);
+        } else if (type == 3) {
+            markerInfo = cameraPhotoMapper.findMarkerInfo(id);
+        } else {
+            markerInfo = cameraPhotoMapper.findAlbumMarkerInfo(id);
+        }
+        markerInfo.setType(type);
+
+        int channelId = markerInfo.getChannelId();
+        if (channelId != 0) {
+            String uploadId = markerInfo.getUploadId();
+            try {
+                String signedUrl = ossService.getSignedUrl(channelId, uploadId);
+                if (signedUrl != null) {
+                    markerInfo.setPhotoUrl(signedUrl);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        return markerInfo;
+    }
+
+    public List<SelectOption> getGeoItems() {
+        return Arrays.stream(GeoItem.values()).map(geoItem -> {
+            int id = geoItem.getValue();
+            String name = geoItem.getName();
+            return new SelectOption(name, id);
+        }).collect(Collectors.toList());
+    }
+}

+ 7 - 2
content/content-service/src/main/resources/mapper/geo/CameraPhotoMapper.xml

@@ -47,7 +47,7 @@
         </association>
     </resultMap>
     <select id="findByWestGeoGroup" resultMap="mapMarker">
-        select id, manufacturer as title,x(geo) as lng,y(geo) as lat
+        select id, manufacturer as cup,x(geo) as lng,y(geo) as lat
         from geo_camera_photo
         where `type`=#{itemType}
         group by geo
@@ -74,7 +74,7 @@
         order by photo.id desc
         limit #{pageSize}
     </select>
-    <select id="findMarkerInfoById" resultType="cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo">
+    <select id="findCommentMarkerInfo" resultType="cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo">
         select reply.item_id,reply.reply_id,reply.extra as sku,reply.reply_content,reply.append_content,
         photo.object_id as upload_id,photo.channel_id,photo.photo_url
         from geo_camera_photo photo
@@ -86,4 +86,9 @@
         from geo_camera_photo
         where id=#{id}
     </select>
+    <select id="findAlbumMarkerInfo" resultType="cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo">
+        select object_id as upload_id,album_id as item_id,channel_id,photo_url
+        from geo_camera_photo
+        where id=#{id}
+    </select>
 </mapper>

+ 6 - 0
content/content-service/src/main/resources/mapper/geo/GeoChinaMapper.xml

@@ -22,4 +22,10 @@
         from geo_china
         where id=#{id}
     </select>
+    <select id="findByDeep" resultType="cn.reghao.tnb.content.app.geo.model.vo.GeoMarker">
+        select id,`name`,x(geo) as lng,y(geo) as lat
+        from geo_china
+        where deep=#{deep}
+        limit 1000
+    </select>
 </mapper>

+ 0 - 17
content/content-service/src/main/resources/mapper/geo/GeoEarthMapper.xml

@@ -1,17 +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="cn.reghao.tnb.content.app.geo.db.mapper.GeoEarthMapper">
-    <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into geo_earth
-        (`name`,`template`)
-        values 
-        (#{name},#{template})
-    </insert>
-    
-    <select id="findByName" resultType="cn.reghao.tnb.content.app.geo.model.po.GeoEarth">
-        select *
-        from geo_earth
-        where `name`=#{name}
-    </select>
-</mapper>

+ 0 - 16
content/content-service/src/main/resources/mapper/geo/GeoItemMapper.xml

@@ -1,16 +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="cn.reghao.tnb.content.app.geo.db.mapper.GeoItemMapper">
-    <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into geo_item
-        (`name`,`total`)
-        values 
-        (#{name},#{total})
-    </insert>
-    
-    <select id="findAll" resultType="cn.reghao.tnb.content.app.geo.model.po.GeoItem">
-        select *
-        from geo_item
-    </select>
-</mapper>

+ 8 - 8
content/content-service/src/main/resources/mapper/geo/GeoPointMapper.xml

@@ -4,23 +4,23 @@
 <mapper namespace="cn.reghao.tnb.content.app.geo.db.mapper.GeoPointMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
         insert into geo_point
-        (`geo`,`title`,`create_by`,`create_at`)
+        (`geo`,`device_id`,`create_by`,`create_at`)
         values 
-        (point(#{longitude},#{latitude}),#{title},#{createBy},#{createAt})
+        (point(#{longitude},#{latitude}),#{deviceId},#{createBy},#{createAt})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
         insert ignore into geo_point
-        (`geo`,`title`,`create_by`,`create_at`)
+        (`geo`,`device_id`,`create_by`,`create_at`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (point(#{item.longitude},#{item.latitude}),#{item.title},#{item.createBy},#{item.createAt})
+            (point(#{item.longitude},#{item.latitude}),#{item.deviceId},#{item.createBy},#{item.createAt})
         </foreach>
     </insert>
 
-    <select id="findAll" resultType="cn.reghao.tnb.content.app.geo.model.po.GeoPoint">
-        select id,create_time,x(geo) as longitude,y(geo) as latitude,title,create_by,create_at
+    <select id="findByUserId" resultType="cn.reghao.tnb.content.app.geo.model.po.GeoPoint">
+        select id,create_time,x(geo) as longitude,y(geo) as latitude,device_id,create_by,create_at
         from geo_point
-        order by id asc
-        limit 20
+        where create_by=#{userId}
+        order by create_at asc
     </select>
 </mapper>

+ 65 - 14
content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/GeoTest.java

@@ -2,18 +2,15 @@ package cn.reghao.tnb.content.app.vod.service;
 
 import cn.reghao.jutil.jdk.serializer.JsonConverter;
 import cn.reghao.jutil.jdk.text.TextFile;
+import cn.reghao.oss.sdk.OssConsoleClient;
+import cn.reghao.oss.sdk.model.OssConsoleConfig;
+import cn.reghao.oss.sdk.model.dto.ObjectInfo;
 import cn.reghao.tnb.content.app.ContentApplication;
-import cn.reghao.tnb.content.app.geo.db.mapper.GeoChinaMapper;
-import cn.reghao.tnb.content.app.geo.db.mapper.GeoPointMapper;
-import cn.reghao.tnb.content.app.geo.db.mapper.GeoPolygonMapper;
-import cn.reghao.tnb.content.app.geo.db.mapper.MallReplyMapper;
-import cn.reghao.tnb.content.app.geo.model.po.GeoChina;
-import cn.reghao.tnb.content.app.geo.model.po.GeoPoint;
-import cn.reghao.tnb.content.app.geo.model.po.GeoPolygon;
-import cn.reghao.tnb.content.app.geo.model.po.MallReply;
+import cn.reghao.tnb.content.app.geo.db.mapper.*;
+import cn.reghao.tnb.content.app.geo.model.po.*;
 import cn.reghao.tnb.content.app.geo.model.vo.GeoData;
+import cn.reghao.tnb.content.app.geo.model.vo.MapMarker;
 import cn.reghao.tnb.content.app.geo.model.vo.MapPoint;
-import cn.reghao.tnb.content.app.geo.service.GeoService;
 import cn.reghao.tnb.content.app.geo.service.MapService;
 import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
@@ -61,20 +58,18 @@ public class GeoTest {
         MapPoint mapPointE = new MapPoint(lngE, latE);
         MapPoint mapPointW = new MapPoint(lngW, latW);
 
-        List<GeoPoint> list = new ArrayList<>();
+        /*List<GeoPoint> list = new ArrayList<>();
         list.add(new GeoPoint(mapPointN, "最北"));
         list.add(new GeoPoint(mapPointS, "最南"));
         list.add(new GeoPoint(mapPointE, "最东"));
         list.add(new GeoPoint(mapPointW, "最西"));
-        geoPointMapper.saveAll(list);
+        geoPointMapper.saveAll(list);*/
     }
 
     @Autowired
     GeoChinaMapper geoChinaMapper;
     @Autowired
     GeoPolygonMapper geoPolygonMapper;
-    @Autowired
-    GeoService geoService;
     @Test
     public void geoPolygonTest() {
         TextFile textFile = new TextFile();
@@ -116,8 +111,8 @@ public class GeoTest {
             GeoChina geoChina1 = geoChinaMapper.findById(id);
             if (geoChina1 == null) {
                 geoChina1 = geoChina;
-                geoService.add(geoChina1, geoPolygon);
             }
+            mapService.add(geoChina1, geoPolygon);
         });
     }
 
@@ -214,4 +209,60 @@ public class GeoTest {
         }
         return extra1;
     }
+
+
+    OssConsoleClient getOssConsoleClient() {
+        String consoleUrl = "http://bnt.reghao.cn";
+        String accessKeyId = "ESCKn3Cd";
+        String accessKeySecret = "OL9SIOLoOqUjhMiQMv";
+        int videoChannelId = 101;
+        OssConsoleConfig ossConsoleConfig = new OssConsoleConfig(consoleUrl, accessKeyId, accessKeySecret);
+        try {
+            OssConsoleClient ossConsoleClient = new OssConsoleClient(ossConsoleConfig);
+            return ossConsoleClient;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+    @Autowired
+    CameraPhotoMapper cameraPhotoMapper;
+    @Test
+    void photoMapTest() {
+        OssConsoleClient ossConsoleClient = getOssConsoleClient();
+
+        List<CameraPhoto> list = cameraPhotoMapper.findAll();
+        for (CameraPhoto cameraPhoto : list) {
+            String objectId = cameraPhoto.getObjectId();
+            int channelId = cameraPhoto.getChannelId();
+            try {
+                ObjectInfo objectInfo = ossConsoleClient.getObjectInfo(channelId, objectId);
+            } catch (Exception e) {
+                log.info("objectId {} not exist", objectId);
+            }
+        }
+    }
+
+    @Autowired
+    BusStationMapper busStationMapper;
+    @Test
+    void geoBusTest() {
+        List<BusStation> list = busStationMapper.findAll();
+        for (BusStation busStation : list) {
+            String id = busStation.getId()+"";
+            String stationName = busStation.getStationName();
+            String latStr = String.valueOf(busStation.getLat());
+            String latStr1 = String.format("%s.%s", latStr.substring(0, 2), latStr.substring(2));
+            double lat = Double.parseDouble(latStr1);
+
+            String lngStr = String.valueOf(busStation.getLng());
+            String lngStr1 = String.format("%s.%s", lngStr.substring(0, 3), lngStr.substring(3));
+            double lng = Double.parseDouble(lngStr1);
+            MapPoint mapPoint = new MapPoint(lng, lat);
+
+            MapMarker mapMarker = new MapMarker(id, stationName, mapPoint);
+        }
+    }
 }