Browse Source

1.0.0 新增经纬度转换接口

feature/v1.0.0
peihao 4 years ago
parent
commit
27acabcfec
  1. 27
      air/src/main/java/com/air/land/controller/LandListedLonLatController.java
  2. 27
      air/src/main/java/com/air/land/controller/LandToListLonLatController.java

27
air/src/main/java/com/air/land/controller/LandListedLonLatController.java

@ -3,6 +3,7 @@ package com.air.land.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.air.land.dto.LandListedStatisticsDto;
import com.air.land.entity.LandListedLonLat;
import com.air.land.service.LandListedLonLatService;
import com.air.land.vo.LandListedLonLatVo;
@ -15,6 +16,7 @@ import com.vividsolutions.jts.geom.Polygon;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -30,6 +32,7 @@ import java.util.List;
* @author peihao
* @date 2021-05-18 09:40:04
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/landlistedlonlat")
@ -119,4 +122,28 @@ public class LandListedLonLatController {
return R.ok(landListedLonLatService.importLandListedLonLatExcel(file));
}
/**
* 经纬度转换wgs84_To_Gcj02
* @return R
*/
@ApiOperation(value = "经纬度转换(wgs84_To_Gcj02)", notes = "经纬度转换(wgs84_To_Gcj02)")
@GetMapping("/landListLonLatConversion")
public R<Boolean> landListLonLatConversion() {
List<LandListedLonLat> list = landListedLonLatService.list(Wrappers.<LandListedLonLat>query()
.lambda().isNull(LandListedLonLat::getGeom));
if (CollectionUtil.isNotEmpty(list)){
list.forEach(landListedLonLat -> {
if(StrUtil.isNotEmpty(landListedLonLat.getLandLonLat())){
try{
String[] split = landListedLonLat.getLandLonLat().split(";");
landListedLonLat.setLandLonLat(new StringBuffer(landListedLonLat.getLandLonLat()).append(";").append(split[0]).toString());
}catch (Exception e){
log.error(landListedLonLat.getLandListedId()+"已挂牌经纬度转换出错!",e);
}
}
});
}
return R.ok(landListedLonLatService.saveBatch(list));
}
}

27
air/src/main/java/com/air/land/controller/LandToListLonLatController.java

@ -3,6 +3,7 @@ package com.air.land.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.air.land.entity.LandListedLonLat;
import com.air.land.entity.LandToListLonLat;
import com.air.land.service.LandToListLonLatService;
import com.air.land.vo.LandToListLonLatVo;
@ -12,6 +13,7 @@ import com.cinderella.framework.common.core.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -25,6 +27,7 @@ import java.util.List;
* @author peihao
* @date 2021-05-18 09:40:15
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/landtolistlonlat")
@ -122,4 +125,28 @@ public class LandToListLonLatController {
return R.ok(landToListLonLatService.importLandToListedLonLatExcel(file));
}
/**
* 经纬度转换wgs84_To_Gcj02
* @return R
*/
@ApiOperation(value = "经纬度转换(wgs84_To_Gcj02)", notes = "经纬度转换(wgs84_To_Gcj02)")
@GetMapping("/landToListLonLatConversion")
public R<Boolean> landToListLonLatConversion() {
List<LandToListLonLat> list = landToListLonLatService.list(Wrappers.<LandToListLonLat>query()
.lambda().isNull(LandToListLonLat::getGeom));
if (CollectionUtil.isNotEmpty(list)){
list.forEach(landToListLonLat -> {
if(StrUtil.isNotEmpty(landToListLonLat.getLandLonLat())){
try{
String[] split = landToListLonLat.getLandLonLat().split(";");
landToListLonLat.setLandLonLat(new StringBuffer(landToListLonLat.getLandLonLat()).append(";").append(split[0]).toString());
}catch (Exception e){
log.error(landToListLonLat.getProposedseriaId()+"拟挂牌经纬度转换出错!",e);
}
}
});
}
return R.ok(landToListLonLatService.saveBatch(list));
}
}

Loading…
Cancel
Save