ソースを参照

电厂大屏数据抓取test

Wang Zi Wen 3 年 前
コミット
86463629e1

+ 290 - 0
src/main/java/io/renren/modules/test/TestPullDataCsv.java

@@ -0,0 +1,290 @@
+package io.renren.modules.test;
+
+import com.opencsv.CSVReader;
+import io.renren.modules.aspen.entity.TDashboarddayelecEntity;
+import io.renren.modules.aspen.service.TDashboarddayelecService;
+import io.renren.modules.sys.controller.AbstractController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * 电厂大屏抓取数据测试类(.csv文件)
+ *
+ * @author Wang Zi Wen
+ * @email wangggziwen@163.com
+ * @date 2022/04/15 11:09:02
+ */
+@Component
+@Configuration      //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling   // 2.开启定时任务
+public class TestPullDataCsv extends AbstractController {
+
+    @Autowired
+    private TDashboarddayelecService tDashboarddayelecService;
+
+    public static void main(String[] args) {
+//        TestPullDataCsv testPullDataCsv = new TestPullDataCsv();
+//        testPullDataCsv.getCsvData();
+    }
+
+//    @Scheduled(cron = "9,19,29,39,49,59 * * * * ?" )
+    public void getCsvData(){
+        logger.info("实时获取数据");
+//        String csvFile = "D://ssyFile/物料.csv";
+        String csvFile = "D://elecdashboardaspen/elecDashboardData1.csv";
+        TDashboarddayelecEntity tDashboarddayelecEntity = new TDashboarddayelecEntity();
+        CSVReader reader = null;
+        try {
+            reader = new CSVReader(new FileReader(csvFile));
+            String[] line;
+            //定义行数
+            int i = 0;
+            while ((line = reader.readNext()) != null) {
+                i++;
+                if (i == 2) {
+                    logger.info("第" + i + "行");
+                    for (int j = 2; j < 7; j++) {
+                        logger.info("读数:" + line[j]);
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setGtg1Lv(line[2]);
+                    tDashboarddayelecEntity.setGtg2Lv(line[3]);
+                    tDashboarddayelecEntity.setGtg3Lv(line[4]);
+                    tDashboarddayelecEntity.setStg1Lv(line[5]);
+                    tDashboarddayelecEntity.setMwhLv(line[6]);
+                }
+                if (i == 3) {
+                    logger.info("第" + i + "行");
+                    for (int j = 0; j < 6; j++) {
+                        logger.info("读数:" + line[j]);
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setGtg1Wr(line[2]);
+                    tDashboarddayelecEntity.setGtg2Wr(line[3]);
+                    tDashboarddayelecEntity.setGtg3Wr(line[4]);
+                    tDashboarddayelecEntity.setStg1Wr(line[5]);
+                }
+                if (i == 4) {
+                    logger.info("第" + i + "行");
+                    for (int j = 0; j < 6; j++) {
+                        logger.info("读数:" + line[j]);
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setMwhWr(line[6]);
+                }
+                if (i == 6) {
+                    logger.info("第" + i + "行");
+                    for (int j = 2; j < 7; j++) {
+                        logger.info("读数:" + line[j]);
+                        if (line[j].equals("")) {
+                            line[j] = "0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setHhp(line[2]);
+                    tDashboarddayelecEntity.setHp(line[3]);
+                    tDashboarddayelecEntity.setLp(line[4]);
+                    tDashboarddayelecEntity.setMp(line[5]);
+                    tDashboarddayelecEntity.setTotalConsumption(line[6]);
+                }
+                if (i == 9) {
+                    logger.info("第" + i + "行");
+                    for (int j = 2; j < 6; j++) {
+                        logger.info("读数:" + line[j]);
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+//                    Integer HhpNum=new Integer(line[2]).intValue();
+//                    Integer HpNum=new Integer(line[3]).intValue();
+//                    Integer LpNum=new Integer(line[4]).intValue();
+//                    Integer MpNum=new Integer(line[5]).intValue();
+                    tDashboarddayelecEntity.setHhpNum(line[2]);
+                    tDashboarddayelecEntity.setHpNum(line[3]);
+                    tDashboarddayelecEntity.setLpNum(line[4]);
+                    tDashboarddayelecEntity.setMpNum(line[5]);
+
+                }
+                if (i == 10) {
+                    logger.info("第" + i + "行");
+                    for (int j = 2; j < 6; j++) {
+                        logger.info("读数:" + line[j]);
+                        if (line[j].equals("")) {
+                            line[j] = "0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setHhpTemp(line[2]);
+                    tDashboarddayelecEntity.setHpTemp(line[3]);
+                    tDashboarddayelecEntity.setLpTemp(line[4]);
+                    tDashboarddayelecEntity.setMpTemp(line[5]);
+                }
+                /* SS */
+                if (i == 13) {
+                    logger.info("第" + i + "行");
+                    for(int j=2;j<5;j++){
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setShihua(line[2]);
+                    tDashboarddayelecEntity.setShiyou(line[3]);
+                    tDashboarddayelecEntity.setShunshiliang(line[4]);
+                }
+                if (i == 18) {
+                    logger.info("第" + i + "行");
+                    for(int j=2;j<6;j++){
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setYpg(line[2]);
+                    tDashboarddayelecEntity.setDaodianliang(line[3]);
+                    tDashboarddayelecEntity.setEveLec(line[4]);
+                    tDashboarddayelecEntity.setFenggucha(rounding(line[5]));
+                }
+                if (i == 20) {
+                    logger.info("第" + i + "行");
+                    for(int j=2;j<4;j++){
+                        if (line[j].equals("")) {
+                            line[j] = "0.0";
+                        }else {
+                            if (!Character.isDigit(line[j].charAt(0))) {
+                                line[j] = "0.0";
+                            }else {
+                                BigDecimal b = new BigDecimal(Double.parseDouble(line[j]));
+                                double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                                line[j] = String.valueOf(f);
+                            }
+                        }
+                        logger.info(line[j]);
+                    }
+                    tDashboarddayelecEntity.setBycElec(line[2]);
+                    tDashboarddayelecEntity.setBocElec(line[3]);
+                }
+            }
+            tDashboarddayelecEntity.setCreatedate(new Date());
+            tDashboarddayelecEntity.setDataDate(new Date());
+            Calendar now = Calendar.getInstance();
+            tDashboarddayelecEntity.setDateDay(String.valueOf(now.get(Calendar.DAY_OF_MONTH)));
+            logger.info("dashboardData:" + tDashboarddayelecEntity);
+            tDashboarddayelecService.save(tDashboarddayelecEntity);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String rounding(String lineNum) {
+        try {
+            logger.info("读数:" + lineNum);
+            if (lineNum.equals("")) {
+                lineNum = "0.0";
+            }else {
+                if (!Character.isDigit(lineNum.charAt(0))) {
+                    if ("-".equals(lineNum.substring(0,1))){
+                        BigDecimal b = new BigDecimal(Double.parseDouble(lineNum));
+                        double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                        lineNum = String.valueOf(f);
+                    }else {
+                        lineNum = "0.0";
+                    }
+                }else {
+                    BigDecimal b = new BigDecimal(Double.parseDouble(lineNum));
+                    double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                    lineNum = String.valueOf(f);
+                }
+            }
+            logger.info(lineNum);
+            return lineNum;
+        }catch (Exception e) {
+            logger.error(String.valueOf(e));
+            return "0.0";
+        }
+    }
+
+}

+ 230 - 0
src/main/java/io/renren/modules/test/TestPullDataExcel.java

@@ -0,0 +1,230 @@
+package io.renren.modules.test;
+
+import io.renren.modules.test.entity.ElecDashboardData;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * 电厂大屏抓取数据测试类(.xls/.xlsx文件)
+ *
+ * @author: Wang Zi Wen
+ * @email: wangggziwen@163.com
+ * @datetime: 2022/8/30 9:22
+ */
+public class TestPullDataExcel {
+
+    public static void main(String[] args) {
+        TestPullDataExcel testPullDataExcel = new TestPullDataExcel();
+        testPullDataExcel.getExcelData();
+    }
+
+    /**
+     * 抓取excel数据
+     */
+    private void getExcelData() {
+        // excel对象
+        Workbook workbook = null;
+        try {
+            // 文件读取路径
+            String filePath = "C://elecdashboard/elecDashboardData.xlsx";
+            // 文件输入流
+            InputStream inputStream = new FileInputStream(filePath);
+            // 根据文件后缀名,决定excel(workbook)对象的具体实现
+            if (filePath.substring(filePath.lastIndexOf(".") + 1).equals("xls")){
+                workbook = new HSSFWorkbook(inputStream);
+            }else if (filePath.substring(filePath.lastIndexOf(".") + 1).equals("xlsx")){
+                workbook = new XSSFWorkbook(inputStream);
+            }
+            // 根据sheet index,获取sheet对象
+            Sheet sheet1 = workbook.getSheetAt(0);  // 数据监控
+            Sheet sheet2 = workbook.getSheetAt(1);  // 蒸汽平衡
+            Sheet sheet3 = workbook.getSheetAt(2);  // 环保监控
+            // 电厂大屏数据对象
+            ElecDashboardData elecDashboardData = new ElecDashboardData();
+            //========================================电厂大屏数据第一页:数据监控========================================
+            // 发电机
+            String gtg1PowerGenLevel = this.getCellData(sheet1, 2, 2);  // 1#GTG发电水平
+            String gtg1Efficiency = this.getCellData(sheet1, 3, 2);     // 1#GTG效率(百分比)
+            String gtg2PowerGenLevel = this.getCellData(sheet1, 2, 3);  // 2#GTG发电水平
+            String gtg2Efficiency = this.getCellData(sheet1, 3, 3);     // 2#GTG效率(百分比)
+            String gtg3PowerGenLevel = this.getCellData(sheet1, 2, 4);  // 3#GTG发电水平
+            String gtg3Efficiency = this.getCellData(sheet1, 3, 4);     // 3#GTG效率(百分比)
+            String stgPowerGenLevel = this.getCellData(sheet1, 2, 5);   // STG发电水平
+            String stgEfficiency = this.getCellData(sheet1, 3, 5);      // STG效率(百分比)
+            String totalPowerGen = this.getCellData(sheet1, 2, 6);      // 总发电量
+            elecDashboardData.setGtg1PowerGenLevel(gtg1PowerGenLevel);
+            elecDashboardData.setGtg1Efficiency(gtg1Efficiency);
+            elecDashboardData.setGtg2PowerGenLevel(gtg2PowerGenLevel);
+            elecDashboardData.setGtg2Efficiency(gtg2Efficiency);
+            elecDashboardData.setGtg3PowerGenLevel(gtg3PowerGenLevel);
+            elecDashboardData.setGtg3Efficiency(gtg3Efficiency);
+            elecDashboardData.setStgPowerGenLevel(stgPowerGenLevel);
+            elecDashboardData.setStgEfficiency(stgEfficiency);
+            elecDashboardData.setTotalPowerGen(totalPowerGen);
+            // 蒸汽
+            String steamHhp = this.getCellData(sheet1, 6, 2);    // 蒸汽HHP
+            String steamHp = this.getCellData(sheet1, 6, 3);     // 蒸汽HP
+            String steamMp = this.getCellData(sheet1, 6, 4);     // 蒸汽MP
+            String steamLp = this.getCellData(sheet1, 6, 5);     // 蒸汽LP
+            elecDashboardData.setSteamHhp(steamHhp);
+            elecDashboardData.setSteamHp(steamHp);
+            elecDashboardData.setSteamMp(steamMp);
+            elecDashboardData.setSteamLp(steamLp);
+            // 天然气
+            String gasRealTime = this.getCellData(sheet1, 9, 2);    // 瞬时量
+            String gasLeft = this.getCellData(sheet1, 9, 3);        // 日剩余量
+            String gasUsed = this.getCellData(sheet1, 9, 4);        // 日消耗量(实际)
+            String gasPlan = this.getCellData(sheet1, 9, 5);        // 日消耗量(计划)
+            String gasElec = this.getCellData(sheet1, 11, 2);       // 电厂
+            String gasSynGas = this.getCellData(sheet1, 11, 3);     // 合成气
+            String gasU2 = this.getCellData(sheet1, 11, 4);         // U2
+            String gasStyrene = this.getCellData(sheet1, 11, 5);    // 苯乙烯
+            elecDashboardData.setGasRealTime(gasRealTime);
+            elecDashboardData.setGasLeft(gasLeft);
+            elecDashboardData.setGasUsed(gasUsed);
+            elecDashboardData.setGasPlan(gasPlan);
+            elecDashboardData.setGasElec(gasElec);
+            elecDashboardData.setGasSynGas(gasSynGas);
+            elecDashboardData.setGasU2(gasU2);
+            elecDashboardData.setGasStyrene(gasStyrene);
+            // 电量
+            String elecPowerGen = this.getCellData(sheet1, 14, 2);    // 昨日发电量
+            String elecPowerSwitch = this.getCellData(sheet1, 14, 3); // 倒电量
+            String elecUsed = this.getCellData(sheet1, 14, 4);        // 每日用电量
+            String elecDiff = this.getCellData(sheet1, 14, 5);        // 每日峰谷差
+            String elecBycUsed = this.getCellData(sheet1, 16, 2);     // BYC用电量
+            String elecBocUsed = this.getCellData(sheet1, 16, 3);     // BOC用电量
+            elecDashboardData.setElecPowerGen(elecPowerGen);
+            elecDashboardData.setElecPowerSwitch(elecPowerSwitch);
+            elecDashboardData.setElecUsed(elecUsed);
+            elecDashboardData.setElecDiff(elecDiff);
+            elecDashboardData.setElecBycUsed(elecBycUsed);
+            elecDashboardData.setElecBocUsed(elecBocUsed);
+            // 煤耗
+            String carbonUsed = this.getCellData(sheet1, 19, 2);        // 每日煤耗量
+            String carbonRealTime = this.getCellData(sheet1, 19, 3);    // 瞬时煤耗量
+            elecDashboardData.setCarbonUsed(carbonUsed);
+            elecDashboardData.setCarbonRealTime(carbonRealTime);
+            // SUB
+            String sub = this.getCellData(sheet1, 22, 2);               // SUB
+            String subFurnaceLoad = this.getCellData(sheet1, 22, 3);    // SUB开工锅炉负荷(百分比)
+            elecDashboardData.setSub(sub);
+            elecDashboardData.setSubFurnaceLoad(subFurnaceLoad);
+            //========================================电厂大屏数据第二页:蒸汽平衡=======================================
+            // HHP
+            String hhpPphhp = this.getCellData(sheet2, 2, 1);   // HHP PPHHP
+            String hhpAaae = this.getCellData(sheet2, 2, 2);    // HHP AA/AE
+            String hhpGaa = this.getCellData(sheet2, 2, 3);     // HHP GAA
+            String hhpSyn = this.getCellData(sheet2, 2, 4);     // HHP SYN
+            String hhpP3802 = this.getCellData(sheet2, 2, 5);   // HHP P3802
+            elecDashboardData.setHhpPphhp(hhpPphhp);
+            elecDashboardData.setHhpAaae(hhpAaae);
+            elecDashboardData.setHhpGaa(hhpGaa);
+            elecDashboardData.setHhpSyn(hhpSyn);
+            elecDashboardData.setHhpP3802(hhpP3802);
+            // HP
+            String hpLpg = this.getCellData(sheet2, 5, 1);    // HP LPG(百分比)
+            String hpSub = this.getCellData(sheet2, 5, 2);    // HP SUB(百分比)
+            String hpNg = this.getCellData(sheet2, 5, 3);    // HP NG
+            String hpJ1501 = this.getCellData(sheet2, 5, 4);    // HP J1501(百分比)
+            String hpJ1504In = this.getCellData(sheet2, 5, 5);    // HP J1504入
+            String hpJ1504Out = this.getCellData(sheet2, 5, 6);    // HP J1504出
+            String hpUser = this.getCellData(sheet2, 5, 7);    // HP HP用户
+            elecDashboardData.setHpLpg(hpLpg);
+            elecDashboardData.setHpSub(hpSub);
+            elecDashboardData.setHpNg(hpNg);
+            elecDashboardData.setHpJ1501(hpJ1501);
+            elecDashboardData.setHpJ1504In(hpJ1504In);
+            elecDashboardData.setHpJ1504Out(hpJ1504Out);
+            elecDashboardData.setHpUser(hpUser);
+            // MP
+            String mpNcipmp = this.getCellData(sheet2, 8, 1);   // MP NCI MP
+            String mp150511 = this.getCellData(sheet2, 8, 2);   // MP 15051_2(百分比)
+            String mp150512 = this.getCellData(sheet2, 8, 3);   // MP 15051_2(百分比)
+            String mpPpmp = this.getCellData(sheet2, 8, 4);     // MP PPMP
+            String mpP9801In = this.getCellData(sheet2, 8, 5);  // MP P9801入
+            String mpP9801Out = this.getCellData(sheet2, 8, 6); // MP P9801出
+            String mpJ1502 = this.getCellData(sheet2, 8, 7);    // MP J1502(百分比)
+            String mpUser = this.getCellData(sheet2, 8, 8);     // MP MP用户
+            elecDashboardData.setMpNcipMp(mpNcipmp);
+            elecDashboardData.setMp150511(mp150511);
+            elecDashboardData.setMp150512(mp150512);
+            elecDashboardData.setMpPpMp(mpPpmp);
+            elecDashboardData.setMpP9801In(mpP9801In);
+            elecDashboardData.setMpP9801Out(mpP9801Out);
+            elecDashboardData.setMpJ1502(mpJ1502);
+            elecDashboardData.setMpUser(mpUser);
+            // LP
+            String lpPpLp = this.getCellData(sheet2, 11, 1);        // LP PP LP
+            String lpEmpty = this.getCellData(sheet2, 11, 2);       // LP防空
+            String lpMpLetdown = this.getCellData(sheet2, 11, 3);   // LP MP LETDOWN
+            String lpJ1509 = this.getCellData(sheet2, 11, 4);       // LP J1509(百分比)
+            String lpJ1503 = this.getCellData(sheet2, 11, 5);       // LP J1503(百分比)
+            String lpLdpeTs = this.getCellData(sheet2, 11, 6);      // LP LDPE TS
+            String lpLdpeDm = this.getCellData(sheet2, 11, 7);      // LP LDPE DM
+            String lpUser = this.getCellData(sheet2, 11, 8);        // LP用户
+            elecDashboardData.setLpPpLp(lpPpLp);
+            elecDashboardData.setLpEmpty(lpEmpty);
+            elecDashboardData.setLpMpLetdown(lpMpLetdown);
+            elecDashboardData.setLpJ1509(lpJ1509);
+            elecDashboardData.setLpJ1503(lpJ1503);
+            elecDashboardData.setLpLdpeTs(lpLdpeTs);
+            elecDashboardData.setLpLdpeDm(lpLdpeDm);
+            elecDashboardData.setLpUser(lpUser);
+            // BCC
+            String bccSyn = this.getCellData(sheet2, 14, 1);    // BCC SYN
+            String bccYpc = this.getCellData(sheet2, 14, 2);    // BCC YPC
+            elecDashboardData.setBccSyn(bccSyn);
+            elecDashboardData.setBccYpc(bccYpc);
+            //========================================电厂大屏数据第三页:环保监控=======================================
+            System.out.println(elecDashboardData.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                workbook.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 抓取单元格数据
+     * 如果单元格数据为空,返回空字符串
+     *
+     * @param sheet excel的sheet对象
+     * @param rowIndex 行下标
+     * @param cellIndex 列下标
+     * @return 单元格数据
+     */
+    private String getCellData(Sheet sheet, int rowIndex, int cellIndex) {
+        // 单元格数据
+        String cellValue = "";
+        try {
+            // 根据行下标,获取行对象
+            Row row = sheet.getRow(rowIndex);
+            // 根据列下表,获取单元格对象,如果单元格的值为空,则返回null
+            Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
+            if (cell != null) {
+                // 设置单元格格式
+                cell.setCellType(CellType.STRING);
+                // 获取单元格数据
+                cellValue = cell.getStringCellValue();
+                // 将excel空单元格中取到的"#NAME?"转换为空字符串
+                if ("#NAME?".equals(cellValue)) {
+                    cellValue = "";
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            return cellValue;
+        }
+    }
+}

+ 644 - 0
src/main/java/io/renren/modules/test/entity/ElecDashboardData.java

@@ -0,0 +1,644 @@
+package io.renren.modules.test.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 电厂大屏数据(第一页)
+ *
+ * @author: Wang Zi Wen
+ * @email: wangggziwen@163.com
+ * @datetime: 2022/8/30 10:33
+ */
+@Data
+@TableName("T_ELEC_DASHBOARD_DATA_SHEET1")
+@KeySequence(value = "SEQ_T_ELEC_DASHBOARD_DATA_SHEET1")
+public class ElecDashboardData implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(type = IdType.INPUT)
+    private Integer id;
+
+    private String gtg1PowerGenLevel;   // 1#GTG 发电水平
+    private String gtg1Efficiency;      // 1#GTG 效率(百分比)
+    private String gtg2PowerGenLevel;   // 2#GTG 发电水平
+    private String gtg2Efficiency;      // 2#GTG 效率(百分比)
+    private String gtg3PowerGenLevel;   // 3#GTG 发电水平
+    private String gtg3Efficiency;      // 3#GTG效 率(百分比)
+    private String stgPowerGenLevel;    // STG 发电水平
+    private String stgEfficiency;       // STG 效率(百分比)
+    private String totalPowerGen;       // 总发电量
+
+    private String steamHhp; // 蒸汽 HHP
+    private String steamHp;  // 蒸汽 HP
+    private String steamMp;  // 蒸汽 MP
+    private String steamLp;  // 蒸汽 LP
+
+    private String gasRealTime; // 瞬时量
+    private String gasLeft;     // 日剩余量
+    private String gasUsed;     // 日消耗量(实际)
+    private String gasPlan;     // 日消耗量(计划)
+    private String gasElec;     // 电厂
+    private String gasSynGas;   // 合成气
+    private String gasU2;       // U2
+    private String gasStyrene;  // 苯乙烯
+
+    private String elecPowerGen;    // 昨日发电量
+    private String elecPowerSwitch; // 倒电量
+    private String elecUsed;        // 每日用电量
+    private String elecDiff;        // 每日峰谷差
+    private String elecBycUsed;     // BYC用电量
+    private String elecBocUsed;     // BOC用电量
+
+    private String carbonUsed;      // 每日煤耗量
+    private String carbonRealTime;  // 瞬时煤耗量
+
+    private String sub;             // SUB
+    private String subFurnaceLoad;  // SUB开工锅炉负荷(百分比)
+
+    private String hhpPphhp;    // HHP PPHHP
+    private String hhpAaae;     // HHP AA/AE
+    private String hhpGaa;      // HHP GAA
+    private String hhpSyn;      // HHP SYN
+    private String hhpP3802;    // HHP P3802
+
+    private String hpLpg;       // HP LPG(百分比)
+    private String hpSub;       // HP SUB(百分比)
+    private String hpNg;        // HP NG
+    private String hpJ1501;     // HP J1501(百分比)
+    private String hpJ1504In;   // HP J1504入
+    private String hpJ1504Out;  // HP J1504出
+    private String hpUser;      // HP HP用户
+
+    private String mpNcipMp;    // MP NCI MP
+    private String mp150511;    // MP 15051_2(百分比)
+    private String mp150512;    // MP 15051_2(百分比)
+    private String mpPpMp;      // MP PPMP
+    private String mpP9801In;   // MP P9801入
+    private String mpP9801Out;  // MP P9801出
+    private String mpJ1502;     // MP J1502(百分比)
+    private String mpUser;      // MP MP用户
+
+    private String lpPpLp;      // LP PP LP
+    private String lpEmpty;     // LP防空
+    private String lpMpLetdown; // LP MP LETDOWN
+    private String lpJ1509;     // LP J1509(百分比)
+    private String lpJ1503;     // LP J1503(百分比)
+    private String lpLdpeTs;    // LP LDPE TS
+    private String lpLdpeDm;    // LP LDPE DM
+    private String lpUser;      // LP用户
+
+    private String bccSyn;  // BCC SYN
+    private String bccYpc;  // BCC YPC
+
+    @Override
+    public String toString() {
+        return "gtg1PowerGenLevel:" + this.gtg1PowerGenLevel + "\n" +
+                "gtg1Efficiency:" + this.gtg1Efficiency + "\n" +
+                "gtg2PowerGenLevel:" + this.gtg2PowerGenLevel + "\n" +
+                "gtg2Efficiency:" + this.gtg2Efficiency + "\n" +
+                "gtg3PowerGenLevel:" + this.gtg3PowerGenLevel + "\n" +
+                "gtg3Efficiency:" + this.gtg3Efficiency + "\n" +
+                "stgPowerGenLevel:" + this.stgPowerGenLevel + "\n" +
+                "stgEfficiency:" + this.stgEfficiency + "\n" +
+                "totalPowerGen:" + this.totalPowerGen + "\n" +
+                "steamHhp:" + this.steamHhp + "\n" +
+                "steamHp:" + this.steamHp + "\n" +
+                "steamMp:" + this.steamMp + "\n" +
+                "steamLp:" + this.steamLp + "\n" +
+                "gasRealTime:" + this.gasRealTime + "\n" +
+                "gasLeft:" + this.gasLeft + "\n" +
+                "gasUsed:" + this.gasUsed + "\n" +
+                "gasPlan:" + this.gasPlan + "\n" +
+                "gasElec:" + this.gasElec + "\n" +
+                "gasSynGas:" + this.gasSynGas + "\n" +
+                "gasU2:" + this.gasU2 + "\n" +
+                "gasStyrene:" + this.gasStyrene + "\n" +
+                "elecPowerGen:" + this.elecPowerGen + "\n" +
+                "elecPowerSwitch:" + this.elecPowerSwitch + "\n" +
+                "elecUsed:" + this.elecUsed + "\n" +
+                "elecDiff:" + this.elecDiff + "\n" +
+                "elecBycUsed:" + this.elecBycUsed + "\n" +
+                "elecBocUsed:" + this.elecBocUsed + "\n" +
+                "carbonUsed:" + this.carbonUsed + "\n" +
+                "carbonRealTime:" + this.carbonRealTime + "\n" +
+                "sub:" + this.sub + "\n" +
+                "subFurnaceLoad:" + this.subFurnaceLoad + "\n" +
+                "hhpPphhp:" + this.hhpPphhp + "\n" +
+                "hhpAaae:" + this.hhpAaae + "\n" +
+                "hhpGaa:" + this.hhpGaa + "\n" +
+                "hhpSyn:" + this.hhpSyn + "\n" +
+                "hhpP3802:" + this.hhpP3802 + "\n" +
+                "hpLpg:" + this.hpLpg + "\n" +
+                "hpSub:" + this.hpSub + "\n" +
+                "hpNg:" + this.hpNg + "\n" +
+                "hpJ1501:" + this.hpJ1501 + "\n" +
+                "hpJ1504In:" + this.hpJ1504In + "\n" +
+                "hpJ1504Out:" + this.hpJ1504Out + "\n" +
+                "hpUser:" + this.hpUser + "\n" +
+                "mpNcipmp:" + this.mpNcipMp + "\n" +
+                "mp150511:" + this.mp150511 + "\n" +
+                "mp150512:" + this.mp150512 + "\n" +
+                "mpPpmp:" + this.mpPpMp + "\n" +
+                "mpP9801In:" + this.mpP9801In + "\n" +
+                "mpP9801Out:" + this.mpP9801Out + "\n" +
+                "mpJ1502:" + this.mpJ1502 + "\n" +
+                "mpUser:" + this.mpUser + "\n" +
+                "lpPpLp:" + this.lpPpLp + "\n" +
+                "lpEmpty:" + this.lpEmpty + "\n" +
+                "lpMpLetdown:" + this.lpMpLetdown + "\n" +
+                "lpJ1509:" + this.lpJ1509 + "\n" +
+                "lpJ1503:" + this.lpJ1503 + "\n" +
+                "lpLdpeTs:" + this.lpLdpeTs + "\n" +
+                "lpLdpeDm:" + this.lpLdpeDm + "\n" +
+                "lpUser:" + this.lpUser + "\n" +
+                "bccSyn:" + this.bccSyn + "\n" +
+                "bccYpc:" + this.bccYpc + "\n" ;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getGtg1PowerGenLevel() {
+        return gtg1PowerGenLevel;
+    }
+
+    public void setGtg1PowerGenLevel(String gtg1PowerGenLevel) {
+        this.gtg1PowerGenLevel = gtg1PowerGenLevel;
+    }
+
+    public String getGtg1Efficiency() {
+        return gtg1Efficiency;
+    }
+
+    public void setGtg1Efficiency(String gtg1Efficiency) {
+        this.gtg1Efficiency = gtg1Efficiency;
+    }
+
+    public String getGtg2PowerGenLevel() {
+        return gtg2PowerGenLevel;
+    }
+
+    public void setGtg2PowerGenLevel(String gtg2PowerGenLevel) {
+        this.gtg2PowerGenLevel = gtg2PowerGenLevel;
+    }
+
+    public String getGtg2Efficiency() {
+        return gtg2Efficiency;
+    }
+
+    public void setGtg2Efficiency(String gtg2Efficiency) {
+        this.gtg2Efficiency = gtg2Efficiency;
+    }
+
+    public String getGtg3PowerGenLevel() {
+        return gtg3PowerGenLevel;
+    }
+
+    public void setGtg3PowerGenLevel(String gtg3PowerGenLevel) {
+        this.gtg3PowerGenLevel = gtg3PowerGenLevel;
+    }
+
+    public String getGtg3Efficiency() {
+        return gtg3Efficiency;
+    }
+
+    public void setGtg3Efficiency(String gtg3Efficiency) {
+        this.gtg3Efficiency = gtg3Efficiency;
+    }
+
+    public String getStgPowerGenLevel() {
+        return stgPowerGenLevel;
+    }
+
+    public void setStgPowerGenLevel(String stgPowerGenLevel) {
+        this.stgPowerGenLevel = stgPowerGenLevel;
+    }
+
+    public String getStgEfficiency() {
+        return stgEfficiency;
+    }
+
+    public void setStgEfficiency(String stgEfficiency) {
+        this.stgEfficiency = stgEfficiency;
+    }
+
+    public String getTotalPowerGen() {
+        return totalPowerGen;
+    }
+
+    public void setTotalPowerGen(String totalPowerGen) {
+        this.totalPowerGen = totalPowerGen;
+    }
+
+    public String getSteamHhp() {
+        return steamHhp;
+    }
+
+    public void setSteamHhp(String steamHhp) {
+        this.steamHhp = steamHhp;
+    }
+
+    public String getSteamHp() {
+        return steamHp;
+    }
+
+    public void setSteamHp(String steamHp) {
+        this.steamHp = steamHp;
+    }
+
+    public String getSteamMp() {
+        return steamMp;
+    }
+
+    public void setSteamMp(String steamMp) {
+        this.steamMp = steamMp;
+    }
+
+    public String getSteamLp() {
+        return steamLp;
+    }
+
+    public void setSteamLp(String steamLp) {
+        this.steamLp = steamLp;
+    }
+
+    public String getGasRealTime() {
+        return gasRealTime;
+    }
+
+    public void setGasRealTime(String gasRealTime) {
+        this.gasRealTime = gasRealTime;
+    }
+
+    public String getGasLeft() {
+        return gasLeft;
+    }
+
+    public void setGasLeft(String gasLeft) {
+        this.gasLeft = gasLeft;
+    }
+
+    public String getGasUsed() {
+        return gasUsed;
+    }
+
+    public void setGasUsed(String gasUsed) {
+        this.gasUsed = gasUsed;
+    }
+
+    public String getGasPlan() {
+        return gasPlan;
+    }
+
+    public void setGasPlan(String gasPlan) {
+        this.gasPlan = gasPlan;
+    }
+
+    public String getGasElec() {
+        return gasElec;
+    }
+
+    public void setGasElec(String gasElec) {
+        this.gasElec = gasElec;
+    }
+
+    public String getGasSynGas() {
+        return gasSynGas;
+    }
+
+    public void setGasSynGas(String gasSynGas) {
+        this.gasSynGas = gasSynGas;
+    }
+
+    public String getGasU2() {
+        return gasU2;
+    }
+
+    public void setGasU2(String gasU2) {
+        this.gasU2 = gasU2;
+    }
+
+    public String getGasStyrene() {
+        return gasStyrene;
+    }
+
+    public void setGasStyrene(String gasStyrene) {
+        this.gasStyrene = gasStyrene;
+    }
+
+    public String getElecPowerGen() {
+        return elecPowerGen;
+    }
+
+    public void setElecPowerGen(String elecPowerGen) {
+        this.elecPowerGen = elecPowerGen;
+    }
+
+    public String getElecPowerSwitch() {
+        return elecPowerSwitch;
+    }
+
+    public void setElecPowerSwitch(String elecPowerSwitch) {
+        this.elecPowerSwitch = elecPowerSwitch;
+    }
+
+    public String getElecUsed() {
+        return elecUsed;
+    }
+
+    public void setElecUsed(String elecUsed) {
+        this.elecUsed = elecUsed;
+    }
+
+    public String getElecDiff() {
+        return elecDiff;
+    }
+
+    public void setElecDiff(String elecDiff) {
+        this.elecDiff = elecDiff;
+    }
+
+    public String getElecBycUsed() {
+        return elecBycUsed;
+    }
+
+    public void setElecBycUsed(String elecBycUsed) {
+        this.elecBycUsed = elecBycUsed;
+    }
+
+    public String getElecBocUsed() {
+        return elecBocUsed;
+    }
+
+    public void setElecBocUsed(String elecBocUsed) {
+        this.elecBocUsed = elecBocUsed;
+    }
+
+    public String getCarbonUsed() {
+        return carbonUsed;
+    }
+
+    public void setCarbonUsed(String carbonUsed) {
+        this.carbonUsed = carbonUsed;
+    }
+
+    public String getCarbonRealTime() {
+        return carbonRealTime;
+    }
+
+    public void setCarbonRealTime(String carbonRealTime) {
+        this.carbonRealTime = carbonRealTime;
+    }
+
+    public String getSub() {
+        return sub;
+    }
+
+    public void setSub(String sub) {
+        this.sub = sub;
+    }
+
+    public String getSubFurnaceLoad() {
+        return subFurnaceLoad;
+    }
+
+    public void setSubFurnaceLoad(String subFurnaceLoad) {
+        this.subFurnaceLoad = subFurnaceLoad;
+    }
+
+    public String getHhpPphhp() {
+        return hhpPphhp;
+    }
+
+    public void setHhpPphhp(String hhpPphhp) {
+        this.hhpPphhp = hhpPphhp;
+    }
+
+    public String getHhpAaae() {
+        return hhpAaae;
+    }
+
+    public void setHhpAaae(String hhpAaae) {
+        this.hhpAaae = hhpAaae;
+    }
+
+    public String getHhpGaa() {
+        return hhpGaa;
+    }
+
+    public void setHhpGaa(String hhpGaa) {
+        this.hhpGaa = hhpGaa;
+    }
+
+    public String getHhpSyn() {
+        return hhpSyn;
+    }
+
+    public void setHhpSyn(String hhpSyn) {
+        this.hhpSyn = hhpSyn;
+    }
+
+    public String getHhpP3802() {
+        return hhpP3802;
+    }
+
+    public void setHhpP3802(String hhpP3802) {
+        this.hhpP3802 = hhpP3802;
+    }
+
+    public String getHpLpg() {
+        return hpLpg;
+    }
+
+    public void setHpLpg(String hpLpg) {
+        this.hpLpg = hpLpg;
+    }
+
+    public String getHpSub() {
+        return hpSub;
+    }
+
+    public void setHpSub(String hpSub) {
+        this.hpSub = hpSub;
+    }
+
+    public String getHpNg() {
+        return hpNg;
+    }
+
+    public void setHpNg(String hpNg) {
+        this.hpNg = hpNg;
+    }
+
+    public String getHpJ1501() {
+        return hpJ1501;
+    }
+
+    public void setHpJ1501(String hpJ1501) {
+        this.hpJ1501 = hpJ1501;
+    }
+
+    public String getHpJ1504In() {
+        return hpJ1504In;
+    }
+
+    public void setHpJ1504In(String hpJ1504In) {
+        this.hpJ1504In = hpJ1504In;
+    }
+
+    public String getHpJ1504Out() {
+        return hpJ1504Out;
+    }
+
+    public void setHpJ1504Out(String hpJ1504Out) {
+        this.hpJ1504Out = hpJ1504Out;
+    }
+
+    public String getHpUser() {
+        return hpUser;
+    }
+
+    public void setHpUser(String hpUser) {
+        this.hpUser = hpUser;
+    }
+
+    public String getMpNcipMp() {
+        return mpNcipMp;
+    }
+
+    public void setMpNcipMp(String mpNcipMp) {
+        this.mpNcipMp = mpNcipMp;
+    }
+
+    public String getMp150511() {
+        return mp150511;
+    }
+
+    public void setMp150511(String mp150511) {
+        this.mp150511 = mp150511;
+    }
+
+    public String getMp150512() {
+        return mp150512;
+    }
+
+    public void setMp150512(String mp150512) {
+        this.mp150512 = mp150512;
+    }
+
+    public String getMpPpMp() {
+        return mpPpMp;
+    }
+
+    public void setMpPpMp(String mpPpMp) {
+        this.mpPpMp = mpPpMp;
+    }
+
+    public String getMpP9801In() {
+        return mpP9801In;
+    }
+
+    public void setMpP9801In(String mpP9801In) {
+        this.mpP9801In = mpP9801In;
+    }
+
+    public String getMpP9801Out() {
+        return mpP9801Out;
+    }
+
+    public void setMpP9801Out(String mpP9801Out) {
+        this.mpP9801Out = mpP9801Out;
+    }
+
+    public String getMpJ1502() {
+        return mpJ1502;
+    }
+
+    public void setMpJ1502(String mpJ1502) {
+        this.mpJ1502 = mpJ1502;
+    }
+
+    public String getMpUser() {
+        return mpUser;
+    }
+
+    public void setMpUser(String mpUser) {
+        this.mpUser = mpUser;
+    }
+
+    public String getLpPpLp() {
+        return lpPpLp;
+    }
+
+    public void setLpPpLp(String lpPpLp) {
+        this.lpPpLp = lpPpLp;
+    }
+
+    public String getLpEmpty() {
+        return lpEmpty;
+    }
+
+    public void setLpEmpty(String lpEmpty) {
+        this.lpEmpty = lpEmpty;
+    }
+
+    public String getLpMpLetdown() {
+        return lpMpLetdown;
+    }
+
+    public void setLpMpLetdown(String lpMpLetdown) {
+        this.lpMpLetdown = lpMpLetdown;
+    }
+
+    public String getLpJ1509() {
+        return lpJ1509;
+    }
+
+    public void setLpJ1509(String lpJ1509) {
+        this.lpJ1509 = lpJ1509;
+    }
+
+    public String getLpJ1503() {
+        return lpJ1503;
+    }
+
+    public void setLpJ1503(String lpJ1503) {
+        this.lpJ1503 = lpJ1503;
+    }
+
+    public String getLpLdpeTs() {
+        return lpLdpeTs;
+    }
+
+    public void setLpLdpeTs(String lpLdpeTs) {
+        this.lpLdpeTs = lpLdpeTs;
+    }
+
+    public String getLpLdpeDm() {
+        return lpLdpeDm;
+    }
+
+    public void setLpLdpeDm(String lpLdpeDm) {
+        this.lpLdpeDm = lpLdpeDm;
+    }
+
+    public String getLpUser() {
+        return lpUser;
+    }
+
+    public void setLpUser(String lpUser) {
+        this.lpUser = lpUser;
+    }
+}