Browse Source

增加类说明

songhaodong 3 years ago
parent
commit
197eddedb6

+ 1 - 0
ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/IcingShutdown.java

@@ -4,6 +4,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 /**
+ * 恶劣天气启停机类
  * @author shd
  * @since 2022-07-05
  */

+ 4 - 4
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/ExportToExcelController.java

@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
 import java.io.IOException;
 
 /**
+ * 导出到excel restful接口
+ *
  * @author shd
  * @since 2022-07-25
  */
@@ -37,8 +39,7 @@ public class ExportToExcelController {
    */
   @GetMapping("/fanUnitInfoExport")
   public ResponseVO fanUnitInfoExport() {
-    exportToExcelService.fanUnitInfoExport();
-    return ResponseVO.success("导出结束");
+    return exportToExcelService.fanUnitInfoExport();
   }
 
   /**
@@ -47,8 +48,7 @@ public class ExportToExcelController {
    */
   @GetMapping("/cutOutSpeedSpecifyInfoExport")
   public ResponseVO cutOutSpeedSpecifyInfoExport() {
-    exportToExcelService.cutOutSpeedSpecifyInfoExport();
-    return ResponseVO.success("导出结束");
+    return exportToExcelService.cutOutSpeedSpecifyInfoExport();
   }
   /**
    * 功率曲线导出

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/ReadToMysqlController.java

@@ -12,6 +12,7 @@ import java.io.IOException;
 import java.sql.SQLException;
 
 /**
+ * 读取excel到数据库restful接口
  * @author shd
  * @since 2022-06-02
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindSpeedPointInfoController.java

@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 风速点表restful接口
  * @author shd
  * @since 2022-06-01
  */

+ 2 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/WindTurbinePowerCurveController.java

@@ -13,6 +13,8 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 风机曲线restful接口
+ *
  * @author shd
  * @since 2022-06-01
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/CutOutSpeedSpecifyInfoService.java

@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
+ * 切出停机业务层
  * @author shd
  * @since 2022-05-31
  */

+ 24 - 14
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ExportToExcelService.java

@@ -2,6 +2,7 @@ package com.jiayue.ipfcst.service;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.poi.excel.ExcelWriter;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
 import com.jiayue.ipfcst.common.data.entity.CutOutSpeedSpecifyInfo;
 import com.jiayue.ipfcst.common.data.entity.FanUnitInfo;
 import com.jiayue.ipfcst.common.data.entity.WindSpeedPointInfo;
@@ -20,6 +21,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
+ * 导出到excel业务层
  * @author shd
  * @since 2022-07-25
  */
@@ -211,8 +213,8 @@ public class ExportToExcelService extends BaseService {
   /**
    * 机组信息导出
    */
-  public void fanUnitInfoExport(){
-    ExcelWriter writer = new ExcelWriter("d:/baa.xls", "机组信息");
+  public ResponseVO fanUnitInfoExport(){
+    try (ExcelWriter writer = new ExcelWriter("d:/baa.xls", "机组信息")) {
     List<String> list = new ArrayList<>();
     List<List<String>> lists = new ArrayList<>();
     List<FanUnitInfo> fanUnitInfoList = fanUnitInfoRepository.findAll();
@@ -233,23 +235,31 @@ public class ExportToExcelService extends BaseService {
     writer.write(lists, true);
     //关闭writer,释放内存
     writer.close();
+    } catch (cn.hutool.poi.exceptions.POIException e) {
+      return ResponseVO.error(e);
+    }
+    return ResponseVO.success();
   }
 
   /**
    * 切出风速导出
    */
-  public void cutOutSpeedSpecifyInfoExport(){
-    ExcelWriter writer = new ExcelWriter("d:/baa.xls", "应切出未停机发电");
-    List<CutOutSpeedSpecifyInfo> cutOutSpeedSpecifyInfos = cutOutSpeedSpecifyInfoRepository.findAll();
-    writer.addHeaderAlias("id", "序号");
-    writer.addHeaderAlias("lowerWindSpeedLimit", "风速下限(包含)m/s");
-    writer.addHeaderAlias("highWindSpeedLimit", "风速上限(不包含)m/s");
-    writer.addHeaderAlias("powerGeneration", "发电功率kW");
-    writer.addHeaderAlias("fanId", "所属机组");
-    //一次性写出内容,强制输出标题
-    writer.write(cutOutSpeedSpecifyInfos, true);
-    //关闭writer,释放内存
-    writer.close();
+  public ResponseVO cutOutSpeedSpecifyInfoExport() {
+    try (ExcelWriter writer = new ExcelWriter("d:/baa.xls", "应切出未停机发电")) {
+      List<CutOutSpeedSpecifyInfo> cutOutSpeedSpecifyInfos = cutOutSpeedSpecifyInfoRepository.findAll();
+      writer.addHeaderAlias("id", "序号");
+      writer.addHeaderAlias("lowerWindSpeedLimit", "风速下限(包含)m/s");
+      writer.addHeaderAlias("highWindSpeedLimit", "风速上限(不包含)m/s");
+      writer.addHeaderAlias("powerGeneration", "发电功率kW");
+      writer.addHeaderAlias("fanId", "所属机组");
+      //一次性写出内容,强制输出标题
+      writer.write(cutOutSpeedSpecifyInfos, true);
+      //关闭writer,释放内存
+      writer.close();
+    } catch (cn.hutool.poi.exceptions.POIException e) {
+      return ResponseVO.error(e);
+    }
+    return ResponseVO.success();
   }
 
   public void windTurbinePowerCurveExport(){

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/FanUnitInfoService.java

@@ -17,6 +17,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 风机信息业务层
  * @author shd
  * @since 2022-05-31
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ModifyShorterDataService.java

@@ -17,6 +17,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
+ * 修改短期数据业务层
  * @author shd
  * @since 2022-06-15
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/ReadToMysqlService.java

@@ -29,6 +29,7 @@ import java.text.DecimalFormat;
 import java.util.*;
 
 /**
+ * 读取excel到数据库业务层
  * @author shd
  * @since 2022-07-25
  */

+ 1 - 1
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindSpeedPointInfoService.java

@@ -17,7 +17,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
- *
+ * 风速点表业务层
  *
  * @author shd
  * @since 2022-06-01

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/WindTurbinePowerCurveService.java

@@ -19,6 +19,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
+ * 风机曲线业务层
  * @author shd
  * @since 2022-06-01
  */

+ 1 - 0
ipfcst/ipfcst-reportquery/src/main/resources/db.setting

@@ -1,4 +1,5 @@
 ## db.setting文件
+## hutool导入导出配置
 
 url = jdbc:mysql://localhost:3306/ipfcst-v3?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
 user = root