Przeglądaj źródła

修改代码规范1

xusl 3 lat temu
rodzic
commit
4557509ce0
29 zmienionych plików z 686 dodań i 1311 usunięć
  1. 0 1
      ipfcst-console/src/main/java/com/jiayue/ipfcst/config/RedisConfig.java
  2. 17 348
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ElectricFieldController.java
  3. 1 1
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/FileAnalysisRecordController.java
  4. 2 3
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ForecastPowerShortTermController.java
  5. 1 4
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ForecastPowerShortTermHisController.java
  6. 2 3
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ForecastPowerUltraShortTermHisController.java
  7. 103 103
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterInfoController.java
  8. 10 21
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterStatusDataController.java
  9. 2 3
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/NwpController.java
  10. 0 1
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/OverHaulOlanController.java
  11. 107 106
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/PvModuleModelController.java
  12. 1 2
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/QuartzController.java
  13. 89 89
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WeatherStationInfoController.java
  14. 9 9
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WeatherStationStatusDataController.java
  15. 74 71
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerInfoController.java
  16. 8 15
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerStatusDataController.java
  17. 5 7
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineInfoController.java
  18. 23 23
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineStatusDataController.java
  19. 8 10
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/FileAnalysisJob.java
  20. 0 2
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/DownLoadService.java
  21. 5 86
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerShortTermHisService.java
  22. 10 9
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerShortTermService.java
  23. 29 42
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerUltraShortTermService.java
  24. 4 34
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/HolidayCalendarService.java
  25. 2 3
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InitJobClassService.java
  26. 151 194
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterInfoService.java
  27. 10 103
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterStatusDataService.java
  28. 10 13
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/powerofreference/iml/PowerOfReferenceCalculator1.java
  29. 3 5
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/powerofreference/iml/PowerOfReferenceCalculator2.java

+ 0 - 1
ipfcst-console/src/main/java/com/jiayue/ipfcst/config/RedisConfig.java

@@ -3,7 +3,6 @@ package com.jiayue.ipfcst.config;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
 import redis.clients.jedis.JedisPool;
 import redis.clients.jedis.JedisPoolConfig;
 

+ 17 - 348
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ElectricFieldController.java

@@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedOutputStream;
 import java.io.IOException;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -41,45 +42,6 @@ public class ElectricFieldController {
   @Autowired
   OverHaulPlanService overHaulPlanService;
 
-   /* @Autowired
-    InverterInfoService inverterInfoService;
-
-    @Autowired
-    WeatherStationInfoService weatherStationInfoService;
-
-    @Autowired
-    WindTowerInfoService windTowerInfoService;
-
-    @Autowired
-    WindTurbineInfoService windTurbineInfoService;
-
-    @Autowired
-    PvModuleModelService pvModuleModelService;
-
-    @Autowired
-    UploadObjectService uploadObjectService;
-
-    @Autowired
-    UploadFileChannelService uploadFileChannelService;
-
-    @Autowired
-    UploadFileCodeService uploadFileCodeService;
-
-    @Autowired
-    UploadURLService uploadURLService;
-
-    @Autowired
-    TunnelInfoService tunnelInfoService;
-
-    @Autowired
-    EquipmentAttributeService equipmentAttributeService;
-
-    @Autowired
-    ProtocolSenderDataPointService protocolSenderDataPointService;
-
-    @Autowired
-    ProtocolGatherDataPointService protocolGatherDataPointService;*/
-
   /**
    * 新增场站信息
    *
@@ -97,10 +59,8 @@ public class ElectricFieldController {
       log.error(" 保存场站信息异常");
       return ResponseVO.fail();
     }
-
   }
 
-
   /**
    * 更新场站信息
    *
@@ -118,7 +78,6 @@ public class ElectricFieldController {
       log.error(" 更新场站信息异常");
       return ResponseVO.fail();
     }
-
   }
 
   /**
@@ -126,7 +85,6 @@ public class ElectricFieldController {
    *
    * @return 所有场站信息
    */
-
   @GetMapping(value = "/getElectricField")
   public ResponseVO getElectricField() {
     try {
@@ -137,7 +95,6 @@ public class ElectricFieldController {
       log.error(" 获取场站信息异常");
       return ResponseVO.success(null);
     }
-
   }
 
   /**
@@ -145,7 +102,6 @@ public class ElectricFieldController {
    *
    * @return 所有场站信息
    */
-
   @GetMapping(value = "/getElectricField/{stationCode}")
   public ResponseVO getElectricFieldByStationCode(@PathVariable String stationCode) {
     try {
@@ -156,10 +112,8 @@ public class ElectricFieldController {
       log.error(" 获取场站信息异常");
       return ResponseVO.success(null);
     }
-
   }
 
-
   @DeleteMapping(value = "/{stationCode}")
   @SaveValidate
   public ResponseVO deleteElectricField(@PathVariable String stationCode) {
@@ -171,7 +125,6 @@ public class ElectricFieldController {
       log.error(" 删除场站信息异常");
       return ResponseVO.fail();
     }
-
   }
 
   /**
@@ -201,288 +154,8 @@ public class ElectricFieldController {
       log.error(" 获取场站类型异常");
       return ResponseVO.fail(elType);
     }
-
   }
 
-
-
-
-    /*@PostMapping(value = "/dataDownload")
-    public void dataDownload(HttpServletRequest request,
-                             HttpServletResponse response) {
-        BufferedOutputStream bos = null;
-        try {
-            response.setCharacterEncoding("UTF-8");
-            StringBuilder templateContent = new StringBuilder();
-            ElectricField electricField = electricFieldService.getElectricField();
-            // 添加第一行
-            String header = electricField.getStationCode();
-            templateContent.append(header + "\r\n");
-
-            List<String> vals = new ArrayList<>();
-            String val;
-            String type = "All";
-            List<ElectricField> electricFields = new ArrayList<>();
-            electricFields.add(electricField);
-            val = "ElectricField:::" + JsonBeanUtil.beanToJson(electricFields);
-            templateContent.append(val + "\r\n");
-
-            if (type.equals("All")) {
-                List<PvModuleModel> beans = pvModuleModelService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (PvModuleModel bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "PvModuleModel:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            if (type.equals("All")) {
-                List<OverhaulPlan> beans = overHaulPlanService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (OverhaulPlan bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "OverhaulPlan:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            if (type.equals("All")) {
-                List<InverterInfo> beans = inverterInfoService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (InverterInfo bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "InverterInfo:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            if (type.equals("All")) {
-                List<WeatherStationInfo> beans = weatherStationInfoService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (WeatherStationInfo bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "WeatherStationInfo:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            if (type.equals("All")) {
-                List<WindTowerInfo> beans = windTowerInfoService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (WindTowerInfo bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "WindTowerInfo:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            if (type.equals("All")) {
-                List<WindTurbineInfo> beans = windTurbineInfoService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (WindTurbineInfo bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "WindTurbineInfo:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-
-            if (type.equals("All")) {
-                List<SysParameter> beans = sysParameterService.getAll();
-                if (null != beans && beans.size() > 0) {
-                    for (SysParameter bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "SysParameter:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            if (type.equals("All")) {
-                //文件上报部分
-                List<UploadObject> beans = uploadObjectService.get();
-                if (null != beans && beans.size() > 0) {
-                    for (UploadObject bean : beans) {
-                        bean.setStationCode(header);
-                    }
-                    val = "UploadObject:::" + JsonBeanUtil.beanToJson(beans);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<UploadFileChannel> uploadFileChannels = uploadFileChannelService.get();
-                if (null != uploadFileChannels && uploadFileChannels.size() > 0) {
-                    for (UploadFileChannel bean : uploadFileChannels) {
-                        bean.setStationCode(header);
-                    }
-                    val = "UploadFileChannel:::" + JsonBeanUtil.beanToJson(uploadFileChannels);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<UploadFileCode> uploadFileCodes = uploadFileCodeService.get();
-                if (null != uploadFileCodes && uploadFileCodes.size() > 0) {
-                    for (UploadFileCode bean : uploadFileCodes) {
-                        bean.setStationCode(header);
-                    }
-                    val = "UploadFileCode:::" + JsonBeanUtil.beanToJson(uploadFileCodes);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<UploadURL> uploadURLS = uploadURLService.findAll();
-                if (null != uploadURLS && uploadURLS.size() > 0) {
-                    for (UploadURL bean : uploadURLS) {
-                        bean.setStationCode(header);
-                    }
-                    val = "UploadURL:::" + JsonBeanUtil.beanToJson(uploadURLS);
-                    templateContent.append(val + "\r\n");
-                }
-
-
-                //数据接入部分
-                List<EquipmentAttribute> equipmentAttributes = equipmentAttributeService.getAll();
-                if (null != equipmentAttributes && equipmentAttributes.size() > 0) {
-                    for (EquipmentAttribute bean : equipmentAttributes) {
-                        bean.setStationCode(header);
-                    }
-                    val = "EquipmentAttribute:::" + JsonBeanUtil.beanToJson(equipmentAttributes);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<FileParseTunnelInfo> fileParseTunnelInfos = tunnelInfoService.getAllFileParseTunnel();
-                if (null != fileParseTunnelInfos && fileParseTunnelInfos.size() > 0) {
-                    for (FileParseTunnelInfo bean : fileParseTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "FileParseTunnelInfo:::" + JsonBeanUtil.beanToJson(fileParseTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<Gather104TcpTunnelInfo> gather104TcpTunnelInfos = tunnelInfoService.getAllGather104TcpTunnel();
-                if (null != gather104TcpTunnelInfos && gather104TcpTunnelInfos.size() > 0) {
-                    for (Gather104TcpTunnelInfo bean : gather104TcpTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "Gather104TcpTunnelInfo:::" + JsonBeanUtil.beanToJson(gather104TcpTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<GatherCdtRtuTunnelInfo> gatherCdtRtuTunnelInfos = tunnelInfoService.getAllGatherCdtRtuTunnel();
-                if (null != gatherCdtRtuTunnelInfos && gatherCdtRtuTunnelInfos.size() > 0) {
-                    for (GatherCdtRtuTunnelInfo bean : gatherCdtRtuTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "GatherCdtRtuTunnelInfo:::" + JsonBeanUtil.beanToJson(gatherCdtRtuTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<GatherModbusRtuTunnelInfo> gatherModbusRtuTunnelInfos =
-                        tunnelInfoService.getAllGatherModbusRtuTunnel();
-                if (null != gatherModbusRtuTunnelInfos && gatherModbusRtuTunnelInfos.size() > 0) {
-                    for (GatherModbusRtuTunnelInfo bean : gatherModbusRtuTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "GatherModbusRtuTunnelInfo:::" + JsonBeanUtil.beanToJson(gatherModbusRtuTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<GatherModbusTcpTunnelInfo> gatherModbusTcpTunnelInfos =
-                        tunnelInfoService.getAllGatherModbusTcpTunnel();
-                if (null != gatherModbusTcpTunnelInfos && gatherModbusTcpTunnelInfos.size() > 0) {
-                    for (GatherModbusTcpTunnelInfo bean : gatherModbusTcpTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "GatherModbusTcpTunnelInfo:::" + JsonBeanUtil.beanToJson(gatherModbusTcpTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<Sender104TcpTunnelInfo> sender104TcpTunnelInfos = tunnelInfoService.getAllSender104TcpTunnel();
-                if (null != sender104TcpTunnelInfos && sender104TcpTunnelInfos.size() > 0) {
-                    for (Sender104TcpTunnelInfo bean : sender104TcpTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "Sender104TcpTunnelInfo:::" + JsonBeanUtil.beanToJson(sender104TcpTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<SenderCdtRtuTunnelInfo> senderCdtRtuTunnelInfos = tunnelInfoService.getAllSenderCdtRtuTunnel();
-                if (null != senderCdtRtuTunnelInfos && senderCdtRtuTunnelInfos.size() > 0) {
-                    for (SenderCdtRtuTunnelInfo bean : senderCdtRtuTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "SenderCdtRtuTunnelInfo:::" + JsonBeanUtil.beanToJson(senderCdtRtuTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<SenderModbusRtuTunnelInfo> senderModbusRtuTunnelInfos =
-                        tunnelInfoService.getAllSenderModbusRtuTunnel();
-                if (null != senderModbusRtuTunnelInfos && senderModbusRtuTunnelInfos.size() > 0) {
-                    for (SenderModbusRtuTunnelInfo bean : senderModbusRtuTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "SenderModbusRtuTunnelInfo:::" + JsonBeanUtil.beanToJson(senderModbusRtuTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<SenderModbusTcpTunnelInfo> senderModbusTcpTunnelInfos =
-                        tunnelInfoService.getAllSenderModbusTcpTunnel();
-                if (null != senderModbusTcpTunnelInfos && senderModbusTcpTunnelInfos.size() > 0) {
-                    for (SenderModbusTcpTunnelInfo bean : senderModbusTcpTunnelInfos) {
-                        bean.setStationCode(header);
-                    }
-                    val = "SenderModbusTcpTunnelInfo:::" + JsonBeanUtil.beanToJson(senderModbusTcpTunnelInfos);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<ProtocolSenderDataPoint> protocolSenderDataPoints = protocolSenderDataPointService.get();
-                if (null != protocolSenderDataPoints && protocolSenderDataPoints.size() > 0) {
-                    for (ProtocolSenderDataPoint bean : protocolSenderDataPoints) {
-                        bean.setStationCode(header);
-                    }
-                    val = "ProtocolSenderDataPoint:::" + JsonBeanUtil.beanToJson(protocolSenderDataPoints);
-                    templateContent.append(val + "\r\n");
-                }
-
-                List<ProtocolGatherDataPoint> protocolGatherDataPoints = protocolGatherDataPointService.getAll();
-                if (null != protocolGatherDataPoints && protocolGatherDataPoints.size() > 0) {
-                    for (ProtocolGatherDataPoint bean : protocolGatherDataPoints) {
-                        bean.setStationCode(header);
-                    }
-                    val = "ProtocolGatherDataPoint:::" + JsonBeanUtil.beanToJson(protocolGatherDataPoints);
-                    templateContent.append(val + "\r\n");
-                }
-            }
-
-            byte[] templateContentBytes = templateContent.toString().getBytes("UTF-8");
-            long fileLength = templateContentBytes.length + 3;
-            response.setContentType("application/x-msdownload;charset=UTF-8");
-
-
-            response.setHeader("Content-disposition",
-                    "attachment; filename=" + URLEncoder.encode(electricField.getStationCode() + "-" + DateUtil.today() + ".rb", "UTF-8"));
-            response.setHeader("Content-Length", String.valueOf(fileLength));
-            bos = new BufferedOutputStream(response.getOutputStream());
-            bos.write(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF});
-            bos.write(templateContentBytes);
-            response.flushBuffer();
-        } catch (Exception e) {
-            log.error("系统错误:" + e.getMessage(), e);
-            throw new RuntimeException(e);
-        } finally {
-            if (bos != null)
-                try {
-                    bos.close();
-                } catch (IOException e) {
-                    log.error("系统错误:" + e.getMessage(), e);
-                }
-        }
-    }*/
-
   //导出所有场站
   @RequestMapping(value = "/export")
   public void export(HttpServletResponse response) {
@@ -495,33 +168,31 @@ public class ElectricFieldController {
 
       StringBuilder content = new StringBuilder();
       for (ElectricField electricField : electricFieldList) {
-        content.append(electricField.getStationCode() + ",");
-        content.append(electricField.getName() + ",");
-        content.append(electricField.getSign() + ",");
-        content.append(electricField.getNetSubstationName() + ",");
-        content.append(electricField.getCapacity() + ",");
-        content.append(electricField.getGridCE() + ",");
-        content.append(electricField.getLongitude() + ",");
-        content.append(electricField.getLatitude() + ",");
-        content.append(electricField.getElectricFieldTypeEnum().getMessage() + ",");
-        content.append(electricField.getInterval() + ",");
-        content.append(electricField.getAltitude() + ",");
-        content.append(electricField.getCompany() + ",");
-        content.append(electricField.getLocation() + ",");
-        content.append(electricField.getArea() + ",");
+        content.append(electricField.getStationCode()).append(",");
+        content.append(electricField.getName()).append(",");
+        content.append(electricField.getSign()).append(",");
+        content.append(electricField.getNetSubstationName()).append(",");
+        content.append(electricField.getCapacity()).append(",");
+        content.append(electricField.getGridCE()).append(",");
+        content.append(electricField.getLongitude()).append(",");
+        content.append(electricField.getLatitude()).append(",");
+        content.append(electricField.getElectricFieldTypeEnum().getMessage()).append(",");
+        content.append(electricField.getInterval()).append(",");
+        content.append(electricField.getAltitude()).append(",");
+        content.append(electricField.getCompany()).append(",");
+        content.append(electricField.getLocation()).append(",");
+        content.append(electricField.getArea()).append(",");
         content.append("\r\n");
       }
       templateContent.append(header);
-      templateContent.append(content.toString());
+      templateContent.append(content);
       response.setContentType("application/x-msdownload;charset=UTF-8");// 文件下载必须配置为application/x-msdownload
       response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode("场站信息数据.csv", "UTF-8"));// 中文文件名必须使用URLEncoder.encode进行转码
-      byte[] templateContentBytes = templateContent.toString().getBytes("UTF-8");
+      byte[] templateContentBytes = templateContent.toString().getBytes(StandardCharsets.UTF_8);
       bos = new BufferedOutputStream(response.getOutputStream());// 向response中写入文件流
       bos.write(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF});// 指定csv文件用UTF-8字符集打开
       bos.write(templateContentBytes);
       response.flushBuffer();
-      templateContent = null;
-
     } catch (Exception e) {
       log.error("系统错误:" + e.getMessage(), e);
       throw new RuntimeException(e);
@@ -533,7 +204,5 @@ public class ElectricFieldController {
           log.error("系统错误:" + e.getMessage(), e);
         }
     }
-
   }
-
 }

