|
@@ -159,7 +159,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//修改
|
|
|
public void updateProject(ProjectDto projectDto) {
|
|
|
List<WindTowerInfo> windTowerInfoList = windTowerInfoService.list();
|
|
|
-
|
|
|
+ List<List<Coordinates>> cooList;
|
|
|
ProjectInfo projectInfo = projectInfoService.getOneProjectInfoById(projectDto.getId());
|
|
|
|
|
|
ProjectBasicInfo projectBasicInfo = projectInfo.getProjectBasicInfo();
|
|
@@ -170,7 +170,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Equipment> equipment = CalculationUtil.getEquipment(windTowerInfoList, projectDto.getEquipment());
|
|
|
projectInfo.setEquipment(equipment);
|
|
|
}
|
|
|
- ArrayList<List<Coordinates>> cooList = new ArrayList<>();
|
|
|
+ if (projectInfo.getCoordinates() == null) {
|
|
|
+ cooList = new ArrayList<>();
|
|
|
+ } else {
|
|
|
+ cooList = projectInfo.getCoordinates();
|
|
|
+ }
|
|
|
+
|
|
|
if (projectDto.getCoordinates().contains("。")) {
|
|
|
String[] split = projectDto.getCoordinates().split("。");
|
|
|
for (String s : split) {
|
|
@@ -181,18 +186,23 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Coordinates> coordinatesList1 = this.getCoordinates(projectDto.getCoordinates());
|
|
|
cooList.add(coordinatesList1);
|
|
|
}
|
|
|
+ projectInfo.setCoordinates(cooList);
|
|
|
mongoTemplate.save(projectInfo);
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Coordinates> getCoordinates(String coordinates) {
|
|
|
ArrayList<Coordinates> coordinatesList = new ArrayList<>();
|
|
|
- Coordinates coordinates1 = new Coordinates();
|
|
|
if (coordinates.length() > 0) {
|
|
|
- String[] split = coordinates.split(";");
|
|
|
- coordinates1.setLongitude(split[0]);
|
|
|
- coordinates1.setLatitude(split[1]);
|
|
|
- coordinatesList.add(coordinates1);
|
|
|
+ String[] splits = coordinates.split(";");
|
|
|
+ for (String s : splits) {
|
|
|
+ String[] split = s.split(",");
|
|
|
+ Coordinates coordinates1 = new Coordinates();
|
|
|
+ coordinates1.setLongitude(split[0]);
|
|
|
+ coordinates1.setLatitude(split[1]);
|
|
|
+ coordinatesList.add(coordinates1);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return coordinatesList;
|
|
|
}
|