Forráskód Böngészése

项目信息修改bug 数据完整性修改逻辑

hxf 1 éve
szülő
commit
904a3098a3

+ 12 - 10
neim-biz/src/main/java/com/jiayue/biz/service/impl/ProjectServiceImpl.java

@@ -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);

+ 2 - 4
neim-biz/src/main/java/com/jiayue/biz/service/impl/RealTimeDisplayServiceImpl.java

@@ -634,10 +634,8 @@ public class RealTimeDisplayServiceImpl implements RealTimeDisplayService {
             long yesterday = new Date().getTime() - 1000 * 60 * 60 * 24;
             Date endTime = DateTimeUtil.getDayLastTime(yesterday);
             //获取该塔的数据起止时间
-            List<StatisticsSituation> statisticsSituationList = statisticsSituationService.list();
-            List<StatisticsSituation> collectStatisticsSituationList = statisticsSituationList.stream().filter(s -> s.getEquipmentId().equals(equipmentNo)).collect(Collectors.toList());
-            String[] startTimeAndEndTime = collectStatisticsSituationList.get(0).getStartTimeAndEndTime().split(",");
-            Date startTime = DateTimeUtil.beginOfMonth(new Date(Long.parseLong(startTimeAndEndTime[0])));
+            Map<String, Long> dataTimeStartAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(equipmentNo);
+            Date startTime = DateTimeUtil.beginOfMonth(new Date(dataTimeStartAndEnd.get("startTime")));
 
             List<Entity> entities = prophaseWeatherDataService.selectCount(equipmentNo);
             Map<Object, Object> formatMap = new HashMap<>();