Browse Source

增加注释和检查站端短期上报超时预警

tl 8 tháng trước cách đây
mục cha
commit
600c1a7bd3

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/controller/alarm/AbnormalAlarmController.java

@@ -39,7 +39,7 @@ public class AbnormalAlarmController {
     public R dashboard(Long currentPage, Long pageSize, AlarmEnum alarmType) {
         Page page = new Page(currentPage, pageSize);
         page.setMaxLimit((long) -1);
-        return R.ok(abnormalAlarmService.page(page, abnormalAlarmService.dashboard(alarmType)).addOrder(OrderItem.desc("start_time")));
+        return R.ok(abnormalAlarmService.page(page, abnormalAlarmService.dashboard(alarmType)));
     }
 
 

+ 45 - 2
cpp-admin/src/main/java/com/cpp/web/job/ScheduledJob.java

@@ -1,20 +1,38 @@
 package com.cpp.web.job;
 
+import com.cpp.system.service.ISysConfigService;
+import com.cpp.web.domain.Alarm.AbnormalAlarm;
+import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
+import com.cpp.web.domain.enums.AlarmEnum;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.service.accuracy.CalcAccuracy;
 import com.cpp.web.service.alarm.AlarmLog;
 import com.cpp.web.service.cloud.CloudFileParsing;
+import com.cpp.web.service.datafactory.ParsingLogService;
 import com.cpp.web.service.datafactory.SftpFileParsing;
+import com.cpp.web.utils.DateTimeUtil;
+import com.cpp.web.utils.LogUtil;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+
 /**
  * 定时任务管理类
  */
 @RequiredArgsConstructor
 @Component
+@Slf4j
 public class ScheduledJob implements ApplicationRunner {
     private final SftpFileParsing sftpFileParsing;
 
@@ -22,12 +40,38 @@ public class ScheduledJob implements ApplicationRunner {
 
     private final CloudFileParsing cloudFileParsing;
 
+    private final ISysConfigService iSysConfigService;
+
+
+    private final ParsingLogService parsingLogService;
+
+    AlarmLog alarmLog = AlarmLog.getInstance();
+
     /**
      * 解析站端文件定时任务
      */
-//    @Scheduled(fixedRate = 60000L)
+//    @Scheduled(fixedRate = 300000L)
     public void parsingFile() {
         sftpFileParsing.parsingFile();
+
+        //短期未解析告警
+        String dqEndTime = iSysConfigService.selectConfigByKey("dqEndTime");
+        if (!dqEndTime.equals(StringUtils.EMPTY)) {
+            Date date = null;
+            try {
+                date = DateUtils.parseDate(DateFormatUtils.format(new Date(), "yyyy-MM-dd " + dqEndTime),"yyyy-MM-dd HH:mm");
+                Date now = new Date();
+                if (date.getTime() < now.getTime() && date.getTime() + 600000L > now.getTime()) {
+                    List<ElectricField> electricFields = parsingLogService.notTodayLogStation(FileTypeEnum.dq, DataSourcesEnum.E1);
+                    for (ElectricField electricField : electricFields) {
+                        alarmLog.info(DataSourcesEnum.E1, AlarmEnum.E4, LogUtil.format("”{}“发电站,未在”{}“前上传“短期”预测文件!", electricField.getName(), DateFormatUtils.format(new Date(), "yyyy-MM-dd " + dqEndTime)), electricField.getStationCode());
+                    }
+                }
+            } catch (ParseException e) {
+                log.info("dqEndTime参数转换date失败");
+                e.printStackTrace();
+            }
+        }
     }
 
     /**
@@ -47,7 +91,6 @@ public class ScheduledJob implements ApplicationRunner {
     }
 
 
-
     /**
      * 计算准确率定时任务
      */

+ 10 - 1
cpp-admin/src/main/java/com/cpp/web/service/accuracy/CalcAccuracy.java

@@ -11,6 +11,9 @@ import org.springframework.stereotype.Service;
 
 import java.util.*;
 
+/**
+ * 准确路计算的主类
+ */
 @Service
 @RequiredArgsConstructor
 public class CalcAccuracy {
@@ -25,6 +28,7 @@ public class CalcAccuracy {
      * 执行准确率计算
      */
     public void calculate() {
+        //获取前一天的数据
         Long day = 86400000L;
         Long now = System.currentTimeMillis();
 
@@ -33,10 +37,13 @@ public class CalcAccuracy {
         List<ElectricField> electricFieldList = electricFieldService.list();
         List<AccuracyPassRate> accuracyPassRateList = new ArrayList<>();
         String province = sysConfigService.selectConfigByKey("province");
+
+        //第一个集中预测作用于新疆,因为用了内部准确率计算包,所以需要省份的枚举标识,这里可以改为动态获取
         if (province.equals("")) province = "E65";
         if (!electricFieldList.isEmpty()) {
             List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataService.findByTimeBetween(startTime, endTime);
             if (!powerStationStatusDataList.isEmpty()) {
+                //定义了准确率计算的三种方式,同样可以改为动态获取
                 List<String> formulaTypes = Arrays.asList("DAY_SHORT_ACCURACY", "POINT_SHORT_ACCURACY", "POINT_ULTRA_SHORT_ACCURACY");
                 for (CalculateInterface calculateInterface : calculateInterfaces) {
                     if (listHasIntersection(calculateInterface.calculationTypes(), formulaTypes)) {
@@ -45,6 +52,8 @@ public class CalcAccuracy {
                 }
             }
         }
+
+        //如果存在准确率结果,则保存
         if (accuracyPassRateList.size() > 0) {
             accuracyPassRateService.saveBatch(accuracyPassRateList);
         }
@@ -52,7 +61,7 @@ public class CalcAccuracy {
 
 
     /**
-     * 集合交集判断(此方法还需优化写法
+     * 集合交集判断(此方法还可以写得更好
      *
      * @param strings
      * @param stringList

+ 19 - 13
cpp-admin/src/main/java/com/cpp/web/service/alarm/AlarmLog.java

@@ -29,6 +29,7 @@ public class AlarmLog {
         return LazyHolder.INSTANCE;
     }
 
+    //一个告警过滤的缓存map
     private Map<String, List<AlarmConf>> stationAlarmConfListMap = new ConcurrentHashMap<>();
 
     private static class LazyHolder {
@@ -38,18 +39,17 @@ public class AlarmLog {
     /**
      * 告警日志打印+存储
      *
-     * @param alarmSource
-     * @param alarmType
-     * @param info
-     * @param stationCode
+     * @param alarmSource 数据来源
+     * @param alarmType 告警类型
+     * @param info  告警信息
+     * @param stationCode   场站编号
      */
     public void info(DataSourcesEnum alarmSource, AlarmEnum alarmType, String info, String stationCode) {
 
         List<AlarmConf> alarmConfs = stationAlarmConfListMap.get(stationCode);
 
         Integer status = 0;
-
-        if (alarmConfs.stream().anyMatch(a -> a.getType().equals(1) ? a.getKeyword().equals(info) : info.contains(a.getKeyword()))) {
+        if (alarmConfs != null && alarmConfs.stream().anyMatch(a -> a.getType().equals(1) ? a.getKeyword().equals(info) : info.contains(a.getKeyword()))) {
             status = 1;
         }
 
@@ -112,7 +112,7 @@ public class AlarmLog {
 
 
     /**
-     * 初始化告警信息
+     * 将告警的常用信息装载缓存map
      */
     public void initMap() {
         List<AbnormalAlarm> abnormalAlarms = SpringUtils.getBean(AbnormalAlarmService.class).list(Wrappers.lambdaQuery(AbnormalAlarm.class).select().isNull(AbnormalAlarm::getEndTime));
@@ -126,25 +126,31 @@ public class AlarmLog {
     }
 
 
+    /**
+     * 更新缓存map
+     *
+     * @param alarmConf
+     * @param b
+     */
     public void updateStationAlarmConfListMap(AlarmConf alarmConf, Boolean b) {
 
         if (b) {
             //更新
-            if (stationAlarmConfListMap.containsKey(alarmConf.getStationCode())){
+            if (stationAlarmConfListMap.containsKey(alarmConf.getStationCode())) {
                 List<AlarmConf> list = stationAlarmConfListMap.get(alarmConf.getStationCode());
-                list.removeIf(s->s.getId().equals(alarmConf.getId()));
+                list.removeIf(s -> s.getId().equals(alarmConf.getId()));
                 list.add(alarmConf);
-            }else {
+            } else {
                 List<AlarmConf> list = new ArrayList<>();
                 list.add(alarmConf);
-                stationAlarmConfListMap.put(alarmConf.getStationCode(),list);
+                stationAlarmConfListMap.put(alarmConf.getStationCode(), list);
             }
 
         } else {
             //删除
-            if (stationAlarmConfListMap.containsKey(alarmConf.getStationCode())){
+            if (stationAlarmConfListMap.containsKey(alarmConf.getStationCode())) {
                 List<AlarmConf> list = stationAlarmConfListMap.get(alarmConf.getStationCode());
-                list.removeIf(s->s.getId().equals(alarmConf.getId()));
+                list.removeIf(s -> s.getId().equals(alarmConf.getId()));
             }
         }
     }

+ 7 - 0
cpp-admin/src/main/java/com/cpp/web/service/alarm/impl/AbnormalAlarmServiceImpl.java

@@ -3,6 +3,7 @@ package com.cpp.web.service.alarm.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cpp.web.domain.Alarm.AbnormalAlarm;
@@ -83,6 +84,11 @@ public class AbnormalAlarmServiceImpl extends ServiceImpl<AbnormalAlarmMapper, A
         return baseMapper.selectCount(wrapper);
     }
 
+    /**
+     *
+     * @param alarmType
+     * @return
+     */
     @Override
     public QueryWrapper<AbnormalAlarm> dashboard(AlarmEnum alarmType) {
 
@@ -92,6 +98,7 @@ public class AbnormalAlarmServiceImpl extends ServiceImpl<AbnormalAlarmMapper, A
         }
 
         wrapper.eq("status", 0);
+        wrapper.orderByDesc("start_time");
 
         return wrapper;
     }

+ 12 - 3
cpp-admin/src/main/java/com/cpp/web/service/cloud/CloudFileParsing.java

@@ -9,6 +9,7 @@ import com.cpp.web.domain.enums.AlarmEnum;
 import com.cpp.web.domain.enums.DataSourcesEnum;
 import com.cpp.web.service.alarm.AbnormalAlarmService;
 import com.cpp.web.service.datafactory.ParsingLogService;
+import com.cpp.web.service.overhaulplan.OverhaulPlanService;
 import com.cpp.web.utils.*;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -40,8 +41,6 @@ public class CloudFileParsing {
 
     private final ParsingLogService parsingLogService;
 
-    private final AbnormalAlarmService abnormalAlarmService;
-
     private final ForecastPowerShortTermCloudService forecastPowerShortTermCloudService;
     private final NwpCloudService nwpCloudService;
 
@@ -49,6 +48,9 @@ public class CloudFileParsing {
 
     private final ThreadPoolTaskExecutor executor;
 
+
+    private final OverhaulPlanService overhaulPlanService;
+
     /**
      * 解析文件方法
      * 逻辑:先配置识别文件名称类型:识别文件名称关键字对应的文件类型
@@ -117,11 +119,13 @@ public class CloudFileParsing {
                                 } catch (Exception e) {
                                     log.error("保存短期数据报错:" + fileName, e);
                                     parsingLog.setParsingDescribe("保存短期数据报错:" + fileName);
+                                    LogUtil.info(DataSourcesEnum.E2, AlarmEnum.E4,"保存短期数据报错:" + fileName,null);
                                     flag = false;
                                 }
                             } else {
                                 log.info(file.getName() + "文件数据内容为空、不能正常解析 、移除该文件:" + fileName);
                                 parsingLog.setParsingDescribe("文件数据内容为空、不能正常解析 、移除该文件:" + fileName);
+                                LogUtil.info(DataSourcesEnum.E2, AlarmEnum.E4,"文件数据内容为空、不能正常解析 、移除该文件::" + fileName,null);
                                 flag = false;
                             }
 
@@ -129,6 +133,7 @@ public class CloudFileParsing {
                         } catch (Exception e) {
                             flag = false;
                             parsingLog.setParsingDescribe("解析DQ文件异常:" + fileName);
+                            LogUtil.info(DataSourcesEnum.E2, AlarmEnum.E4,"解析DQ文件失败:" + fileName,null);
                             log.error("解析DQ文件失败:" + fileName, e);
                         }
                     }
@@ -144,16 +149,19 @@ public class CloudFileParsing {
                                     nwpCloudService.saveBatch(listNwp);
                                     flag = true;
                                 } catch (Exception e) {
+                                    LogUtil.info(DataSourcesEnum.E2, AlarmEnum.E4,"保存NWP数据报错:" + fileName,null);
                                     log.error("保存NWP数据报错:" + fileName, e);
                                     parsingLog.setParsingDescribe("保存NWP数据报错:" + fileName);
                                     flag = false;
                                 }
                             } else {
+                                LogUtil.info(DataSourcesEnum.E2, AlarmEnum.E4,"文件数据内容为空、不能正常解析 、移除该文件:" + fileName,null);
                                 parsingLog.setParsingDescribe("文件数据内容为空、不能正常解析 、移除该文件:" + fileName);
                                 log.info(file.getName() + "文件数据内容为空、不能正常解析 、移除该文件");
                                 flag = false;
                             }
                         } catch (Exception e) {
+                            LogUtil.info(DataSourcesEnum.E2, AlarmEnum.E4,"解析NWP文件失败:" + fileName,null);
                             log.error("解析NWP文件失败:" + fileName, e);
                             parsingLog.setParsingDescribe("解析NWP文件失败:" + fileName);
                             flag = false;
@@ -411,7 +419,8 @@ public class CloudFileParsing {
                 close(bufferedReader, read);
             }
         }
-        return forecastPowerShortTerm;
+
+        return overhaulPlanService.getCorrectionData(forecastPowerShortTerm);
     }
 
 

+ 6 - 0
cpp-admin/src/main/java/com/cpp/web/service/datafactory/ParsingLogService.java

@@ -4,6 +4,9 @@ package com.cpp.web.service.datafactory;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.cpp.web.domain.datafactory.ParsingLog;
+import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
+import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.station.ElectricField;
 
 import java.util.Date;
 import java.util.List;
@@ -21,4 +24,7 @@ public interface ParsingLogService extends IService<ParsingLog> {
     QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileType(String stationCode, Date startTime, Date endTime,String fileType,String dataSources,String parsingDescribe,String parsingFileStatus);
 
     List<ParsingLog> findByTimeBetweenAndFileTypeAndStationCode(Date startTime,Date endTime,String fileType,String stationCode);
+
+
+    List<ElectricField> notTodayLogStation(FileTypeEnum fileTypeEnum, DataSourcesEnum dataSourcesEnum);
 }

+ 12 - 9
cpp-admin/src/main/java/com/cpp/web/service/datafactory/SftpFileParsing.java

@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
 import java.util.zip.ZipOutputStream;
 
 /**
- * ftp文件解析
+ * ftp文件解析主类
  *
  * @author tl
  * @date 2022-05-11 09:51:21
@@ -107,9 +107,9 @@ public class SftpFileParsing {
     /**
      * sftp下载文件并解析文件的具体步骤
      *
-     * @param parsingTypes
-     * @param channelElectricFields
-     * @param sftp
+     * @param parsingTypes  解析类型
+     * @param channelElectricFields 某通道绑定的场站
+     * @param sftp  sftp
      */
     private void parsingFile(List<ParsingType> parsingTypes, List<ElectricField> channelElectricFields, Sftp sftp) {
         List<ParsingLog> parsingLogs = new ArrayList<>();
@@ -200,7 +200,8 @@ public class SftpFileParsing {
     /**
      * 创建sftp 并解析
      *
-     * @param sftpChannel
+     * @param sftpChannel sftp通道信息
+     * @return sftp控制
      */
     public SftpConfig createSftp(SftpChannel sftpChannel) {
         // SFTP方式上报
@@ -275,11 +276,11 @@ public class SftpFileParsing {
     }
 
     /**
-     * 上传文件
+     * sftp 上传文件
      *
      * @param sftp
-     * @param destPathName
-     * @param srcName
+     * @param destPathName 目标路径
+     * @param srcName 源路径
      */
     private void upload(Sftp sftp, String destPathName, String srcName) {
         FileInputStream fis = null;
@@ -303,7 +304,9 @@ public class SftpFileParsing {
     }
 
 
-
+    /**
+     * 一个临时的sftp控制类
+     */
     @Data
     public class SftpConfig{
         private JSch jsch = new JSch();

+ 53 - 24
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingLogServiceImpl.java

@@ -3,12 +3,18 @@ package com.cpp.web.service.datafactory.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cpp.web.domain.datafactory.ParsingLog;
+import com.cpp.web.domain.datafactory.enums.FileTypeEnum;
 import com.cpp.web.domain.enums.DataSourcesEnum;
+import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.mapper.datafactory.ParsingLogMapper;
 import com.cpp.web.service.datafactory.ParsingLogService;
+import com.cpp.web.service.station.ElectricFieldService;
+import com.cpp.web.utils.DateTimeUtil;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -19,13 +25,12 @@ import java.util.List;
  * @date 2022-05-11 18:07:03
  */
 @Service
+@RequiredArgsConstructor
 public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, ParsingLog> implements ParsingLogService {
 
     private final ParsingLogMapper parsingLogMapper;
 
-    public ParsingLogServiceImpl(ParsingLogMapper parsingLogMapper) {
-        this.parsingLogMapper = parsingLogMapper;
-    }
+    private final ElectricFieldService electricFieldService;
 
     @Override
     public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileStatusAndFileType(String stationCode, Date startTime, Date endTime, String fileStatus, String fileType) {
@@ -46,34 +51,34 @@ public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, Parsing
     }
 
     @Override
-    public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileType(String stationCode, Date startTime, Date endTime, String fileType,String dataSources,String parsingDescribe,String parsingFileStatus) {
+    public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileType(String stationCode, Date startTime, Date endTime, String fileType, String dataSources, String parsingDescribe, String parsingFileStatus) {
         QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
 
-        if ("未知".equals(stationCode)){
+        if ("未知".equals(stationCode)) {
             wrapper.isNull("station_code");
-        }else if (stationCode != null && !"".equals(stationCode)){
+        } else if (stationCode != null && !"".equals(stationCode)) {
             wrapper.eq("station_code", stationCode);
         }
-        if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)){
+        if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)) {
             wrapper.between("parsing_time", startTime, endTime);
         }
-        if (null != fileType && !"".equals(fileType)){
+        if (null != fileType && !"".equals(fileType)) {
             wrapper.eq("file_type", fileType);
         }
-        if (null != dataSources && !"".equals(dataSources)){
+        if (null != dataSources && !"".equals(dataSources)) {
             wrapper.eq("data_sources", DataSourcesEnum.valueOf(dataSources));
         }
-        if ("null".equals(parsingDescribe)){
-            wrapper.eq("parsing_describe","");
+        if ("null".equals(parsingDescribe)) {
+            wrapper.eq("parsing_describe", "");
         }
-        if ("notNull".equals(parsingDescribe)){
-            wrapper.ne("parsing_describe","");
+        if ("notNull".equals(parsingDescribe)) {
+            wrapper.ne("parsing_describe", "");
         }
-        if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "成功".equals(parsingFileStatus)){
-            wrapper.eq("parsing_file_status",parsingFileStatus);
+        if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "成功".equals(parsingFileStatus)) {
+            wrapper.eq("parsing_file_status", parsingFileStatus);
         }
-        if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "失败".equals(parsingFileStatus)){
-            wrapper.eq("parsing_file_status",parsingFileStatus);
+        if (null != parsingFileStatus && !"".equals(parsingFileStatus) && "失败".equals(parsingFileStatus)) {
+            wrapper.eq("parsing_file_status", parsingFileStatus);
         }
         return wrapper;
     }
@@ -81,17 +86,41 @@ public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, Parsing
     @Override
     public List<ParsingLog> findByTimeBetweenAndFileTypeAndStationCode(Date startTime, Date endTime, String fileType, String stationCode) {
         QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
-        if (stationCode != null && !"".equals(stationCode)){
-            wrapper.eq("station_code",stationCode);
+        if (stationCode != null && !"".equals(stationCode)) {
+            wrapper.eq("station_code", stationCode);
         }
-        if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)){
-            wrapper.between("parsing_time",startTime,endTime);
+        if (null != startTime && !"".equals(startTime) && null != endTime && !"".equals(endTime)) {
+            wrapper.between("parsing_time", startTime, endTime);
         }
-        if (null != fileType && !"".equals(fileType)){
-            wrapper.eq("file_type",fileType);
+        if (null != fileType && !"".equals(fileType)) {
+            wrapper.eq("file_type", fileType);
         }
-        wrapper.eq("data_sources","E1");
+        wrapper.eq("data_sources", "E1");
         List<ParsingLog> parsingLogs = parsingLogMapper.selectList(wrapper);
         return parsingLogs;
     }
+
+    @Override
+    public List<ElectricField> notTodayLogStation(FileTypeEnum fileTypeEnum, DataSourcesEnum dataSourcesEnum) {
+        Date date = DateTimeUtil.getDayStartTime(System.currentTimeMillis());
+
+        QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
+        wrapper.ge("parsing_time", date);
+        wrapper.eq("data_sources", dataSourcesEnum.name());
+        wrapper.eq("file_type", fileTypeEnum.name());
+        List<ParsingLog> parsingLogs = parsingLogMapper.selectList(wrapper);
+
+
+        List<ElectricField> electricFields = electricFieldService.list();
+
+        List<ElectricField> electricFieldList = new ArrayList<>();
+
+        for (ElectricField electricField : electricFields) {
+            if (!parsingLogs.stream().anyMatch(p->p.getStationCode().equals(electricField.getStationCode()))){
+                electricFieldList.add(electricField);
+            }
+        }
+
+        return electricFieldList;
+    }
 }

+ 3 - 3
cpp-admin/src/main/java/com/cpp/web/service/station/impl/PowerStationStatusDataServiceImpl.java

@@ -544,7 +544,7 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
         String electricFieldType = electricField.getElectricFieldTypeEnum();
         List<TableFiled> tableFields = new ArrayList<>();
 
-        tableFields.addAll(Arrays.asList(new TableFiled("时间", "time"), new TableFiled("实际功率", "realPower"), new TableFiled("可用功率", "ablePower"), new TableFiled("理论功率", "theoryPower"),new TableFiled("站端", "fpValue")));
+        tableFields.addAll(Arrays.asList(new TableFiled("时间", "time"), new TableFiled("实际功率", "realPower"), new TableFiled("可用功率", "ablePower"), new TableFiled("理论功率", "theoryPower"), new TableFiled("站端", "fpValue")));
 
         Map<String, String> forecastModelMap = new HashMap<>();
 
@@ -568,7 +568,7 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
         for (long l = startTime.getTime(); l < endTime.getTime(); l += 900000L) {
             Map<String, Object> dataMap = new HashMap<>();
             Date time = new Date(l);
-            dataMap.put("time", DateFormatUtils.format(time,"yyyy-MM-dd HH:mm"));
+            dataMap.put("time", DateFormatUtils.format(time, "yyyy-MM-dd HH:mm"));
             PowerStationStatusData powerStationStatusData = Optional.ofNullable(powerStationStatusDataTimeMap.containsKey(time) ? powerStationStatusDataTimeMap.get(time).get(0) : null).orElse(new PowerStationStatusData());
             dataMap.put("realPower", powerStationStatusData.getRealValue());
             dataMap.put("ablePower", powerStationStatusData.getAbleValue());
@@ -583,7 +583,7 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
                 dataMap.put("wsHubHeight", windTowerStatusData.getWsHubHeight());
             }
 
-            ForecastPowerShortTermStation forecastPowerShortTermStation = Optional.ofNullable(forecastPowerShortTermStationTimeMap.containsKey(time) ?  forecastPowerShortTermStationTimeMap.get(time).get(0) : null).orElse(new ForecastPowerShortTermStation());
+            ForecastPowerShortTermStation forecastPowerShortTermStation = Optional.ofNullable(forecastPowerShortTermStationTimeMap.containsKey(time) ? forecastPowerShortTermStationTimeMap.get(time).get(0) : null).orElse(new ForecastPowerShortTermStation());
             dataMap.put("fpValue", forecastPowerShortTermStation.getFpValue());