+ 1 - 1
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/FileAnalysisRecordController.java

@@ -18,7 +18,7 @@ public class FileAnalysisRecordController {
 
   @GetMapping("/FileAnalysisRecord/{startTime}")
   public ResponseVO findByCreateTimeBetween(@PathVariable Long startTime) {
-    List<FileAnalysisRecord> fileAnalysisRecords = fileAnalysisRecordService.findByCreateTimeBetween(new Date(startTime), new Date(startTime + 86400000l));
+    List<FileAnalysisRecord> fileAnalysisRecords = fileAnalysisRecordService.findByCreateTimeBetween(new Date(startTime), new Date(startTime + 86400000L));
     return ResponseVO.success(fileAnalysisRecords);
   }
 }

+ 2 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ForecastPowerShortTermController.java

@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -34,7 +33,7 @@ public class ForecastPowerShortTermController {
   @GetMapping(value = "/forecastPowerShortTerm/{startTime}/{endTime}/{stationCode}")
   public ResponseVO findByForecastTimeBetween(@PathVariable("startTime") Long startTime,
                                               @PathVariable("endTime") Long endTime, @PathVariable("stationCode") String stationCode) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = forecastPowerShortTermService.findByForecastTimeBetweenAndStationCode(startTime, endTime, stationCode);
       return ResponseVO.success(map);
@@ -61,7 +60,7 @@ public class ForecastPowerShortTermController {
                                                @PathVariable("page") Integer page,
                                                @PathVariable("size") Integer size,
                                                String sortOrder) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = forecastPowerShortTermService.findByTimeBetweenAndNoForPaging(startTime, endTime, stationCode, page, size, sortOrder);
       return ResponseVO.success(map);

+ 1 - 4
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ForecastPowerShortTermHisController.java

@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -38,7 +37,7 @@ public class ForecastPowerShortTermHisController {
                                               @PathVariable("page") Integer page,
                                               @PathVariable("size") Integer size,
                                               String sortOrder) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = forecastPowerShortTermHisService.findByForecastTimeBetweenAndStationCode(startTime, endTime, stationCode, page, size, sortOrder);
       return ResponseVO.success(map);
@@ -47,6 +46,4 @@ public class ForecastPowerShortTermHisController {
       return ResponseVO.fail(e.toString());
     }
   }
-
-
 }

+ 2 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/ForecastPowerUltraShortTermHisController.java

