Browse Source

楼盘

feature/v.2.0.0
caoyizhong 3 years ago
parent
commit
ae6d34aac2
  1. 11
      air/pom.xml
  2. 3
      air/src/main/java/com/air/applets/controller/AppletsMapController.java
  3. 7
      air/src/main/java/com/air/applets/convert/LandLonLatConvert.java
  4. 12
      air/src/main/java/com/air/applets/dto/CoordinatePoint.java
  5. 10
      air/src/main/java/com/air/applets/entity/CityAreaLonLatBase.java
  6. 18
      air/src/main/java/com/air/applets/service/impl/AppletsMapServiceImpl.java
  7. 28
      air/src/main/java/com/air/facilities/controller/FacilitiesController.java
  8. 13
      air/src/main/java/com/air/facilities/dto/FacilitiesDTO.java
  9. 8
      air/src/main/java/com/air/facilities/mapper/FacilitiesMapper.java
  10. 18
      air/src/main/java/com/air/facilities/service/FacilitiesService.java
  11. 54
      air/src/main/java/com/air/facilities/service/impl/FacilitiesServiceImpl.java
  12. 2
      air/src/main/java/com/air/land/controller/LandListedController.java
  13. 11
      air/src/main/java/com/air/origin/controller/BlocksOriginController.java
  14. 7
      air/src/main/java/com/air/origin/mapper/BlocksOriginMapper.java
  15. 7
      air/src/main/java/com/air/origin/service/BlocksOriginService.java
  16. 20
      air/src/main/java/com/air/origin/service/impl/BlocksOriginServiceImpl.java
  17. 141
      air/src/main/java/com/air/utils/GeomUtils.java
  18. 10
      air/src/main/resources/mapper/BlocksOriginMapper.xml
  19. 9
      air/src/main/resources/mapper/FacilitiesMapper.xml

11
air/pom.xml

@ -49,9 +49,14 @@
</dependency>
<dependency>
<groupId>cn.pomit</groupId>
<artifactId>spring-boot-monitor</artifactId>
<version>0.0.4</version>
<groupId>cn.pomit</groupId>
<artifactId>spring-boot-monitor</artifactId>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.16.0</version>
</dependency>
</dependencies>

