소스 검색

优化sql,驾驶舱

shiyue 4 주 전
부모
커밋
157511a2a4

+ 2 - 1
energy-manage-service/src/main/java/com/energy/manage/service/controller/system/SysTestController.java

@@ -71,8 +71,9 @@ public class SysTestController {
 	@GetMapping("/vibrationData")
 	public void vibrationData() {
 
+//        vibrationService.extractSkfPointData();
 
-        vibrationService.extractSkfPointData();
+        vibrationService.extracTwindGeneratorSkfPointData();
 
 	}
 

+ 5 - 3
energy-manage-service/src/main/java/com/energy/manage/service/service/vibration/VibrationService.java

@@ -6,10 +6,12 @@ package com.energy.manage.service.service.vibration;
 public interface VibrationService {
 
     /**
-     * 抽取skf测点数据生成csv文件
+     * 抽取skf测点数据生成csv文件,子设备下测点数据
      */
      void extractSkfPointData();
 
-
-
+    /**
+     * 抽取skf测点数据生成csv文件,风机下测点数据
+     */
+    void extracTwindGeneratorSkfPointData();
 }

+ 61 - 10
energy-manage-service/src/main/java/com/energy/manage/service/service/vibration/impl/VibrationServiceImpl.java

@@ -87,11 +87,6 @@ public class VibrationServiceImpl implements VibrationService {
                     if (CollectionUtils.isEmpty(engineHierarchyListVo.getChildren())) {
                         continue;
                     }
-//                    List<String> subs = StrUtil.split(condition,",");
-//                    if(CollUtil.contains(subs,fieldHierarchyListVo.getName())){
-//                        getIointIdCreateDataCsv(engineHierarchyListVo,companyHierarchyListVo.getName(),
-//                                fieldHierarchyListVo.getName(),engineHierarchyListVo.getName(), engineHierarchyListVo.getName());
-//                    }else{
                     //部件
                     assembly:
                     for (HierarchyListVo assemblyHierarchyListVo : engineHierarchyListVo.getChildren()) {
@@ -113,23 +108,79 @@ public class VibrationServiceImpl implements VibrationService {
                             }
                             // 拼接服务器地址
                             String dataPath = skfDataPath + companyHierarchyListVo.getName() + "/" + fieldHierarchyListVo.getName() + "/"
-                                    + engineHierarchyListVo.getName()  + "/" + getCurrentYearByTimeZone(this.shanghaiZone) + "/"
+                                    + engineHierarchyListVo.getName() + "/" + getCurrentYearByTimeZone(this.shanghaiZone) + "/"
                                     + yesterdayTime;
 
-                            String fileNamePrefix = fieldHierarchyListVo.getName()  + "_" + engineHierarchyListVo.getName() + "_" +
-                                    pointHierarchyListVo.getName();
+                            String fileNamePrefix = fieldHierarchyListVo.getName() + "#" + engineHierarchyListVo.getName() + "#" + pointHierarchyListVo.getName();
 
                             // 获取具体数据并生成csv
                             dynamicMeasurementsConvertData(dynamicMeasurementsList, dataPath, fileNamePrefix);
                         }
                     }
-//                    }
                 }
             }
             log.info(" >>> skf接口处理完毕 <<<");
         }
     }
 
+
+    @Override
+    public void extracTwindGeneratorSkfPointData() {
+        // 获取组织结构
+        List<HierarchyListVo> hierarchyListVoList = getHierarchyLists();
+        log.info("获取SKF数据组织结构树 >>> " + JSON.toJSONString(hierarchyListVoList));
+
+        // 企业
+        company:
+        for (HierarchyListVo companyHierarchyListVo : hierarchyListVoList) {
+            // 风场
+            field:
+            for (HierarchyListVo fieldHierarchyListVo : companyHierarchyListVo.getChildren()) {
+                if (CollectionUtils.isEmpty(fieldHierarchyListVo.getChildren())) {
+                    continue;
+                }
+                // 是否包含当前风场
+                if (fieldHierarchyListVo.getName().contains("七台河数据2")) {
+                    //风机,特殊情况需要单独处理(风机到部件到具体测点有可能少一层部件)需要根据不同风场进行单独处理,风机直接获取测点id,跳过部件
+                    engine:
+                    for (HierarchyListVo engineHierarchyListVo : fieldHierarchyListVo.getChildren()) {
+                        if (CollectionUtils.isEmpty(engineHierarchyListVo.getChildren())) {
+                            continue;
+                        }
+                        // 具体测点
+                        for (HierarchyListVo pointHierarchyListVo : engineHierarchyListVo.getChildren()) {
+                            //获取测点id值,调用skf接口获取振动测点值
+                            log.info("测点路径:>>> " + companyHierarchyListVo.getName() + " -> " + fieldHierarchyListVo.getName() +
+                                    " -> " + engineHierarchyListVo.getName() + " -> " + pointHierarchyListVo.getName());
+                            // 测点id
+                            Integer pointId = pointHierarchyListVo.getId();
+                            log.info("测点id >>> " + pointId);
+
+                            List<DynamicMeasurementsVo> dynamicMeasurementsList = getDynamicMeasurementsList(pointId);
+                            if (CollectionUtil.isEmpty(dynamicMeasurementsList)) {
+                                continue;
+                            }
+                            // 拼接服务器地址
+                            String dataPath = skfDataPath + companyHierarchyListVo.getName() + "/" + fieldHierarchyListVo.getName() + "/"
+                                    + engineHierarchyListVo.getName() + "/" + getCurrentYearByTimeZone(this.shanghaiZone) + "/"
+                                    + yesterdayTime;
+
+                            String fileNamePrefix = fieldHierarchyListVo.getName() + "#" + engineHierarchyListVo.getName() + "#" + pointHierarchyListVo.getName();
+
+                            // 获取具体数据并生成csv
+                            dynamicMeasurementsConvertData(dynamicMeasurementsList, dataPath, fileNamePrefix);
+                        }
+
+
+                    }
+
+                }
+
+            }
+            log.info(" >>> skf接口处理完毕 <<<");
+        }
+    }
+
     /**
      * 通过测点id获取测点数据并生成csv文件
      *
@@ -188,7 +239,7 @@ public class VibrationServiceImpl implements VibrationService {
             if (CollectionUtils.isEmpty(doubleList)) {
                 break dynamic;
             }
-            String fileName = fileNamePrefix + "_" + dynamicMeasurementsVo.getSpeed() + "_" + utctolocal(dynamicMeasurementsVo.getReadingTimeUTC()) + "_cms.csv";
+            String fileName = fileNamePrefix + "@" + dynamicMeasurementsVo.getSpeed() + "@" + utctolocal(dynamicMeasurementsVo.getReadingTimeUTC()) + "_cms.csv";
             //生成csv文件
             createCsvFile(doubleList, dataPath, fileName);
             log.info("抽取skf数据并生成csv文件 >>>> " + fileName);

+ 1 - 1
energy-manage-service/src/main/java/com/energy/manage/service/task/SkfVibrationDataTask.java

@@ -31,7 +31,7 @@ public class SkfVibrationDataTask {
         // 获取昨天的时间
         String yesterdayDate = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(dateTimeFormatter));
 
-//        vibrationService.extractSkfPointData(yesterdayDate,1,999);
+        vibrationService.extractSkfPointData();
 
         log.info(getCurrentDateTim() + "结束抽取skf测点数据 ");
     }