@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -39,7 +38,7 @@ public class ForecastPowerUltraShortTermHisController {
   public ResponseVO findByForecastTimeBetween(@PathVariable("startTime") Long startTime,
                                               @PathVariable("endTime") Long endTime,
                                               @PathVariable("endTime") Integer ago) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = forecastPowerUltraShortTermService.findByForecastTimeBetweenAndForecastHowLongAgoOrderByForecastTime(startTime, endTime, ago);
       return ResponseVO.success(map);
@@ -58,7 +57,7 @@ public class ForecastPowerUltraShortTermHisController {
    */
   @GetMapping(value = "/findByForecastRealTimeUltraShortTerm16/{startTime}/{stationCode}")
   public ResponseVO findByForecastRealTimeUltraShortTerm16(@PathVariable("startTime") Long startTime, @PathVariable("stationCode") String stationCode) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = forecastPowerUltraShortTermService.findByForecastRealTimeUltraShortTerm16(startTime, stationCode);
       return ResponseVO.success(map);

+ 103 - 103
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterInfoController.java

@@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -23,131 +22,132 @@ import java.util.List;
 @Slf4j
 public class InverterInfoController {
 
-    private final InverterInfoService inverterInfoService;
+  private final InverterInfoService inverterInfoService;
 
-    @Autowired
-    public InverterInfoController(InverterInfoService inverterInfoService) {
-        this.inverterInfoService = inverterInfoService;
-    }
-
-    /**
-     * 获取逆变器(分页)
-     *
-     * @return 执行结果
-     */
-    @GetMapping(value = {"inverterInfo/{page}/{size}/{stationCode}"})
-    public ResponseVO getPageAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
-      InverterInfo inverterInfo = new InverterInfo();
-      if (!"ALL".equals(stationCode)) {
-        inverterInfo.setStationCode(stationCode);
-      }
-      Page<InverterInfo> inverterPage = this.inverterInfoService.get(inverterInfo, page, size);
-      return ResponseVO.success(inverterPage);
-    }
+  @Autowired
+  public InverterInfoController(InverterInfoService inverterInfoService) {
+    this.inverterInfoService = inverterInfoService;
+  }
 
-    /**
-     * 获取逆变器
-     *
-     * @return 执行结果
-     */
-    @GetMapping(value = {"inverterInfo"})
-    public ResponseVO getAll() {
-      List<InverterInfo> list = this.inverterInfoService.getAll();
-      return ResponseVO.success(list);
+  /**
+   * 获取逆变器(分页)
+   *
+   * @return 执行结果
+   */
+  @GetMapping(value = {"inverterInfo/{page}/{size}/{stationCode}"})
+  public ResponseVO getPageAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
+    InverterInfo inverterInfo = new InverterInfo();
+    if (!"ALL".equals(stationCode)) {
+      inverterInfo.setStationCode(stationCode);
     }
+    Page<InverterInfo> inverterPage = this.inverterInfoService.get(inverterInfo, page, size);
+    return ResponseVO.success(inverterPage);
+  }
 
-    /**
-     * 保存逆变器信息
-     *
-     * @param inverterInfo 参数
-     * @return 执行结果
-     */
-    @SaveValidate
-    @PostMapping(value = "inverterInfo/")
-    public ResponseVO saveInverter(@RequestBody InverterInfo inverterInfo) {
-        try {
-            inverterInfoService.save(inverterInfo);
-            return ResponseVO.success();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 保存逆变器信息异常");
-            return ResponseVO.fail();
-        }
+  /**
+   * 获取逆变器
+   *
+   * @return 执行结果
+   */
+  @GetMapping(value = {"inverterInfo"})
+  public ResponseVO getAll() {
+    List<InverterInfo> list = this.inverterInfoService.getAll();
+    return ResponseVO.success(list);
+  }
 
+  /**
+   * 保存逆变器信息
+   *
+   * @param inverterInfo 参数
+   * @return 执行结果
+   */
+  @SaveValidate
+  @PostMapping(value = "inverterInfo/")
+  public ResponseVO saveInverter(@RequestBody InverterInfo inverterInfo) {
+    try {
+      inverterInfoService.save(inverterInfo);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 保存逆变器信息异常");
+      return ResponseVO.fail();
     }
 
-    /**
-     * 批量保存逆变器信息
-     *
-     * @param inverterInfo 参数
-     * @return 执行结果
-     */
-    @SaveValidate
-    @PostMapping(value = "inverterInfo/saveAll/{startValue}/{endValue}")
-    public ResponseVO allSaveInverter(@RequestBody InverterInfo inverterInfo,@PathVariable("startValue") Integer startValue,@PathVariable("endValue") Integer endValue) {
-        try {
-          inverterInfoService.addALL(inverterInfo,startValue,endValue);
-            return ResponseVO.success();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 保存逆变器信息异常");
-            return ResponseVO.fail();
-        }
-    }
+  }
 
+  /**
+   * 批量保存逆变器信息
+   *
+   * @param inverterInfo 参数
+   * @return 执行结果
+   */
+  @SaveValidate
+  @PostMapping(value = "inverterInfo/saveAll/{startValue}/{endValue}")
+  public ResponseVO allSaveInverter(@RequestBody InverterInfo inverterInfo, @PathVariable("startValue") Integer startValue, @PathVariable("endValue") Integer endValue) {
+    try {
+      inverterInfoService.addALL(inverterInfo, startValue, endValue);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 保存逆变器信息异常");
+      return ResponseVO.fail();
+    }
+  }
 
-    /**
-     * 更新逆变器信息
-     *
-     * @param inverterInfo 参数
-     * @return 执行结果
-     */
-    @SaveValidate
-    @PutMapping(value = "inverterInfo/")
-    public ResponseVO updateInverter(@RequestBody InverterInfo inverterInfo) {
-        try {
-            inverterInfoService.save(inverterInfo);
-            return ResponseVO.success();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 更新逆变器信息异常");
-            return ResponseVO.fail();
-        }
 
+  /**
+   * 更新逆变器信息
+   *
+   * @param inverterInfo 参数
+   * @return 执行结果
+   */
+  @SaveValidate
+  @PutMapping(value = "inverterInfo/")
+  public ResponseVO updateInverter(@RequestBody InverterInfo inverterInfo) {
+    try {
+      inverterInfoService.save(inverterInfo);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 更新逆变器信息异常");
+      return ResponseVO.fail();
     }
 
+  }
 
-    /**
-     * 删除逆变器信息
-     *
-     * @param ids 删除id
-     * @return 执行结果
-     */
-    @SaveValidate
-    @DeleteMapping(value = "inverterInfo/{ids}")
-    public ResponseVO deleteInverter(@PathVariable("ids") String ids) {
-        try {
-            inverterInfoService.delete(ids);
-            return ResponseVO.success();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 删除逆变器异常");
-            return ResponseVO.fail();
-        }
 
+  /**
+   * 删除逆变器信息
+   *
+   * @param ids 删除id
+   * @return 执行结果
+   */
+  @SaveValidate
+  @DeleteMapping(value = "inverterInfo/{ids}")
+  public ResponseVO deleteInverter(@PathVariable("ids") String ids) {
+    try {
+      inverterInfoService.delete(ids);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 删除逆变器异常");
+      return ResponseVO.fail();
     }
 
+  }
+
   /**
    * 查询所有逆变器设备信息按ID排序 yh
+   *
    * @return 结果集
    */
   @GetMapping(value = "findInverterInfoByStation/{stationCode}")
-  public ResponseVO findInverterInfoByStation(@PathVariable("stationCode") String stationCode){
-    List<InverterInfo> list = new ArrayList<>();
-    try{
+  public ResponseVO findInverterInfoByStation(@PathVariable("stationCode") String stationCode) {
+    List<InverterInfo> list;
+    try {
       list = inverterInfoService.getByStationCode(stationCode);
       return ResponseVO.success(list);
-    }catch(Exception e){
+    } catch (Exception e) {
       e.printStackTrace();
       log.error("逆变器信息所有查询错误");
       return ResponseVO.fail(e.toString());

+ 10 - 21
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterStatusDataController.java

@@ -1,47 +1,36 @@
 package com.jiayue.ipfcst.console.controller;
 
 import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
-import com.jiayue.ipfcst.common.data.entity.InverterInfo;
-import com.jiayue.ipfcst.common.data.entity.InverterStatusData;
-import com.jiayue.ipfcst.console.service.InverterInfoService;
 import com.jiayue.ipfcst.console.service.InverterStatusDataService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.Date;
+import java.util.Map;
 
 @RestController
 @Slf4j
 public class InverterStatusDataController {
 
   private final InverterStatusDataService inverterStatusDataService;
-  private final InverterInfoService inverterInfoService;
 
   @Autowired
-  public InverterStatusDataController(InverterStatusDataService inverterStatusDataService, InverterInfoService inverterInfoService) {
+  public InverterStatusDataController(InverterStatusDataService inverterStatusDataService) {
     this.inverterStatusDataService = inverterStatusDataService;
-    this.inverterInfoService = inverterInfoService;
   }
 
 
   /**
    * 分页查询 所有逆变器功率状态
    *
-   * @param startTime     开始时间
-   * @param endTime       结束时间
-   * @param page          页码
-   * @param size          条数
-   * @param no            逆变器编号
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
+   * @param no        逆变器编号
    * @return
    */
   @GetMapping(value = "/inverterStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}")
@@ -51,9 +40,9 @@ public class InverterStatusDataController {
                                                @PathVariable("page") Integer page,
                                                @PathVariable("size") Integer size,
                                                @PathVariable("no") String no) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
-      map = inverterStatusDataService.findByTimeBetweenForPaging(stationCode,new Date(startTime), new Date(endTime), page, size, no);
+      map = inverterStatusDataService.findByTimeBetweenForPaging(stationCode, new Date(startTime), new Date(endTime), page, size, no);
       return ResponseVO.success(map);
     } catch (Exception e) {
       e.printStackTrace();

+ 2 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/NwpController.java

@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -39,7 +38,7 @@ public class NwpController {
   public ResponseVO findByForecastTimeBetween(@PathVariable("startTime") Long startTime,
                                               @PathVariable("endTime") Long endTime,
                                               @PathVariable("stationCode") String stationCode) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = nwpService.findByForecastTimeBetween(startTime, endTime, stationCode);
       return ResponseVO.success(map);
@@ -67,7 +66,7 @@ public class NwpController {
                                                @PathVariable("page") Integer page,
                                                @PathVariable("size") Integer size,
                                                String sortOrder) {
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map;
     try {
       map = nwpService.findByTimeBetweenAndNoForPaging(startTime, endTime, stationCode, page, size, sortOrder);
       return ResponseVO.success(map);

+ 0 - 1
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/OverHaulOlanController.java

@@ -100,7 +100,6 @@ public class OverHaulOlanController {
   @SneakyThrows
   @GetMapping()
   public ResponseVO getAll() {
-    OverhaulPlan overhaulPlan = new OverhaulPlan();
     List<OverhaulPlan> list = this.overHaulPlanService.getAll();
     return ResponseVO.success(list);
   }

+ 107 - 106
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/PvModuleModelController.java

@@ -3,7 +3,6 @@ package com.jiayue.ipfcst.console.controller;
 import com.jiayue.ipfcst.aop.SaveValidate;
 import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
 import com.jiayue.ipfcst.common.data.constant.enums.PvRotationModeEnum;
-import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
 import com.jiayue.ipfcst.console.service.PvModuleModelService;
 import lombok.extern.slf4j.Slf4j;
@@ -27,139 +26,141 @@ import java.util.Map;
 @Slf4j
 public class PvModuleModelController {
 
-    private final PvModuleModelService pvModuleModelService;
-
-    @Autowired public PvModuleModelController(PvModuleModelService pvModuleModelService) {
-        this.pvModuleModelService = pvModuleModelService;
-    }
+  private final PvModuleModelService pvModuleModelService;
 
+  @Autowired
+  public PvModuleModelController(PvModuleModelService pvModuleModelService) {
+    this.pvModuleModelService = pvModuleModelService;
+  }
 
-    /**
-     * 分页获取光伏组件信息
-     * @param size 条数
-     * @param page 页码
-     * @return 光伏组件信息
-     */
 
-    @GetMapping(value="pvModuleModel/{page}/{size}/{stationCode}")
-    public ResponseVO getPvModuleModel(@PathVariable("page")  Integer page,
-                                       @PathVariable("size")  Integer size, @PathVariable("stationCode") String stationCode) {
-      PvModuleModel pvModuleModel = new PvModuleModel();
-      if (!"ALL".equals(stationCode)) {
-        pvModuleModel.setStationCode(stationCode);
-      }
+  /**
+   * 分页获取光伏组件信息
+   *
+   * @param size 条数
+   * @param page 页码
+   * @return 光伏组件信息
+   */
 
-      Page<PvModuleModel> pvModuleModelPage = this.pvModuleModelService.get(pvModuleModel, page, size);
-      return ResponseVO.success(pvModuleModelPage);
+  @GetMapping(value = "pvModuleModel/{page}/{size}/{stationCode}")
+  public ResponseVO getPvModuleModel(@PathVariable("page") Integer page,
+                                     @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
+    PvModuleModel pvModuleModel = new PvModuleModel();
+    if (!"ALL".equals(stationCode)) {
+      pvModuleModel.setStationCode(stationCode);
     }
 
+    Page<PvModuleModel> pvModuleModelPage = this.pvModuleModelService.get(pvModuleModel, page, size);
+    return ResponseVO.success(pvModuleModelPage);
+  }
 
-    /**
-     * 获取光伏组件信息
-     *
-     * @return 光伏组件信息
-     */
 
-    @GetMapping(value="pvModuleModel/")
-    public ResponseVO getAll() {
+  /**
+   * 获取光伏组件信息
+   *
+   * @return 光伏组件信息
+   */
 
-        try{
-            List<PvModuleModel> ps =  this.pvModuleModelService.getAll();
+  @GetMapping(value = "pvModuleModel/")
+  public ResponseVO getAll() {
 
-            return ResponseVO.success(ps);
-        }catch (Exception e){
-            e.printStackTrace();
-            log.error(" 获取所有光伏组件异常");
-            return ResponseVO.success(null);
-        }
+    try {
+      List<PvModuleModel> ps = this.pvModuleModelService.getAll();
 
+      return ResponseVO.success(ps);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 获取所有光伏组件异常");
+      return ResponseVO.success(null);
     }
 
-    /**
-     * 保存光伏组件信息
-     *
-     * @param pvModuleModel 参数
-     * @return 执行结果
-     */
-    @SaveValidate
-    @PostMapping(value = "pvModuleModel/")
-    public ResponseVO savePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
-        try {
-            pvModuleModelService.save(pvModuleModel);
-            return ResponseVO.success();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 保存光伏组件信息异常");
-            return ResponseVO.fail();
-        }
+  }
 
+  /**
+   * 保存光伏组件信息
+   *
+   * @param pvModuleModel 参数
+   * @return 执行结果
+   */
+  @SaveValidate
+  @PostMapping(value = "pvModuleModel/")
+  public ResponseVO savePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
+    try {
+      pvModuleModelService.save(pvModuleModel);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 保存光伏组件信息异常");
+      return ResponseVO.fail();
     }
 
-    /**
-     * 更新光伏组件信息
-     *
-     * @param pvModuleModel 参数
-     * @return 执行结果
-     */
-    @SaveValidate
-    @PutMapping(value = "pvModuleModel/")
-    public ResponseVO updatePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
-        try {
-            pvModuleModelService.save(pvModuleModel);
-            return ResponseVO.success();
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 更新光伏组件信息异常");
-            return ResponseVO.fail();
-        }
+  }
 
+  /**
+   * 更新光伏组件信息
+   *
+   * @param pvModuleModel 参数
+   * @return 执行结果
+   */
+  @SaveValidate
+  @PutMapping(value = "pvModuleModel/")
+  public ResponseVO updatePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
+    try {
+      pvModuleModelService.save(pvModuleModel);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 更新光伏组件信息异常");
+      return ResponseVO.fail();
     }
 
-    /**
-     * 删除光伏组件信息
-     *
-     * @param ids 删除id
-     * @return 执行结果
-     */
-    @SaveValidate
-    @DeleteMapping(value="pvModuleModel/{ids}")
-    public ResponseVO deletePvModuleModel(@PathVariable("ids")String ids){
-        try{
-            pvModuleModelService.delete(ids);
-            return ResponseVO.success();
-        }catch(Exception e){
-            e.printStackTrace();
-            log.error(" 删除光伏组件信息异常");
-            return ResponseVO.fail();
-        }
+  }
 
+  /**
+   * 删除光伏组件信息
+   *
+   * @param ids 删除id
+   * @return 执行结果
+   */
+  @SaveValidate
+  @DeleteMapping(value = "pvModuleModel/{ids}")
+  public ResponseVO deletePvModuleModel(@PathVariable("ids") String ids) {
+    try {
+      pvModuleModelService.delete(ids);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 删除光伏组件信息异常");
+      return ResponseVO.fail();
     }
 
+  }
+
   /**
    * 获取光伏组件旋转方式枚举
    *
    * @return 执行结果
    */
-    @GetMapping(value = "getPvRotationMode/")
-    public ResponseVO getPvRotationMode() {
-        List<Map<String, Object>> provinceType = new ArrayList<>();
-        Map<String, Object> map;
-        try {
-            for (PvRotationModeEnum e : PvRotationModeEnum.values()) {
-                map = new HashMap<>();
-                map.put("label", e.getMessage());
-                map.put("key", e.name());
-                map.put("value", e.name());
-                provinceType.add(map);
-            }
-            return ResponseVO.success(provinceType);
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error(" 获取光伏组件旋转类型异常");
-            return ResponseVO.fail(provinceType);
-        }
-
+  @GetMapping(value = "getPvRotationMode/")
+  public ResponseVO getPvRotationMode() {
+    List<Map<String, Object>> provinceType = new ArrayList<>();
+    Map<String, Object> map;
+    try {
+      for (PvRotationModeEnum e : PvRotationModeEnum.values()) {
+        map = new HashMap<>();
+        map.put("label", e.getMessage());
+        map.put("key", e.name());
+        map.put("value", e.name());
+        provinceType.add(map);
+      }
+      return ResponseVO.success(provinceType);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 获取光伏组件旋转类型异常");
+      return ResponseVO.fail(provinceType);
     }
 
+  }
+
 
 }

+ 1 - 2
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/QuartzController.java

@@ -11,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.sql.SQLException;
 import java.util.Map;
 
 /**
@@ -117,7 +116,7 @@ public class QuartzController {
 
   @SneakyThrows
   @GetMapping(value = "initJobClasses/initJob")
-  public ResponseVO initJobClass() throws SQLException {
+  public ResponseVO initJobClass() {
     Boolean b = quartzService.initJobClass();
     if (!b) {
       return ResponseVO.fail("初始化失败,请检查sql文件是否存在");

+ 89 - 89
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WeatherStationInfoController.java

@@ -7,7 +7,6 @@ import com.jiayue.ipfcst.console.service.WeatherStationInfoService;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -24,110 +23,111 @@ import java.util.List;
 @Slf4j
 public class WeatherStationInfoController {
 
-    private final WeatherStationInfoService weatherStationInfoService;
+  private final WeatherStationInfoService weatherStationInfoService;
 
-    @Autowired
-    public WeatherStationInfoController(WeatherStationInfoService weatherStationInfoService) {
-        this.weatherStationInfoService = weatherStationInfoService;
+  @Autowired
+  public WeatherStationInfoController(WeatherStationInfoService weatherStationInfoService) {
+    this.weatherStationInfoService = weatherStationInfoService;
+  }
+
+  /**
+   * 新增环境监测仪
+   *
+   * @param weatherStationInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @PostMapping()
+  public ResponseVO add(@RequestBody WeatherStationInfo weatherStationInfo) {
+    try {
+      this.weatherStationInfoService.add(weatherStationInfo);
+      return ResponseVO.success(1);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
     }
 
-    /**
-     * 新增环境监测仪
-     *
-     * @param weatherStationInfo 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @SaveValidate
-    @PostMapping()
-    public ResponseVO add(@RequestBody WeatherStationInfo weatherStationInfo) {
-      try {
-        this.weatherStationInfoService.add(weatherStationInfo);
-        return ResponseVO.success(1);
-      } catch (Exception ex) {
-        log.error("系统错误" + ex);
-        return ResponseVO.error(ex);
-      }
 
+  }
 
+  /**
+   * 修改环境监测仪
+   *
+   * @param weatherStationInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @PutMapping()
+  public ResponseVO update(@RequestBody WeatherStationInfo weatherStationInfo) {
+    try {
+      this.weatherStationInfoService.update(weatherStationInfo);
+      return ResponseVO.success(1);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
     }
 
-    /**
-     * 修改环境监测仪
-     *
-     * @param weatherStationInfo 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @SaveValidate
-    @PutMapping()
-    public ResponseVO update(@RequestBody WeatherStationInfo weatherStationInfo) {
-      try {
-        this.weatherStationInfoService.update(weatherStationInfo);
-        return ResponseVO.success(1);
-      } catch (Exception ex) {
-        log.error("系统错误" + ex);
-        return ResponseVO.error(ex);
-      }
+  }
 
+  /**
+   * 获取环境监测仪
+   *
+   * @param weatherStationInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @GetMapping("/ById")
+  public ResponseVO get(@RequestBody WeatherStationInfo weatherStationInfo) {
+    try {
+      weatherStationInfo = this.weatherStationInfoService.get(weatherStationInfo.getId());
+      return ResponseVO.success(weatherStationInfo);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
     }
 
-    /**
-     * 获取环境监测仪
-     *
-     * @param weatherStationInfo 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @GetMapping("/ById")
-    public ResponseVO get(@RequestBody WeatherStationInfo weatherStationInfo) {
-        try {
-          weatherStationInfo = this.weatherStationInfoService.get(weatherStationInfo.getId());
-          return ResponseVO.success(weatherStationInfo);
-        } catch (Exception ex) {
-          log.error("系统错误" + ex);
-          return ResponseVO.error(ex);
-        }
+  }
 
+  /**
+   * 删除环境监测仪
+   *
+   * @param id 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @DeleteMapping("/{id}")
+  public ResponseVO delete(@PathVariable Integer id) {
+    try {
+      this.weatherStationInfoService.delete(id);
+      return ResponseVO.success(1);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
     }
 
-    /**
-     * 删除环境监测仪
-     *
-     * @param id 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @SaveValidate
-    @DeleteMapping("/{id}")
-    public ResponseVO delete(@PathVariable Integer id) {
-      try {
-        this.weatherStationInfoService.delete(id);
-        return ResponseVO.success(1);
-      } catch (Exception ex) {
-        log.error("系统错误" + ex);
-        return ResponseVO.error(ex);
-      }
+  }
 
+  /**
+   * RequestParams
+   * 获取环境监测仪
+   *
+   * @param stationCode 参数
+   * @return 执行结果
+   */
+  @GetMapping(value = "/{stationCode}")
+  public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
+    try {
+      List<WeatherStationInfo> weatherStationInfoPage = this.weatherStationInfoService.get(stationCode);
+      return ResponseVO.success(weatherStationInfoPage);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
     }
 
-    /**RequestParams
-     * 获取环境监测仪
-     *
-     * @param stationCode 参数
-     * @return 执行结果
-     */
-    @GetMapping(value = "/{stationCode}")
-    public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
-        try {
-          List<WeatherStationInfo> weatherStationInfoPage = this.weatherStationInfoService.get(stationCode);
-          return ResponseVO.success(weatherStationInfoPage);
-        } catch (Exception ex) {
-          log.error("系统错误" + ex);
-          return ResponseVO.error(ex);
-        }
-
-    }
+  }
 
   /**
    * 获取环境监测仪

+ 9 - 9
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WeatherStationStatusDataController.java

@@ -7,8 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
+
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -25,21 +25,21 @@ public class WeatherStationStatusDataController {
   private final WeatherStationStatusDataService weatherStationStatusDataService;
 
   @Autowired
-  public WeatherStationStatusDataController(WeatherStationStatusDataService weatherStationStatusDataService){
-    this.weatherStationStatusDataService=weatherStationStatusDataService;
+  public WeatherStationStatusDataController(WeatherStationStatusDataService weatherStationStatusDataService) {
+    this.weatherStationStatusDataService = weatherStationStatusDataService;
   }
 
   @GetMapping(value = "/weatherStationStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}")
-  public ResponseVO findByTimeBetweenAndNoAndTimeStep(@PathVariable("stationCode") String stationCode,@PathVariable("startTime") Long startTime,
+  public ResponseVO findByTimeBetweenAndNoAndTimeStep(@PathVariable("stationCode") String stationCode, @PathVariable("startTime") Long startTime,
                                                       @PathVariable("endTime") Long endTime,
                                                       @PathVariable("page") Integer page,
                                                       @PathVariable("size") Integer size,
-                                                      @PathVariable("no") String no){
-    Map<String,Object> map = new HashMap<>();
-    try{
-      map =  weatherStationStatusDataService.findByTimeBetweenAndNoAndTimeStep(stationCode,new Date(startTime),new Date(endTime),page,size,no);
+                                                      @PathVariable("no") String no) {
+    Map<String, Object> map;
+    try {
+      map = weatherStationStatusDataService.findByTimeBetweenAndNoAndTimeStep(stationCode, new Date(startTime), new Date(endTime), page, size, no);
       return ResponseVO.success(map);
-    }catch(Exception e){
+    } catch (Exception e) {
       e.printStackTrace();
       log.error("气象数据分页查询错误");
       return ResponseVO.fail(e.toString());

+ 74 - 71
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerInfoController.java

@@ -2,13 +2,11 @@ package com.jiayue.ipfcst.console.controller;
 
 import com.jiayue.ipfcst.aop.SaveValidate;
 import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
-import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
 import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
 import com.jiayue.ipfcst.console.service.WindTowerInfoService;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -22,82 +20,87 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("windTowerInfo")
-@Slf4j public class WindTowerInfoController {
+@Slf4j
+public class WindTowerInfoController {
 
-    private final WindTowerInfoService windTowerInfoService;
+  private final WindTowerInfoService windTowerInfoService;
 
-    @Autowired public WindTowerInfoController(WindTowerInfoService windTowerInfoService) {
-        this.windTowerInfoService = windTowerInfoService;
-    }
-
-    /**
-     * 新增测风塔
-     *
-     * @param windTowerInfo 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @SaveValidate
-    @PostMapping() public ResponseVO add(@RequestBody WindTowerInfo windTowerInfo) {
-        try {
-            this.windTowerInfoService.add(windTowerInfo);
-            return ResponseVO.success(1);
-        } catch (Exception ex) {
-            log.error("系统错误" + ex);
-            return ResponseVO.error(ex);
-        }
+  @Autowired
+  public WindTowerInfoController(WindTowerInfoService windTowerInfoService) {
+    this.windTowerInfoService = windTowerInfoService;
+  }
 
+  /**
+   * 新增测风塔
+   *
+   * @param windTowerInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @PostMapping()
+  public ResponseVO add(@RequestBody WindTowerInfo windTowerInfo) {
+    try {
+      this.windTowerInfoService.add(windTowerInfo);
+      return ResponseVO.success(1);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
     }
 
-    /**
-     * 修改测风塔
-     *
-     * @param windTowerInfo 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @SaveValidate
-    @PutMapping() public ResponseVO update(@RequestBody WindTowerInfo windTowerInfo) {
-        this.windTowerInfoService.update(windTowerInfo);
-        return ResponseVO.success(1);
-    }
+  }
 
-    /**
-     * 删除测风塔
-     *
-     * @param id 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @SaveValidate
-    @DeleteMapping("/{id}") public ResponseVO delete(@PathVariable Integer id) {
-        this.windTowerInfoService.delete(id);
-        return ResponseVO.success(1);
-    }
+  /**
+   * 修改测风塔
+   *
+   * @param windTowerInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @PutMapping()
+  public ResponseVO update(@RequestBody WindTowerInfo windTowerInfo) {
+    this.windTowerInfoService.update(windTowerInfo);
+    return ResponseVO.success(1);
+  }
 
-    /**
-     * 获取测风塔
-     *
-     * @param stationCode 参数
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @GetMapping(value = "/{stationCode}")
-    public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
-      List<WindTowerInfo> windTowerPage = this.windTowerInfoService.get(stationCode);
-        return ResponseVO.success(windTowerPage);
-    }
+  /**
+   * 删除测风塔
+   *
+   * @param id 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @DeleteMapping("/{id}")
+  public ResponseVO delete(@PathVariable Integer id) {
+    this.windTowerInfoService.delete(id);
+    return ResponseVO.success(1);
+  }
 
-    /**
-     * 获取测风塔
-     *
-     * @return 执行结果
-     */
-    @SneakyThrows
-    @GetMapping(value = "")
-    public ResponseVO getAll() {
+  /**
+   * 获取测风塔
+   *
+   * @param stationCode 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @GetMapping(value = "/{stationCode}")
+  public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
+    List<WindTowerInfo> windTowerPage = this.windTowerInfoService.get(stationCode);
+    return ResponseVO.success(windTowerPage);
+  }
 
-      List<WindTowerInfo> list = this.windTowerInfoService.getAll();
-      return ResponseVO.success(list);
-    }
+  /**
+   * 获取测风塔
+   *
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @GetMapping(value = "")
+  public ResponseVO getAll() {
+
+    List<WindTowerInfo> list = this.windTowerInfoService.getAll();
+    return ResponseVO.success(list);
+  }
 }

+ 8 - 15
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerStatusDataController.java

@@ -8,14 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -32,8 +25,8 @@ public class WindTowerStatusDataController {
   private final WindTowerStatusDataService windTowerStatusDataService;
 
   @Autowired
-  public WindTowerStatusDataController(WindTowerStatusDataService windTowerStatusDataService){
-    this.windTowerStatusDataService=windTowerStatusDataService;
+  public WindTowerStatusDataController(WindTowerStatusDataService windTowerStatusDataService) {
+    this.windTowerStatusDataService = windTowerStatusDataService;
   }
 
 //  /**
@@ -64,16 +57,16 @@ public class WindTowerStatusDataController {
 //  }
 
   @GetMapping(value = "/windTowerStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}")
-  public ResponseVO findByTimeBetweenAndNoAndTimeStep(@PathVariable("stationCode") String stationCode,@PathVariable("startTime") Long startTime,
+  public ResponseVO findByTimeBetweenAndNoAndTimeStep(@PathVariable("stationCode") String stationCode, @PathVariable("startTime") Long startTime,
                                                       @PathVariable("endTime") Long endTime,
                                                       @PathVariable("page") Integer page,
                                                       @PathVariable("size") Integer size,
-                                                      @PathVariable("no") String no){
-    Map<String,Object> map = new HashMap<>();
-    try{
-      map =  windTowerStatusDataService.findByTimeBetweenAndNoAndTimeStep(stationCode,new Date(startTime),new Date(endTime),page,size,no);
+                                                      @PathVariable("no") String no) {
+    Map<String, Object> map;
+    try {
+      map = windTowerStatusDataService.findByTimeBetweenAndNoAndTimeStep(stationCode, new Date(startTime), new Date(endTime), page, size, no);
       return ResponseVO.success(map);
-    }catch(Exception e){
+    } catch (Exception e) {
       e.printStackTrace();
       log.error("测风数据分页查询错误");
       return ResponseVO.fail(e.toString());

+ 5 - 7
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineInfoController.java

@@ -3,8 +3,6 @@ package com.jiayue.ipfcst.console.controller;
 import com.jiayue.ipfcst.aop.SaveValidate;
 import com.jiayue.ipfcst.common.core.web.vo.RequestVO;
 import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
-import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
-import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
 import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
 import lombok.SneakyThrows;
@@ -13,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -161,15 +158,16 @@ public class WindTurbineInfoController {
 
   /**
    * 查询所有逆变器设备信息按ID排序 yh
+   *
    * @return 结果集
    */
   @GetMapping(value = "findWindTurbineInfoByStation/{stationCode}")
-  public ResponseVO findWindTurbineInfoByStation(@PathVariable("stationCode") String stationCode){
-    List<WindTurbineInfo> list = new ArrayList<>();
-    try{
+  public ResponseVO findWindTurbineInfoByStation(@PathVariable("stationCode") String stationCode) {
+    List<WindTurbineInfo> list;
+    try {
       list = windTurbineInfoService.getByStationCode(stationCode);
       return ResponseVO.success(list);
-    }catch(Exception e){
+    } catch (Exception e) {
       e.printStackTrace();
       log.error("风机信息所有查询错误");
       return ResponseVO.fail(e.toString());

+ 23 - 23
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineStatusDataController.java

@@ -1,16 +1,15 @@
 package com.jiayue.ipfcst.console.controller;
 
 import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
-import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
 import com.jiayue.ipfcst.console.service.WindTurbineStatusDataService;
 import lombok.extern.slf4j.Slf4j;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.*;
+import java.util.Date;
+import java.util.Map;
 
 
 @RestController
@@ -18,21 +17,21 @@ import java.util.*;
 public class WindTurbineStatusDataController {
 
   private final WindTurbineStatusDataService windTurbineStatusDataService;
-  private final WindTurbineInfoService windTurbineInfoService;
+
   @Autowired
-  public WindTurbineStatusDataController(WindTurbineStatusDataService windTurbineStatusDataService, WindTurbineInfoService windTurbineInfoService){
+  public WindTurbineStatusDataController(WindTurbineStatusDataService windTurbineStatusDataService) {
     this.windTurbineStatusDataService = windTurbineStatusDataService;
-    this.windTurbineInfoService = windTurbineInfoService;
   }
 
 
   /**
    * 分页查询 所有风机功率状态
+   *
    * @param startTime 开始时间
-   * @param endTime 结束时间
-   * @param page 页码
-   * @param size 条数
-   * @param no   风机编号
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
+   * @param no        风机编号
    * @return
    */
   @GetMapping(value = "/windTurbineStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}")
@@ -41,12 +40,12 @@ public class WindTurbineStatusDataController {
                                                @PathVariable("endTime") Long endTime,
                                                @PathVariable("page") Integer page,
                                                @PathVariable("size") Integer size,
-                                               @PathVariable("no") String no){
-    Map<String,Object> map = new HashMap<>();
-    try{
-      map =  windTurbineStatusDataService.findByTimeBetweenForPaging(stationCode,new Date(startTime),new Date(endTime),page,size,no);
+                                               @PathVariable("no") String no) {
+    Map<String, Object> map;
+    try {
+      map = windTurbineStatusDataService.findByTimeBetweenForPaging(stationCode, new Date(startTime), new Date(endTime), page, size, no);
       return ResponseVO.success(map);
-    }catch(Exception e){
+    } catch (Exception e) {
       e.printStackTrace();
       log.error("风机分页查询错误");
       return ResponseVO.fail(e.toString());
@@ -55,10 +54,11 @@ public class WindTurbineStatusDataController {
 
   /**
    * 分页查询  按设备编号查询风机状态
+   *
    * @param startTime 开始时间
-   * @param endTime 结束时间
-   * @param page 页码
-   * @param size 条数
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
    * @return
    */
   @GetMapping(value = "/windTurbineStatusData/{startTime}/{endTime}/{page}/{size}/{no}")
@@ -67,12 +67,12 @@ public class WindTurbineStatusDataController {
                                                @PathVariable("page") Integer page,
                                                @PathVariable("size") Integer size,
                                                @PathVariable("no") Integer[] no,
-                                               String timeSortOrder, String noSortOrder){
-    Map<String,Object> map = new HashMap<>();
-    try{
-      map =  windTurbineStatusDataService.findByTimeBetweenAndNoForPaging(new Date(startTime),new Date(endTime),page,size,no,timeSortOrder,noSortOrder);
+                                               String timeSortOrder, String noSortOrder) {
+    Map<String, Object> map;
+    try {
+      map = windTurbineStatusDataService.findByTimeBetweenAndNoForPaging(new Date(startTime), new Date(endTime), page, size, no, timeSortOrder, noSortOrder);
       return ResponseVO.success(map);
-    }catch(Exception e){
+    } catch (Exception e) {
       e.printStackTrace();
       log.error("按设备号风机分页查询错误");
       return ResponseVO.fail(e.toString());

+ 8 - 10
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/FileAnalysisJob.java

@@ -1,7 +1,5 @@
 package com.jiayue.ipfcst.console.job;
 
-import com.jiayue.ipfcst.common.core.exception.BusinessException;
-import com.jiayue.ipfcst.common.data.entity.ElectricField;
 import com.jiayue.ipfcst.console.service.FileAnalysisService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,19 +18,19 @@ import org.springframework.stereotype.Service;
 @EnableScheduling
 public class FileAnalysisJob {
 
-    @Autowired
-    private FileAnalysisService fileAnalysisService;
+  @Autowired
+  private FileAnalysisService fileAnalysisService;
 
-    @Scheduled(cron = "0 0/1 * * * *")
-    public void fxglFileAnalysis() {
+  @Scheduled(cron = "0 0/1 * * * *")
+  public void fxglFileAnalysis() {
 
-        log.debug("文件解析定时任务执行开始");
+    log.debug("文件解析定时任务执行开始");
 
-        this.fileAnalysisService.analysisJob();
+    this.fileAnalysisService.analysisJob();
 
-        log.debug("文件解析定时任务执行完成");
+    log.debug("文件解析定时任务执行完成");
 
-    }
+  }
 
 
 }

+ 0 - 2
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/DownLoadService.java

@@ -37,8 +37,6 @@ public class DownLoadService {
       List<FileCreateLog> list = array.toList(FileCreateLog.class);
       Date date = new Date();
       SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
-      //String dir = FileUtil.getDownloadFilePath() +File.separator+stationCode+File.separator+"new/";
-      //String dirBak = FileUtil.getDownloadFilePath() +File.separator+stationCode+File.separator+"backups/"+simpleDateFormat.format(date)+"/";
       //测试使用
       String dir = "/Users/wanghongchen/fsdownload/" + stationCode + "/" + "new/";
       String dirBak = "/Users/wanghongchen/fsdownload/" + stationCode + "/" + "backups/" + simpleDateFormat.format(date) + "/";

+ 5 - 86
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerShortTermHisService.java

@@ -14,9 +14,10 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.persistence.criteria.Predicate;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 历史预测短期业务层
@@ -35,45 +36,6 @@ public class ForecastPowerShortTermHisService extends BaseService {
   }
 
   /**
-   * 根据提前多久,开始结束时间查询历史超短期 yh
-   *
-   * @param startTime 开始时间
-   * @param endTime   结束时间
-   * @param ago       提前多久预测
-   * @return 结果集
-   */
-  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public Map<String, Object> findByForecastTimeBetweenAndForecastHowLongAgoOrderByForecastTime(Long startTime, Long endTime, Integer ago) {
-    Map<String, Object> map = new HashMap<>();
-    List<ForecastPowerShortTermHis> list = forecastPowerShortTermHisRepository.findByForecastTimeBetweenAndForecastHowLongAgo(startTime, endTime, ago);
-    list.sort(Comparator.comparing(ForecastPowerShortTermHis::getForecastTime));
-    long timeStep = 900000L;
-    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-    List<String> times = new ArrayList<>();
-    List<Float> datas = new ArrayList<>();
-    if (startTime % timeStep != 0) {
-      startTime = startTime - (startTime % timeStep) + timeStep;
-    }
-    if (list != null && list.size() > 0) {
-      for (Long i = startTime; i < endTime; i = i + timeStep) {
-        long finalI = i;
-        List<ForecastPowerShortTermHis> filterList = list.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
-        if (filterList != null && filterList.size() > 0) {
-          datas.add(filterList.get(0).getAbleValue().floatValue());
-        } else {
-          datas.add(null);
-        }
-
-        times.add(sdf.format(new Date(finalI)));
-      }
-    }
-    map.put("times", times);
-    map.put("datas", datas);
-
-    return map;
-  }
-
-  /**
    * 根据时间,场站编码查询历史短期数据
    *
    * @param startTime   开始时间
@@ -92,56 +54,13 @@ public class ForecastPowerShortTermHisService extends BaseService {
     Specification<ForecastPowerShortTermHis> specification = this.specificationFindByTimeAndNo(startTime, endTime, stationCode);
     Pageable pageable = PageRequest.of(page - 1, size, sort);
     Page forecastPowerShortTermHiss = forecastPowerShortTermHisRepository.findAll(specification, pageable);
-    List<ForecastPowerShortTermHis> datas = forecastPowerShortTermHiss.getContent();
+    List datas = forecastPowerShortTermHiss.getContent();
     map.put("content", datas);
     map.put("count", forecastPowerShortTermHiss.getTotalElements());
 
     return map;
   }
 
-
-  /**
-   * 根据提前多久,开始结束时间查询历史超短期 yh
-   *
-   * @param startTime 开始时间
-   * @param endTime   结束时间
-   * @param ago       提前多久预测
-   * @return 结果集
-   */
-  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public Map<String, Object> findByForecastTimeBetweenAndForecastHowLongAgoOrderByForecastTimeForDB(Long startTime, Long endTime, Integer ago, Long timeStep) {
-    Map<String, Object> map = new HashMap<>();
-    List<ForecastPowerShortTermHis> list = forecastPowerShortTermHisRepository.findByForecastTimeBetweenAndForecastHowLongAgo(startTime, endTime, ago);
-    list.sort(Comparator.comparing(ForecastPowerShortTermHis::getForecastTime));
-    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-    List<String> times = new ArrayList<>();
-    List<Float> datas = new ArrayList<>();
-    if (startTime % timeStep != 0) {
-      startTime = startTime - (startTime % timeStep) + timeStep;
-    }
-    for (Long i = startTime; i < endTime; i = i + timeStep) {
-      if (list != null && list.size() > 0) {
-        long finalI = i;
-        List<ForecastPowerShortTermHis> filterList = list.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
-        if (filterList != null && filterList.size() > 0) {
-          datas.add(filterList.get(0).getAbleValue().floatValue());
-        } else {
-          datas.add(null);
-        }
-      } else {
-        datas.add(null);
-      }
-      times.add(sdf.format(new Date(i)));
-
-    }
-
-    map.put("times", times);
-    map.put("datas", datas);
-
-    return map;
-  }
-
-
   /**
    * 根据时间和编号 分页查询条件 yh
    *

+ 10 - 9
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerShortTermService.java

@@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.persistence.criteria.Predicate;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -86,7 +87,7 @@ public class ForecastPowerShortTermService extends BaseService {
     log.info(stationCode + "查询现有短期预测记录数:" + forecastPowerShortTerms.size());
     // 判断查询结果是否满足查询所需
     Long momentTime = 15 * 60 * 1000L; // 15分钟一个时刻
-    Integer moments = Math.toIntExact((endTime - startTime) / momentTime + 1);
+    int moments = Math.toIntExact((endTime - startTime) / momentTime + 1);
     log.info(stationCode + "获取所需记录数:" + moments);
     if (moments > forecastPowerShortTerms.size()) {
       Map<Long, List<ForecastPowerShortTerm>> forecastPowerShortTermsMap =
@@ -97,7 +98,7 @@ public class ForecastPowerShortTermService extends BaseService {
         if (forecastPowerShortTermsMap.get(tempTime) == null) {
           // 缺失时间点
           ForecastPowerShortTerm _forecastPowerShortTerms = this.generateForecastPowerShortTerm(tempTime,
-            electricFieldInfo, openCapacityMap.get(tempTime));
+            electricFieldInfo, openCapacityMap != null ? openCapacityMap.get(tempTime) : electricFieldInfo.getCapacity());
           addForecastPowerShortTermList.add(_forecastPowerShortTerms);
         }
       }
@@ -126,13 +127,13 @@ public class ForecastPowerShortTermService extends BaseService {
       forecastPowerShortTermHis.setCapacity(electricFieldInfo.getCapacity());
       // 预测可用功率=预测*(开机容量/装机容量)
       BigDecimal ableValue =
-        _forecastPowerShortTerm.getFpValue().multiply(openCapacityMap.get(_forecastPowerShortTerm.getForecastTime()))
-          .divide(electricFieldInfo.getCapacity(), 2, BigDecimal.ROUND_HALF_UP);
+        _forecastPowerShortTerm.getFpValue().multiply(openCapacityMap != null ? openCapacityMap.get(_forecastPowerShortTerm.getForecastTime()) : electricFieldInfo.getCapacity())
+          .divide(electricFieldInfo.getCapacity(), 2, RoundingMode.HALF_UP);
 
       forecastPowerShortTermHis.setAbleValue(ableValue.compareTo(lpl) == -1 ? lpl : ableValue);
       forecastPowerShortTermHis.setPredictionModelEnum(_forecastPowerShortTerm.getPredictionModelEnum());
       forecastPowerShortTermHis.setGenDate(new Date());
-      forecastPowerShortTermHis.setSuCapacity(openCapacityMap.get(_forecastPowerShortTerm.getForecastTime()));
+      forecastPowerShortTermHis.setSuCapacity(openCapacityMap != null ? openCapacityMap.get(_forecastPowerShortTerm.getForecastTime()) : electricFieldInfo.getCapacity());
       // 设置提前几天预测
       forecastPowerShortTermHis.setForecastHowLongAgo(DateMomentUtil.getDaysBetweenTwoDate(systemTime,
         forecastPowerShortTermHis.getForecastTime()));
@@ -186,7 +187,7 @@ public class ForecastPowerShortTermService extends BaseService {
     ForecastPowerShortTerm forecastPowerShortTerm = new ForecastPowerShortTerm();
     forecastPowerShortTerm.setForecastTime(tempTime);
     BigDecimal tempValue;
-    BigDecimal randomValue = new BigDecimal(CommonUtil.getRandom(97, 99) / 100.0);
+    BigDecimal randomValue = BigDecimal.valueOf(CommonUtil.getRandom(97, 99) / 100.0);
     if (DateTimeUtil.checkInSunriseAndSunset(tempTime, electricFieldInfo.getLongitude().doubleValue(),
       electricFieldInfo.getLatitude().doubleValue())) {
       // 2021-4-22 xsl修改补数取固定系数
@@ -197,7 +198,7 @@ public class ForecastPowerShortTermService extends BaseService {
       tempValue = BigDecimal.ZERO;
     }
 
-    forecastPowerShortTerm.setFpValue(NumberUtils.multiply(tempValue, openCapacity).multiply(randomValue).setScale(2, BigDecimal.ROUND_HALF_UP));
+    forecastPowerShortTerm.setFpValue(NumberUtils.multiply(tempValue, openCapacity).multiply(randomValue).setScale(2, RoundingMode.HALF_UP));
     forecastPowerShortTerm.setGenDate(new Date());
     forecastPowerShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
     forecastPowerShortTerm.setStationCode(electricFieldInfo.getStationCode());
@@ -216,10 +217,10 @@ public class ForecastPowerShortTermService extends BaseService {
     System.out.println("风补数");
     ForecastPowerShortTerm forecastPowerShortTerm = new ForecastPowerShortTerm();
     forecastPowerShortTerm.setForecastTime(tempTime);
-    BigDecimal randomValue = new BigDecimal(CommonUtil.getRandom(97, 99) / 100.0d);
+    BigDecimal randomValue = BigDecimal.valueOf(CommonUtil.getRandom(97, 99) / 100.0d);
     // 2021-4-22 xsl修改补数取固定系数
     BigDecimal tempValue = new BigDecimal(Constant.forecastCoe(tempTime, ElectricFieldTypeEnum.E2));
-    forecastPowerShortTerm.setFpValue(NumberUtils.multiply(tempValue, openCapacity).multiply(randomValue).setScale(2, BigDecimal.ROUND_HALF_UP));
+    forecastPowerShortTerm.setFpValue(NumberUtils.multiply(tempValue, openCapacity).multiply(randomValue).setScale(2, RoundingMode.HALF_UP));
     forecastPowerShortTerm.setGenDate(new Date());
     forecastPowerShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
     forecastPowerShortTerm.setStationCode(stationCode);

+ 29 - 42
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerUltraShortTermService.java

@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -52,17 +53,6 @@ public class ForecastPowerUltraShortTermService extends BaseService {
   ForecastPowerShortTermService forecastPowerShortTermService;
 
   /**
-   * 生成超短期预测功率,自动更新覆盖预测功率
-   *
-   * @param startTime 开始时间
-   * @param endTime   结束时间
-   */
-  @Transactional(propagation = Propagation.REQUIRED)
-  public void buildForecastPowerUltraShortTerm(@NotNull final Long startTime, @NotNull final Long endTime, String stationCode) {
-    this.getForecastPowerUltraShortTerm(startTime, endTime, stationCode);
-  }
-
-  /**
    * 获取超短期预测功率,当数据库中超短期预测记录不足查询所需时,进行本地化计算,用于上报专用
    *
    * @param startTime 开始时间
@@ -82,7 +72,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     } catch (BusinessException e) {
       log.error(stationCode + "超短期数据生成获取开机容量出错:" + CommonUtil.printStackTraceToString(e));
     }
-    Long monentTime = 0L;
+    long monentTime = 0L;
     try {
       monentTime = DateMomentUtil.getMomentTime(new Date().getTime(), 1, 15 * 60 * 1000L);
     } catch (Exception e) {
@@ -98,7 +88,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     }
 
     Long momentTime = 15 * 60 * 1000L; // 15分钟一个时刻
-    Integer moments = Math.toIntExact((endTime - startTime) / momentTime + 1);
+    int moments = Math.toIntExact((endTime - startTime) / momentTime + 1);
     log.info(stationCode + "所需时间moments个数:" + moments);
     log.info(stationCode + "获取所需记录数:" + forecastPowerUltraShortTermList.size());
     if (moments > forecastPowerUltraShortTermList.size()) {
@@ -109,22 +99,22 @@ public class ForecastPowerUltraShortTermService extends BaseService {
           BigDecimal tempValue;
           if (ElectricFieldTypeEnum.E1.equals(electricFieldInfo.getElectricFieldTypeEnum())) {
             if (DateTimeUtil.checkInSunriseAndSunset(startTime, electricFieldInfo.getLongitude().doubleValue(), electricFieldInfo.getLatitude().doubleValue())) {
-              tempValue = new BigDecimal(CommonUtil.getRandom(1, 70) / 100.0d);
+              tempValue = BigDecimal.valueOf(CommonUtil.getRandom(1, 70) / 100.0d);
             } else {
               // 日升日落
               tempValue = BigDecimal.ZERO;
             }
           } else {
-            tempValue = new BigDecimal(CommonUtil.getRandom(1, 70) / 100.0d);
+            tempValue = BigDecimal.valueOf(CommonUtil.getRandom(1, 70) / 100.0d);
           }
-          tempValue = tempValue.multiply(electricFieldInfo.getCapacity()).setScale(2, BigDecimal.ROUND_HALF_UP);
+          tempValue = tempValue.multiply(electricFieldInfo.getCapacity()).setScale(2, RoundingMode.HALF_UP);
           ForecastPowerUltraShortTerm forecastPowerUltraShortTerm = new ForecastPowerUltraShortTerm();
           forecastPowerUltraShortTerm.setGenDate(new Date(monentTime));
           forecastPowerUltraShortTerm.setForecastTime(tempTime);
           forecastPowerUltraShortTerm.setFpValue(tempValue);
           forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
-          forecastPowerUltraShortTerm.setCoefficientValue(new BigDecimal(-0.99).setScale(2, BigDecimal.ROUND_HALF_UP));
-          forecastPowerUltraShortTerm.setDifferenceValue(new BigDecimal(-0.99).setScale(2, BigDecimal.ROUND_HALF_UP));
+          forecastPowerUltraShortTerm.setCoefficientValue(BigDecimal.valueOf(-0.99).setScale(2, RoundingMode.HALF_UP));
+          forecastPowerUltraShortTerm.setDifferenceValue(BigDecimal.valueOf(-0.99).setScale(2, RoundingMode.HALF_UP));
           forecastPowerUltraShortTerm.setStationCode(stationCode);
           // 保存超短期实时预测记录
           this.forecastPowerUltraShortTermRepository.save(forecastPowerUltraShortTerm);
@@ -145,7 +135,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     //生成数据
     for (ForecastPowerUltraShortTerm forecastPowerUltraShortTerm : forecastPowerUltraShortTermList) {
       forecastPowerUltraShortTermHis = new ForecastPowerUltraShortTermHis();
-      openCapacity = openCapacityMap.get(forecastPowerUltraShortTerm.getForecastTime());
+      openCapacity = openCapacityMap != null ? openCapacityMap.get(forecastPowerUltraShortTerm.getForecastTime()) : electricFieldInfo.getCapacity();
       forecastPowerUltraShortTermHis.setForecastTime(forecastPowerUltraShortTerm.getForecastTime());
       forecastPowerUltraShortTermHis.setSuCapacity(openCapacity);
       forecastPowerUltraShortTermHis.setCapacity(electricFieldInfo.getCapacity());
@@ -153,7 +143,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
       forecastPowerUltraShortTermHis.setTheoryValue(forecastPowerUltraShortTerm.getFpValue());
       // 预测可用功率=预测*(开机容量/装机容量)
       BigDecimal fpValue = forecastPowerUltraShortTerm.getFpValue().multiply(openCapacity)
-        .divide(electricFieldInfo.getCapacity(), 2, BigDecimal.ROUND_HALF_UP);
+        .divide(electricFieldInfo.getCapacity(), 2, RoundingMode.HALF_UP);
       forecastPowerUltraShortTermHis.setAbleValue(fpValue);
       forecastPowerUltraShortTermHis.setPredictionModelEnum(forecastPowerUltraShortTerm.getPredictionModelEnum());
       forecastPowerUltraShortTermHis.setDifferenceValue(forecastPowerUltraShortTerm.getDifferenceValue());
@@ -164,11 +154,11 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     }
 //    List<ForecastPowerUltraShortTermHis> forecastPowerUltraShortTermHiss = forecastPowerUltraShortTermHiss1.stream().filter(t -> t.getForecastHowLongAgo() <=16).collect(Collectors.toList());
     // 获取实际功率替换超短期点位参数
-    Integer replacePoint = 0;
+    int replacePoint;
     String realpower_replace_cdq = sysParameterService.getSysParameter("realpower_replace_cdq", "0", stationCode);
-    replacePoint = Integer.valueOf(realpower_replace_cdq);
+    replacePoint = Integer.parseInt(realpower_replace_cdq);
     if (replacePoint <= forecastPowerUltraShortTermHiss.size() && replacePoint > 0) {
-      Long pre5Time = 0l;
+      long pre5Time;
       Date systemDate = new Date();
       try {
         // 获取前5分钟时刻
@@ -228,10 +218,10 @@ public class ForecastPowerUltraShortTermService extends BaseService {
         // 根据场站类型执行相应超短期预测
         try {
           String cdqUpMin = super.getSysParameter("CDQ_UP_MIN", "0", stationCode);
-          Long currentTime = System.currentTimeMillis() + Integer.parseInt(cdqUpMin) * 1000 * 60;
+          Long currentTime = System.currentTimeMillis() + (long) Integer.parseInt(cdqUpMin) * 1000 * 60;
           String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16", stationCode);
-          Integer forecastPoints = Integer.parseInt(llcdq_point);
-          Integer forecastMinutes = forecastPoints * 15;
+          int forecastPoints = Integer.parseInt(llcdq_point);
+          int forecastMinutes = forecastPoints * 15;
 
           // 超短期提前N分钟生成文件
           Long startTime = DateMomentUtil.getMomentTime(currentTime, 1, 15 * 60 * 1000L);
@@ -252,11 +242,11 @@ public class ForecastPowerUltraShortTermService extends BaseService {
           for (Long tempTime = startTime; tempTime <= endTime; tempTime = tempTime + 15 * 60 * 1000L) {
             if (forecastPowerShortTermsMap.get(tempTime) == null) {
               // 缺失时间点
-              ForecastPowerShortTerm forecastPowerShortTerms = null;
+              ForecastPowerShortTerm forecastPowerShortTerms;
               if (ElectricFieldTypeEnum.E1.compareTo(electricField.getElectricFieldTypeEnum()) == 0) {
-                forecastPowerShortTerms = forecastPowerShortTermService.generateSolarPowerShortTerm(tempTime, openCapacityMap.get(tempTime), electricField);
+                forecastPowerShortTerms = forecastPowerShortTermService.generateSolarPowerShortTerm(tempTime, openCapacityMap != null ? openCapacityMap.get(tempTime) : electricField.getCapacity(), electricField);
               } else {
-                forecastPowerShortTerms = forecastPowerShortTermService.generateWindPowerShortTerm(tempTime, openCapacityMap.get(tempTime), stationCode);
+                forecastPowerShortTerms = forecastPowerShortTermService.generateWindPowerShortTerm(tempTime, openCapacityMap != null ? openCapacityMap.get(tempTime) : electricField.getCapacity(), stationCode);
               }
               addForecastPowerShortTermList.add(forecastPowerShortTerms);
             }
@@ -293,7 +283,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
    * @param forecastPowerShortTermList 短期预测结果集
    * @param capacity                   装机容量
    */
-  private List<ForecastPowerUltraShortTerm> executeForecastForWind(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
+  private void executeForecastForWind(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
     List<ForecastPowerUltraShortTerm> forecastPowerUltraShortTermList = new ArrayList<>();
     ForecastPowerUltraShortTerm forecastPowerUltraShortTerm;
     //获取系统参数cdqjsfs,超短期计算方式,0为默认乘系数的方式,1为根据可用功率计算的方式
@@ -310,7 +300,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     List<PowerStationStatusData> filterList = powerStationStatusDataList.stream().filter(t -> t.getAbleValue().compareTo(new BigDecimal("-1")) == 1).collect(Collectors.toList());
     String coe = super.getSysParameter("CDQ_COE", "1.05", stationCode);
 
-    Long monentTime = 0L;
+    long monentTime = 0L;
     try {
       monentTime = DateMomentUtil.getMomentTime(new Date().getTime(), 1, 15 * 60 * 1000L);
     } catch (Exception e) {
@@ -319,7 +309,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     if (filterList.size() > 0) {
       BigDecimal sumAbleValue = filterList.stream().map(PowerStationStatusData::getAbleValue)
         .reduce(BigDecimal.ZERO, BigDecimal::add);
-      BigDecimal averageAbleValue = sumAbleValue.divide(new BigDecimal(filterList.size()), 2, BigDecimal.ROUND_HALF_UP);
+      BigDecimal averageAbleValue = sumAbleValue.divide(new BigDecimal(filterList.size()), 2, RoundingMode.HALF_UP);
       //可用-短期差值
       BigDecimal deviationValue = averageAbleValue.subtract(currentForecastPowerShortTerm.getFpValue());
       for (int i = 1; i < forecastPowerShortTermList.size(); i++) {
@@ -329,7 +319,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
         //短期
         stPower = forecastPowerShortTermList.get(i).getFpValue();
         //短期*系数
-        ustPowers = stPower.multiply(new BigDecimal(coe)).setScale(2, BigDecimal.ROUND_HALF_UP);
+        ustPowers = stPower.multiply(new BigDecimal(coe)).setScale(2, RoundingMode.HALF_UP);
         // 如果短期预测小于等于0,则超短期为0
         if (stPower.doubleValue() <= 0) {
           forecastPowerUltraShortTerm.setFpValue(BigDecimal.ZERO);
@@ -337,12 +327,12 @@ public class ForecastPowerUltraShortTermService extends BaseService {
           forecastPowerUltraShortTerm.setCoefficientValue(BigDecimal.ZERO);
           forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E4);
         } else {
-          BigDecimal xzjdq = deviationValue.add(stPower).setScale(2, BigDecimal.ROUND_HALF_UP);
+          BigDecimal xzjdq = deviationValue.add(stPower).setScale(2, RoundingMode.HALF_UP);
           String cdqjsfsZbxz = electricFieldService.getSysParameter("cdqjsfsZbxz", "0.4", stationCode);
           log.debug("参数cdqjsfsZbxz值为:" + cdqjsfsZbxz + ",超短期计算方式,可用和短期的差值加短期占比。");
           String cdqjsfsZbdq = electricFieldService.getSysParameter("cdqjsfsZbdq", "0.6", stationCode);
           log.debug("参数cdqjsfsZbdq值为:" + cdqjsfsZbdq + ",超短期计算方式,短期占比。");
-          ustPower = xzjdq.multiply(new BigDecimal(cdqjsfsZbxz)).setScale(2, BigDecimal.ROUND_HALF_UP).add(stPower.multiply(new BigDecimal(cdqjsfsZbdq)).setScale(2, BigDecimal.ROUND_HALF_UP));
+          ustPower = xzjdq.multiply(new BigDecimal(cdqjsfsZbxz)).setScale(2, RoundingMode.HALF_UP).add(stPower.multiply(new BigDecimal(cdqjsfsZbdq)).setScale(2, RoundingMode.HALF_UP));
           if (ustPower.doubleValue() > capacity.doubleValue()) {
             // 如果超短期结果超出装机容量,则超短期结果为装机容量
             forecastPowerUltraShortTerm.setFpValue(capacity);
@@ -370,12 +360,12 @@ public class ForecastPowerUltraShortTermService extends BaseService {
       // 短期乘以系数
       for (int i = 1; i < forecastPowerShortTermList.size(); i++) {
         stPower = forecastPowerShortTermList.get(i).getFpValue();
-        ustPower = stPower.multiply(new BigDecimal(coe)).setScale(2, BigDecimal.ROUND_HALF_UP);
+        ustPower = stPower.multiply(new BigDecimal(coe)).setScale(2, RoundingMode.HALF_UP);
         forecastPowerUltraShortTerm = new ForecastPowerUltraShortTerm();
         forecastPowerUltraShortTerm.setForecastTime(forecastPowerShortTermList.get(i).getForecastTime());
         forecastPowerUltraShortTerm.setPredictionModelEnum(PredictionModelEnum.E9);
         forecastPowerUltraShortTerm.setCoefficientValue(ustPower);
-        forecastPowerUltraShortTerm.setDifferenceValue(new BigDecimal(-0.99).setScale(2, BigDecimal.ROUND_HALF_UP));
+        forecastPowerUltraShortTerm.setDifferenceValue(new BigDecimal(-0.99).setScale(2, RoundingMode.HALF_UP));
         forecastPowerUltraShortTerm.setFpValue(ustPower);
         forecastPowerUltraShortTerm.setGenDate(new Date(monentTime));
         forecastPowerUltraShortTerm.setStationCode(stationCode);
@@ -386,7 +376,6 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     this.forecastPowerUltraShortTermRepository.deleteByForecastTimeBetweenAndStationCode(forecastPowerShortTermList.get(1).getForecastTime(), forecastPowerShortTermList.get(forecastPowerShortTermList.size() - 1).getForecastTime(), stationCode);
     this.forecastPowerUltraShortTermRepository.saveAll(forecastPowerUltraShortTermList);
 
-    return forecastPowerUltraShortTermList;
   }
 
   private void executeForecastForlight(final List<ForecastPowerShortTerm> forecastPowerShortTermList, final BigDecimal capacity, String stationCode) {
@@ -416,7 +405,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
       startTime = startTime - (startTime % timeStep) + timeStep;
     }
     if (list != null && list.size() > 0) {
-      for (Long i = startTime; i < endTime; i = i + timeStep) {
+      for (long i = startTime; i < endTime; i = i + timeStep) {
         long finalI = i;
         List<ForecastPowerUltraShortTermHis> filterList = list.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
         if (filterList != null && filterList.size() > 0) {
@@ -443,7 +432,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
   public Map<String, Object> findByForecastRealTimeUltraShortTerm16(Long startTime, String stationCode) {
-    Long endTime = startTime + 60 * 60 * 1000 * 24;
+    long endTime = startTime + 60 * 60 * 1000 * 24;
 //    List<Map<String,Object>> valueList16 = new ArrayList<>();
     //取出16点数据存入集合中
     Map<String, Object> realPowerMap = new HashMap<>();
@@ -453,13 +442,11 @@ public class ForecastPowerUltraShortTermService extends BaseService {
       int finalP = p;
       List<ForecastPowerUltraShortTermHis> filterList = forecastPowerUltraShortTermHisList.stream().filter(t -> t.getForecastHowLongAgo() == finalP).collect(Collectors.toList());
 
-      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       long timeStep = 900000L;
       if (startTime % timeStep != 0) {
         startTime = startTime - (startTime % timeStep);
       }
       List<Float> ableDatas = new ArrayList<>();
-      List<String> times = new ArrayList<>();
 
       for (long i = startTime; i < endTime; i = i + 900000L) {
         long finalI = i;

+ 4 - 34
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/HolidayCalendarService.java

@@ -83,39 +83,9 @@ public class HolidayCalendarService extends BaseService {
 
   }
 
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void saveCloud(List<HolidayCalendar> beans) {
-        holidayCalendarRepository.deleteAll();
-        holidayCalendarRepository.saveAll(beans);
-    }
-
-  /**
-   * 计算出距离当前最近且在当前时间之后的时间
-   * @return
-   */
-  public HolidayCalendar findByNextTime(){
-
-    List<HolidayCalendar> holidayCalendarList = holidayCalendarRepository.findAll();
-    HolidayCalendar holidayCalendar1 = new HolidayCalendar();
-    holidayCalendar1.setStartTime(0l);
-    if(holidayCalendarList.size()>0){
-
-      Long time = System.currentTimeMillis();
-      for(HolidayCalendar holidayCalendar:holidayCalendarList){
-        Long difference = holidayCalendar.getStartTime() - time;
-        if(holidayCalendar.getStartTime()>time){
-          if(holidayCalendar1.getStartTime()==0){
-//          holidayCalendar1.setStartTime(difference);
-            holidayCalendar1 = holidayCalendar;
-          }
-          if(difference>0l&&difference<holidayCalendar1.getStartTime()){
-            holidayCalendar1 = holidayCalendar;
-          }
-        }
-
-      }
-    }
-
-    return holidayCalendar1;
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(List<HolidayCalendar> beans) {
+    holidayCalendarRepository.deleteAll();
+    holidayCalendarRepository.saveAll(beans);
   }
 }

+ 2 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InitJobClassService.java

@@ -84,8 +84,7 @@ public class InitJobClassService extends BaseService {
   public boolean deleteById(String ids) {
     boolean flag = false;
     try {
-      if (ids.isEmpty()) {
-      } else {
+      if (!ids.isEmpty()) {
         String[] id = ids.split(",");
         if (null != id && id.length > 0) {
           for (String did : id) {
@@ -119,7 +118,7 @@ public class InitJobClassService extends BaseService {
     //分页信息
     Pageable pageable = PageRequest.of(page - 1, size); //页码:前端从1开始,jpa从0开始,做个转换
     Page pageUser = initJobClassRepository.findAll(specification, pageable);
-    List<InitJobClass> quartzs = pageUser.getContent();// 结果集
+    List quartzs = pageUser.getContent();// 结果集
     map.put("emps", quartzs);// 结果集
     map.put("count", pageUser.getTotalElements());// 总记录数
     return map;

+ 151 - 194
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterInfoService.java

@@ -2,20 +2,16 @@ package com.jiayue.ipfcst.console.service;
 
 import com.jiayue.ipfcst.common.core.exception.BusinessException;
 import com.jiayue.ipfcst.common.data.entity.InverterInfo;
-import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
 import com.jiayue.ipfcst.common.data.repository.InverterInfoRepository;
 import com.jiayue.ipfcst.common.data.service.BaseService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.*;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
-import javax.persistence.criteria.Predicate;
-import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Optional;
@@ -31,126 +27,105 @@ import java.util.stream.Collectors;
 @Service
 @Slf4j
 public class InverterInfoService extends BaseService {
-    private final InverterInfoRepository inverterInfoRepository;
+  private final InverterInfoRepository inverterInfoRepository;
 
-    @Autowired
-    public InverterInfoService(InverterInfoRepository inverterInfoRepository) {
-        this.inverterInfoRepository = inverterInfoRepository;
-    }
+  @Autowired
+  public InverterInfoService(InverterInfoRepository inverterInfoRepository) {
+    this.inverterInfoRepository = inverterInfoRepository;
+  }
 
 
-    /**
-     * 新增逆变器
-     *
-     * @param inverterInfo 逆变器
-     * @throws BusinessException 业务异常
-     */
-    @Transactional(propagation = Propagation.SUPPORTS)
-    public void add(InverterInfo inverterInfo) throws BusinessException {
-        this.inverterInfoRepository.save(inverterInfo);
-    }
+  /**
+   * 新增逆变器
+   *
+   * @param inverterInfo 逆变器
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void add(InverterInfo inverterInfo) throws BusinessException {
+    this.inverterInfoRepository.save(inverterInfo);
+  }
 
 
-    /**
-     * 批量新增逆变器
-     *
-     * @param inverterInfo 逆变器
-     * @throws BusinessException 业务异常
-     */
-    @Transactional(propagation = Propagation.SUPPORTS)
-    public void addALL(InverterInfo inverterInfo, Integer startValue, Integer endValue) throws BusinessException {
-        for (int i = startValue; i < startValue + endValue; i++) {
-          InverterInfo inverterInfo1 = new InverterInfo();
-          inverterInfo1.setManufacturer(inverterInfo.getManufacturer());
-          inverterInfo1.setReport(inverterInfo.getReport());
-          inverterInfo1.setInstallationTime(inverterInfo.getInstallationTime());
-          inverterInfo1.setName(inverterInfo.getName() + "-" + i);
-          inverterInfo1.setBatteryModel(inverterInfo.getBatteryModel());
-          inverterInfo1.setBatteryNumber(inverterInfo.getBatteryNumber());
-          inverterInfo1.setBox(inverterInfo.getBox());
-          inverterInfo1.setCapacity(inverterInfo.getCapacity());
-          inverterInfo1.setCollectorCircuit(inverterInfo.getCollectorCircuit());
-          inverterInfo1.setEfficiency(inverterInfo.getEfficiency());
-          inverterInfo1.setGroupSeries(inverterInfo.getGroupSeries());
-          inverterInfo1.setSample(inverterInfo.getSample());
-          inverterInfo1.setModelNumber(inverterInfo.getModelNumber());
-          inverterInfo1.setInterval(inverterInfo.getInterval());
-          inverterInfo1.setStationCode(inverterInfo.getStationCode());
-          inverterInfo1.setEquipmentNo(inverterInfo.getEquipmentNo());
-          inverterInfo1.setBackupA(inverterInfo.getBackupA());
-          inverterInfo1.setBackupB(inverterInfo.getBackupB());
-          inverterInfo1.setBackupC(inverterInfo.getBackupC());
-          this.inverterInfoRepository.save(inverterInfo1);
-        }
+  /**
+   * 批量新增逆变器
+   *
+   * @param inverterInfo 逆变器
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void addALL(InverterInfo inverterInfo, Integer startValue, Integer endValue) throws BusinessException {
+    for (int i = startValue; i < startValue + endValue; i++) {
+      InverterInfo inverterInfo1 = new InverterInfo();
+      inverterInfo1.setManufacturer(inverterInfo.getManufacturer());
+      inverterInfo1.setReport(inverterInfo.getReport());
+      inverterInfo1.setInstallationTime(inverterInfo.getInstallationTime());
+      inverterInfo1.setName(inverterInfo.getName() + "-" + i);
+      inverterInfo1.setBatteryModel(inverterInfo.getBatteryModel());
+      inverterInfo1.setBatteryNumber(inverterInfo.getBatteryNumber());
+      inverterInfo1.setBox(inverterInfo.getBox());
+      inverterInfo1.setCapacity(inverterInfo.getCapacity());
+      inverterInfo1.setCollectorCircuit(inverterInfo.getCollectorCircuit());
+      inverterInfo1.setEfficiency(inverterInfo.getEfficiency());
+      inverterInfo1.setGroupSeries(inverterInfo.getGroupSeries());
+      inverterInfo1.setSample(inverterInfo.getSample());
+      inverterInfo1.setModelNumber(inverterInfo.getModelNumber());
+      inverterInfo1.setInterval(inverterInfo.getInterval());
+      inverterInfo1.setStationCode(inverterInfo.getStationCode());
+      inverterInfo1.setEquipmentNo(inverterInfo.getEquipmentNo());
+      inverterInfo1.setBackupA(inverterInfo.getBackupA());
+      inverterInfo1.setBackupB(inverterInfo.getBackupB());
+      inverterInfo1.setBackupC(inverterInfo.getBackupC());
+      this.inverterInfoRepository.save(inverterInfo1);
     }
+  }
 
-    /**
-     * 修改逆变器
-     *
-     * @param inverterInfo 逆变器
-     * @throws BusinessException 业务异常
-     */
-    @Transactional(propagation = Propagation.SUPPORTS)
-    public void update(InverterInfo inverterInfo) throws BusinessException {
-        if (StringUtils.isEmpty(inverterInfo.getId())) {
-            throw new BusinessException("逆变器编号不能为空!");
-        } else {
-            this.inverterInfoRepository.save(inverterInfo);
-        }
+  /**
+   * 修改逆变器
+   *
+   * @param inverterInfo 逆变器
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void update(InverterInfo inverterInfo) throws BusinessException {
+    if (StringUtils.isEmpty(inverterInfo.getId())) {
+      throw new BusinessException("逆变器编号不能为空!");
+    } else {
+      this.inverterInfoRepository.save(inverterInfo);
     }
+  }
 
-    /**
-     * 删除逆变器
-     *
-     * @param id 逆变器编号
-     * @throws BusinessException 业务异常
-     */
-    @Transactional(propagation = Propagation.SUPPORTS)
-    public void delete(final Integer id) throws BusinessException {
-        if (StringUtils.isEmpty(id)) {
-            throw new BusinessException("逆变器编号不能为空!");
-        } else {
-            this.inverterInfoRepository.deleteById(id);
-        }
+  /**
+   * 删除逆变器
+   *
+   * @param id 逆变器编号
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void delete(final Integer id) throws BusinessException {
+    if (StringUtils.isEmpty(id)) {
+      throw new BusinessException("逆变器编号不能为空!");
+    } else {
+      this.inverterInfoRepository.deleteById(id);
     }
+  }
 
-    /**
-     * 查询逆变器
-     *
-     * @param id 逆变器编号
-     * @return 逆变器
-     * @throws BusinessException 业务异常
-     */
-    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-    public InverterInfo get(final Integer id) throws BusinessException {
-        Optional<InverterInfo> optional = this.inverterInfoRepository.findById(id);
-        if (optional.isPresent()) {
-            return optional.get();
-        } else {
-            throw new BusinessException("逆变器不存在!");
-        }
+  /**
+   * 查询逆变器
+   *
+   * @param id 逆变器编号
+   * @return 逆变器
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public InverterInfo get(final Integer id) throws BusinessException {
+    Optional<InverterInfo> optional = this.inverterInfoRepository.findById(id);
+    if (optional.isPresent()) {
+      return optional.get();
+    } else {
+      throw new BusinessException("逆变器不存在!");
     }
-
-    /*
-     *//**
-     * 查询逆变器【分页查询】
-     *
-     * @param inverter 查询条件
-     * @param page     页码
-     * @param size     每页记录数
-     * @return 分页结果
-     *//*
-    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-    public Page<Inverter> get(final Inverter inverter, final Integer page, final Integer size) {
-        ExampleMatcher matcher = ExampleMatcher.matching()
-                .withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains())
-                .withMatcher("box", ExampleMatcher.GenericPropertyMatchers.contains())
-                .withMatcher("collectorCircuit", ExampleMatcher.GenericPropertyMatchers.contains());
-        Example<Inverter> example = Example.of(inverter, matcher);
-        Pageable pageable = PageRequest.of(page - 1, size);
-        return this.inverterRepository.findAll(example, pageable);
-    }*/
-
+  }
 
   /**
    * 查询逆变器【分页查询】
@@ -168,100 +143,82 @@ public class InverterInfoService extends BaseService {
     return this.inverterInfoRepository.findAll(example, pageable);
   }
 
-    /**
-     * 查询逆变器【分页查询】
-     * @return 分页结果
-     */
-    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-    public List<InverterInfo> getAll() {
-        return inverterInfoRepository.findAll();
-    }
-
-
-    /**
-     * 查询所有样板机逆变器 create by xiuwei
-     *
-     * @return 逆变器信息
-     */
-    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-    public List<InverterInfo> getAllSample() {
-        InverterInfo inverterInfo = new InverterInfo();
-        inverterInfo.setSample(true);
-        return inverterInfoRepository.findAll(Example.of(inverterInfo));
-    }
-
-
-    /**
-     * 查询条件
-     *
-     * @param sample 是否样板机
-     * @return 查询条件
-     */
-    private Specification<InverterInfo> getDemoQuerySpecification(Boolean sample) {
-        return (Specification<InverterInfo>) (root, criteriaQuery, cb) -> {
-            List<Predicate> predicates = new ArrayList<>();
-            if (null != sample) {
-                predicates.add(cb.equal(root.get("sample").as(Boolean.class), sample));
-            }
+  /**
+   * 查询逆变器【分页查询】
+   *
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<InverterInfo> getAll() {
+    return inverterInfoRepository.findAll();
+  }
 
-            return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-        };
-    }
 
+  /**
+   * 查询所有样板机逆变器 create by xiuwei
+   *
+   * @return 逆变器信息
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<InverterInfo> getAllSample() {
+    InverterInfo inverterInfo = new InverterInfo();
+    inverterInfo.setSample(true);
+    return inverterInfoRepository.findAll(Example.of(inverterInfo));
+  }
 
-    /**
-     * 保存光伏组件信息
-     *
-     * @param inverterInfo 光伏组件信息
-     */
-    @Transactional(propagation = Propagation.SUPPORTS)
-    public void save(InverterInfo inverterInfo) {
-        this.inverterInfoRepository.save(inverterInfo);
-    }
+  /**
+   * 保存光伏组件信息
+   *
+   * @param inverterInfo 光伏组件信息
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void save(InverterInfo inverterInfo) {
+    this.inverterInfoRepository.save(inverterInfo);
+  }
 
-    /**
-     * 删除逆变器信息
-     */
-    @Transactional(propagation = Propagation.SUPPORTS)
-    public boolean delete(String ids) {
-        boolean flag = false;
-        if (!StringUtils.isEmpty(ids)) {
-            String[] idArray = ids.split(",");
-            if (idArray != null && idArray.length > 0) {
-                for (String id : idArray) {
-                    this.inverterInfoRepository.deleteById(Integer.valueOf(id));
-                    log.info("删除逆变器ID为[" + id + "]成功!");
+  /**
+   * 删除逆变器信息
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public boolean delete(String ids) {
+    boolean flag = false;
+    if (!StringUtils.isEmpty(ids)) {
+      String[] idArray = ids.split(",");
+      if (idArray != null && idArray.length > 0) {
+        for (String id : idArray) {
+          this.inverterInfoRepository.deleteById(Integer.valueOf(id));
+          log.info("删除逆变器ID为[" + id + "]成功!");
 
-                }
-                flag = true;
-            } else {
-                this.inverterInfoRepository.deleteById(Integer.valueOf(ids));
-                flag = true;
-                log.info("删除逆变器ID为[" + ids + "]成功!");
-            }
         }
+        flag = true;
+      } else {
+        this.inverterInfoRepository.deleteById(Integer.valueOf(ids));
+        flag = true;
+        log.info("删除逆变器ID为[" + ids + "]成功!");
+      }
+    }
 
-        return flag;
+    return flag;
 
-    }
+  }
 
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void saveCloud(InverterInfo bean) {
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(InverterInfo bean) {
 //        InverterInfo inverterInfo = inverterInfoRepository.findByName(bean.getName());
 //        if (null != inverterInfo) {
 //            bean.setId(inverterInfo.getId());
 //        }
-        inverterInfoRepository.save(bean);
-    }
+    inverterInfoRepository.save(bean);
+  }
 
 
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void saveCloud(List<InverterInfo> beans) {
-        if(beans != null && beans.size() > 0){
-            inverterInfoRepository.deleteAll();
-            inverterInfoRepository.saveAll(beans);
-        }
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(List<InverterInfo> beans) {
+    if (beans != null && beans.size() > 0) {
+      inverterInfoRepository.deleteAll();
+      inverterInfoRepository.saveAll(beans);
     }
+  }
 
   /**
    * 根据场站编号查询逆变器
@@ -272,10 +229,10 @@ public class InverterInfoService extends BaseService {
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
   public List<InverterInfo> getByStationCode(String stationCode) {
-    List<InverterInfo> resultList = new ArrayList<>();
-    resultList =  this.inverterInfoRepository.findAll();
-    if (!"ALL".equals(stationCode)){
-      resultList = resultList.stream().filter(s->s.getStationCode().equals(stationCode)).collect(Collectors.toList());
+    List<InverterInfo> resultList;
+    resultList = this.inverterInfoRepository.findAll();
+    if (!"ALL".equals(stationCode)) {
+      resultList = resultList.stream().filter(s -> s.getStationCode().equals(stationCode)).collect(Collectors.toList());
     }
     return resultList.stream().sorted(Comparator.comparing(InverterInfo::getStationCode)).collect(Collectors.toList());
   }

+ 10 - 103
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterStatusDataService.java

@@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.Predicate;
 import java.math.BigDecimal;
 import java.util.*;
@@ -34,109 +33,26 @@ public class InverterStatusDataService {
     this.inverterStatusDataRepository = inverterStatusDataRepository;
   }
 
-
   /**
    * 根据时间和编号 分页查询 逆变器数据 yh
    *
-   * @param startTime     开始时间
-   * @param endTime       结束时间
-   * @param no            设备编号
-   * @param page          页码
-   * @param size          条数
-   * @param timeSortOrder 排序
-   * @param noSortOrder   排序
+   * @param startTime  开始时间
+   * @param endTime    结束时间
+   * @param page       页码
+   * @param size       条数
+   * @param inverterId 设备编号
    * @return
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public Map<String, Object> findByTimeBetweenAndNoForPaging(Date startTime, Date endTime,
-                                                             Integer page, Integer size,
-                                                             Integer[] no, String timeSortOrder, String noSortOrder) {
-    Map<String, Object> map = new HashMap<>();
-    List<Sort.Order> orders = new ArrayList<Sort.Order>();
-
-    if (timeSortOrder.indexOf("asc") >= 0) {
-      orders.add(new Sort.Order(Sort.Direction.ASC, "time"));
-    } else {
-      orders.add(new Sort.Order(Sort.Direction.DESC, "time"));
-    }
-
-    if (noSortOrder.indexOf("asc") >= 0) {
-      orders.add(new Sort.Order(Sort.Direction.ASC, "equipmentNo"));
-    } else {
-      orders.add(new Sort.Order(Sort.Direction.DESC, "equipmentNo"));
-    }
-
-    Sort sort = Sort.by(orders);
-    Specification<InverterStatusData> specification = this.specificationFindByTimeAndNo(startTime, endTime, no);
-    Pageable pageable = PageRequest.of(page - 1, size, sort);
-    Page inverterStatusDatas = inverterStatusDataRepository.findAll(specification, pageable);
-    List<InverterStatusData> datas = new ArrayList<>();
-    datas = inverterStatusDatas.getContent();
-    this.defaultReplace(datas);
-    map.put("content", datas);
-    map.put("count", inverterStatusDatas.getTotalElements());
-    return map;
-  }
-
-  /**
-   * 根据时间和编号 分页查询条件 yh
-   *
-   * @param startTime 开始时间
-   * @param endTime   结束时间
-   * @param no        设备编号
-   * @return 过滤条件
-   */
-  Specification<InverterStatusData> specificationFindByTimeAndNo(final Date startTime, final Date endTime, final Integer[] no) {
-    return (Specification<InverterStatusData>) (root, criteriaQuery, cb) -> {
-      List<Predicate> predicates = new ArrayList<>();
-      if (startTime != null) {
-        //大于或等于传入时间
-        predicates.add(cb.greaterThanOrEqualTo(root.get("time").as(Date.class), startTime));
-      }
-      if (endTime != null) {
-        //小于传入时间
-        predicates.add(cb.lessThan(root.get("time").as(Date.class), endTime));
-      }
-
-//            if(no!=null){
-//              predicates.add(cb.equal(root.get("equipmentNo").as(Integer.class), no));
-//            }
-      if (no != null) {
-        List<Predicate> list = new ArrayList<Predicate>();
-        CriteriaBuilder.In<Integer> in = cb.in(root.get("equipmentNo"));
-        for (int i = 0; i < no.length; i++) {
-          in.value(no[i]);
-        }
-        predicates.add(in);
-      }
-
-      //添加排序的功能
-      return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-
-    };
-  }
-
-
-  /**
-   * 根据时间和编号 分页查询 逆变器数据 yh
-   *
-   * @param startTime     开始时间
-   * @param endTime       结束时间
-   * @param page          页码
-   * @param size          条数
-   * @param inverterId   设备编号
-   * @return
-   */
-  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public Map<String, Object> findByTimeBetweenForPaging(String stationCode,Date startTime, Date endTime,
+  public Map<String, Object> findByTimeBetweenForPaging(String stationCode, Date startTime, Date endTime,
                                                         Integer page, Integer size,
                                                         String inverterId) {
     Map<String, Object> map = new HashMap<>();
     Sort sort = Sort.by(Sort.Direction.DESC, "time");
-    Specification<InverterStatusData> specification = this.specificationFindByTime(stationCode,startTime, endTime,inverterId);
+    Specification<InverterStatusData> specification = this.specificationFindByTime(stationCode, startTime, endTime, inverterId);
     Pageable pageable = PageRequest.of(page - 1, size, sort); //页码:前端从1开始,jpa从0开始,做个转换
     Page inverterStatusDatas = inverterStatusDataRepository.findAll(specification, pageable);
-    List<InverterStatusData> datas = new ArrayList<>();
+    List<InverterStatusData> datas;
     datas = inverterStatusDatas.getContent();
     this.defaultReplace(datas);
     map.put("content", datas);// 结果集
@@ -151,11 +67,11 @@ public class InverterStatusDataService {
    * @param endTime   结束时间
    * @return 过滤条件
    */
-  Specification<InverterStatusData> specificationFindByTime(final String stationCode, final Date startTime, final Date endTime,final String inverterId) {
+  Specification<InverterStatusData> specificationFindByTime(final String stationCode, final Date startTime, final Date endTime, final String inverterId) {
     return (Specification<InverterStatusData>) (root, criteriaQuery, cb) -> {
       List<Predicate> predicates = new ArrayList<>();
       predicates.add(cb.equal(root.get("stationCode").as(String.class), stationCode));
-      if (!"ALL".equals(inverterId)){
+      if (!"ALL".equals(inverterId)) {
         predicates.add(cb.equal(root.get("equipmentId").as(String.class), inverterId));
       }
       if (startTime != null) {
@@ -202,14 +118,5 @@ public class InverterStatusDataService {
         i.setDayGridConnectedHours(null);
       }
     }
-
-  }
-
-
-  public List<InverterStatusData> findByTimeBetweenAndNo(Long startTime, Long endTime, Integer[] no) {
-    List<InverterStatusData> inverterStatusData = inverterStatusDataRepository.findByTimeBetweenAndEquipmentIdIn(new Date(startTime), new Date(endTime), no);
-
-    return inverterStatusData;
   }
-
 }

+ 10 - 13
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/powerofreference/iml/PowerOfReferenceCalculator1.java

@@ -5,8 +5,6 @@ import com.jiayue.ipfcst.common.data.constant.enums.ElectricFieldTypeEnum;
 import com.jiayue.ipfcst.common.data.entity.ElectricField;
 import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
-import com.jiayue.ipfcst.console.service.InverterInfoService;
-import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
 import com.jiayue.ipfcst.console.service.powerofreference.BasePowerOfReferenceCalculator;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -21,7 +19,6 @@ import java.util.List;
 /**
  * 样板机的发电比例法计算     判断参照功率
  *
- *
  * @author: xiuwei
  * @version: 3.0
  */
@@ -41,8 +38,8 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
    */
   List<SampleEquipment> samples = new ArrayList<>();
 
-  public PowerOfReferenceCalculator1( ElectricField electricField) {
-    super( electricField);
+  public PowerOfReferenceCalculator1(ElectricField electricField) {
+    super(electricField);
   }
 
 
@@ -59,11 +56,11 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
 
       if (stationTotalCapacity != null && stationTotalCapacity.compareTo(BigDecimal.ZERO) != 0) {
         for (SampleEquipment e : samples) {
-          ratio=e.updatePower().getSamplePowerGenerationRatio();
-          if(ratio.compareTo(BigDecimal.ONE)>0){
-            log.warn("样板机"+e.equipmentId+"发电量超装");
+          ratio = e.updatePower().getSamplePowerGenerationRatio();
+          if (ratio.compareTo(BigDecimal.ONE) > 0) {
+            log.warn("样板机" + e.equipmentId + "发电量超装");
           }
-          if(ratio.compareTo(BigDecimal.ZERO)>0){
+          if (ratio.compareTo(BigDecimal.ZERO) > 0) {
             avgRatio = avgRatio.add(ratio);
           }
         }
@@ -87,12 +84,12 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
     if (ElectricFieldTypeEnum.E1.equals(this.electricFieldType)) {
       List<InverterInfo> inverterInfos = inverterInfoService.getAllSample();
       for (InverterInfo i : inverterInfos) {
-        this.samples.add(new SampleEquipment(i.getId(),i.getCapacity()));
+        this.samples.add(new SampleEquipment(i.getId(), i.getCapacity()));
       }
     } else if (ElectricFieldTypeEnum.E2.equals(this.electricFieldType)) {
       List<WindTurbineInfo> windTurbineInfos = windTurbineInfoService.getAllSample();
       for (WindTurbineInfo i : windTurbineInfos) {
-        this.samples.add(new SampleEquipment(i.getId(),BigDecimal.valueOf(i.getMaxPower())));
+        this.samples.add(new SampleEquipment(i.getId(), BigDecimal.valueOf(i.getMaxPower())));
       }
     }
     return this;
@@ -125,7 +122,7 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
      * @param equipmentId 设备id
      * @param capacity    容量
      */
-    public SampleEquipment(int equipmentId,  BigDecimal capacity) {
+    public SampleEquipment(int equipmentId, BigDecimal capacity) {
       this.equipmentId = equipmentId;
       this.capacity = capacity;
     }
@@ -136,7 +133,7 @@ public class PowerOfReferenceCalculator1 extends BasePowerOfReferenceCalculator
      * @return 发电比例
      */
     protected BigDecimal getSamplePowerGenerationRatio() {
-      return realPower.divide(capacity,2,BigDecimal.ROUND_HALF_UP);
+      return realPower.divide(capacity, 2, RoundingMode.HALF_UP);
     }
 
     /**

+ 3 - 5
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/powerofreference/iml/PowerOfReferenceCalculator2.java

@@ -4,8 +4,6 @@ import com.jiayue.ipfcst.common.data.constant.enums.ElectricFieldTypeEnum;
 import com.jiayue.ipfcst.common.data.entity.ElectricField;
 import com.jiayue.ipfcst.common.data.entity.InverterInfo;
 import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
-import com.jiayue.ipfcst.console.service.InverterInfoService;
-import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
 import com.jiayue.ipfcst.console.service.powerofreference.BasePowerOfReferenceCalculator;
 import lombok.SneakyThrows;
 
@@ -27,8 +25,8 @@ public class PowerOfReferenceCalculator2 extends BasePowerOfReferenceCalculator
   Set<Integer> samples = new HashSet<>();
 
 
-  public PowerOfReferenceCalculator2( ElectricField electricField) {
-    super( electricField);
+  public PowerOfReferenceCalculator2(ElectricField electricField) {
+    super(electricField);
   }
 
 
@@ -42,7 +40,7 @@ public class PowerOfReferenceCalculator2 extends BasePowerOfReferenceCalculator
     for (Integer i : samples) {
       total = total.add(getPowerOfEquipment(i));
     }
-    return total.divide(BigDecimal.valueOf(samples.size()),2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(electricField.getGridCE()));
+    return total.divide(BigDecimal.valueOf(samples.size()), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(electricField.getGridCE()));
   }
 
   @SneakyThrows