|
@@ -96,8 +96,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
for (Coordinates coordinates1 : coordinate) {
|
|
|
stringBuilder.append(coordinates1.getLongitude()).append(",").append(coordinates1.getLatitude()).append(";");
|
|
|
}
|
|
|
- stringBuilder.delete(stringBuilder.length() - 1, stringBuilder.length());
|
|
|
- stringBuilder.append("。");
|
|
|
+ if(stringBuilder.length() > 0){
|
|
|
+ stringBuilder.delete(stringBuilder.length() - 1, stringBuilder.length());
|
|
|
+ stringBuilder.append("。");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
projectDto.setCoordinates(stringBuilder.toString());
|
|
@@ -159,7 +162,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//修改
|
|
|
public void updateProject(ProjectDto projectDto) {
|
|
|
List<WindTowerInfo> windTowerInfoList = windTowerInfoService.list();
|
|
|
- List<List<Coordinates>> cooList;
|
|
|
+ List<List<Coordinates>> cooList = new ArrayList<>();
|
|
|
ProjectInfo projectInfo = projectInfoService.getOneProjectInfoById(projectDto.getId());
|
|
|
|
|
|
ProjectBasicInfo projectBasicInfo = projectInfo.getProjectBasicInfo();
|
|
@@ -169,11 +172,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (projectDto.getEquipment() != null && !projectDto.getEquipment().equals("")) {
|
|
|
List<Equipment> equipment = CalculationUtil.getEquipment(windTowerInfoList, projectDto.getEquipment());
|
|
|
projectInfo.setEquipment(equipment);
|
|
|
- }
|
|
|
- if (projectInfo.getCoordinates() == null) {
|
|
|
- cooList = new ArrayList<>();
|
|
|
- } else {
|
|
|
- cooList = projectInfo.getCoordinates();
|
|
|
+ }else {
|
|
|
+ projectInfo.setEquipment(new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
if (projectDto.getCoordinates().contains("。")) {
|
|
@@ -183,8 +183,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
cooList.add(coordinatesList);
|
|
|
}
|
|
|
} else {
|
|
|
- List<Coordinates> coordinatesList1 = this.getCoordinates(projectDto.getCoordinates());
|
|
|
- cooList.add(coordinatesList1);
|
|
|
+ if(!projectDto.getCoordinates().equals("")){
|
|
|
+ List<Coordinates> coordinatesList1 = this.getCoordinates(projectDto.getCoordinates());
|
|
|
+ cooList.add(coordinatesList1);
|
|
|
+ }
|
|
|
}
|
|
|
projectInfo.setCoordinates(cooList);
|
|
|
mongoTemplate.save(projectInfo);
|