提交 83dd0906 authored 作者: huyufan's avatar huyufan

数据大屏

上级 185bec54
......@@ -61,41 +61,45 @@ public class LargeScreenListener {
Optional<LargeScreenAddressRoute> optional = largeScreenAddressRouteDao.getEntityByReceiveAddressIdAndSendAddressId(receiveAddressId, sendAddressId);
if (optional.isPresent()) {
log.info("当前地址已经记录receiveAddressId{}, sendAddressId{}", receiveAddressId, sendAddressId);
return;
} else {
ReceiveAndSendAddressVO feignAddressVO = Optional.of(addressFeign.getSendAndReceiveSystemAddress(sendAddressId, receiveAddressId)).filter(Result::succeed)
.map(Result::getData).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
BigDecimal sendAddressLatitude = feignAddressVO.getSendAddressVo().getLatitude().setScale(4, RoundingMode.DOWN);
BigDecimal sendAddressLongitude = feignAddressVO.getSendAddressVo().getLongitude().setScale(4, RoundingMode.DOWN);
BigDecimal receiveAddressLatitude = feignAddressVO.getReceiveAddressVo().getLatitude().setScale(4, RoundingMode.DOWN);
BigDecimal receiveAddressLongitude = feignAddressVO.getReceiveAddressVo().getLongitude().setScale(4, RoundingMode.DOWN);
List<GdRouteDTO> route = gdService.getRoute(sendAddressLongitude, sendAddressLatitude, receiveAddressLongitude, receiveAddressLatitude);
MongoLargeScreenAddressRoute mongoEntity = new MongoLargeScreenAddressRoute();
mongoEntity.setName(sendName);
mongoEntity.setReceiveSystemAddressId(receiveAddressId);
mongoEntity.setSendSystemAddressId(sendAddressId);
mongoEntity.setValue(sendName);
mongoEntity.setColorField("3");
mongoEntity.setSizeField("3");
mongoEntity.setInfo(receiveName);
List<Point> points = new LinkedList<>();
List<GdPosDTO> posList = route.get(0).getPosList();
for (GdPosDTO gdPosDTO : posList) {
GeoJsonPoint geoJsonPoint = new GeoJsonPoint(new Point(gdPosDTO.getLongitude().doubleValue(), gdPosDTO.getLatitude().doubleValue()));
points.add(geoJsonPoint);
}
mongoEntity.setGeometry(new GeoJsonLineString(points));
mongoTemplate.insert(mongoEntity);
LargeScreenAddressRoute build = LargeScreenAddressRoute.builder().
receiveSystemAddressId(receiveAddressId)
.sendSystemAddressId(receiveAddressId)
.receiveName(receiveName)
.sendName(sendName)
.build();
log.info("执行保存:{}", JSONUtil.parse(build));
largeScreenAddressRouteDao.saveEntity(build);
}
ReceiveAndSendAddressVO feignAddressVO = Optional.of(addressFeign.getSendAndReceiveSystemAddress(sendAddressId, receiveAddressId)).filter(Result::succeed)
.map(Result::getData).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
BigDecimal sendAddressLatitude = feignAddressVO.getSendAddressVo().getLatitude().setScale(4, RoundingMode.DOWN);
BigDecimal sendAddressLongitude = feignAddressVO.getSendAddressVo().getLongitude().setScale(4, RoundingMode.DOWN);
BigDecimal receiveAddressLatitude = feignAddressVO.getReceiveAddressVo().getLatitude().setScale(4, RoundingMode.DOWN);
BigDecimal receiveAddressLongitude = feignAddressVO.getReceiveAddressVo().getLongitude().setScale(4, RoundingMode.DOWN);
List<GdRouteDTO> route = gdService.getRoute(sendAddressLongitude, sendAddressLatitude, receiveAddressLongitude, receiveAddressLatitude);
MongoLargeScreenAddressRoute mongoEntity = new MongoLargeScreenAddressRoute();
mongoEntity.setName(sendName);
mongoEntity.setReceiveSystemAddressId(receiveAddressId);
mongoEntity.setSendSystemAddressId(sendAddressId);
mongoEntity.setValue(sendName);
mongoEntity.setColorField("3");
mongoEntity.setSizeField("3");
mongoEntity.setInfo(receiveName);
List<Point> points = new LinkedList<>();
List<GdPosDTO> posList = route.get(0).getPosList();
for (GdPosDTO gdPosDTO : posList) {
GeoJsonPoint geoJsonPoint = new GeoJsonPoint(new Point(gdPosDTO.getLongitude().doubleValue(), gdPosDTO.getLatitude().doubleValue()));
points.add(geoJsonPoint);
}
mongoEntity.setGeometry(new GeoJsonLineString(points));
mongoTemplate.insert(mongoEntity);
LargeScreenAddressRoute build = LargeScreenAddressRoute.builder().
receiveSystemAddressId(receiveAddressId)
.sendSystemAddressId(receiveAddressId)
.receiveName(receiveName)
.sendName(sendName)
.build();
largeScreenAddressRouteDao.saveEntity(build);
} catch (Exception e) {
log.info("数据大屏监控订单轨迹线路异常:{}", e.getMessage());
......
......@@ -5,7 +5,7 @@ import org.springframework.data.mongodb.core.geo.GeoJsonLineString;
import org.springframework.data.mongodb.core.mapping.Document;
@Data
@Document(collection = "demo_entity_collection")
@Document(collection = "large_screen_address_route")
public class MongoLargeScreenAddressRoute {
// private Integer id;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论