|
@@ -2,10 +2,9 @@ package io.renren.modules.common;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import io.renren.common.utils.ExcelUtils;
|
|
|
-import io.renren.modules.aspen.entity.TAlarmstatisticsDayEntity;
|
|
|
-import io.renren.modules.aspen.service.TAlarmstatisticsDayService;
|
|
|
+import io.renren.modules.aspen.entity.TDashboarddataEntity;
|
|
|
+import io.renren.modules.aspen.service.TDashboarddataService;
|
|
|
import io.renren.modules.sys.controller.AbstractController;
|
|
|
-import io.renren.modules.sys.entity.SysMenuEntity;
|
|
|
import io.renren.modules.sys.service.SysMenuService;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
@@ -17,8 +16,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@Component
|
|
|
@Configuration //1.主要用于标记配置类,兼备Component的效果。
|
|
@@ -28,27 +26,82 @@ public class AspenController extends AbstractController {
|
|
|
@Autowired
|
|
|
private SysMenuService sysMenuService;
|
|
|
@Autowired
|
|
|
- private TAlarmstatisticsDayService tAlarmstatisticsDayService;
|
|
|
+ private TDashboarddataService tDashboarddataService;
|
|
|
|
|
|
@Scheduled(cron = "0/9 * * * * ?")
|
|
|
public void getExcelData(){
|
|
|
Workbook workbook = ExcelUtils.getWorkBook("D://ssyFile/K300.xlsm");
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
int rowNum = sheet.getPhysicalNumberOfRows();
|
|
|
- for (int i = 1; i < rowNum; i++) {
|
|
|
- Row row = sheet.getRow(i);
|
|
|
- int cellNum = row.getPhysicalNumberOfCells();
|
|
|
- for (int j = 0; j < cellNum; j++) {
|
|
|
- Cell cell = row.getCell(j);
|
|
|
- String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
- if (j == 0) {
|
|
|
- logger.info(cellValue + "第一列");
|
|
|
- }else if (j ==1) {
|
|
|
- logger.info(cellValue + "第二列");
|
|
|
+ TDashboarddataEntity dashboarddataEntity = new TDashboarddataEntity();
|
|
|
+ for (int i = 0; i < rowNum; i++) {
|
|
|
+ if (i == 4) {
|
|
|
+ logger.info("i:" + i);
|
|
|
+ Row row = sheet.getRow(i);
|
|
|
+ int cellNum = row.getPhysicalNumberOfCells();
|
|
|
+ for (int j = 0; j < cellNum; j++) {
|
|
|
+ Cell cell = row.getCell(j);
|
|
|
+ String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
+ if (j == 0) {
|
|
|
+ dashboarddataEntity.setEnergyYixi(cellValue);
|
|
|
+ }else if (j == 1) {
|
|
|
+ dashboarddataEntity.setEnergyBingxi(cellValue);
|
|
|
+ }else if (j == 2) {
|
|
|
+ dashboarddataEntity.setEnergyQingqi(cellValue);
|
|
|
+ }else if (j == 3) {
|
|
|
+ dashboarddataEntity.setEnergyJiawan(cellValue);
|
|
|
+ }else if (j == 4) {
|
|
|
+ dashboarddataEntity.setEnergyOffgas(cellValue);
|
|
|
+ }else if (j == 5) {
|
|
|
+ dashboarddataEntity.setEnergyLpg(cellValue);
|
|
|
+ }else if (j == 6) {
|
|
|
+ dashboarddataEntity.setEnergyCsi(cellValue);
|
|
|
+ }else if (j == 7) {
|
|
|
+ dashboarddataEntity.setEnergyBenzene(cellValue);
|
|
|
+ }else if (j == 8) {
|
|
|
+ dashboarddataEntity.setEnergyToluene(cellValue);
|
|
|
+ }else if (j == 9) {
|
|
|
+ dashboarddataEntity.setEnergyXylene(cellValue);
|
|
|
+ }else if (j == 10) {
|
|
|
+ dashboarddataEntity.setEnergyTanliu(cellValue);
|
|
|
+ }else if (j == 11) {
|
|
|
+ dashboarddataEntity.setEnergyWashoil(cellValue);
|
|
|
+ }else if (j == 12) {
|
|
|
+ dashboarddataEntity.setEnergyTanwu(cellValue);
|
|
|
+ }else if (j == 13) {
|
|
|
+ dashboarddataEntity.setEnergyIma(cellValue);
|
|
|
+ }else if (j == 14) {
|
|
|
+ dashboarddataEntity.setEnergyCjiu(cellValue);
|
|
|
+ }else if (j == 15) {
|
|
|
+ dashboarddataEntity.setEnergyRpg(cellValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (i == 11) {
|
|
|
+ logger.info("i:" + i);
|
|
|
+ Row row = sheet.getRow(i);
|
|
|
+ int cellNum = row.getPhysicalNumberOfCells();
|
|
|
+ for (int j = 0; j < cellNum; j++) {
|
|
|
+ Cell cell = row.getCell(j);
|
|
|
+ String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
+ if (j == 0) {
|
|
|
+ dashboarddataEntity.setEnergyfeedNap(cellValue);
|
|
|
+ }else if (j ==1) {
|
|
|
+ dashboarddataEntity.setEnergyfeedYiwan(cellValue);
|
|
|
+ }else if (j ==2) {
|
|
|
+ dashboarddataEntity.setEnergyfeedTanwu(cellValue);
|
|
|
+ }else if (j ==3) {
|
|
|
+ dashboarddataEntity.setEnergyfeedTanliu(cellValue);
|
|
|
+ }else if (j ==4) {
|
|
|
+ dashboarddataEntity.setEnergyfeedLpg(cellValue);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<TAlarmstatisticsDayEntity> menuList = tAlarmstatisticsDayService.list();
|
|
|
- logger.info(JSON.toJSONString(menuList));
|
|
|
+ dashboarddataEntity.setCreatedate(new Date());
|
|
|
+ logger.info("dashboardData:" + dashboarddataEntity);
|
|
|
+ /*tDashboarddataService.save(dashboarddataEntity);
|
|
|
+ List<TDashboarddataEntity> menuList = tDashboarddataService.list();
|
|
|
+ logger.info(JSON.toJSONString(menuList));*/
|
|
|
}
|
|
|
}
|