3
air/src/main/java/com/air/applets/controller/AppletsMapController.java

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.cinderella.framework.common.core.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -25,6 +26,7 @@ import java.util.Map;
@RestController
@RequestMapping("/applets/map")
@Api(value = "appletsMap", tags = "小程序地图显示")
@Slf4j
public class AppletsMapController {
@Autowired
@ -72,6 +74,7 @@ public class AppletsMapController {
@ApiOperation(value = "查询城市的大组团和小组团信息(typ:dazutuan,xiaozutuan)", notes = "查询城市的大组团和小组团信息(typ:dazutuan,xiaozutuan)")
@GetMapping("getTypeRegionByLocation")
public R<List<LandLonLatDto>> getTypeRegionByLocation(@RequestParam String type,String city) {
log.info("组团类型(表名)=={}===地区 ={}",type,city);
return R.ok(mapService.getTypeRegionByLocation(type,city), "查询成功");
}

7
air/src/main/java/com/air/applets/convert/LandLonLatConvert.java

@ -20,7 +20,12 @@ import java.util.List;
* @date 2021-09-16
**/
public class LandLonLatConvert {
/**
* 地块的信息
* @param list
* @param id
* @return
*/
public static List<LandLonLatDto> getCityAreaLonLat(List<CityAreaLonLatBase> list, Integer id){
if (CollectionUtil.isEmpty(list)){
return null;

12
air/src/main/java/com/air/applets/dto/CoordinatePoint.java

@ -11,11 +11,17 @@ import java.util.List;
**/
@Data
public class CoordinatePoint {
/**
* 经纬度
*/
private List<PolygonPoint> polygonPoints;
/**
* 坐标数组
*/
private List<List<Double>> coordinates;
/**
* 中心点
*/
private List<Double> cenPoint;
}

10
air/src/main/java/com/air/applets/entity/CityAreaLonLatBase.java

@ -13,13 +13,13 @@ import lombok.Data;
@ApiModel
@Data
public class CityAreaLonLatBase {
@ApiModelProperty(value="")
@ApiModelProperty(value="id")
private Integer id;
@ApiModelProperty(value="")
@ApiModelProperty(value="名称")
private String name;
@ApiModelProperty(value="")
@ApiModelProperty(value="范围坐标")
private String pos;
@ApiModelProperty(value="")
@ApiModelProperty(value="")
private Integer lineWidth;
@ApiModelProperty(value="线颜色")
private String lineColor;
@ -33,7 +33,7 @@ public class CityAreaLonLatBase {
private Integer attr;
@ApiModelProperty(value="")
private String comment;
@ApiModelProperty(value="")
@ApiModelProperty(value="经纬度")
private String geom;
@ApiModelProperty(value = "城市")
private String city;

18
air/src/main/java/com/air/applets/service/impl/AppletsMapServiceImpl.java

@ -26,17 +26,35 @@ public class AppletsMapServiceImpl implements AppletsMapService {
private AppletsMapMapper mapMapper;
/**
* 根据定位经纬度范围行政区数据
* @param city
* @return
*/
@Override
public List<LandLonLatDto> getRegionByLocation(String city) {
List<CityAreaLonLatBase> list = mapMapper.getRegionByLocation(city);
return LandLonLatConvert.getCityAreaLonLat(list,4);
}
/**
* 根据定位经纬度返回3公里范围内的设施数据
* @param lat 纬度
* @param lon 经度
* @param radius 范围 默认30003公里
* @return
*/
@Override
public List<Map<String, String>> getFacilitiesByLocation(String lat, String lon, Double radius) {
return mapMapper.getFacilitiesByLocation(lat,lon,radius);
}
/**
* 查询城市的大组团和小组团信息
* @param type 组团类型表名
* @param city
* @return
*/
@Override
public List<LandLonLatDto> getTypeRegionByLocation(String type,String city) {
List<CityAreaLonLatBase> list = mapMapper.getTypeRegionByLocation(type, city);

28
air/src/main/java/com/air/facilities/controller/FacilitiesController.java

@ -50,18 +50,19 @@ public class FacilitiesController {
}
@ApiOperation(value = "查询全部")
@GetMapping("/list")
public R<Page<Facilities>> selectFacilitiesList(QueryPage queryPage, Facilities facilities){
log.info(""+facilities); Page<Facilities> page = queryPage.toPage();
List<Facilities> facilities1 = facilitiesService.selectAllFacilitiesPage(page, facilities);
public R<Page<Facilities>> selectFacilitiesList(QueryPage queryPage, FacilitiesDTO facilitiesDTO){
log.info(""+facilitiesDTO);
Page<Facilities> page = queryPage.toPage();
List<Facilities> facilities1 = facilitiesService.selectAllFacilitiesPage(page, facilitiesDTO);
return R.ok(page.setRecords(facilities1), "查询成功");
}
@ApiOperation(value = "查询城市地区")
@GetMapping("/list/rim")
public R<Page<Facilities>> selectFacilitiesRim(QueryPage queryPage){
public R<Page<Facilities>> selectFacilitiesRim(QueryPage queryPage,FacilitiesDTO facilitiesDTO){
Page<Facilities> page = queryPage.toPage();
List<Facilities> facilities1 = facilitiesService.selectAllFacilitiesRim(page);
log.info("{}",facilitiesDTO);
List<Facilities> facilities1 = facilitiesService.selectAllFacilitiesRim(page,facilitiesDTO);
return R.ok(page.setRecords(facilities1), "查询成功");
}
@ -74,12 +75,21 @@ public class FacilitiesController {
@ApiOperation(value = "删除")
@DeleteMapping("/delete/{ids}")
public R<Facilities> deleteFacilities(@PathVariable String[] ids){
facilitiesService.deleteFacilities(ids);
return R.ok();
int i = facilitiesService.deleteFacilities(ids);
return i > 0 ? R.ok() : R.failed("删除失败!");
}
@ApiOperation(value = "查询周边类型集合")
@ApiOperation(value = "删除指定城市周边数据")
@DeleteMapping("/deleteRim")
public R<Facilities> deleteFacilitiesRim(@RequestBody FacilitiesDTO facilitiesDTO){
log.info("======={}=======",facilitiesDTO);
int i = facilitiesService.deleteFacilitiesRim(facilitiesDTO);
return i > 0 ? R.ok() : R.failed("删除失败!");
}
@ApiOperation(value = "查询城市市")
@GetMapping("/selectTypeList")
public R<List<Facilities>> selectTypeList(){
List<Facilities> facilities = facilitiesService.selectTypeList();

13
air/src/main/java/com/air/facilities/dto/FacilitiesDTO.java

@ -40,4 +40,17 @@ public class FacilitiesDTO {
@ApiModelProperty(value = "旧类型")
private String oldType;
@ApiModelProperty(value = "省")
private String site;
@ApiModelProperty(value = "市")
private String city;
@ApiModelProperty(value = "区、县")
private String county;
@ApiModelProperty(value = "标识")
private String marking;
@ApiModelProperty(value = "城市")
private String urban;
}

8
air/src/main/java/com/air/facilities/mapper/FacilitiesMapper.java

@ -31,9 +31,15 @@ public interface FacilitiesMapper extends BaseMapper<Facilities> {
*/
List<Facilities> getAllFacilitiesRim(Page page);
/**
* 查询城市市周边
* @return
*/
List<Facilities> getAllFacilitiesRimShi(Page page);
/**
* 查询周边类型集合
* 查询城市市
* @return
*/
List<Facilities> selectTypeList();

18
air/src/main/java/com/air/facilities/service/FacilitiesService.java

@ -1,7 +1,6 @@
package com.air.facilities.service;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.dto.FacilitiesFileDTO;
import com.air.facilities.entity.Facilities;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -14,16 +13,16 @@ public interface FacilitiesService extends IService<Facilities> {
/**
* 查询全部周边信息
* @param facilities
* @param facilitiesDTO
* @return
*/
List<Facilities> selectAllFacilitiesPage(Page page, Facilities facilities);
List<Facilities> selectAllFacilitiesPage(Page page, FacilitiesDTO facilitiesDTO);
/**
* 查询全部周边信息
* 查询地区信息
* @return
*/
List<Facilities> selectAllFacilitiesRim(Page page);
List<Facilities> selectAllFacilitiesRim(Page page,FacilitiesDTO facilitiesDTO);
/**
* 根据ID查询具体信息
@ -46,6 +45,13 @@ public interface FacilitiesService extends IService<Facilities> {
*/
int deleteFacilities(String[] ids);
/**
* 删除指定城市周边信息
* @param facilitiesDTO
* @return
*/
int deleteFacilitiesRim(FacilitiesDTO facilitiesDTO);
/**
* 添加周边信息
* @param facilities
@ -54,7 +60,7 @@ public interface FacilitiesService extends IService<Facilities> {
int addFacilities(FacilitiesDTO facilities);
/**
* 查询周边类型集合
* 查询城市市
* @return
*/
List<Facilities> selectTypeList();

54
air/src/main/java/com/air/facilities/service/impl/FacilitiesServiceImpl.java

@ -2,16 +2,12 @@ package com.air.facilities.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSON;
import com.air.baseRegion.dto.BaseRegionDTO;
import com.air.baseRegion.mapper.BaseRegionMapper;
import com.air.baseRegion.vo.BaseRegionVO;
import com.air.dictitem.entity.DictItem;
import com.air.dictitem.mapper.DictItemMapper;
import com.air.facilities.dto.FacilitiesDTO;
import com.air.facilities.dto.FacilitiesFileDTO;
import com.air.facilities.entity.Facilities;
import com.air.facilities.listener.FacilitiesListener;
import com.air.facilities.mapper.FacilitiesMapper;
import com.air.facilities.service.FacilitiesService;
import com.alibaba.excel.EasyExcel;
@ -36,7 +32,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;
/**
* @program: back-end
@ -62,12 +57,15 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
/**
* 查询全部数据
*
* @param facilities
* @param facilitiesDTO
* @return
*/
@Override
public List<Facilities> selectAllFacilitiesPage(Page page, Facilities facilities) {
log.info("===="+facilities);
public List<Facilities> selectAllFacilitiesPage(Page page, FacilitiesDTO facilitiesDTO) {
Facilities facilities = new Facilities();
BeanUtils.copyProperties(facilitiesDTO,facilities);
facilities.setCity(facilitiesDTO.getUrban());
// log.info("=========={}",facilities);
List<Facilities> allFacilities = facilitiesMapper.getAllFacilities(page, facilities);
return allFacilities;
}
@ -75,10 +73,14 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
/**
* 查询全部地区
* @param page
* @param facilitiesDTO
* @return
*/
@Override
public List<Facilities> selectAllFacilitiesRim(Page page) {
public List<Facilities> selectAllFacilitiesRim(Page page, FacilitiesDTO facilitiesDTO) {
if(facilitiesDTO.getMarking().equals("2")){
return facilitiesMapper.getAllFacilitiesRimShi(page);
}
return facilitiesMapper.getAllFacilitiesRim(page);
}
@ -116,6 +118,38 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
return facilitiesMapper.delFacilities(ids);
}
/**
* 删除指定城市周边信息
* @param facilitiesDTO
* @return
*/
@Override
public int deleteFacilitiesRim(FacilitiesDTO facilitiesDTO) {
List<Facilities> facilitiesList = new ArrayList<>();
if(StrUtil.isNotBlank(facilitiesDTO.getCounty())){
facilitiesList = facilitiesMapper.selectList(Wrappers.<Facilities>query().lambda()
.eq(StringUtils.isNotBlank(facilitiesDTO.getSite()), Facilities::getSite, facilitiesDTO.getSite())
.eq(StringUtils.isNotBlank(facilitiesDTO.getCity()), Facilities::getCity, facilitiesDTO.getCity())
.eq(StringUtils.isNotBlank(facilitiesDTO.getCounty()), Facilities::getCounty, facilitiesDTO.getCounty())
);
}else{
facilitiesList = facilitiesMapper.selectList(Wrappers.<Facilities>query().lambda()
.eq(StringUtils.isNotBlank(facilitiesDTO.getSite()), Facilities::getSite, facilitiesDTO.getSite())
.eq(StringUtils.isNotBlank(facilitiesDTO.getCity()), Facilities::getCity, facilitiesDTO.getCity())
);
}
log.info("{}",facilitiesList.size());
List<String> list = new ArrayList<>();
facilitiesList.forEach(ids ->{
list.add(ids.getGid().toString());
});
// log.info("id============{}",list);
String[] array = list.toArray(new String[list.size()]);
//删除
return facilitiesMapper.delFacilities(array);
}
/**
* 添加
*
@ -147,7 +181,7 @@ public class FacilitiesServiceImpl extends ServiceImpl<FacilitiesMapper, Facilit
}
/**
* 查询周边类型集合
* 查询城市市
*
* @return
*/

2
air/src/main/java/com/air/land/controller/LandListedController.java

@ -238,8 +238,6 @@ public class LandListedController {
return R.ok(minioDownUrl + landListedUrl);
}
@Autowired
private RedisUtil redisUtil;
/**
* 导出已挂牌地块信息

11
air/src/main/java/com/air/origin/controller/BlocksOriginController.java

@ -1,5 +1,6 @@
package com.air.origin.controller;
import com.air.facilities.entity.Facilities;
import com.air.origin.dto.BlocksOriginQuery;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -12,6 +13,8 @@ import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 楼栋信息
@ -29,14 +32,16 @@ public class BlocksOriginController {
/**
* 分页查询
* @param page 分页对象
* @param queryPage 分页对象
* @param blocksOriginQuery 楼栋信息
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page")
public R getBlocksOriginPage(QueryPage page, BlocksOriginQuery blocksOriginQuery) {
return R.ok(blocksOriginService.page(page.toPage(), blocksOriginQuery));
public R<Page<BlocksOrigin>> getBlocksOriginPage(QueryPage queryPage, BlocksOriginQuery blocksOriginQuery) {
Page<BlocksOrigin> page = queryPage.toPage();
List<BlocksOrigin> blocksOrigins = blocksOriginService.pageSer(page, blocksOriginQuery);
return R.ok(page.setRecords(blocksOrigins),"查询成功");
}

7
air/src/main/java/com/air/origin/mapper/BlocksOriginMapper.java

@ -1,7 +1,12 @@
package com.air.origin.mapper;
import com.air.origin.dto.BlocksOriginQuery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.air.origin.entity.BlocksOrigin;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 楼栋信息
@ -11,4 +16,6 @@ import com.air.origin.entity.BlocksOrigin;
*/
public interface BlocksOriginMapper extends BaseMapper<BlocksOrigin> {
List<BlocksOrigin> selectPager(Page page, @Param("query")BlocksOriginQuery query);
}

7
air/src/main/java/com/air/origin/service/BlocksOriginService.java

@ -1,10 +1,13 @@
package com.air.origin.service;
import com.air.origin.dto.BlocksOriginQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.air.origin.entity.BlocksOrigin;
import java.util.List;
/**
* 楼栋信息
*
@ -19,5 +22,5 @@ public interface BlocksOriginService extends IService<BlocksOrigin> {
* @param query
* @return
*/
IPage<BlocksOrigin> page(IPage<BlocksOrigin> page, BlocksOriginQuery query);
List<BlocksOrigin> pageSer(Page page, BlocksOriginQuery query);
}

20
air/src/main/java/com/air/origin/service/impl/BlocksOriginServiceImpl.java

@ -1,13 +1,16 @@
package com.air.origin.service.impl;
import com.air.origin.dto.BlocksOriginQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.air.origin.entity.BlocksOrigin;
import com.air.origin.mapper.BlocksOriginMapper;
import com.air.origin.service.BlocksOriginService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 楼栋信息
@ -18,8 +21,17 @@ import org.springframework.stereotype.Service;
@Service
public class BlocksOriginServiceImpl extends ServiceImpl<BlocksOriginMapper, BlocksOrigin> implements BlocksOriginService {
@Autowired
private BlocksOriginMapper blocksOriginMapper;
@Override
public IPage<BlocksOrigin> page(IPage<BlocksOrigin> page, BlocksOriginQuery query) {
return super.page(page, Wrappers.query(query.blocksOrigin()));
public List<BlocksOrigin> pageSer(Page page, BlocksOriginQuery query) {
// return super.page(page, Wrappers.query(query.blocksOrigin()));
if(StringUtils.isNotBlank(query.getCreateDate()) ) {
String substring = query.getCreateDate().substring(0, 10);
query.setCreateDate(substring);
}
return blocksOriginMapper.selectPager(page,query);
}
}

141
air/src/main/java/com/air/utils/GeomUtils.java

@ -8,16 +8,17 @@ import com.air.applets.dto.CoordinatePoint;
import com.air.entity.PolygonGeom;
import com.air.entity.PolygonPoint;
import lombok.extern.slf4j.Slf4j;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.util.WebUtils;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -49,7 +50,9 @@ public class GeomUtils {
}
public static CoordinatePoint lonLatConvertPoint(String lonLat){
List<String> lonLatList = Arrays.asList(lonLat.split(";"));
log.info("范围坐标=={}",lonLat);
List<String> lonLatList = Arrays.asList(lonLat.split(";"));//将坐标转换为数组
CoordinatePoint coordinatePoint = new CoordinatePoint();
//绘图经纬度
@ -58,14 +61,22 @@ public class GeomUtils {
List<List<Double>> coordinates = new ArrayList<>();
//导航中间点
List<Double> cenPoint = new ArrayList<>(2);
for (int i = 0;i<lonLatList.size();i++){
//
// log.info("中心lon经度==={}===中心lat纬度==={}",centerPoint.get("lon"),centerPoint.get("lat"));
Map<String, Double> centerPoint = getCenterPoint(lonLat);//有些中心不准
// Map<String, Double> centerPoint = getCenterOfGravityPoint4(lonLat);
log.info("中心lon经度==={}===中心lat纬度==={}",centerPoint.get("lon"),centerPoint.get("lat"));
cenPoint.add(centerPoint.get("lon"));
cenPoint.add(centerPoint.get("lat"));
for (int i = 0;i<lonLatList.size();i++){ //处理坐标点
String[] lntlat = lonLatList.get(i).split(",");
// log.info("lon经度==={}===lat纬度==={}",lntlat[0],lntlat[1]);
double lon = Double.parseDouble(lntlat[0]);
double lat = Double.parseDouble(lntlat[1]);
if (i == 0){
cenPoint.add(lon);
cenPoint.add(lat);
}
// if (i == 0){
// cenPoint.add(lon);
// cenPoint.add(lat);
// }
PolygonPoint point = new PolygonPoint();
point.setLongitude(lon);
point.setLatitude(lat);
@ -75,12 +86,122 @@ public class GeomUtils {
polygonPoints.add(point);
coordinates.add(coordinate);
}
coordinatePoint.setCoordinates(coordinates);
coordinatePoint.setPolygonPoints(polygonPoints);
coordinatePoint.setCenPoint(cenPoint);
return coordinatePoint;
}
/**
* 根据输入的地点坐标计算中心点
*
* @param str ( 118.778076,30.905645;118.780764,30.914549;118.782928,30.9186;118.785621,30.92202; )
* @return
*/
public static Map<String,Double> getCenterPoint(String str) {
String[] arr = str.split(";");
int total = arr.length;
double X = 0, Y = 0, Z = 0;
for (int i = 0; i < arr.length; i++) {
double lat, lon, x, y, z;
lon = Double.parseDouble(arr[i].split(",")[0]) * Math.PI / 180;
lat = Double.parseDouble(arr[i].split(",")[1]) * Math.PI / 180;
x = Math.cos(lat) * Math.cos(lon);
y = Math.cos(lat) * Math.sin(lon);
z = Math.sin(lat);
X += x;
Y += y;
Z += z;
}
X = X / total;
Y = Y / total;
Z = Z / total;
double Lon = Math.atan2(Y, X);
double Hyp = Math.sqrt(X * X + Y * Y);
double Lat = Math.atan2(Z, Hyp);
log.info("{}",Lat * 180 / Math.PI);
log.info("{}", Lon * 180 / Math.PI);
// return new GeoCoordinate(Lat * 180 / Math.PI, Lon * 180 / Math.PI);
Map<String,Double> map = new HashMap<String,Double>();
map.put("lon", Lon * 180 / Math.PI);
map.put("lat", Lat * 180 / Math.PI);
return map;
}
//计算内心、质心
public static Map<String,Double> getCenterOfGravityPoint4(String str ) {
String[] arr = str.split(";");
// for (String s : arr) {
// String[] split = s.split(",");
// }
List<Coordinate> CoordinateList=new ArrayList<>();
//CoordinateList.add(new Coordinate("经度","纬度"));
for (String s : arr) {
String[] split = s.split(",");
String s1 = split[0];
String s2 = split[1];
Double doubleString = Double.parseDouble(s1);
Double doubler = Double.parseDouble(s2);
CoordinateList.add(new Coordinate(doubleString,doubler));
}
Coordinate[] coordinates = new Coordinate[CoordinateList.size()];
CoordinateList.toArray(coordinates);
GeometryFactory geometryFactory = new GeometryFactory();
//MultiPoint mpoint=geometryFactory.createMultiPointFromCoords(coordinates);//创建多点
//Point pt=mpoint.getCentroid();//得到多点的质心
//Point pt=mpoint.getInteriorPoint();//多点内心
Polygon p=geometryFactory.createPolygon(coordinates);//创建多边形
//Point pt=p.getCentroid();//多边形质心
Point pt=p.getInteriorPoint();//多边形内心
Map<String,Double> map = new HashMap<String,Double>();
map.put("lon", pt.getX());
map.put("lat", pt.getY());
// log.info("{}",pt.getX());
// log.info("{}", pt.getY());
return map;
}
// /**
// * 根据输入的地点坐标计算中心点
// * @param str
// * @return
// */
// public static Map<String,Double> getCenterPoint(String str) {
// String[] arr = str.split(";");
// int total = arr.length;
// double X = 0, Y = 0, Z = 0;
// for(int i=0;i<arr.length;i++){
// double lat, lon, x, y, z;
// lon = Double.parseDouble(arr[i].split(",")[0]) * Math.PI / 180;
// lat = Double.parseDouble(arr[i].split(",")[1]) * Math.PI / 180;
// x = Math.cos(lat) * Math.cos(lon);
// y = Math.cos(lat) * Math.sin(lon);
// z = Math.sin(lat);
// X += x;
// Y += y;
// Z += z;
// }
//
// X = X / total;
// Y = Y / total;
// Z = Z / total;
// double Lon = Math.atan2(Y, X);
// double Hyp = Math.sqrt(X * X + Y * Y);
// double Lat = Math.atan2(Z, Hyp);
//
// Map<String,Double> map = new HashMap<String,Double>();
// map.put("lng", Lon * 180 / Math.PI);
// map.put("lat", Lat * 180 / Math.PI);
// return map;
// }
public static String computeColor(String color,Integer opaqueness){
if (StrUtil.isEmpty(color) || opaqueness == null){
return null;

10
air/src/main/resources/mapper/BlocksOriginMapper.xml

@ -23,4 +23,14 @@
<result property="remark" column="remark"/>
<result property="dataId" column="data_id"/>
</resultMap>
<select id="selectPager" resultMap="blocksOriginMap">
SELECT block_id, item_id, anno_id, net_name, name, developer, position, pre_sale_license_no, building_no, status_cd,
status_date, create_user_id, create_date, update_user_id, update_date, remark, data_id
FROM blocks_origin
<where>
<if test="query.statusCd != null and query.statusCd != ''">and status_cd = #{query.statusCd}</if>
<if test="query.createDate != null and query.createDate != ''">and date_format(create_date, '%Y-%m-%d') = #{query.createDate}</if>
<if test="query.name != null and query.name != ''">and name like concat('%',#{query.name} ,'%') </if>
</where>
</select>
</mapper>

9
air/src/main/resources/mapper/FacilitiesMapper.xml

@ -4,19 +4,24 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.air.facilities.mapper.FacilitiesMapper">
<select id="getAllFacilities" resultType="com.air.facilities.entity.Facilities">
select gid,id,name,typecn,remark,lon,lat,type,geom,mini_geom,address,site from facilities
select gid,id,name,typecn,remark,lon,lat,type,geom,mini_geom,address,site,city from facilities
<where>
<if test="facilities.name != null and facilities.name != ''"> and name like concat('%', #{facilities.name},'%') </if>
<if test="facilities.typecn != null and facilities.typecn != ''"> and typecn = #{facilities.typecn} </if>
<if test="facilities.type != null and facilities.type != ''"> and type = #{facilities.type} </if>
<if test="facilities.city != null and facilities.city != ''"> and city = #{facilities.city} </if>
</where>
</select>
<select id="getAllFacilitiesRim" resultType="com.air.facilities.entity.Facilities">
select DISTINCT site,city,county from facilities
</select>
<select id="getAllFacilitiesRimShi" resultType="com.air.facilities.entity.Facilities">
select DISTINCT site,city from facilities
</select>
<select id="selectTypeList" resultType="com.air.facilities.entity.Facilities">
select DISTINCT typecn,type from facilities
select DISTINCT site,city from facilities
</select>
<delete id="delFacilities" parameterType="String">

Loading…
Cancel
Save