|
@@ -3,6 +3,7 @@ package com.ruoyi.project.production.service.impl;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl;
|
|
@@ -14,6 +15,8 @@ import com.ruoyi.project.production.mapper.TMonthlyProductionReportMapper;
|
|
|
import com.ruoyi.project.production.domain.TMonthlyProductionReport;
|
|
|
import com.ruoyi.project.production.service.ITMonthlyProductionReportService;
|
|
|
|
|
|
+import javax.sound.midi.Soundbank;
|
|
|
+
|
|
|
/**
|
|
|
* 每月生产报告Service业务层处理
|
|
|
*
|
|
@@ -100,11 +103,17 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
|
|
|
|
|
|
@Override
|
|
|
public List<CrackerRawMaterialVO> selectCrackerRawMaterialByYear(Long year) {
|
|
|
+ // 当前日期
|
|
|
+ Date currentDate = new Date();
|
|
|
+ // 当前年份
|
|
|
+ Long currentYear = Long.parseLong(currentDate.getYear() + 1900 + "");
|
|
|
+ // 当前月份
|
|
|
+ Long currentMonth = Long.parseLong(currentDate.getMonth() + 1 + "");
|
|
|
// 从数据库中查出的当前year的月报数据集合,每个元素对应当前year某个月的数据
|
|
|
List<TMonthlyProductionReport> tMonthlyProductionReports = tMonthlyProductionReportMapper.selectCrackerRawMaterialByYear(year);
|
|
|
// 前端月报数据集合,每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
|
|
|
List<CrackerRawMaterialVO> crackerRawMaterialVOs = new ArrayList<>();
|
|
|
- crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Cracker Raw Material", ""));
|
|
|
+ crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Cracker Raw Material", "t"));
|
|
|
crackerRawMaterialVOs.add(new CrackerRawMaterialVO("NAP", "t"));
|
|
|
crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C5", "t"));
|
|
|
crackerRawMaterialVOs.add(new CrackerRawMaterialVO("NA", "t"));
|
|
@@ -120,7 +129,7 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
|
|
|
crackerRawMaterialVOs.add(new CrackerRawMaterialVO("toluene", "t"));
|
|
|
crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C4 Recycle(ton)", "t"));
|
|
|
crackerRawMaterialVOs.add(new CrackerRawMaterialVO("input total", "t"));
|
|
|
- crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Total feed", ""));
|
|
|
+ crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Total feed", "t"));
|
|
|
// 遍历从数据库中查出的月报数据集合,结果为0~12条数据不等
|
|
|
for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
|
|
|
TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
|
|
@@ -141,13 +150,17 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
|
|
|
String hyC4FrR800 = tMonthlyProductionReport.getHyC4FrR800();
|
|
|
String crackerRawInput = tMonthlyProductionReport.getCrackerRawInput();
|
|
|
String crackerRawFeed = tMonthlyProductionReport.getCrackerRawFeed();
|
|
|
+ Long raff3FrBdAndRaffinate2pFr2ph = Long.parseLong(raff3FrBd) + Long.parseLong(raffinate2pFr2ph);
|
|
|
+ String raff3FrBdAndRaffinate2pFr2phStr = raff3FrBdAndRaffinate2pFr2ph.toString();
|
|
|
// 前端数据集合的class
|
|
|
Class clazz = null;
|
|
|
// 当前元素调用的set方法
|
|
|
Method method = null;
|
|
|
try {
|
|
|
+ Long reportMonth = tMonthlyProductionReport.getReportMonth(); // 当前元素的所属月份
|
|
|
+ Long reportYear = tMonthlyProductionReport.getReportYear(); // 当前元素的所属年份
|
|
|
clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.CrackerRawMaterialVO");
|
|
|
- switch (tMonthlyProductionReport.getReportMonth().toString()) { // 当前元素的所属月份
|
|
|
+ switch (reportMonth.toString()) {
|
|
|
case "1": // 一月
|
|
|
method = clazz.getDeclaredMethod("setJan", String.class);
|
|
|
break;
|
|
@@ -192,18 +205,37 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
|
|
|
method.invoke(crackerRawMaterialVOs.get(3), c6C8Na);
|
|
|
method.invoke(crackerRawMaterialVOs.get(4), wisonEthane);
|
|
|
method.invoke(crackerRawMaterialVOs.get(5), lpgToFurnace);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(6), raff3FrBd);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(7), raffinate2pFr2ph);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(8), c2FrLdpe);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(9), c3FrOxo);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(10), mixedC3C4);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(11), hyC9);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(12), pguOffgas);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(13), washOil);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(14), toluene);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(15), hyC4FrR800);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(16), crackerRawInput);
|
|
|
- method.invoke(crackerRawMaterialVOs.get(17), crackerRawFeed);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(6), raff3FrBdAndRaffinate2pFr2phStr);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(7), c2FrLdpe);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(8), c3FrOxo);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(9), mixedC3C4);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(10), hyC9);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(11), pguOffgas);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(12), washOil);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(13), toluene);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(14), hyC4FrR800);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(15), crackerRawInput);
|
|
|
+ method.invoke(crackerRawMaterialVOs.get(16), crackerRawFeed);
|
|
|
+ // 当前年份=所属年份,当前月份=所属月份
|
|
|
+ if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
|
|
|
+ crackerRawMaterialVOs.get(0).setCurrently(crackerRawInput);
|
|
|
+ crackerRawMaterialVOs.get(1).setCurrently(nap);
|
|
|
+ crackerRawMaterialVOs.get(2).setCurrently(c5);
|
|
|
+ crackerRawMaterialVOs.get(3).setCurrently(c6C8Na);
|
|
|
+ crackerRawMaterialVOs.get(4).setCurrently(wisonEthane);
|
|
|
+ crackerRawMaterialVOs.get(5).setCurrently(lpgToFurnace);
|
|
|
+ crackerRawMaterialVOs.get(6).setCurrently(raff3FrBdAndRaffinate2pFr2phStr);
|
|
|
+ crackerRawMaterialVOs.get(7).setCurrently(c2FrLdpe);
|
|
|
+ crackerRawMaterialVOs.get(8).setCurrently(c3FrOxo);
|
|
|
+ crackerRawMaterialVOs.get(9).setCurrently(mixedC3C4);
|
|
|
+ crackerRawMaterialVOs.get(10).setCurrently(hyC9);
|
|
|
+ crackerRawMaterialVOs.get(11).setCurrently(pguOffgas);
|
|
|
+ crackerRawMaterialVOs.get(12).setCurrently(washOil);
|
|
|
+ crackerRawMaterialVOs.get(13).setCurrently(toluene);
|
|
|
+ crackerRawMaterialVOs.get(14).setCurrently(hyC4FrR800);
|
|
|
+ crackerRawMaterialVOs.get(15).setCurrently(crackerRawInput);
|
|
|
+ crackerRawMaterialVOs.get(16).setCurrently(crackerRawFeed);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|