|
@@ -62,7 +62,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
ProjectDto projectDto = new ProjectDto();
|
|
|
projectDto.setId(projectInfo.getId());
|
|
|
- if(projectInfo.getProjectBasicInfo() != null){
|
|
|
+ if (projectInfo.getProjectBasicInfo() != null) {
|
|
|
projectDto.setProjectSort(projectInfo.getProjectBasicInfo().getProjectSort());
|
|
|
projectDto.setProjectState(projectInfo.getProjectBasicInfo().getProjectState());
|
|
|
projectDto.setProjectType(projectInfo.getProjectBasicInfo().getProjectType());
|
|
@@ -76,17 +76,22 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
projectDto.setLatitude(split[1]);
|
|
|
}
|
|
|
}
|
|
|
- List<String> collect = projectInfo.getEquipment().stream().map(Equipment::getName).collect(Collectors.toList());
|
|
|
- for (String s : collect) {
|
|
|
- builder.append(s).append(",");
|
|
|
- }
|
|
|
- if (builder.length() > 0) {
|
|
|
- builder.delete(builder.length() - 1, builder.length());
|
|
|
+ if (projectInfo.getEquipment() != null) {
|
|
|
+ List<String> collect = projectInfo.getEquipment().stream().map(Equipment::getName).collect(Collectors.toList());
|
|
|
+ if (projectInfo.getEquipment() != null && !projectInfo.getEquipment().equals("")) {
|
|
|
+ for (String s : collect) {
|
|
|
+ builder.append(s).append(",");
|
|
|
+ }
|
|
|
+ if (builder.length() > 0) {
|
|
|
+ builder.delete(builder.length() - 1, builder.length());
|
|
|
+ }
|
|
|
+ projectDto.setEquipment(builder.toString());
|
|
|
+ }
|
|
|
}
|
|
|
- projectDto.setEquipment(builder.toString());
|
|
|
+
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
List<List<Coordinates>> coordinates = projectInfo.getCoordinates();
|
|
|
- if(coordinates != null && coordinates.size() > 0){
|
|
|
+ if (coordinates != null && coordinates.size() > 0) {
|
|
|
for (List<Coordinates> coordinate : coordinates) {
|
|
|
for (Coordinates coordinates1 : coordinate) {
|
|
|
stringBuilder.append(coordinates1.getLongitude()).append(",").append(coordinates1.getLatitude()).append(";");
|
|
@@ -95,21 +100,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
stringBuilder.append("。");
|
|
|
}
|
|
|
}
|
|
|
-// if (stringBuilder.length() > 0) {
|
|
|
-// stringBuilder.delete(stringBuilder.length() - 1, stringBuilder.length());
|
|
|
-// }
|
|
|
-
|
|
|
projectDto.setCoordinates(stringBuilder.toString());
|
|
|
projectList.add(projectDto);
|
|
|
}
|
|
|
- if(project.getProjectName() != null){
|
|
|
+ if (project.getProjectName() != null) {
|
|
|
return projectList.stream().filter(p -> p.getProjectName().contains(project.getProjectName())).collect(Collectors.toList());
|
|
|
}
|
|
|
return projectList;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void delProject(String id){
|
|
|
+ public void delProject(String id) {
|
|
|
projectInfoService.delProjectInfo(id);
|
|
|
}
|
|
|
|
|
@@ -120,7 +121,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
ProjectInfo projectInfo = new ProjectInfo();
|
|
|
projectInfo.setId(UUID.randomUUID().toString());
|
|
|
ProjectBasicInfo projectBasicInfo = projectInfo.getProjectBasicInfo();
|
|
|
- if(projectBasicInfo == null){
|
|
|
+ if (projectBasicInfo == null) {
|
|
|
projectBasicInfo = new ProjectBasicInfo();
|
|
|
this.getProjectBasicInfo(projectBasicInfo, projectDto);
|
|
|
}
|
|
@@ -129,6 +130,24 @@ 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);
|
|
|
+ } else {
|
|
|
+ projectInfo.setEquipment(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ ArrayList<List<Coordinates>> cooList = new ArrayList<>();
|
|
|
+ if (projectDto.getCoordinates() != null) {
|
|
|
+ if (projectDto.getCoordinates().contains("。")) {
|
|
|
+ String[] split = projectDto.getCoordinates().split("。");
|
|
|
+ for (String s : split) {
|
|
|
+ List<Coordinates> coordinatesList = this.getCoordinates(s);
|
|
|
+ cooList.add(coordinatesList);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<Coordinates> coordinatesList1 = this.getCoordinates(projectDto.getCoordinates());
|
|
|
+ cooList.add(coordinatesList1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ projectInfo.setCoordinates(new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
mongoTemplate.save(projectInfo);
|
|
@@ -152,13 +171,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
projectInfo.setEquipment(equipment);
|
|
|
}
|
|
|
ArrayList<List<Coordinates>> cooList = new ArrayList<>();
|
|
|
- if(projectDto.getCoordinates().contains("。")){
|
|
|
+ if (projectDto.getCoordinates().contains("。")) {
|
|
|
String[] split = projectDto.getCoordinates().split("。");
|
|
|
for (String s : split) {
|
|
|
List<Coordinates> coordinatesList = this.getCoordinates(s);
|
|
|
cooList.add(coordinatesList);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
List<Coordinates> coordinatesList1 = this.getCoordinates(projectDto.getCoordinates());
|
|
|
cooList.add(coordinatesList1);
|
|
|
}
|
|
@@ -166,10 +185,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<Coordinates> getCoordinates(String coordinates){
|
|
|
+ public List<Coordinates> getCoordinates(String coordinates) {
|
|
|
ArrayList<Coordinates> coordinatesList = new ArrayList<>();
|
|
|
Coordinates coordinates1 = new Coordinates();
|
|
|
- if(coordinates.length() > 0){
|
|
|
+ if (coordinates.length() > 0) {
|
|
|
String[] split = coordinates.split(";");
|
|
|
coordinates1.setLongitude(split[0]);
|
|
|
coordinates1.setLatitude(split[1]);
|
|
@@ -179,14 +198,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public void getProjectBasicInfo(ProjectBasicInfo projectBasicInfo, ProjectDto projectDto) {
|
|
|
projectBasicInfo.setProjectName(projectDto.getProjectName());
|
|
|
projectBasicInfo.setProjectSort(projectDto.getProjectSort());
|
|
|
projectBasicInfo.setProjectState(projectDto.getProjectState());
|
|
|
projectBasicInfo.setProjectType(projectDto.getProjectType());
|
|
|
projectBasicInfo.setProjectNameEasy(projectDto.getProjectNameEasy());
|
|
|
- projectBasicInfo.setPosition(projectDto.getLongitude() + "," + projectDto.getLatitude());
|
|
|
+ if (projectDto.getLongitude() != null && projectDto.getLatitude() != null) {
|
|
|
+ projectBasicInfo.setPosition(projectDto.getLongitude() + "," + projectDto.getLatitude());
|
|
|
+ } else {
|
|
|
+ projectBasicInfo.setPosition("");
|
|
|
+ }
|
|
|
projectBasicInfo.setProjectOverview(projectDto.getProjectOverview());
|
|
|
projectBasicInfo.setResourcesOverview(projectBasicInfo.getResourcesOverview());
|
|
|
}
|