|
@@ -1,16 +1,19 @@
|
|
|
package io.renren.modules.common;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.opencsv.CSVReader;
|
|
|
-import io.renren.common.utils.ExcelUtils;
|
|
|
+import io.renren.common.utils.Constant;
|
|
|
+import io.renren.common.utils.PageUtils;
|
|
|
+import io.renren.common.utils.Query;
|
|
|
+import io.renren.modules.aspen.dao.TDailyProductionReportDao;
|
|
|
+import io.renren.modules.aspen.entity.TDailyProductionReport;
|
|
|
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.service.SysMenuService;
|
|
|
-import org.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
@@ -21,7 +24,6 @@ import java.io.FileReader;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
@Component
|
|
|
@Configuration //1.主要用于标记配置类,兼备Component的效果。
|
|
|
@EnableScheduling // 2.开启定时任务
|
|
@@ -29,13 +31,15 @@ public class AspenController extends AbstractController {
|
|
|
|
|
|
@Autowired
|
|
|
private TDashboarddataService tDashboarddataService;
|
|
|
+ @Autowired
|
|
|
+ private TDailyProductionReportDao tDailyProductionReportDao;
|
|
|
|
|
|
- @Scheduled(cron = "0/15 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 */1 * * * ?")
|
|
|
// @Scheduled(cron = "0 */15 * * * ?")
|
|
|
public void getExcelData(){
|
|
|
- String csvFile = "D://ssyFile/物料.csv";
|
|
|
+ logger.info("实时获取数据");
|
|
|
+ String csvFile = "D://ssyFile/wuliao.csv";
|
|
|
// String csvFile = "C://dashboardAspen/wuliao.csv";
|
|
|
-// B:\GLOBAL\7430-BYC\NANJING\CB\CBP_C\15 CBP Cracker Share 乙烯装置共享文件夹\Dashboard data\物料.xlsm
|
|
|
TDashboarddataEntity dashboarddataEntity = new TDashboarddataEntity();
|
|
|
CSVReader reader = null;
|
|
|
try {
|
|
@@ -101,112 +105,560 @@ public class AspenController extends AbstractController {
|
|
|
dashboarddataEntity.setEnergyfeedTanliu(line[3]);
|
|
|
dashboarddataEntity.setEnergyfeedLpg(line[4]);
|
|
|
}
|
|
|
+ if (i == 15) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ line[0] = rounding(line[0]);
|
|
|
+ line[2] = rounding(line[2]);
|
|
|
+ dashboarddataEntity.setOutputYixi(rounding(line[0]));
|
|
|
+ dashboarddataEntity.setInstantaneous(rounding(line[2]));
|
|
|
+ logger.info("===========================" + line[5]);
|
|
|
+ String annual = line[5];
|
|
|
+ annual = new BigDecimal(annual).toPlainString();
|
|
|
+ annual = new BigDecimal(annual).multiply(new BigDecimal("100")).toString();
|
|
|
+ dashboarddataEntity.setOutputAnnual(rounding(annual)+"%");
|
|
|
+ }
|
|
|
+ if (i == 16) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ for (int j = 7; j < 20; 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]);
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setNapOne(line[7]);
|
|
|
+ dashboarddataEntity.setNapTwo(line[8]);
|
|
|
+ dashboarddataEntity.setNapThree(line[9]);
|
|
|
+ dashboarddataEntity.setEhtOne(line[10]);
|
|
|
+ dashboarddataEntity.setEhtTwo(line[11]);
|
|
|
+ dashboarddataEntity.setEhtThree(line[12]);
|
|
|
+ dashboarddataEntity.setEhtFour(line[13]);
|
|
|
+ dashboarddataEntity.setEhtFive(line[14]);
|
|
|
+ dashboarddataEntity.setAcrOne(line[15]);
|
|
|
+ dashboarddataEntity.setAcrTwo(line[16]);
|
|
|
+ dashboarddataEntity.setAcrThree(line[17]);
|
|
|
+ dashboarddataEntity.setAcrFour(line[18]);
|
|
|
+ dashboarddataEntity.setAcrZero(line[19]);
|
|
|
+ }
|
|
|
+ if (i == 19) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ for (int j = 0; j < 3; 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]);
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setOutputBx(line[0]);
|
|
|
+ dashboarddataEntity.setCumulative(line[2]);
|
|
|
+ }
|
|
|
+ if (i == 20) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ for (int j = 7; j < 11; 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]);
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setProTwo(line[7]);
|
|
|
+ dashboarddataEntity.setProOne(line[8]);
|
|
|
+ dashboarddataEntity.setProThree(line[9]);
|
|
|
+ dashboarddataEntity.setProFour(line[10]);
|
|
|
+ }
|
|
|
+ /* SS */
|
|
|
+ if (i == 40) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[1].equals("")) {
|
|
|
+ line[1] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[1].charAt(0))) {
|
|
|
+ line[1] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[1]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[1] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamSsinfur(line[1]);
|
|
|
+ }
|
|
|
+ if (i == 41) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[6].equals("")) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[6].charAt(0))) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[6]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[6] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamSsoutlet(line[6]);
|
|
|
+ }
|
|
|
+ if (i == 42) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[6].equals("")) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[6].charAt(0))) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[6]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[6] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamSsoutesi(line[6]);
|
|
|
+ }
|
|
|
+ if (i == 43) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[6].equals("")) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[6].charAt(0))) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[6]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[6] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamSsoutaeu(line[6]);
|
|
|
+ }
|
|
|
+ if (i == 44) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ for (int j = 6; j < 9; 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]);
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamSsoutksan(line[6]);
|
|
|
+ dashboarddataEntity.setSteamHsinksan(line[8]);
|
|
|
+ }
|
|
|
+ if (i == 45) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[8].equals("")) {
|
|
|
+ line[8] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[8].charAt(0))) {
|
|
|
+ line[8] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[8]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[8] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamSsoutsc(line[8]);
|
|
|
+ }
|
|
|
+ /* HS */
|
|
|
+ if (i == 55) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[1].equals("")) {
|
|
|
+ line[1] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[1].charAt(0))) {
|
|
|
+ line[1] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[1]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[1] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsinsub(line[1]);
|
|
|
+ }
|
|
|
+ if (i == 56) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ for (int j = 1; j < 10; 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]);
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHhpsub(line[1]);
|
|
|
+ dashboarddataEntity.setSteamHsoutpjiu(line[4]);
|
|
|
+ dashboarddataEntity.setSteamHsouthwu(line[9]);
|
|
|
+ }
|
|
|
+ if (i == 57) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ for (int j = 1; j < 10; 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]);
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsinlet(line[1]);
|
|
|
+ dashboarddataEntity.setSteamHsoutaeu(line[4]);
|
|
|
+ dashboarddataEntity.setSteamHsouthc230(line[9]);
|
|
|
+ }
|
|
|
+ if (i == 58) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[4].equals("")) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[4].charAt(0))) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[4]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[4] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsoutlet(line[4]);
|
|
|
+ }
|
|
|
+ if (i == 59) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[4].equals("")) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[4].charAt(0))) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[4]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[4] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsoutesan(line[4]);
|
|
|
+ }
|
|
|
+ if (i == 60) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[4].equals("")) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[4].charAt(0))) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[4]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[4] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsoutphyi(line[4]);
|
|
|
+ }
|
|
|
+ if (i == 61) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[4].equals("")) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[4].charAt(0))) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[4]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[4] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsoutpher(line[4]);
|
|
|
+ }
|
|
|
+ if (i == 62) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamHsoutklz(rounding(line[4]));
|
|
|
+ dashboarddataEntity.setSteamMsinkliu(rounding(line[6]));
|
|
|
+ }
|
|
|
+ if (i == 63) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[6].equals("")) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[6].charAt(0))) {
|
|
|
+ line[6] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[6]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[6] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsoutsc(line[6]);
|
|
|
+ }
|
|
|
+ if (i == 64) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ if (line[4].equals("")) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ if (!Character.isDigit(line[4].charAt(0))) {
|
|
|
+ line[4] = "0.0";
|
|
|
+ }else {
|
|
|
+ BigDecimal b = new BigDecimal(Double.parseDouble(line[4]));
|
|
|
+ double f = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ line[4] = String.valueOf(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dashboarddataEntity.setSteamHsoutkliu(line[4]);
|
|
|
+ }
|
|
|
+ /* MS */
|
|
|
+ if (i == 69) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamMsinaeu(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamMsoutflare(rounding(line[4]));
|
|
|
+ dashboarddataEntity.setSteamMsoutfur(rounding(line[7]));
|
|
|
+ }
|
|
|
+ if (i == 70) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamMsinphyi(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamMsoutaeu(rounding(line[4]));
|
|
|
+ dashboarddataEntity.setSteamMsoutva(rounding(line[7]));
|
|
|
+ }
|
|
|
+ if (i == 71) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamMsinlet(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamMsouttracing(rounding(line[7]));
|
|
|
+ }
|
|
|
+ if (i == 74) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamMsoutsctu(rounding(line[4]));
|
|
|
+ }
|
|
|
+ if (i == 79) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamMsouteer(rounding(line[4]));
|
|
|
+ }
|
|
|
+ /* LS */
|
|
|
+ if (i == 84) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsinsub(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamLsoutsctu(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 85) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsinpjiu(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamLsoutvjiu(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 86) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsinaeu(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamLsoutewuliu(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 87) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsineer(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamLsoutewusan(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 88) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsinpher(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSteamLsouttracing(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 89) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsoutesan(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 90) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsoutesi(rounding(line[5]));
|
|
|
+ }
|
|
|
+ if (i == 91) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSteamLsoutother(rounding(line[5]));
|
|
|
+ }
|
|
|
+ /* 总需求 */
|
|
|
+ if (i == 99) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setSsBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setSsSub(rounding(line[2]));
|
|
|
+ dashboarddataEntity.setSsEu(rounding(line[3]));
|
|
|
+ dashboarddataEntity.setSsPgu(rounding(line[4]));
|
|
|
+ }
|
|
|
+ if (i == 100) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setHhpBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setHhpSub(rounding(line[2]));
|
|
|
+ }
|
|
|
+ if (i == 101) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setHsBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setHsSub(rounding(line[2]));
|
|
|
+ dashboarddataEntity.setHsEu(rounding(line[3]));
|
|
|
+ dashboarddataEntity.setHsPgu(rounding(line[4]));
|
|
|
+ }
|
|
|
+ if (i == 102) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setMsBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setMsEu(rounding(line[3]));
|
|
|
+ dashboarddataEntity.setMsPgu(rounding(line[4]));
|
|
|
+ }
|
|
|
+ if (i == 103) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setLsBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setLsEu(rounding(line[3]));
|
|
|
+ dashboarddataEntity.setLsPgu(rounding(line[4]));
|
|
|
+ }
|
|
|
+ if (i == 104) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setTotalBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setTotalEu(rounding(line[3]));
|
|
|
+ }
|
|
|
+ if (i == 105) {
|
|
|
+ logger.info("第" + i + "行");
|
|
|
+ dashboarddataEntity.setZongBcc(rounding(line[1]));
|
|
|
+ dashboarddataEntity.setZongEu(rounding(line[3]));
|
|
|
+ dashboarddataEntity.setZongPgu(rounding(line[4]));
|
|
|
+ }
|
|
|
i++;
|
|
|
}
|
|
|
dashboarddataEntity.setCreatedate(new Date());
|
|
|
+ //储罐的代码
|
|
|
+ TDailyProductionReport report = tDailyProductionReportDao.selectOne( new QueryWrapper<TDailyProductionReport>()
|
|
|
+ .last("where REPORT_DATE = (select max(t2.REPORT_DATE) from t_daily_production_report t2)")
|
|
|
+ );
|
|
|
+ logger.info("TDailyProductionReport:" + JSON.toJSONString(report));
|
|
|
+ dashboarddataEntity.setNapOne(rounding0(report.getSctfStorageCltf1621()));
|
|
|
+ dashboarddataEntity.setNapTwo(rounding0(report.getSctfStorageCltf1622()));
|
|
|
+ dashboarddataEntity.setNapThree(rounding0(report.getSctfStorageCltf1623()));
|
|
|
+ dashboarddataEntity.setEhtOne(rounding0(report.getSctfStorageTk1061()));
|
|
|
+ dashboarddataEntity.setEhtTwo(rounding0(report.getSctfStorageTk1062()));
|
|
|
+ dashboarddataEntity.setEhtThree(rounding0(report.getSctfStorageTk1063()));
|
|
|
+ dashboarddataEntity.setEhtFour(rounding0(report.getSctfStorageTk1064()));
|
|
|
+ dashboarddataEntity.setEhtFive(rounding0(report.getSctfStorageTk1065Off()));
|
|
|
+ dashboarddataEntity.setAcrOne(rounding0(report.getSctfStorageTk1011()));
|
|
|
+ dashboarddataEntity.setAcrTwo(rounding0(report.getSctfStorageTk1012()));
|
|
|
+ dashboarddataEntity.setAcrThree(rounding0(report.getSctfStorageTk1013()));
|
|
|
+ dashboarddataEntity.setAcrFour(rounding0(report.getSctfStorageTk1014()));
|
|
|
+ dashboarddataEntity.setAcrZero(rounding0(report.getSctfStorageTk1040Off()));
|
|
|
+ dashboarddataEntity.setProTwo(rounding0(report.getSctfStorageTk1520Rpg()));
|
|
|
+ dashboarddataEntity.setProOne(rounding0(report.getSctfStorageTk1510B()));
|
|
|
+ dashboarddataEntity.setProThree(rounding0(report.getSctfStorageTk1360T()));
|
|
|
+ dashboarddataEntity.setProFour(rounding0(report.getSctfStorageTk1410X()));
|
|
|
+
|
|
|
logger.info("dashboardData:" + dashboarddataEntity);
|
|
|
tDashboarddataService.save(dashboarddataEntity);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- /*Workbook workbook = ExcelUtils.getWorkBook("B://GLOBAL/7430-BYC/NANJING/CB/CBP/CBP_C/15 CBP Cracker Share 乙烯装置共享文件夹/Dashboard data/物料.xlsx");
|
|
|
-// Workbook workbook = ExcelUtils.getWorkBook("D://ssyFile/ceshi.xlsx");
|
|
|
- Sheet sheet = workbook.getSheetAt(0);
|
|
|
- int rowNum = sheet.getLastRowNum();
|
|
|
- TDashboarddataEntity dashboarddataEntity = new TDashboarddataEntity();
|
|
|
- logger.info("rowNum:" + rowNum);
|
|
|
- for (int i = 0; i <= rowNum; i++) {
|
|
|
- if (i == 0) {
|
|
|
- logger.info("i:" + i);
|
|
|
- Row row = sheet.getRow(i);
|
|
|
- int cellNum = row.getLastCellNum();
|
|
|
- for (int j = 0; j <= cellNum; j++) {
|
|
|
- if (j == 4) {
|
|
|
- logger.info("==========");
|
|
|
- }
|
|
|
- Cell cell = row.getCell(j);
|
|
|
- String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- 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 == 6) {
|
|
|
- logger.info("i:" + i);
|
|
|
- Row row = sheet.getRow(i);
|
|
|
- int cellNum = row.getLastCellNum();
|
|
|
- for (int j = 0; j <= cellNum; j++) {
|
|
|
- if (j == 0) {
|
|
|
- logger.info("==========");
|
|
|
- }
|
|
|
- Cell cell = row.getCell(j);
|
|
|
- String cellValue = ExcelUtils.getCellValue(cell);
|
|
|
+// @Scheduled(cron = "0 */1 * * * ?")
|
|
|
+ public void getDayTankData(){
|
|
|
+ TDailyProductionReport report = tDailyProductionReportDao.selectOne( new QueryWrapper<TDailyProductionReport>()
|
|
|
+ .last("where REPORT_DATE = (select max(t2.REPORT_DATE) from t_daily_production_report t2)")
|
|
|
+ );
|
|
|
+ logger.info(JSON.toJSONString(report));
|
|
|
|
|
|
+ TDashboarddataEntity data = tDashboarddataService.getOne( new QueryWrapper<TDashboarddataEntity>()
|
|
|
+ .eq("id" , "811")
|
|
|
+ );
|
|
|
+ data.setNapOne(rounding0(report.getSctfStorageCltf1621()));
|
|
|
+ data.setNapTwo(rounding0(report.getSctfStorageCltf1622()));
|
|
|
+ data.setNapThree(rounding0(report.getSctfStorageCltf1623()));
|
|
|
+ data.setEhtOne(rounding0(report.getSctfStorageTk1061()));
|
|
|
+ data.setEhtTwo(rounding0(report.getSctfStorageTk1062()));
|
|
|
+ data.setEhtThree(rounding0(report.getSctfStorageTk1063()));
|
|
|
+ data.setEhtFour(rounding0(report.getSctfStorageTk1064()));
|
|
|
+ data.setEhtFive(rounding0(report.getSctfStorageTk1065Off()));
|
|
|
+ data.setAcrOne(rounding0(report.getSctfStorageTk1011()));
|
|
|
+ data.setAcrTwo(rounding0(report.getSctfStorageTk1012()));
|
|
|
+ data.setAcrThree(rounding0(report.getSctfStorageTk1013()));
|
|
|
+ data.setAcrFour(rounding0(report.getSctfStorageTk1014()));
|
|
|
+ data.setAcrZero(rounding0(report.getSctfStorageTk1040Off()));
|
|
|
+ data.setProTwo(rounding0(report.getSctfStorageTk1520Rpg()));
|
|
|
+ data.setProOne(rounding0(report.getSctfStorageTk1510B()));
|
|
|
+ data.setProThree(rounding0(report.getSctfStorageTk1360T()));
|
|
|
+ data.setProFour(rounding0(report.getSctfStorageTk1410X()));
|
|
|
+ tDashboarddataService.saveOrUpdate(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
- 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);
|
|
|
+ logger.info(lineNum);
|
|
|
+ return lineNum;
|
|
|
+ }catch (Exception e) {
|
|
|
+ logger.error(String.valueOf(e));
|
|
|
+ return "0.0";
|
|
|
+ }
|
|
|
+ };
|
|
|
+ public String rounding0(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))){
|
|
|
+ int b = new BigDecimal(Double.parseDouble(lineNum)).intValue();
|
|
|
+ lineNum = String.valueOf(b);
|
|
|
+ }else {
|
|
|
+ lineNum = "0.0";
|
|
|
}
|
|
|
+ }else {
|
|
|
+ int b = new BigDecimal(Double.parseDouble(lineNum)).intValue();
|
|
|
+ lineNum = String.valueOf(b);
|
|
|
}
|
|
|
}
|
|
|
+ logger.info(lineNum);
|
|
|
+ return lineNum;
|
|
|
+ }catch (Exception e) {
|
|
|
+ logger.error(String.valueOf(e));
|
|
|
+ return "0.0";
|
|
|
}
|
|
|
- dashboarddataEntity.setCreatedate(new Date());
|
|
|
- logger.info("dashboardData:" + dashboarddataEntity);
|
|
|
- tDashboarddataService.save(dashboarddataEntity);*/
|
|
|
}
|
|
|
}
|