package com.ruoyi.project.production.service.impl;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.production.controller.vo.MonthlyAnalysisDataVO;
import com.ruoyi.project.production.controller.vo.MonthlyAnalysisQueryVO;
import com.ruoyi.project.production.controller.vo.MonthlyUpdateVO;
import com.ruoyi.project.production.mapper.TMonthlyProductionPriceMapper;
import com.ruoyi.project.production.service.impl.thread.SyncAfterMonthlyUpdateThread;
import com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.production.mapper.TMonthlyProductionReportMapper;
import com.ruoyi.project.production.domain.TMonthlyProductionReport;
import com.ruoyi.project.production.service.ITMonthlyProductionReportService;

/**
 * 每月生产报告Service业务层处理
 *
 * @author ruoyi
 * @date 2022-10-31
 */
@Service
public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionReportService
{
    private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);

    @Autowired
    private TMonthlyProductionPriceMapper tMonthlyProductionPriceMapper;

    @Autowired
    private TMonthlyProductionReportMapper tMonthlyProductionReportMapper;

    /**
     * 查询每月生产报告
     *
     * @param id 每月生产报告ID
     * @return 每月生产报告
     */
    @Override
    public TMonthlyProductionReport selectTMonthlyProductionReportById(Long id)
    {
        return tMonthlyProductionReportMapper.selectTMonthlyProductionReportById(id);
    }

    /**
     * 查询每月生产报告列表
     *
     * @param tMonthlyProductionReport 每月生产报告
     * @return 每月生产报告
     */
    @Override
    public List<TMonthlyProductionReport> selectTMonthlyProductionReportList(TMonthlyProductionReport tMonthlyProductionReport)
    {
        return tMonthlyProductionReportMapper.selectTMonthlyProductionReportList(tMonthlyProductionReport);
    }

    /**
     * 新增每月生产报告
     *
     * @param tMonthlyProductionReport 每月生产报告
     * @return 结果
     */
    @Override
    public int insertTMonthlyProductionReport(TMonthlyProductionReport tMonthlyProductionReport)
    {
        return tMonthlyProductionReportMapper.insertTMonthlyProductionReport(tMonthlyProductionReport);
    }

    /**
     * 修改每月生产报告
     *
     * @param tMonthlyProductionReport 每月生产报告
     * @return 结果
     */
    @Override
    public int updateTMonthlyProductionReport(TMonthlyProductionReport tMonthlyProductionReport)
    {
        return tMonthlyProductionReportMapper.updateTMonthlyProductionReport(tMonthlyProductionReport);
    }

    /**
     * 批量删除每月生产报告
     *
     * @param ids 需要删除的每月生产报告ID
     * @return 结果
     */
    @Override
    public int deleteTMonthlyProductionReportByIds(Long[] ids)
    {
        return tMonthlyProductionReportMapper.deleteTMonthlyProductionReportByIds(ids);
    }

    /**
     * 删除每月生产报告信息
     *
     * @param id 每月生产报告ID
     * @return 结果
     */
    @Override
    public int deleteTMonthlyProductionReportById(Long id)
    {
        return tMonthlyProductionReportMapper.deleteTMonthlyProductionReportById(id);
    }

    /**
     * 计算平均值
     *
     * @param monthlyProductionReportVOs 前端月报数据集合
     */
    protected void calcAvg(List<MonthlyProductionReportVO> monthlyProductionReportVOs) {
        for (int i = 0; i < monthlyProductionReportVOs.size(); i++) {
            MonthlyProductionReportVO monthlyProductionReportVO = monthlyProductionReportVOs.get(i);
            BigDecimal total = new BigDecimal("0");
            BigDecimal avg = new BigDecimal("0");
            int count = 0;
            String janStr = monthlyProductionReportVO.getJan();
            String febStr = monthlyProductionReportVO.getFeb();
            String marStr = monthlyProductionReportVO.getMar();
            String aprStr = monthlyProductionReportVO.getApr();
            String mayStr = monthlyProductionReportVO.getMay();
            String junStr = monthlyProductionReportVO.getJun();
            String julStr = monthlyProductionReportVO.getJul();
            String augStr = monthlyProductionReportVO.getAug();
            String sepStr = monthlyProductionReportVO.getSep();
            String octStr = monthlyProductionReportVO.getOct();
            String novStr = monthlyProductionReportVO.getNov();
            String decStr = monthlyProductionReportVO.getDec();
            BigDecimal jan = new BigDecimal("0");
            BigDecimal feb = new BigDecimal("0");
            BigDecimal mar = new BigDecimal("0");
            BigDecimal apr = new BigDecimal("0");
            BigDecimal may = new BigDecimal("0");
            BigDecimal jun = new BigDecimal("0");
            BigDecimal jul = new BigDecimal("0");
            BigDecimal aug = new BigDecimal("0");
            BigDecimal sep = new BigDecimal("0");
            BigDecimal oct = new BigDecimal("0");
            BigDecimal nov = new BigDecimal("0");
            BigDecimal dec = new BigDecimal("0");
            if (janStr == null) {
                jan = new BigDecimal("0");
            } else {
                jan = new BigDecimal(janStr);
                count++;
            }
            if (febStr == null) {
                feb = new BigDecimal("0");
            } else {
                feb = new BigDecimal(febStr);
                count++;
            }
            if (marStr == null) {
                mar = new BigDecimal("0");
            } else {
                mar = new BigDecimal(marStr);
                count++;
            }
            if (aprStr == null) {
                apr = new BigDecimal("0");
            } else {
                apr = new BigDecimal(aprStr);
                count++;
            }
            if (mayStr == null) {
                may = new BigDecimal("0");
            } else {
                may = new BigDecimal(mayStr);
                count++;
            }
            if (junStr == null) {
                jun = new BigDecimal("0");
            } else {
                jun = new BigDecimal(junStr);
                count++;
            }
            if (julStr == null) {
                jul = new BigDecimal("0");
            } else {
                jul = new BigDecimal(julStr);
                count++;
            }
            if (augStr == null) {
                aug = new BigDecimal("0");
            } else {
                aug = new BigDecimal(augStr);
                count++;
            }
            if (sepStr == null) {
                sep = new BigDecimal("0");
            } else {
                sep = new BigDecimal(sepStr);
                count++;
            }
            if (octStr == null) {
                oct = new BigDecimal("0");
            } else {
                oct = new BigDecimal(octStr);
                count++;
            }
            if (novStr == null) {
                nov = new BigDecimal("0");
            } else {
                nov = new BigDecimal(novStr);
                count++;
            }
            if (decStr == null) {
                dec = new BigDecimal("0");
            } else {
                dec = new BigDecimal(decStr);
                count++;
            }
            total = jan.add(feb).add(mar).add(apr).add(may).add(jun)
                    .add(jul).add(aug).add(sep).add(oct).add(nov).add(dec);
            if (count != 0) {
                avg = total.divide(new BigDecimal(count), 2, RoundingMode.HALF_UP);
            }
            monthlyProductionReportVO.setAvg(avg.toString());
        }
    }

    /**
     * 计算总和
     *
     * @param monthlyProductionReportVOs 前端月报数据集合
     */
    private void calcTotal(List<MonthlyProductionReportVO> monthlyProductionReportVOs) {
        for (int i = 0; i < monthlyProductionReportVOs.size(); i++) {
            MonthlyProductionReportVO monthlyProductionReportVO = monthlyProductionReportVOs.get(i);
            BigDecimal total = new BigDecimal("0");
            String janStr = monthlyProductionReportVO.getJan();
            String febStr = monthlyProductionReportVO.getFeb();
            String marStr = monthlyProductionReportVO.getMar();
            String aprStr = monthlyProductionReportVO.getApr();
            String mayStr = monthlyProductionReportVO.getMay();
            String junStr = monthlyProductionReportVO.getJun();
            String julStr = monthlyProductionReportVO.getJul();
            String augStr = monthlyProductionReportVO.getAug();
            String sepStr = monthlyProductionReportVO.getSep();
            String octStr = monthlyProductionReportVO.getOct();
            String novStr = monthlyProductionReportVO.getNov();
            String decStr = monthlyProductionReportVO.getDec();
            BigDecimal jan = new BigDecimal(janStr == null ? "0" : janStr);
            BigDecimal feb = new BigDecimal(febStr == null ? "0" : febStr);
            BigDecimal mar = new BigDecimal(marStr == null ? "0" : marStr);
            BigDecimal apr = new BigDecimal(aprStr == null ? "0" : aprStr);
            BigDecimal may = new BigDecimal(mayStr == null ? "0" : mayStr);
            BigDecimal jun = new BigDecimal(junStr == null ? "0" : junStr);
            BigDecimal jul = new BigDecimal(julStr == null ? "0" : julStr);
            BigDecimal aug = new BigDecimal(augStr == null ? "0" : augStr);
            BigDecimal sep = new BigDecimal(sepStr == null ? "0" : sepStr);
            BigDecimal oct = new BigDecimal(octStr == null ? "0" : octStr);
            BigDecimal nov = new BigDecimal(novStr == null ? "0" : novStr);
            BigDecimal dec = new BigDecimal(decStr == null ? "0" : decStr);
            total = jan.add(feb).add(mar).add(apr).add(may).add(jun).add(jul).add(aug).add(sep).add(oct).add(nov).add(dec);
            monthlyProductionReportVO.setTotal(total.toString());
        }
    }

    /**
     * 根据当前月份，获取相应的set方法
     *
     * @param reportMonth 当前月份
     * @param clazz VO的类型
     * @return 相应的set方法
     */
    protected Method getSetMethod(Long reportMonth, Class clazz) {
        Method method = null;
        try {
            switch (reportMonth.toString()) {
                case "1":   // 一月
                    method =  clazz.getDeclaredMethod("setJan", String.class);
                    break;
                case "2":   // 二月
                    method =  clazz.getDeclaredMethod("setFeb", String.class);
                    break;
                case "3":   // 三月
                    method =  clazz.getDeclaredMethod("setMar", String.class);
                    break;
                case "4":   // 四月
                    method =  clazz.getDeclaredMethod("setApr", String.class);
                    break;
                case "5":   // 五月
                    method =  clazz.getDeclaredMethod("setMay", String.class);
                    break;
                case "6":   // 六月
                    method =  clazz.getDeclaredMethod("setJun", String.class);
                    break;
                case "7":   // 七月
                    method =  clazz.getDeclaredMethod("setJul", String.class);
                    break;
                case "8":   // 八月
                    method =  clazz.getDeclaredMethod("setAug", String.class);
                    break;
                case "9":   // 九月
                    method =  clazz.getDeclaredMethod("setSep", String.class);
                    break;
                case "10":   // 十月
                    method =  clazz.getDeclaredMethod("setOct", String.class);
                    break;
                case "11":   // 十一月
                    method =  clazz.getDeclaredMethod("setNov", String.class);
                    break;
                case "12":   // 十二月
                    method =  clazz.getDeclaredMethod("setDec", String.class);
                    break;
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return method;
        }
    }

    /**
     * 按年份查询Cracker Raw Material
     */
    @Override
    public List<MonthlyProductionReportVO> 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<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_raw_input", "Cracker Raw Material", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("nap", "NAP", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c5", "C5", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c6_c8_na", "NA", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("wison_ethane", "Wison Ethane", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("lpg_to_furnace", "LPG to Furnace", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("raff3_fr_bd_and_2ph", "C4 Raff3 fr bd and 2ph", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c2_fr_ldpe", "C2 fr LDPE", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c3_fr_oxo", "C3 fr OXO", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("mixed_c3_c4", "Mixed C3/C4 fr BD", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("hy_c9", "HC9", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_offgas", "Offgas fr AEU", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("wash_oil", "wash oil", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("toluene", "toluene", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("hy_c4_fr_r800", "C4 Recycle(ton)", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_raw_input", "input total", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_raw_feed", "Total feed", "t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String nap = tMonthlyProductionReport.getNap();
            String c5 = tMonthlyProductionReport.getC5();
            String c6C8Na = tMonthlyProductionReport.getC6C8Na();
            String wisonEthane = tMonthlyProductionReport.getWisonEthane();
            String lpgToFurnace = tMonthlyProductionReport.getLpgToFurnace();
            String raff3FrBdAnd2ph = tMonthlyProductionReport.getRaff3FrBdAnd2ph();
            String c2FrLdpe = tMonthlyProductionReport.getC2FrLdpe();
            String c3FrOxo = tMonthlyProductionReport.getC3FrOxo();
            String mixedC3C4 = tMonthlyProductionReport.getMixedC3C4();
            String hyC9 = tMonthlyProductionReport.getHyC9();
            String pguOffgas = tMonthlyProductionReport.getPguOffgas();
            String washOil = tMonthlyProductionReport.getWashOil();
            String toluene = tMonthlyProductionReport.getToluene();
            String hyC4FrR800 = tMonthlyProductionReport.getHyC4FrR800();
            String crackerRawInput = tMonthlyProductionReport.getCrackerRawInput();
            String crackerRawFeed = tMonthlyProductionReport.getCrackerRawFeed();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), crackerRawInput);
                method.invoke(monthlyProductionReportVOs.get(1), nap);
                method.invoke(monthlyProductionReportVOs.get(2), c5);
                method.invoke(monthlyProductionReportVOs.get(3), c6C8Na);
                method.invoke(monthlyProductionReportVOs.get(4), wisonEthane);
                method.invoke(monthlyProductionReportVOs.get(5), lpgToFurnace);
                method.invoke(monthlyProductionReportVOs.get(6), raff3FrBdAnd2ph);
                method.invoke(monthlyProductionReportVOs.get(7), c2FrLdpe);
                method.invoke(monthlyProductionReportVOs.get(8), c3FrOxo);
                method.invoke(monthlyProductionReportVOs.get(9), mixedC3C4);
                method.invoke(monthlyProductionReportVOs.get(10), hyC9);
                method.invoke(monthlyProductionReportVOs.get(11), pguOffgas);
                method.invoke(monthlyProductionReportVOs.get(12), washOil);
                method.invoke(monthlyProductionReportVOs.get(13), toluene);
                method.invoke(monthlyProductionReportVOs.get(14), hyC4FrR800);
                method.invoke(monthlyProductionReportVOs.get(15), crackerRawInput);
                method.invoke(monthlyProductionReportVOs.get(16), crackerRawFeed);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(crackerRawInput);
                    monthlyProductionReportVOs.get(1).setCurrently(nap);
                    monthlyProductionReportVOs.get(2).setCurrently(c5);
                    monthlyProductionReportVOs.get(3).setCurrently(c6C8Na);
                    monthlyProductionReportVOs.get(4).setCurrently(wisonEthane);
                    monthlyProductionReportVOs.get(5).setCurrently(lpgToFurnace);
                    monthlyProductionReportVOs.get(6).setCurrently(raff3FrBdAnd2ph);
                    monthlyProductionReportVOs.get(7).setCurrently(c2FrLdpe);
                    monthlyProductionReportVOs.get(8).setCurrently(c3FrOxo);
                    monthlyProductionReportVOs.get(9).setCurrently(mixedC3C4);
                    monthlyProductionReportVOs.get(10).setCurrently(hyC9);
                    monthlyProductionReportVOs.get(11).setCurrently(pguOffgas);
                    monthlyProductionReportVOs.get(12).setCurrently(washOil);
                    monthlyProductionReportVOs.get(13).setCurrently(toluene);
                    monthlyProductionReportVOs.get(14).setCurrently(hyC4FrR800);
                    monthlyProductionReportVOs.get(15).setCurrently(crackerRawInput);
                    monthlyProductionReportVOs.get(16).setCurrently(crackerRawFeed);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Cracker Output Product
     */
    @Override
    public List<MonthlyProductionReportVO> selectCrackerOutputProductByYear(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.selectCrackerOutputProductByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_output", "Cracker Output Product", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("h2_produced", "H2", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ethylen_produced", "C2=", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("propylene_produced", "C3=", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c3_c4_lpg_produced", "C3/C4 LPG", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("mixed_c4s_produced", "C4'S", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("rpg_produced", "RPG", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("po_flux_oil_produced", "PO", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("naphthalene_produced", "Naphthalene", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ebo_produced", "EBO", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("residue_oil_produced", "Cracker Residue", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("methane_produced", "Methane", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("offgas_produced", "OFFAGE", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_output", "output total", "t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String h2Produced = tMonthlyProductionReport.getH2Produced();
            String ethylenProduced = tMonthlyProductionReport.getEthylenProduced();
            String propyleneProduced = tMonthlyProductionReport.getPropyleneProduced();
            String c3C4LpgProduced = tMonthlyProductionReport.getC3C4LpgProduced();
            String mixedC4sProduced = tMonthlyProductionReport.getMixedC4sProduced();
            String rpgProduced = tMonthlyProductionReport.getRpgProduced();
            String poFluxOilProduced = tMonthlyProductionReport.getPoFluxOilProduced();
            String naphthaleneProduced = tMonthlyProductionReport.getNaphthaleneProduced();
            String eboProduced = tMonthlyProductionReport.getEboProduced();
            String residueOilProduced = tMonthlyProductionReport.getResidueOilProduced();
            String methaneProduced = tMonthlyProductionReport.getMethaneProduced();
            String offgasProduced = tMonthlyProductionReport.getOffgasProduced();
            String crackerOutput = tMonthlyProductionReport.getCrackerOutput();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), crackerOutput);
                method.invoke(monthlyProductionReportVOs.get(1), h2Produced);
                method.invoke(monthlyProductionReportVOs.get(2), ethylenProduced);
                method.invoke(monthlyProductionReportVOs.get(3), propyleneProduced);
                method.invoke(monthlyProductionReportVOs.get(4), c3C4LpgProduced);
                method.invoke(monthlyProductionReportVOs.get(5), mixedC4sProduced);
                method.invoke(monthlyProductionReportVOs.get(6), rpgProduced);
                method.invoke(monthlyProductionReportVOs.get(7), poFluxOilProduced);
                method.invoke(monthlyProductionReportVOs.get(8), naphthaleneProduced);
                method.invoke(monthlyProductionReportVOs.get(9), eboProduced);
                method.invoke(monthlyProductionReportVOs.get(10), residueOilProduced);
                method.invoke(monthlyProductionReportVOs.get(11), methaneProduced);
                method.invoke(monthlyProductionReportVOs.get(12), offgasProduced);
                method.invoke(monthlyProductionReportVOs.get(13), crackerOutput);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(crackerOutput);
                    monthlyProductionReportVOs.get(1).setCurrently(h2Produced);
                    monthlyProductionReportVOs.get(2).setCurrently(ethylenProduced);
                    monthlyProductionReportVOs.get(3).setCurrently(propyleneProduced);
                    monthlyProductionReportVOs.get(4).setCurrently(c3C4LpgProduced);
                    monthlyProductionReportVOs.get(5).setCurrently(mixedC4sProduced);
                    monthlyProductionReportVOs.get(6).setCurrently(rpgProduced);
                    monthlyProductionReportVOs.get(7).setCurrently(poFluxOilProduced);
                    monthlyProductionReportVOs.get(8).setCurrently(naphthaleneProduced);
                    monthlyProductionReportVOs.get(9).setCurrently(eboProduced);
                    monthlyProductionReportVOs.get(10).setCurrently(residueOilProduced);
                    monthlyProductionReportVOs.get(11).setCurrently(methaneProduced);
                    monthlyProductionReportVOs.get(12).setCurrently(offgasProduced);
                    monthlyProductionReportVOs.get(13).setCurrently(crackerOutput);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Aromatics Raw Material
     */
    @Override
    public List<MonthlyProductionReportVO> selectAromaticsRawMaterialByYear(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.selectAromaticsRawMaterialByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_raw_input", "Aromatics Raw Material", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_rpg2", "RPG fr EU", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_h2", "H2 to PGU", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_btx_produced", "Mix BTX Product", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_btx_to_aeu", "Mix BTX to AEU", "t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_raw_input", "input total", "t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String pguRpg2 = tMonthlyProductionReport.getPguRpg2();
            String pguH2 = tMonthlyProductionReport.getPguH2();
            String pguBtxProduced = tMonthlyProductionReport.getPguBtxProduced();
            String pguBtxToAeu = tMonthlyProductionReport.getPguBtxToAeu();
            String aromaticsRawInput = tMonthlyProductionReport.getAromaticsRawInput();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), aromaticsRawInput);
                method.invoke(monthlyProductionReportVOs.get(1), pguRpg2);
                method.invoke(monthlyProductionReportVOs.get(2), pguH2);
                method.invoke(monthlyProductionReportVOs.get(3), pguBtxProduced);
                method.invoke(monthlyProductionReportVOs.get(4), pguBtxToAeu);
                method.invoke(monthlyProductionReportVOs.get(5), aromaticsRawInput);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(aromaticsRawInput);
                    monthlyProductionReportVOs.get(1).setCurrently(pguRpg2);
                    monthlyProductionReportVOs.get(2).setCurrently(pguH2);
                    monthlyProductionReportVOs.get(3).setCurrently(pguBtxProduced);
                    monthlyProductionReportVOs.get(4).setCurrently(pguBtxToAeu);
                    monthlyProductionReportVOs.get(5).setCurrently(aromaticsRawInput);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Aromatics Output Product
     */
    @Override
    public List<MonthlyProductionReportVO> selectAromaticsOutputProductByYear(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.selectAromaticsOutputProductByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_output","Aromatics Output Product","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_benzene_produced","Benzene","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_toluene_produced","Toluene","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_xylene_produced","Xylene","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_c6_c8_na_produced","C6-C8 NA","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_c5_produced","C5","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_c9_produced","C9","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_washoil_produced","Wash oil","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_offgas_produced","offags","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_btx_change","MIX BTX change","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pgu_btx_produced","BTX Product","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_toluene_produced_m_eu","Toluene Product(- EU)","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_output","output total","t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String aeuBenzeneProduced = tMonthlyProductionReport.getAeuBenzeneProduced();
            String aeuTolueneProduced = tMonthlyProductionReport.getAeuTolueneProduced();
            String aeuXyleneProduced = tMonthlyProductionReport.getAeuXyleneProduced();
            String aeuC6C8NaProduced = tMonthlyProductionReport.getAeuC6C8NaProduced();
            String pguC5Produced = tMonthlyProductionReport.getPguC5Produced();
            String pguC9Produced = tMonthlyProductionReport.getPguC9Produced();
            String pguWashoilProduced = tMonthlyProductionReport.getPguWashoilProduced();
            String pguOffgasProduced = tMonthlyProductionReport.getPguOffgasProduced();
            String pguBtxChange = tMonthlyProductionReport.getPguBtxChange();
            String pguBtxProduced = tMonthlyProductionReport.getPguBtxProduced();
            String aeuTolueneProducedMEu = tMonthlyProductionReport.getAeuTolueneProducedMEu();
            String aromaticsOutput = tMonthlyProductionReport.getAromaticsOutput();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), aromaticsOutput);
                method.invoke(monthlyProductionReportVOs.get(1), aeuBenzeneProduced);
                method.invoke(monthlyProductionReportVOs.get(2), aeuTolueneProduced);
                method.invoke(monthlyProductionReportVOs.get(3), aeuXyleneProduced);
                method.invoke(monthlyProductionReportVOs.get(4), aeuC6C8NaProduced);
                method.invoke(monthlyProductionReportVOs.get(5), pguC5Produced);
                method.invoke(monthlyProductionReportVOs.get(6), pguC9Produced);
                method.invoke(monthlyProductionReportVOs.get(7), pguWashoilProduced);
                method.invoke(monthlyProductionReportVOs.get(8), pguOffgasProduced);
                method.invoke(monthlyProductionReportVOs.get(9), pguBtxChange);
                method.invoke(monthlyProductionReportVOs.get(10), pguBtxProduced);
                method.invoke(monthlyProductionReportVOs.get(11), aeuTolueneProducedMEu);
                method.invoke(monthlyProductionReportVOs.get(12), aromaticsOutput);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(aromaticsOutput);
                    monthlyProductionReportVOs.get(1).setCurrently(aeuBenzeneProduced);
                    monthlyProductionReportVOs.get(2).setCurrently(aeuTolueneProduced);
                    monthlyProductionReportVOs.get(3).setCurrently(aeuXyleneProduced);
                    monthlyProductionReportVOs.get(4).setCurrently(aeuC6C8NaProduced);
                    monthlyProductionReportVOs.get(5).setCurrently(pguC5Produced);
                    monthlyProductionReportVOs.get(6).setCurrently(pguC9Produced);
                    monthlyProductionReportVOs.get(7).setCurrently(pguWashoilProduced);
                    monthlyProductionReportVOs.get(8).setCurrently(pguOffgasProduced);
                    monthlyProductionReportVOs.get(9).setCurrently(pguBtxChange);
                    monthlyProductionReportVOs.get(10).setCurrently(pguBtxProduced);
                    monthlyProductionReportVOs.get(11).setCurrently(aeuTolueneProducedMEu);
                    monthlyProductionReportVOs.get(12).setCurrently(aromaticsOutput);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Eligible Product Rate
     */
    @Override
    public List<MonthlyProductionReportVO> selectEligibleProductRateByYear(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.selectEligibleProductRateByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c2_product_rate","C2=","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c3_product_rate","C3=","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c4s_product_rate","C4's","%"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String c2ProductRate = tMonthlyProductionReport.getC2ProductRate();
            String c3ProductRate = tMonthlyProductionReport.getC3ProductRate();
            String c4sProductRate = tMonthlyProductionReport.getC4sProductRate();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), c2ProductRate);
                method.invoke(monthlyProductionReportVOs.get(1), c3ProductRate);
                method.invoke(monthlyProductionReportVOs.get(2), c4sProductRate);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(c2ProductRate);
                    monthlyProductionReportVOs.get(1).setCurrently(c3ProductRate);
                    monthlyProductionReportVOs.get(2).setCurrently(c4sProductRate);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Product Yield
     */
    @Override
    public List<MonthlyProductionReportVO> selectProductYieldByYear(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.selectProductYieldByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("gaseity_yield", "gaseity","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("tatal_yield", "tatal","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c3_c2_yield", "C3/C2",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("h2_yield", "H2","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ethylene_yield", "ethylene","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("propylene_yield", "propylene","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c3_c4_lpg_yield", "C3/C4 LPG","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c4s_yield", "C4'S","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("po_yield", "PO","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("naphthalene_yield", "Naphthalene","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ebo_yield", "EBO","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ws_yield", "WS ","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("methane_yield", "Methane","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("offage_yield", "OFFAGE","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("rpg_yield", "RPG","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("benzene_yield", "Benzene","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("toluene_yield", "Toluene","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("xylene_yield", "Xylene","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c6_c8_na_yield", "C6-C8 NA","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c5_yield", "C5","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c9_yield", "C9","%"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String gaseityYield = tMonthlyProductionReport.getGaseityYield();
            String tatalYield = tMonthlyProductionReport.getTatalYield();
            String c3C2Yield = tMonthlyProductionReport.getC3C2Yield();
            String h2Yield = tMonthlyProductionReport.getH2Yield();
            String ethyleneYield = tMonthlyProductionReport.getEthyleneYield();
            String propyleneYield = tMonthlyProductionReport.getPropyleneYield();
            String c3C4LpgYield = tMonthlyProductionReport.getC3C4LpgYield();
            String c4sYield = tMonthlyProductionReport.getC4sYield();
            String poYield = tMonthlyProductionReport.getPoYield();
            String naphthaleneYield = tMonthlyProductionReport.getNaphthaleneYield();
            String eboYield = tMonthlyProductionReport.getEboYield();
            String wsYield = tMonthlyProductionReport.getWsYield();
            String methaneYield = tMonthlyProductionReport.getMethaneYield();
            String offageYield = tMonthlyProductionReport.getOffageYield();
            String rpgYield = tMonthlyProductionReport.getRpgYield();
            String benzeneYield = tMonthlyProductionReport.getBenzeneYield();
            String tolueneYield = tMonthlyProductionReport.getTolueneYield();
            String xyleneYield = tMonthlyProductionReport.getXyleneYield();
            String c6C8NaYield = tMonthlyProductionReport.getC6C8NaYield();
            String c5Yield = tMonthlyProductionReport.getC5Yield();
            String c9Yield = tMonthlyProductionReport.getC9Yield();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), gaseityYield);
                method.invoke(monthlyProductionReportVOs.get(1), tatalYield);
                method.invoke(monthlyProductionReportVOs.get(2), c3C2Yield);
                method.invoke(monthlyProductionReportVOs.get(3), h2Yield);
                method.invoke(monthlyProductionReportVOs.get(4), ethyleneYield);
                method.invoke(monthlyProductionReportVOs.get(5), propyleneYield);
                method.invoke(monthlyProductionReportVOs.get(6), c3C4LpgYield);
                method.invoke(monthlyProductionReportVOs.get(7), c4sYield);
                method.invoke(monthlyProductionReportVOs.get(8), poYield);
                method.invoke(monthlyProductionReportVOs.get(9), naphthaleneYield);
                method.invoke(monthlyProductionReportVOs.get(10), eboYield);
                method.invoke(monthlyProductionReportVOs.get(11), wsYield);
                method.invoke(monthlyProductionReportVOs.get(12), methaneYield);
                method.invoke(monthlyProductionReportVOs.get(13), offageYield);
                method.invoke(monthlyProductionReportVOs.get(14), rpgYield);
                method.invoke(monthlyProductionReportVOs.get(15), benzeneYield);
                method.invoke(monthlyProductionReportVOs.get(16), tolueneYield);
                method.invoke(monthlyProductionReportVOs.get(17), xyleneYield);
                method.invoke(monthlyProductionReportVOs.get(18), c6C8NaYield);
                method.invoke(monthlyProductionReportVOs.get(19), c5Yield);
                method.invoke(monthlyProductionReportVOs.get(20), c9Yield);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(gaseityYield);
                    monthlyProductionReportVOs.get(1).setCurrently(tatalYield);
                    monthlyProductionReportVOs.get(2).setCurrently(c3C2Yield);
                    monthlyProductionReportVOs.get(3).setCurrently(h2Yield);
                    monthlyProductionReportVOs.get(4).setCurrently(ethyleneYield);
                    monthlyProductionReportVOs.get(5).setCurrently(propyleneYield);
                    monthlyProductionReportVOs.get(6).setCurrently(c3C4LpgYield);
                    monthlyProductionReportVOs.get(7).setCurrently(c4sYield);
                    monthlyProductionReportVOs.get(8).setCurrently(poYield);
                    monthlyProductionReportVOs.get(9).setCurrently(naphthaleneYield);
                    monthlyProductionReportVOs.get(10).setCurrently(eboYield);
                    monthlyProductionReportVOs.get(11).setCurrently(wsYield);
                    monthlyProductionReportVOs.get(12).setCurrently(methaneYield);
                    monthlyProductionReportVOs.get(13).setCurrently(offageYield);
                    monthlyProductionReportVOs.get(14).setCurrently(rpgYield);
                    monthlyProductionReportVOs.get(15).setCurrently(benzeneYield);
                    monthlyProductionReportVOs.get(16).setCurrently(tolueneYield);
                    monthlyProductionReportVOs.get(17).setCurrently(xyleneYield);
                    monthlyProductionReportVOs.get(18).setCurrently(c6C8NaYield);
                    monthlyProductionReportVOs.get(19).setCurrently(c5Yield);
                    monthlyProductionReportVOs.get(20).setCurrently(c9Yield);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Cracker Utility Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectCrackerUtilityConsumptionByYear(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.selectCrackerUtilityConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("fuel_gas_offgas_cracker","FG(include NG+Offage)","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shp_cracker","SS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("hp_cracker","HS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("mp_cracker","MS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("lp_cracker","LS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("electricity_cracker","Electricity","MWh"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cooling_water_cracker","coiling water","kt"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_ia","Instru. Air","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pa_ia_cracker","Plant Air","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("n2_cracker","N2","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("hp_bfw_cracker","BFW","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("polished_con_cracker","Polished Condensate","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_pww","P. W. Water","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("turbine_con_cracker","TC","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_cnww","CNWW","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_dww","DWW","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_wo","waste oil","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_pw","Potable Water","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("prod_water_cracker","Production Water","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_ng","NG to furnace or offags to SUB","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_consumption_offgas","offage product","t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String fuelGasOffgasCracker = tMonthlyProductionReport.getFuelGasOffgasCracker();
            String shpCracker = tMonthlyProductionReport.getShpCracker();
            String hpCracker = tMonthlyProductionReport.getHpCracker();
            String mpCracker = tMonthlyProductionReport.getMpCracker();
            String lpCracker = tMonthlyProductionReport.getLpCracker();
            String electricityCracker = tMonthlyProductionReport.getElectricityCracker();
            String coolingWaterCracker = tMonthlyProductionReport.getCoolingWaterCracker();
            String crackerConsumptionIa = tMonthlyProductionReport.getCrackerConsumptionIa();
            String paIaCracker = tMonthlyProductionReport.getPaIaCracker();
            String n2Cracker = tMonthlyProductionReport.getN2Cracker();
            String hpBfwCracker = tMonthlyProductionReport.getHpBfwCracker();
            String polishedConCracker = tMonthlyProductionReport.getPolishedConCracker();
            String crackerConsumptionPww = tMonthlyProductionReport.getCrackerConsumptionPww();
            String turbineConCracker = tMonthlyProductionReport.getTurbineConCracker();
            String crackerConsumptionCnww = tMonthlyProductionReport.getCrackerConsumptionCnww();
            String crackerConsumptionDww = tMonthlyProductionReport.getCrackerConsumptionDww();
            String crackerConsumptionWo = tMonthlyProductionReport.getCrackerConsumptionWo();
            String crackerConsumptionPw = tMonthlyProductionReport.getCrackerConsumptionPw();
            String prodWaterCracker = tMonthlyProductionReport.getProdWaterCracker();
            String crackerConsumptionNg = tMonthlyProductionReport.getCrackerConsumptionNg();
            String crackerConsumptionOffgas = tMonthlyProductionReport.getCrackerConsumptionOffgas();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), fuelGasOffgasCracker);
                method.invoke(monthlyProductionReportVOs.get(1), shpCracker);
                method.invoke(monthlyProductionReportVOs.get(2), hpCracker);
                method.invoke(monthlyProductionReportVOs.get(3), mpCracker);
                method.invoke(monthlyProductionReportVOs.get(4), lpCracker);
                method.invoke(monthlyProductionReportVOs.get(5), electricityCracker);
                method.invoke(monthlyProductionReportVOs.get(6), coolingWaterCracker);
                method.invoke(monthlyProductionReportVOs.get(7), crackerConsumptionIa);
                method.invoke(monthlyProductionReportVOs.get(8), paIaCracker);
                method.invoke(monthlyProductionReportVOs.get(9), n2Cracker);
                method.invoke(monthlyProductionReportVOs.get(10), hpBfwCracker);
                method.invoke(monthlyProductionReportVOs.get(11), polishedConCracker);
                method.invoke(monthlyProductionReportVOs.get(12), crackerConsumptionPww);
                method.invoke(monthlyProductionReportVOs.get(13), turbineConCracker);
                method.invoke(monthlyProductionReportVOs.get(14), crackerConsumptionCnww);
                method.invoke(monthlyProductionReportVOs.get(15), crackerConsumptionDww);
                method.invoke(monthlyProductionReportVOs.get(16), crackerConsumptionWo);
                method.invoke(monthlyProductionReportVOs.get(17), crackerConsumptionPw);
                method.invoke(monthlyProductionReportVOs.get(18), prodWaterCracker);
                method.invoke(monthlyProductionReportVOs.get(19), crackerConsumptionNg);
                method.invoke(monthlyProductionReportVOs.get(20), crackerConsumptionOffgas);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(fuelGasOffgasCracker);
                    monthlyProductionReportVOs.get(1).setCurrently(shpCracker);
                    monthlyProductionReportVOs.get(2).setCurrently(hpCracker);
                    monthlyProductionReportVOs.get(3).setCurrently(mpCracker);
                    monthlyProductionReportVOs.get(4).setCurrently(lpCracker);
                    monthlyProductionReportVOs.get(5).setCurrently(electricityCracker);
                    monthlyProductionReportVOs.get(6).setCurrently(coolingWaterCracker);
                    monthlyProductionReportVOs.get(7).setCurrently(crackerConsumptionIa);
                    monthlyProductionReportVOs.get(8).setCurrently(paIaCracker);
                    monthlyProductionReportVOs.get(9).setCurrently(n2Cracker);
                    monthlyProductionReportVOs.get(10).setCurrently(hpBfwCracker);
                    monthlyProductionReportVOs.get(11).setCurrently(polishedConCracker);
                    monthlyProductionReportVOs.get(12).setCurrently(crackerConsumptionPww);
                    monthlyProductionReportVOs.get(13).setCurrently(turbineConCracker);
                    monthlyProductionReportVOs.get(14).setCurrently(crackerConsumptionCnww);
                    monthlyProductionReportVOs.get(15).setCurrently(crackerConsumptionDww);
                    monthlyProductionReportVOs.get(16).setCurrently(crackerConsumptionWo);
                    monthlyProductionReportVOs.get(17).setCurrently(crackerConsumptionPw);
                    monthlyProductionReportVOs.get(18).setCurrently(prodWaterCracker);
                    monthlyProductionReportVOs.get(19).setCurrently(crackerConsumptionNg);
                    monthlyProductionReportVOs.get(20).setCurrently(crackerConsumptionOffgas);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Cracker Energy Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectCrackerEnergyConsumptionByYear(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.selectCrackerEnergyConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_energy_te_teo","total energy","TEO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_energy_te_tec","total energy","TEC"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_energy_ee_kgeot","Energy/ethylene","kgEO/t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_energy_ee_kgect","Energy/ethylene","kgEC/t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String crackerEnergyTeTeo = tMonthlyProductionReport.getCrackerEnergyTeTeo();
            String crackerEnergyTeTec = tMonthlyProductionReport.getCrackerEnergyTeTec();
            String crackerEnergyEeKgeot = tMonthlyProductionReport.getCrackerEnergyEeKgeot();
            String crackerEnergyEeKgect = tMonthlyProductionReport.getCrackerEnergyEeKgect();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), crackerEnergyTeTeo);
                method.invoke(monthlyProductionReportVOs.get(1), crackerEnergyTeTec);
                method.invoke(monthlyProductionReportVOs.get(2), crackerEnergyEeKgeot);
                method.invoke(monthlyProductionReportVOs.get(3), crackerEnergyEeKgect);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(crackerEnergyTeTeo);
                    monthlyProductionReportVOs.get(1).setCurrently(crackerEnergyTeTec);
                    monthlyProductionReportVOs.get(2).setCurrently(crackerEnergyEeKgeot);
                    monthlyProductionReportVOs.get(3).setCurrently(crackerEnergyEeKgect);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Aromatics Utility Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectAromaticsUtilityConsumptionByYear(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.selectAromaticsUtilityConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shp_pgu_aeu","SS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("hp_pgu_aeu","HS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("mp_pgu_aeu","MS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("lp_pgu_aeu","LS","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("electricity_pgu_aeu","Electricity","MWh"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cooling_water_pgu_aeu","coiling water","kt"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_consumption_pw","Potable Water","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("prod_water_pgu_aeu","Production Water","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("hp_bfw_pgu_aeu","BFW","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("n2_pgu_aeu","N2","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("pa_ia_pgu_aeu","PA&IA","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("turbine_con_pgu_aeu","Turbine Condensate","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_consumption_cww","Contaminated WW","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_consumption_pww","Production WW","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_consumption_dww","DWW","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_consumption_wl","Waste Liquid","t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String shpPguAeu = tMonthlyProductionReport.getShpPguAeu();
            String hpPguAeu = tMonthlyProductionReport.getHpPguAeu();
            String mpPguAeu = tMonthlyProductionReport.getMpPguAeu();
            String lpPguAeu = tMonthlyProductionReport.getLpPguAeu();
            String electricityPguAeu = tMonthlyProductionReport.getElectricityPguAeu();
            String coolingWaterPguAeu = tMonthlyProductionReport.getCoolingWaterPguAeu();
            String aromaticsConsumptionPw = tMonthlyProductionReport.getAromaticsConsumptionPw();
            String prodWaterPguAeu = tMonthlyProductionReport.getProdWaterPguAeu();
            String hpBfwPguAeu = tMonthlyProductionReport.getHpBfwPguAeu();
            String n2PguAeu = tMonthlyProductionReport.getN2PguAeu();
            String paIaPguAeu = tMonthlyProductionReport.getPaIaPguAeu();
            String turbineConPguAeu = tMonthlyProductionReport.getTurbineConPguAeu();
            String aromaticsConsumptionCww = tMonthlyProductionReport.getAromaticsConsumptionCww();
            String aromaticsConsumptionPww = tMonthlyProductionReport.getAromaticsConsumptionPww();
            String aromaticsConsumptionDww = tMonthlyProductionReport.getAromaticsConsumptionDww();
            String aromaticsConsumptionWl = tMonthlyProductionReport.getAromaticsConsumptionWl();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), shpPguAeu);
                method.invoke(monthlyProductionReportVOs.get(1), hpPguAeu);
                method.invoke(monthlyProductionReportVOs.get(2), mpPguAeu);
                method.invoke(monthlyProductionReportVOs.get(3), lpPguAeu);
                method.invoke(monthlyProductionReportVOs.get(4), electricityPguAeu);
                method.invoke(monthlyProductionReportVOs.get(5), coolingWaterPguAeu);
                method.invoke(monthlyProductionReportVOs.get(6), aromaticsConsumptionPw);
                method.invoke(monthlyProductionReportVOs.get(7), prodWaterPguAeu);
                method.invoke(monthlyProductionReportVOs.get(8), hpBfwPguAeu);
                method.invoke(monthlyProductionReportVOs.get(9), n2PguAeu);
                method.invoke(monthlyProductionReportVOs.get(10), paIaPguAeu);
                method.invoke(monthlyProductionReportVOs.get(11), turbineConPguAeu);
                method.invoke(monthlyProductionReportVOs.get(12), aromaticsConsumptionCww);
                method.invoke(monthlyProductionReportVOs.get(13), aromaticsConsumptionPww);
                method.invoke(monthlyProductionReportVOs.get(14), aromaticsConsumptionDww);
                method.invoke(monthlyProductionReportVOs.get(15), aromaticsConsumptionWl);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(shpPguAeu);
                    monthlyProductionReportVOs.get(1).setCurrently(hpPguAeu);
                    monthlyProductionReportVOs.get(2).setCurrently(mpPguAeu);
                    monthlyProductionReportVOs.get(3).setCurrently(lpPguAeu);
                    monthlyProductionReportVOs.get(4).setCurrently(electricityPguAeu);
                    monthlyProductionReportVOs.get(5).setCurrently(coolingWaterPguAeu);
                    monthlyProductionReportVOs.get(6).setCurrently(aromaticsConsumptionPw);
                    monthlyProductionReportVOs.get(7).setCurrently(prodWaterPguAeu);
                    monthlyProductionReportVOs.get(8).setCurrently(hpBfwPguAeu);
                    monthlyProductionReportVOs.get(9).setCurrently(n2PguAeu);
                    monthlyProductionReportVOs.get(10).setCurrently(paIaPguAeu);
                    monthlyProductionReportVOs.get(11).setCurrently(turbineConPguAeu);
                    monthlyProductionReportVOs.get(12).setCurrently(aromaticsConsumptionCww);
                    monthlyProductionReportVOs.get(13).setCurrently(aromaticsConsumptionPww);
                    monthlyProductionReportVOs.get(14).setCurrently(aromaticsConsumptionDww);
                    monthlyProductionReportVOs.get(15).setCurrently(aromaticsConsumptionWl);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Aromatics Energy Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectAromaticsEnergyConsumptionByYear(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.selectAromaticsEnergyConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_energy_te_teo","total energy","TEO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_energy_te_tec","total energy","TEC"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_energy_ee_kgeot","Energy/ethylene","kgEO/t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aromatics_energy_ee_kgect","Energy/ethylene","kgEC/t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String aromaticsEnergyTeTeo = tMonthlyProductionReport.getAromaticsEnergyTeTeo();
            String aromaticsEnergyTeTec = tMonthlyProductionReport.getAromaticsEnergyTeTec();
            String aromaticsEnergyEeKgeot = tMonthlyProductionReport.getAromaticsEnergyEeKgeot();
            String aromaticsEnergyEeKgect = tMonthlyProductionReport.getAromaticsEnergyEeKgect();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), aromaticsEnergyTeTeo);
                method.invoke(monthlyProductionReportVOs.get(1), aromaticsEnergyTeTec);
                method.invoke(monthlyProductionReportVOs.get(2), aromaticsEnergyEeKgeot);
                method.invoke(monthlyProductionReportVOs.get(3), aromaticsEnergyEeKgect);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(aromaticsEnergyTeTeo);
                    monthlyProductionReportVOs.get(1).setCurrently(aromaticsEnergyTeTec);
                    monthlyProductionReportVOs.get(2).setCurrently(aromaticsEnergyEeKgeot);
                    monthlyProductionReportVOs.get(3).setCurrently(aromaticsEnergyEeKgect);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Plant Load
     */
    @Override
    public List<MonthlyProductionReportVO> selectPlantLoadByYear(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.selectPlantLoadByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cracker_load","Cracker load","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("c2_c3_capacity","C2+C3 Capacity",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ethylene_load","Ethylene load","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("ethylene_capacity","Ethylene Capacity",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_load","AEU load","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("btx_capacity","BTX Capacity",""));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String crackerLoad = tMonthlyProductionReport.getCrackerLoad();
            String c2C3Capacity = tMonthlyProductionReport.getC2C3Capacity();
            String ethyleneLoad = tMonthlyProductionReport.getEthyleneLoad();
            String ethyleneCapacity = tMonthlyProductionReport.getEthyleneCapacity();
            String aeuLoad = tMonthlyProductionReport.getAeuLoad();
            String btxCapacity = tMonthlyProductionReport.getBtxCapacity();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), crackerLoad);
                method.invoke(monthlyProductionReportVOs.get(1), c2C3Capacity);
                method.invoke(monthlyProductionReportVOs.get(2), ethyleneLoad);
                method.invoke(monthlyProductionReportVOs.get(3), ethyleneCapacity);
                method.invoke(monthlyProductionReportVOs.get(4), aeuLoad);
                method.invoke(monthlyProductionReportVOs.get(5), btxCapacity);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(crackerLoad);
                    monthlyProductionReportVOs.get(1).setCurrently(c2C3Capacity);
                    monthlyProductionReportVOs.get(2).setCurrently(ethyleneLoad);
                    monthlyProductionReportVOs.get(3).setCurrently(ethyleneCapacity);
                    monthlyProductionReportVOs.get(4).setCurrently(aeuLoad);
                    monthlyProductionReportVOs.get(5).setCurrently(btxCapacity);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Cost Fr Ethylene
     */
    @Override
    public List<MonthlyProductionReportVO> selectCostFrEthyleneByYear(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.selectCostFrEthyleneByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("cost_fr_ethylene","the cost","cny/t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String costFrEthylene = tMonthlyProductionReport.getCostFrEthylene();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), costFrEthylene);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(costFrEthylene);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Runing Rate
     */
    @Override
    public List<MonthlyProductionReportVO> selectRuningRateByYear(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.selectRuningRateByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("run_hour", "run hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("run_rate", "run rate", "%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("calendar_hour", "calendar hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("calendar_day", "run day", "day"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String runHour = tMonthlyProductionReport.getRunHour();
            String runRate = tMonthlyProductionReport.getRunRate();
            String calendarHour = tMonthlyProductionReport.getCalendarHour();
            String calendarDay = tMonthlyProductionReport.getCalendarDay();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), runHour);
                method.invoke(monthlyProductionReportVOs.get(1), runRate);
                method.invoke(monthlyProductionReportVOs.get(2), calendarHour);
                method.invoke(monthlyProductionReportVOs.get(3), calendarDay);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(runHour);
                    monthlyProductionReportVOs.get(1).setCurrently(runRate);
                    monthlyProductionReportVOs.get(2).setCurrently(calendarHour);
                    monthlyProductionReportVOs.get(3).setCurrently(calendarDay);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Shoudown Hour
     */
    @Override
    public List<MonthlyProductionReportVO> selectShoudownHourByYear(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.selectShoudownHourByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_opt", "operation time", "time"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_oph", "hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_eqt", "equipment time", "time"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_eqh", "hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_it", "instrument time", "time"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_ith", "hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_elt", "electric time", "time"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_elth", "hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_ot", "otherwise time", "time"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_oth", "hour", "h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_tt", "total time", "time"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("shutdouwn_th", "total hour", "h"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String shutdouwnOpt = tMonthlyProductionReport.getShutdouwnOpt();
            String shutdouwnOph = tMonthlyProductionReport.getShutdouwnOph();
            String shutdouwnEqt = tMonthlyProductionReport.getShutdouwnEqt();
            String shutdouwnEqh = tMonthlyProductionReport.getShutdouwnEqh();
            String shutdouwnIt = tMonthlyProductionReport.getShutdouwnIt();
            String shutdouwnIth = tMonthlyProductionReport.getShutdouwnIth();
            String shutdouwnElt = tMonthlyProductionReport.getShutdouwnElt();
            String shutdouwnElth = tMonthlyProductionReport.getShutdouwnElth();
            String shutdouwnOt = tMonthlyProductionReport.getShutdouwnOt();
            String shutdouwnOth = tMonthlyProductionReport.getShutdouwnOth();
            String shutdouwnTt = tMonthlyProductionReport.getShutdouwnTt();
            String shutdouwnTh = tMonthlyProductionReport.getShutdouwnTh();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), shutdouwnOpt);
                method.invoke(monthlyProductionReportVOs.get(1), shutdouwnOph);
                method.invoke(monthlyProductionReportVOs.get(2), shutdouwnEqt);
                method.invoke(monthlyProductionReportVOs.get(3), shutdouwnEqh);
                method.invoke(monthlyProductionReportVOs.get(4), shutdouwnIt);
                method.invoke(monthlyProductionReportVOs.get(5), shutdouwnIth);
                method.invoke(monthlyProductionReportVOs.get(6), shutdouwnElt);
                method.invoke(monthlyProductionReportVOs.get(7), shutdouwnElth);
                method.invoke(monthlyProductionReportVOs.get(8), shutdouwnOt);
                method.invoke(monthlyProductionReportVOs.get(9), shutdouwnOth);
                method.invoke(monthlyProductionReportVOs.get(10), shutdouwnTt);
                method.invoke(monthlyProductionReportVOs.get(11), shutdouwnTh);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(shutdouwnOpt);
                    monthlyProductionReportVOs.get(1).setCurrently(shutdouwnOph);
                    monthlyProductionReportVOs.get(2).setCurrently(shutdouwnEqt);
                    monthlyProductionReportVOs.get(3).setCurrently(shutdouwnEqh);
                    monthlyProductionReportVOs.get(4).setCurrently(shutdouwnIt);
                    monthlyProductionReportVOs.get(5).setCurrently(shutdouwnIth);
                    monthlyProductionReportVOs.get(6).setCurrently(shutdouwnElt);
                    monthlyProductionReportVOs.get(7).setCurrently(shutdouwnElth);
                    monthlyProductionReportVOs.get(8).setCurrently(shutdouwnOt);
                    monthlyProductionReportVOs.get(9).setCurrently(shutdouwnOth);
                    monthlyProductionReportVOs.get(10).setCurrently(shutdouwnTt);
                    monthlyProductionReportVOs.get(11).setCurrently(shutdouwnTh);

                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Otherside
     */
    @Override
    public List<MonthlyProductionReportVO> selectOthersideByYear(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.selectOthersideByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("eu_loss","EU loss","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("eu_loss_rate","EU loss rate","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_loss","AEU loss","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("aeu_loss_rate","AEU loss rate","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("total_loss","Total loss","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("total_loss_rate","Total loss rate","%"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String euLoss = tMonthlyProductionReport.getEuLoss();
            String euLossRate = tMonthlyProductionReport.getEuLossRate();
            String aeuLoss = tMonthlyProductionReport.getAeuLoss();
            String aeuLossRate = tMonthlyProductionReport.getAeuLossRate();
            String totalLoss = tMonthlyProductionReport.getTotalLoss();
            String totalLossRate = tMonthlyProductionReport.getTotalLossRate();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), euLoss);
                method.invoke(monthlyProductionReportVOs.get(1), euLossRate);
                method.invoke(monthlyProductionReportVOs.get(2), aeuLoss);
                method.invoke(monthlyProductionReportVOs.get(3), aeuLossRate);
                method.invoke(monthlyProductionReportVOs.get(4), totalLoss);
                method.invoke(monthlyProductionReportVOs.get(5), totalLossRate);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(euLoss);
                    monthlyProductionReportVOs.get(1).setCurrently(euLossRate);
                    monthlyProductionReportVOs.get(2).setCurrently(aeuLoss);
                    monthlyProductionReportVOs.get(3).setCurrently(aeuLossRate);
                    monthlyProductionReportVOs.get(4).setCurrently(totalLoss);
                    monthlyProductionReportVOs.get(5).setCurrently(totalLossRate);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Chemical Consume
     */
    @Override
    public List<MonthlyProductionReportVO> selectChemicalConsumeByYear(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.selectChemicalConsumeByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_pt3000","PT-3000","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_naoh","NAOH","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_pt4000","PT-4000","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_ec3392a","EC3392A","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_2w906","2W906","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_ec1489a","EC1489A","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_ec1486a","EC1486A","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_20y3483","20Y3483","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_8q202","8Q202","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_20y97a","20Y97A","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_ec3269a","EC3269A","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_20y25","20Y25","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_20y77","20Y77","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_510ws","510WS","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_n130","N130","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_h2so4","H2SO4","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_naoh2","NaOH","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_ch3oh","CH3OH","TO"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("chemical_consume_pt30002","PT-3000","TO"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String chemicalConsumePt3000 = tMonthlyProductionReport.getChemicalConsumePt3000();
            String chemicalConsumeNaoh = tMonthlyProductionReport.getChemicalConsumeNaoh();
            String chemicalConsumePt4000 = tMonthlyProductionReport.getChemicalConsumePt4000();
            String chemicalConsumeEc3392a = tMonthlyProductionReport.getChemicalConsumeEc3392a();
            String chemicalConsume2w906 = tMonthlyProductionReport.getChemicalConsume2w906();
            String chemicalConsumeEc1489a = tMonthlyProductionReport.getChemicalConsumeEc1489a();
            String chemicalConsumeEc1486a = tMonthlyProductionReport.getChemicalConsumeEc1486a();
            String chemicalConsume20y3483 = tMonthlyProductionReport.getChemicalConsume20y3483();
            String chemicalConsume8q202 = tMonthlyProductionReport.getChemicalConsume8q202();
            String chemicalConsume20y97a = tMonthlyProductionReport.getChemicalConsume20y97a();
            String chemicalConsumeEc3269a = tMonthlyProductionReport.getChemicalConsumeEc3269a();
            String chemicalConsume20y25 = tMonthlyProductionReport.getChemicalConsume20y25();
            String chemicalConsume20y77 = tMonthlyProductionReport.getChemicalConsume20y77();
            String chemicalConsume510ws = tMonthlyProductionReport.getChemicalConsume510ws();
            String chemicalConsumeN130 = tMonthlyProductionReport.getChemicalConsumeN130();
            String chemicalConsumeH2so4 = tMonthlyProductionReport.getChemicalConsumeH2so4();
            String chemicalConsumeNaoh2 = tMonthlyProductionReport.getChemicalConsumeNaoh2();
            String chemicalConsumeCh3oh = tMonthlyProductionReport.getChemicalConsumeCh3oh();
            String chemicalConsumePt30002 = tMonthlyProductionReport.getChemicalConsumePt30002();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), chemicalConsumePt3000);
                method.invoke(monthlyProductionReportVOs.get(1), chemicalConsumeNaoh);
                method.invoke(monthlyProductionReportVOs.get(2), chemicalConsumePt4000);
                method.invoke(monthlyProductionReportVOs.get(3), chemicalConsumeEc3392a);
                method.invoke(monthlyProductionReportVOs.get(4), chemicalConsume2w906);
                method.invoke(monthlyProductionReportVOs.get(5), chemicalConsumeEc1489a);
                method.invoke(monthlyProductionReportVOs.get(6), chemicalConsumeEc1486a);
                method.invoke(monthlyProductionReportVOs.get(7), chemicalConsume20y3483);
                method.invoke(monthlyProductionReportVOs.get(8), chemicalConsume8q202);
                method.invoke(monthlyProductionReportVOs.get(9), chemicalConsume20y97a);
                method.invoke(monthlyProductionReportVOs.get(10), chemicalConsumeEc3269a);
                method.invoke(monthlyProductionReportVOs.get(11), chemicalConsume20y25);
                method.invoke(monthlyProductionReportVOs.get(12), chemicalConsume20y77);
                method.invoke(monthlyProductionReportVOs.get(13), chemicalConsume510ws);
                method.invoke(monthlyProductionReportVOs.get(14), chemicalConsumeN130);
                method.invoke(monthlyProductionReportVOs.get(15), chemicalConsumeH2so4);
                method.invoke(monthlyProductionReportVOs.get(16), chemicalConsumeNaoh2);
                method.invoke(monthlyProductionReportVOs.get(17), chemicalConsumeCh3oh);
                method.invoke(monthlyProductionReportVOs.get(18), chemicalConsumePt30002);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(chemicalConsumePt3000);
                    monthlyProductionReportVOs.get(1).setCurrently(chemicalConsumeNaoh);
                    monthlyProductionReportVOs.get(2).setCurrently(chemicalConsumePt4000);
                    monthlyProductionReportVOs.get(3).setCurrently(chemicalConsumeEc3392a);
                    monthlyProductionReportVOs.get(4).setCurrently(chemicalConsume2w906);
                    monthlyProductionReportVOs.get(5).setCurrently(chemicalConsumeEc1489a);
                    monthlyProductionReportVOs.get(6).setCurrently(chemicalConsumeEc1486a);
                    monthlyProductionReportVOs.get(7).setCurrently(chemicalConsume20y3483);
                    monthlyProductionReportVOs.get(8).setCurrently(chemicalConsume8q202);
                    monthlyProductionReportVOs.get(9).setCurrently(chemicalConsume20y97a);
                    monthlyProductionReportVOs.get(10).setCurrently(chemicalConsumeEc3269a);
                    monthlyProductionReportVOs.get(11).setCurrently(chemicalConsume20y25);
                    monthlyProductionReportVOs.get(12).setCurrently(chemicalConsume20y77);
                    monthlyProductionReportVOs.get(13).setCurrently(chemicalConsume510ws);
                    monthlyProductionReportVOs.get(14).setCurrently(chemicalConsumeN130);
                    monthlyProductionReportVOs.get(15).setCurrently(chemicalConsumeH2so4);
                    monthlyProductionReportVOs.get(16).setCurrently(chemicalConsumeNaoh2);
                    monthlyProductionReportVOs.get(17).setCurrently(chemicalConsumeCh3oh);
                    monthlyProductionReportVOs.get(18).setCurrently(chemicalConsumePt30002);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询SCTU Utility Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectSCTUUtilityConsumptionByYear(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.selectSCTUUtilityConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctu_consumption_fg","FG (NG+Offage)","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctu_consumption_mp","MP","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctu_consumption_lp","LP","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctu_consumption_electirc","Electric","MWh"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctu_consumption_cw","CW","KT"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctu_consumption_pa_ia","PA&IA","Km3"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String sctuConsumptionFg = tMonthlyProductionReport.getSctuConsumptionFg();
            String sctuConsumptionMp = tMonthlyProductionReport.getSctuConsumptionMp();
            String sctuConsumptionLp = tMonthlyProductionReport.getSctuConsumptionLp();
            String sctuConsumptionElectirc = tMonthlyProductionReport.getSctuConsumptionElectirc();
            String sctuConsumptionCw = tMonthlyProductionReport.getSctuConsumptionCw();
            String sctuConsumptionPaIa = tMonthlyProductionReport.getSctuConsumptionPaIa();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), sctuConsumptionFg);
                method.invoke(monthlyProductionReportVOs.get(1), sctuConsumptionMp);
                method.invoke(monthlyProductionReportVOs.get(2), sctuConsumptionLp);
                method.invoke(monthlyProductionReportVOs.get(3), sctuConsumptionElectirc);
                method.invoke(monthlyProductionReportVOs.get(4), sctuConsumptionCw);
                method.invoke(monthlyProductionReportVOs.get(5), sctuConsumptionPaIa);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(sctuConsumptionFg);
                    monthlyProductionReportVOs.get(1).setCurrently(sctuConsumptionMp);
                    monthlyProductionReportVOs.get(2).setCurrently(sctuConsumptionLp);
                    monthlyProductionReportVOs.get(3).setCurrently(sctuConsumptionElectirc);
                    monthlyProductionReportVOs.get(4).setCurrently(sctuConsumptionCw);
                    monthlyProductionReportVOs.get(5).setCurrently(sctuConsumptionPaIa);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询SUB Utility Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectSUBUtilityConsumptionByYear(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.selectSUBUtilityConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_electric","Electric","MWh"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_ng","NG","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_fg_fr_eu","FG fr EU","tom"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_lpg","LPG","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_hhp_steam","HHP Steam","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_mp_steam","MP Steam","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_lp_steam","LP Steam","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_p_condensate","P. Condensate","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_cw","CW","KT"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_n2","N2","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_ia_pa","IA&PA","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_hppa","HPPA","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_production_water","Production Water","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_hp_steam_fr_sub_net","HP Steam fr SuB-net","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_bfw","BFW","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_eo_eg_purge_gas","EO/EG purge gas","Km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_h2_fr_syngas_as_fule","H2 fr Syngas as fule","km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_hp_product","HP product","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_sub1_fg_fic1302","SUB1# FG FIC1302","Km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_sub2_fg_fic2302","SUB2# FG FIC2302","Km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_total_ng_fc3702","total NG FC3702","Km3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_cost_output","COST(output)","RMB/T"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_zfy","总费用","RMB"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_gljcl","锅炉净产量","T"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_cc","产汽","T/h"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sub_con_sc","输出","T/h"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String subConElectric = tMonthlyProductionReport.getSubConElectric();
            String subConNg = tMonthlyProductionReport.getSubConNg();
            String subConFgFrEu = tMonthlyProductionReport.getSubConFgFrEu();
            String subConLpg = tMonthlyProductionReport.getSubConLpg();
            String subConHhpSteam = tMonthlyProductionReport.getSubConHhpSteam();
            String subConMpSteam = tMonthlyProductionReport.getSubConMpSteam();
            String subConLpSteam = tMonthlyProductionReport.getSubConLpSteam();
            String subConPCondensate = tMonthlyProductionReport.getSubConPCondensate();
            String subConCw = tMonthlyProductionReport.getSubConCw();
            String subConN2 = tMonthlyProductionReport.getSubConN2();
            String subConIaPa = tMonthlyProductionReport.getSubConIaPa();
            String subConHppa = tMonthlyProductionReport.getSubConHppa();
            String subConProductionWater = tMonthlyProductionReport.getSubConProductionWater();
            String subConHpSteamFrSubNet = tMonthlyProductionReport.getSubConHpSteamFrSubNet();
            String subConBfw = tMonthlyProductionReport.getSubConBfw();
            String subConEoEgPurgeGas = tMonthlyProductionReport.getSubConEoEgPurgeGas();
            String subConH2FrSyngasAsFule = tMonthlyProductionReport.getSubConH2FrSyngasAsFule();
            String subConHpProduct = tMonthlyProductionReport.getSubConHpProduct();
            String subConSub1FgFic1302 = tMonthlyProductionReport.getSubConSub1FgFic1302();
            String subConSub2FgFic2302 = tMonthlyProductionReport.getSubConSub2FgFic2302();
            String subConTotalNgFc3702 = tMonthlyProductionReport.getSubConTotalNgFc3702();
            String subConCostOutput = tMonthlyProductionReport.getSubConCostOutput();
            String subConZfy = tMonthlyProductionReport.getSubConZfy();
            String subConGljcl = tMonthlyProductionReport.getSubConGljcl();
            String subConCc = tMonthlyProductionReport.getSubConCc();
            String subConSc = tMonthlyProductionReport.getSubConSc();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), subConElectric);
                method.invoke(monthlyProductionReportVOs.get(1), subConNg);
                method.invoke(monthlyProductionReportVOs.get(2), subConFgFrEu);
                method.invoke(monthlyProductionReportVOs.get(3), subConLpg);
                method.invoke(monthlyProductionReportVOs.get(4), subConHhpSteam);
                method.invoke(monthlyProductionReportVOs.get(5), subConMpSteam);
                method.invoke(monthlyProductionReportVOs.get(6), subConLpSteam);
                method.invoke(monthlyProductionReportVOs.get(7), subConPCondensate);
                method.invoke(monthlyProductionReportVOs.get(8), subConCw);
                method.invoke(monthlyProductionReportVOs.get(9), subConN2);
                method.invoke(monthlyProductionReportVOs.get(10), subConIaPa);
                method.invoke(monthlyProductionReportVOs.get(11), subConHppa);
                method.invoke(monthlyProductionReportVOs.get(12), subConProductionWater);
                method.invoke(monthlyProductionReportVOs.get(13), subConHpSteamFrSubNet);
                method.invoke(monthlyProductionReportVOs.get(14), subConBfw);
                method.invoke(monthlyProductionReportVOs.get(15), subConEoEgPurgeGas);
                method.invoke(monthlyProductionReportVOs.get(16), subConH2FrSyngasAsFule);
                method.invoke(monthlyProductionReportVOs.get(17), subConHpProduct);
                method.invoke(monthlyProductionReportVOs.get(18), subConSub1FgFic1302);
                method.invoke(monthlyProductionReportVOs.get(19), subConSub2FgFic2302);
                method.invoke(monthlyProductionReportVOs.get(20), subConTotalNgFc3702);
                method.invoke(monthlyProductionReportVOs.get(21), subConCostOutput);
                method.invoke(monthlyProductionReportVOs.get(22), subConZfy);
                method.invoke(monthlyProductionReportVOs.get(23), subConGljcl);
                method.invoke(monthlyProductionReportVOs.get(24), subConCc);
                method.invoke(monthlyProductionReportVOs.get(25), subConSc);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(subConElectric);
                    monthlyProductionReportVOs.get(1).setCurrently(subConNg);
                    monthlyProductionReportVOs.get(2).setCurrently(subConFgFrEu);
                    monthlyProductionReportVOs.get(3).setCurrently(subConLpg);
                    monthlyProductionReportVOs.get(4).setCurrently(subConHhpSteam);
                    monthlyProductionReportVOs.get(5).setCurrently(subConMpSteam);
                    monthlyProductionReportVOs.get(6).setCurrently(subConLpSteam);
                    monthlyProductionReportVOs.get(7).setCurrently(subConPCondensate);
                    monthlyProductionReportVOs.get(8).setCurrently(subConCw);
                    monthlyProductionReportVOs.get(9).setCurrently(subConN2);
                    monthlyProductionReportVOs.get(10).setCurrently(subConIaPa);
                    monthlyProductionReportVOs.get(11).setCurrently(subConHppa);
                    monthlyProductionReportVOs.get(12).setCurrently(subConProductionWater);
                    monthlyProductionReportVOs.get(13).setCurrently(subConHpSteamFrSubNet);
                    monthlyProductionReportVOs.get(14).setCurrently(subConBfw);
                    monthlyProductionReportVOs.get(15).setCurrently(subConEoEgPurgeGas);
                    monthlyProductionReportVOs.get(16).setCurrently(subConH2FrSyngasAsFule);
                    monthlyProductionReportVOs.get(17).setCurrently(subConHpProduct);
                    monthlyProductionReportVOs.get(18).setCurrently(subConSub1FgFic1302);
                    monthlyProductionReportVOs.get(19).setCurrently(subConSub2FgFic2302);
                    monthlyProductionReportVOs.get(20).setCurrently(subConTotalNgFc3702);
                    monthlyProductionReportVOs.get(21).setCurrently(subConCostOutput);
                    monthlyProductionReportVOs.get(22).setCurrently(subConZfy);
                    monthlyProductionReportVOs.get(23).setCurrently(subConGljcl);
                    monthlyProductionReportVOs.get(24).setCurrently(subConCc);
                    monthlyProductionReportVOs.get(25).setCurrently(subConSc);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询SCTF Utility Consumption
     */
    @Override
    public List<MonthlyProductionReportVO> selectSCTFUtilityConsumptionByYear(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.selectSCTFUtilityConsumptionByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_electric","Electric","MWh"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_ng","NG","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_fg_fr_eu","FG fr EU","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_lpg","LPG","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_hhp_steam","HHP Steam","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_mp_steam","MP Steam","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_lp_steam","LP Steam","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_p_condensate","P. Condensate","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_cw","CW","KT"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_n2","N2","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_ia_pa","IA&PA","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_hppa","HPPA","KM3"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_production_water","Production Water","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_hp_steam_fr_sub_net","HP Steam fr SuB-net","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_bfw","BFW","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_contaminated_ww","Contaminated WW","Ton"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("sctf_con_production_ww","Production WW","Ton"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String sctfConElectric = tMonthlyProductionReport.getSctfConElectric();
            String sctfConNg = tMonthlyProductionReport.getSctfConNg();
            String sctfConFgFrEu = tMonthlyProductionReport.getSctfConFgFrEu();
            String sctfConLpg = tMonthlyProductionReport.getSctfConLpg();
            String sctfConHhpSteam = tMonthlyProductionReport.getSctfConHhpSteam();
            String sctfConMpSteam = tMonthlyProductionReport.getSctfConMpSteam();
            String sctfConLpSteam = tMonthlyProductionReport.getSctfConLpSteam();
            String sctfConPCondensate = tMonthlyProductionReport.getSctfConPCondensate();
            String sctfConCw = tMonthlyProductionReport.getSctfConCw();
            String sctfConN2 = tMonthlyProductionReport.getSctfConN2();
            String sctfConIaPa = tMonthlyProductionReport.getSctfConIaPa();
            String sctfConHppa = tMonthlyProductionReport.getSctfConHppa();
            String sctfConProductionWater = tMonthlyProductionReport.getSctfConProductionWater();
            String sctfConHpSteamFrSubNet = tMonthlyProductionReport.getSctfConHpSteamFrSubNet();
            String sctfConBfw = tMonthlyProductionReport.getSctfConBfw();
            String sctfConContaminatedWw = tMonthlyProductionReport.getSctfConContaminatedWw();
            String sctfConProductionWw = tMonthlyProductionReport.getSctfConProductionWw();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), sctfConElectric);
                method.invoke(monthlyProductionReportVOs.get(1), sctfConNg);
                method.invoke(monthlyProductionReportVOs.get(2), sctfConFgFrEu);
                method.invoke(monthlyProductionReportVOs.get(3), sctfConLpg);
                method.invoke(monthlyProductionReportVOs.get(4), sctfConHhpSteam);
                method.invoke(monthlyProductionReportVOs.get(5), sctfConMpSteam);
                method.invoke(monthlyProductionReportVOs.get(6), sctfConLpSteam);
                method.invoke(monthlyProductionReportVOs.get(7), sctfConPCondensate);
                method.invoke(monthlyProductionReportVOs.get(8), sctfConCw);
                method.invoke(monthlyProductionReportVOs.get(9), sctfConN2);
                method.invoke(monthlyProductionReportVOs.get(10), sctfConIaPa);
                method.invoke(monthlyProductionReportVOs.get(11), sctfConHppa);
                method.invoke(monthlyProductionReportVOs.get(12), sctfConProductionWater);
                method.invoke(monthlyProductionReportVOs.get(13), sctfConHpSteamFrSubNet);
                method.invoke(monthlyProductionReportVOs.get(14), sctfConBfw);
                method.invoke(monthlyProductionReportVOs.get(15), sctfConContaminatedWw);
                method.invoke(monthlyProductionReportVOs.get(16), sctfConProductionWw);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(sctfConElectric);
                    monthlyProductionReportVOs.get(1).setCurrently(sctfConNg);
                    monthlyProductionReportVOs.get(2).setCurrently(sctfConFgFrEu);
                    monthlyProductionReportVOs.get(3).setCurrently(sctfConLpg);
                    monthlyProductionReportVOs.get(4).setCurrently(sctfConHhpSteam);
                    monthlyProductionReportVOs.get(5).setCurrently(sctfConMpSteam);
                    monthlyProductionReportVOs.get(6).setCurrently(sctfConLpSteam);
                    monthlyProductionReportVOs.get(7).setCurrently(sctfConPCondensate);
                    monthlyProductionReportVOs.get(8).setCurrently(sctfConCw);
                    monthlyProductionReportVOs.get(9).setCurrently(sctfConN2);
                    monthlyProductionReportVOs.get(10).setCurrently( sctfConIaPa);
                    monthlyProductionReportVOs.get(11).setCurrently( sctfConHppa);
                    monthlyProductionReportVOs.get(12).setCurrently( sctfConProductionWater);
                    monthlyProductionReportVOs.get(13).setCurrently( sctfConHpSteamFrSubNet);
                    monthlyProductionReportVOs.get(14).setCurrently( sctfConBfw);
                    monthlyProductionReportVOs.get(15).setCurrently( sctfConContaminatedWw);
                    monthlyProductionReportVOs.get(16).setCurrently( sctfConProductionWw);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询KBI
     */
    @Override
    public List<MonthlyProductionReportVO> selectKbiByYear(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.selectKbiByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_pcur","Plant capacity utilization rate","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_energy_consumption","Energy Consumption","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_pepc","Product of Ethylene and Propylene and C4's base FEED","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_c2_c3_production","C2+C3 Production","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_c2_c3_target","C2+C3 target","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_c2_c3_target2","C2+C3 target","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_c2_target","C2 target","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_c2_target2","C2 target","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_lti","LTI","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_yepbf","Yields of Ethylene and propylene base on furnace feeds","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_yebf","Yields of Ethylene  base on furnace feeds","%"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_aeu_energy_consumption","AEU Energy Consumption","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_btx_production","BTX Production","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_btx_target","BTX target","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("kbi_btx_target2","BTX target","t"));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String kbiPcur = tMonthlyProductionReport.getKbiPcur();
            String kbiEnergyConsumption = tMonthlyProductionReport.getKbiEnergyConsumption();
            String kbiPepc = tMonthlyProductionReport.getKbiPepc();
            String kbiC2C3Production = tMonthlyProductionReport.getKbiC2C3Production();
            String kbiC2C3Target = tMonthlyProductionReport.getKbiC2C3Target();
            String kbiC2C3Target2 = tMonthlyProductionReport.getKbiC2C3Target2();
            String kbiC2Target = tMonthlyProductionReport.getKbiC2Target();
            String kbiC2Target2 = tMonthlyProductionReport.getKbiC2Target2();
            String kbiLti = tMonthlyProductionReport.getKbiLti();
            String kbiYepbf = tMonthlyProductionReport.getKbiYepbf();
            String kbiYebf = tMonthlyProductionReport.getKbiYebf();
            String kbiAeuEnergyConsumption = tMonthlyProductionReport.getKbiAeuEnergyConsumption();
            String kbiBtxProduction = tMonthlyProductionReport.getKbiBtxProduction();
            String kbiBtxTarget = tMonthlyProductionReport.getKbiBtxTarget();
            String kbiBtxTarget2 = tMonthlyProductionReport.getKbiBtxTarget2();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), kbiPcur);
                method.invoke(monthlyProductionReportVOs.get(1), kbiEnergyConsumption);
                method.invoke(monthlyProductionReportVOs.get(2), kbiPepc);
                method.invoke(monthlyProductionReportVOs.get(3), kbiC2C3Production);
                method.invoke(monthlyProductionReportVOs.get(4), kbiC2C3Target);
                method.invoke(monthlyProductionReportVOs.get(5), kbiC2C3Target2);
                method.invoke(monthlyProductionReportVOs.get(6), kbiC2Target);
                method.invoke(monthlyProductionReportVOs.get(7), kbiC2Target2);
                method.invoke(monthlyProductionReportVOs.get(8), kbiLti);
                method.invoke(monthlyProductionReportVOs.get(9), kbiYepbf);
                method.invoke(monthlyProductionReportVOs.get(10), kbiYebf);
                method.invoke(monthlyProductionReportVOs.get(11), kbiAeuEnergyConsumption);
                method.invoke(monthlyProductionReportVOs.get(12), kbiBtxProduction);
                method.invoke(monthlyProductionReportVOs.get(13), kbiBtxTarget);
                method.invoke(monthlyProductionReportVOs.get(14), kbiBtxTarget2);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(kbiPcur);
                    monthlyProductionReportVOs.get(1).setCurrently(kbiEnergyConsumption);
                    monthlyProductionReportVOs.get(2).setCurrently(kbiPepc);
                    monthlyProductionReportVOs.get(3).setCurrently(kbiC2C3Production);
                    monthlyProductionReportVOs.get(4).setCurrently(kbiC2C3Target);
                    monthlyProductionReportVOs.get(5).setCurrently(kbiC2C3Target2);
                    monthlyProductionReportVOs.get(6).setCurrently(kbiC2Target);
                    monthlyProductionReportVOs.get(7).setCurrently(kbiC2Target2);
                    monthlyProductionReportVOs.get(8).setCurrently(kbiLti);
                    monthlyProductionReportVOs.get(9).setCurrently(kbiYepbf);
                    monthlyProductionReportVOs.get(10).setCurrently(kbiYebf);
                    monthlyProductionReportVOs.get(11).setCurrently(kbiAeuEnergyConsumption);
                    monthlyProductionReportVOs.get(12).setCurrently(kbiBtxProduction);
                    monthlyProductionReportVOs.get(13).setCurrently(kbiBtxTarget);
                    monthlyProductionReportVOs.get(14).setCurrently(kbiBtxTarget2);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        this.calcAvg(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 按年份查询Summary
     */
    @Override
    public List<MonthlyProductionReportVO> selectSummaryByYear(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.selectSummaryByYear(year);
        // 前端月报数据集合，每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
        List<MonthlyProductionReportVO> monthlyProductionReportVOs = new ArrayList<>();
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_yb","乙丙产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_sny","石脑油产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_c5_raff","C5 raff产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_yw","乙烷产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_jqtj","加氢碳九产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_yxjy","乙烯焦油产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_hhc4","混合C4产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_sb","三苯产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_ljtw","裂解碳五产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_ljtj","裂解碳九产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_ccsny","重整石脑油产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_zqzh","蒸汽综合产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_lqs","冷却水产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_d","电产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_rlq","燃料气产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_jzs","精制水产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_cl_tpny","透平凝液产量","t"));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_yb","乙丙收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_sny","石脑油收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_c5_raff","C5 raff收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_yw","乙烷收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_jqtj","加氢碳九收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_yxjy","乙烯焦油收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_hhc4","混合C4收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_sb","三苯收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_ljtw","裂解碳五收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_ljtj","裂解碳九收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_ccsny","非芳收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_zqzh","蒸汽综合收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_lqs","冷却水收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_d","电收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_rlq","燃料气收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_jzs","精制水收率",""));
        monthlyProductionReportVOs.add(new MonthlyProductionReportVO("summary_sl_tpny","透平凝液收率",""));
        // 遍历从数据库中查出的月报数据集合，结果为0~12条数据不等
        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
            String summaryClYb = tMonthlyProductionReport.getSummaryClYb();
            String summaryClSny = tMonthlyProductionReport.getSummaryClSny();
            String summaryClC5Raff = tMonthlyProductionReport.getSummaryClC5Raff();
            String summaryClYw = tMonthlyProductionReport.getSummaryClYw();
            String summaryClJqtj = tMonthlyProductionReport.getSummaryClJqtj();
            String summaryClYxjy = tMonthlyProductionReport.getSummaryClYxjy();
            String summaryClHhc4 = tMonthlyProductionReport.getSummaryClHhc4();
            String summaryClSb = tMonthlyProductionReport.getSummaryClSb();
            String summaryClLjtw = tMonthlyProductionReport.getSummaryClLjtw();
            String summaryClLjtj = tMonthlyProductionReport.getSummaryClLjtj();
            String summaryClCcsny = tMonthlyProductionReport.getSummaryClCcsny();
            String summaryClZqzh = tMonthlyProductionReport.getSummaryClZqzh();
            String summaryClLqs = tMonthlyProductionReport.getSummaryClLqs();
            String summaryClD = tMonthlyProductionReport.getSummaryClD();
            String summaryClRlq = tMonthlyProductionReport.getSummaryClRlq();
            String summaryClJzs = tMonthlyProductionReport.getSummaryClJzs();
            String summaryClTpny = tMonthlyProductionReport.getSummaryClTpny();
            String summarySlYb = tMonthlyProductionReport.getSummarySlYb();
            String summarySlSny = tMonthlyProductionReport.getSummarySlSny();
            String summarySlC5Raff = tMonthlyProductionReport.getSummarySlC5Raff();
            String summarySlYw = tMonthlyProductionReport.getSummarySlYw();
            String summarySlJqtj = tMonthlyProductionReport.getSummarySlJqtj();
            String summarySlYxjy = tMonthlyProductionReport.getSummarySlYxjy();
            String summarySlHhc4 = tMonthlyProductionReport.getSummarySlHhc4();
            String summarySlSb = tMonthlyProductionReport.getSummarySlSb();
            String summarySlLjtw = tMonthlyProductionReport.getSummarySlLjtw();
            String summarySlLjtj = tMonthlyProductionReport.getSummarySlLjtj();
            String summarySlCcsny = tMonthlyProductionReport.getSummarySlCcsny();
            String summarySlZqzh = tMonthlyProductionReport.getSummarySlZqzh();
            String summarySlLqs = tMonthlyProductionReport.getSummarySlLqs();
            String summarySlD = tMonthlyProductionReport.getSummarySlD();
            String summarySlRlq = tMonthlyProductionReport.getSummarySlRlq();
            String summarySlJzs = tMonthlyProductionReport.getSummarySlJzs();
            String summarySlTpny = tMonthlyProductionReport.getSummarySlTpny();
            Long reportMonth = tMonthlyProductionReport.getReportMonth();   // 当前元素的所属月份
            Long reportYear = tMonthlyProductionReport.getReportYear();     // 当前元素的所属年份
            // 前端数据集合的class
            Class clazz = null;
            // 当前元素调用的set方法
            Method method = null;
            try {
                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
                method = this.getSetMethod(reportMonth, clazz);
                // 按照当前元素的所属月份调取相应set方法
                method.invoke(monthlyProductionReportVOs.get(0), summaryClYb);
                method.invoke(monthlyProductionReportVOs.get(1), summaryClSny);
                method.invoke(monthlyProductionReportVOs.get(2), summaryClC5Raff);
                method.invoke(monthlyProductionReportVOs.get(3), summaryClYw);
                method.invoke(monthlyProductionReportVOs.get(4), summaryClJqtj);
                method.invoke(monthlyProductionReportVOs.get(5), summaryClYxjy);
                method.invoke(monthlyProductionReportVOs.get(6), summaryClHhc4);
                method.invoke(monthlyProductionReportVOs.get(7), summaryClSb);
                method.invoke(monthlyProductionReportVOs.get(8), summaryClLjtw);
                method.invoke(monthlyProductionReportVOs.get(9), summaryClLjtj);
                method.invoke(monthlyProductionReportVOs.get(10), summaryClCcsny);
                method.invoke(monthlyProductionReportVOs.get(11), summaryClZqzh);
                method.invoke(monthlyProductionReportVOs.get(12), summaryClLqs);
                method.invoke(monthlyProductionReportVOs.get(13), summaryClD);
                method.invoke(monthlyProductionReportVOs.get(14), summaryClRlq);
                method.invoke(monthlyProductionReportVOs.get(15), summaryClJzs);
                method.invoke(monthlyProductionReportVOs.get(16), summaryClTpny);
                method.invoke(monthlyProductionReportVOs.get(17), summarySlYb);
                method.invoke(monthlyProductionReportVOs.get(18), summarySlSny);
                method.invoke(monthlyProductionReportVOs.get(19), summarySlC5Raff);
                method.invoke(monthlyProductionReportVOs.get(20), summarySlYw);
                method.invoke(monthlyProductionReportVOs.get(21), summarySlJqtj);
                method.invoke(monthlyProductionReportVOs.get(22), summarySlYxjy);
                method.invoke(monthlyProductionReportVOs.get(23), summarySlHhc4);
                method.invoke(monthlyProductionReportVOs.get(24), summarySlSb);
                method.invoke(monthlyProductionReportVOs.get(25), summarySlLjtw);
                method.invoke(monthlyProductionReportVOs.get(26), summarySlLjtj);
                method.invoke(monthlyProductionReportVOs.get(27), summarySlCcsny);
                method.invoke(monthlyProductionReportVOs.get(28), summarySlZqzh);
                method.invoke(monthlyProductionReportVOs.get(29), summarySlLqs);
                method.invoke(monthlyProductionReportVOs.get(30), summarySlD);
                method.invoke(monthlyProductionReportVOs.get(31), summarySlRlq);
                method.invoke(monthlyProductionReportVOs.get(32), summarySlJzs);
                method.invoke(monthlyProductionReportVOs.get(33), summarySlTpny);
                // 当前年份=所属年份，当前月份=所属月份
                if (currentMonth.equals(reportMonth) && currentYear.equals(reportYear)) {
                    monthlyProductionReportVOs.get(0).setCurrently(summaryClYb);
                    monthlyProductionReportVOs.get(1).setCurrently(summaryClSny);
                    monthlyProductionReportVOs.get(2).setCurrently(summaryClC5Raff);
                    monthlyProductionReportVOs.get(3).setCurrently(summaryClYw);
                    monthlyProductionReportVOs.get(4).setCurrently(summaryClJqtj);
                    monthlyProductionReportVOs.get(5).setCurrently(summaryClYxjy);
                    monthlyProductionReportVOs.get(6).setCurrently(summaryClHhc4);
                    monthlyProductionReportVOs.get(7).setCurrently(summaryClSb);
                    monthlyProductionReportVOs.get(8).setCurrently(summaryClLjtw);
                    monthlyProductionReportVOs.get(9).setCurrently(summaryClLjtj);
                    monthlyProductionReportVOs.get(10).setCurrently(summaryClCcsny);
                    monthlyProductionReportVOs.get(11).setCurrently(summaryClZqzh);
                    monthlyProductionReportVOs.get(12).setCurrently(summaryClLqs);
                    monthlyProductionReportVOs.get(13).setCurrently(summaryClD);
                    monthlyProductionReportVOs.get(14).setCurrently(summaryClRlq);
                    monthlyProductionReportVOs.get(15).setCurrently(summaryClJzs);
                    monthlyProductionReportVOs.get(16).setCurrently(summaryClTpny);
                    monthlyProductionReportVOs.get(17).setCurrently(summarySlYb);
                    monthlyProductionReportVOs.get(18).setCurrently(summarySlSny);
                    monthlyProductionReportVOs.get(19).setCurrently(summarySlC5Raff);
                    monthlyProductionReportVOs.get(20).setCurrently(summarySlYw);
                    monthlyProductionReportVOs.get(21).setCurrently(summarySlJqtj);
                    monthlyProductionReportVOs.get(22).setCurrently(summarySlYxjy);
                    monthlyProductionReportVOs.get(23).setCurrently(summarySlHhc4);
                    monthlyProductionReportVOs.get(24).setCurrently(summarySlSb);
                    monthlyProductionReportVOs.get(25).setCurrently(summarySlLjtw);
                    monthlyProductionReportVOs.get(26).setCurrently(summarySlLjtj);
                    monthlyProductionReportVOs.get(27).setCurrently(summarySlCcsny);
                    monthlyProductionReportVOs.get(28).setCurrently(summarySlZqzh);
                    monthlyProductionReportVOs.get(29).setCurrently(summarySlLqs);
                    monthlyProductionReportVOs.get(30).setCurrently(summarySlD);
                    monthlyProductionReportVOs.get(31).setCurrently(summarySlRlq);
                    monthlyProductionReportVOs.get(32).setCurrently(summarySlJzs);
                    monthlyProductionReportVOs.get(33).setCurrently(summarySlTpny);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        this.calcTotal(monthlyProductionReportVOs);
        return monthlyProductionReportVOs;
    }

    /**
     * 查询趋势分析数据
     *
     * @param monthlyAnalysisQueryVO 查询参数
     * @return
     */
    @Override
    public List<MonthlyAnalysisDataVO> selectAnalysisData(MonthlyAnalysisQueryVO monthlyAnalysisQueryVO) {
        if (monthlyAnalysisQueryVO.getFromYear()==monthlyAnalysisQueryVO.getToYear()) {
            return tMonthlyProductionReportMapper.selectAnalysisDataSameYear(monthlyAnalysisQueryVO.getItem(),
                    monthlyAnalysisQueryVO.getFromYear(), monthlyAnalysisQueryVO.getFromMonth(),
                    monthlyAnalysisQueryVO.getToYear(), monthlyAnalysisQueryVO.getToMonth());
        } else {
            return tMonthlyProductionReportMapper.selectAnalysisDataDiffYear(monthlyAnalysisQueryVO.getItem(),
                    monthlyAnalysisQueryVO.getFromYear(), monthlyAnalysisQueryVO.getFromMonth(),
                    monthlyAnalysisQueryVO.getToYear(), monthlyAnalysisQueryVO.getToMonth());
        }

    }

    /**
     * 获取月数值
     *
     * @param monthIndex
     * @param clazz
     * @param tableDatum
     * @return
     */
    private String getMonthValue(int monthIndex, Class clazz, MonthlyProductionReportVO tableDatum) {
        Method getMethod = null;
        String monthValue = "";
        try {
            if (monthIndex == 0) { getMethod =  clazz.getDeclaredMethod("getJan"); }
            if (monthIndex == 1) { getMethod =  clazz.getDeclaredMethod("getFeb"); }
            if (monthIndex == 2) { getMethod =  clazz.getDeclaredMethod("getMar"); }
            if (monthIndex == 3) { getMethod =  clazz.getDeclaredMethod("getApr"); }
            if (monthIndex == 4) { getMethod =  clazz.getDeclaredMethod("getMay"); }
            if (monthIndex == 5) { getMethod =  clazz.getDeclaredMethod("getJun"); }
            if (monthIndex == 6) { getMethod =  clazz.getDeclaredMethod("getJul"); }
            if (monthIndex == 7) { getMethod =  clazz.getDeclaredMethod("getAug"); }
            if (monthIndex == 8) { getMethod =  clazz.getDeclaredMethod("getSep"); }
            if (monthIndex == 9) { getMethod =  clazz.getDeclaredMethod("getOct"); }
            if (monthIndex == 10) { getMethod =  clazz.getDeclaredMethod("getNov"); }
            if (monthIndex == 11) { getMethod =  clazz.getDeclaredMethod("getDec"); }
            monthValue = (String) getMethod.invoke(tableDatum);
        } catch (NoSuchMethodException e1){
            e1.printStackTrace();
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
        } catch (InvocationTargetException e3) {
            e3.printStackTrace();
        } finally {
            return monthValue;
        }
    }

    /**
     * 修改Eligible Product Rate
     */
    @Override
    public int updateEligibleProductRate(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("c2_product_rate".equals(tableDatum.getDictLabel())) {
                    report.setC2ProductRate(monthValue);
                }
                if ("c3_product_rate".equals(tableDatum.getDictLabel())) {
                    report.setC3ProductRate(monthValue);
                }
                if ("c4s_product_rate".equals(tableDatum.getDictLabel())) {
                    report.setC4sProductRate(monthValue);
                }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改Cracker Utility Consumption
     */
    @Override
    public int updateCrackerUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("fuel_gas_offgas_cracker".equals(tableDatum.getDictLabel())) { report.setFuelGasOffgasCracker(monthValue); }
                if ("shp_cracker".equals(tableDatum.getDictLabel())) { report.setShpCracker(monthValue); }
                if ("hp_cracker".equals(tableDatum.getDictLabel())) { report.setHpCracker(monthValue); }
                if ("mp_cracker".equals(tableDatum.getDictLabel())) { report.setMpCracker(monthValue); }
                if ("lp_cracker".equals(tableDatum.getDictLabel())) { report.setLpCracker(monthValue); }
                if ("electricity_cracker".equals(tableDatum.getDictLabel())) { report.setElectricityCracker(monthValue); }
                if ("cooling_water_cracker".equals(tableDatum.getDictLabel())) { report.setCoolingWaterCracker(monthValue); }
                if ("cracker_consumption_ia".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionIa(monthValue); }
                if ("pa_ia_cracker".equals(tableDatum.getDictLabel())) { report.setPaIaCracker(monthValue); }
                if ("n2_cracker".equals(tableDatum.getDictLabel())) { report.setN2Cracker(monthValue); }
                if ("hp_bfw_cracker".equals(tableDatum.getDictLabel())) { report.setHpBfwCracker(monthValue); }
                if ("polished_con_cracker".equals(tableDatum.getDictLabel())) { report.setPolishedConCracker(monthValue); }
                if ("cracker_consumption_pww".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionPww(monthValue); }
                if ("turbine_con_cracker".equals(tableDatum.getDictLabel())) { report.setTurbineConCracker(monthValue); }
                if ("cracker_consumption_cnww".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionCnww(monthValue); }
                if ("cracker_consumption_dww".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionDww(monthValue); }
                if ("cracker_consumption_wo".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionWo(monthValue); }
                if ("cracker_consumption_pw".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionPw(monthValue); }
                if ("prod_water_cracker".equals(tableDatum.getDictLabel())) { report.setProdWaterCracker(monthValue); }
                if ("cracker_consumption_ng".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionNg(monthValue); }
                if ("cracker_consumption_offgas".equals(tableDatum.getDictLabel())) { report.setCrackerConsumptionOffgas(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改Aromatics Utility Consumption
     */
    @Override
    public int updateAromaticsUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("shp_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setShpPguAeu(monthValue); }
                if ("hp_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setHpPguAeu(monthValue); }
                if ("mp_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setMpPguAeu(monthValue); }
                if ("lp_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setLpPguAeu(monthValue); }
                if ("electricity_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setElectricityPguAeu(monthValue); }
                if ("cooling_water_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setCoolingWaterPguAeu(monthValue); }
                if ("aromatics_consumption_pw".equals(tableDatum.getDictLabel())) { report.setAromaticsConsumptionPw(monthValue); }
                if ("prod_water_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setProdWaterPguAeu(monthValue); }
                if ("hp_bfw_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setHpBfwPguAeu(monthValue); }
                if ("n2_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setN2PguAeu(monthValue); }
                if ("pa_ia_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setPaIaPguAeu(monthValue); }
                if ("turbine_con_pgu_aeu".equals(tableDatum.getDictLabel())) { report.setTurbineConPguAeu(monthValue); }
                if ("aromatics_consumption_cww".equals(tableDatum.getDictLabel())) { report.setAromaticsConsumptionCww(monthValue); }
                if ("aromatics_consumption_pww".equals(tableDatum.getDictLabel())) { report.setAromaticsConsumptionPww(monthValue); }
                if ("aromatics_consumption_dww".equals(tableDatum.getDictLabel())) { report.setAromaticsConsumptionDww(monthValue); }
                if ("aromatics_consumption_wl".equals(tableDatum.getDictLabel())) { report.setAromaticsConsumptionWl(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改Shoudown Hour
     */
    @Override
    public int updateShoudownHour(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("shutdouwn_opt".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnOpt(monthValue);
                }
                if ("shutdouwn_oph".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnOph(monthValue);
                }
                if ("shutdouwn_eqt".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnEqt(monthValue);
                }
                if ("shutdouwn_eqh".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnEqh(monthValue);
                }
                if ("shutdouwn_it".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnIt(monthValue);
                }
                if ("shutdouwn_ith".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnIth(monthValue);
                }
                if ("shutdouwn_elt".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnElt(monthValue);
                }
                if ("shutdouwn_elth".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnElth(monthValue);
                }
                if ("shutdouwn_ot".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnOt(monthValue);
                }
                if ("shutdouwn_oth".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnOth(monthValue);
                }
                if ("shutdouwn_tt".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnTt(monthValue);
                }
                if ("shutdouwn_th".equals(tableDatum.getDictLabel())) {
                    report.setShutdouwnTh(monthValue);
                }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改Runing Rate
     */
    @Override
    public int updateRuningRate(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("run_hour".equals(tableDatum.getDictLabel())) { report.setRunHour(monthValue); }
                if ("run_rate".equals(tableDatum.getDictLabel())) { report.setRunRate(monthValue); }
                if ("calendar_hour".equals(tableDatum.getDictLabel())) { report.setCalendarHour(monthValue); }
                if ("calendar_day".equals(tableDatum.getDictLabel())) { report.setCalendarDay(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改Chemical Consume
     */
    @Override
    public int updateChemicalConsume(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("chemical_consume_pt3000".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumePt3000(monthValue);
                }
                if ("chemical_consume_naoh".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeNaoh(monthValue);
                }
                if ("chemical_consume_pt4000".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumePt4000(monthValue);
                }
                if ("chemical_consume_ec3392a".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeEc3392a(monthValue);
                }
                if ("chemical_consume_2w906".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume2w906(monthValue);
                }
                if ("chemical_consume_ec1489a".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeEc1489a(monthValue);
                }
                if ("chemical_consume_ec1486a".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeEc1486a(monthValue);
                }
                if ("chemical_consume_20y3483".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume20y3483(monthValue);
                }
                if ("chemical_consume_8q202".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume8q202(monthValue);
                }
                if ("chemical_consume_20y97a".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume20y97a(monthValue);
                }
                if ("chemical_consume_ec3269a".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeEc3269a(monthValue);
                }
                if ("chemical_consume_20y25".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume20y25(monthValue);
                }
                if ("chemical_consume_20y77".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume20y77(monthValue);
                }
                if ("chemical_consume_510ws".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsume510ws(monthValue);
                }
                if ("chemical_consume_n130".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeN130(monthValue);
                }
                if ("chemical_consume_h2so4".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeH2so4(monthValue);
                }
                if ("chemical_consume_naoh2".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeNaoh2(monthValue);
                }
                if ("chemical_consume_ch3oh".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumeCh3oh(monthValue);
                }
                if ("chemical_consume_pt30002".equals(tableDatum.getDictLabel())) {
                    report.setChemicalConsumePt30002(monthValue);
                }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改Cost Fr Ethylene
     */
    @Override
    public int updateCostFrEthylene(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("cost_fr_ethylene".equals(tableDatum.getDictLabel())) {
                    report.setCostFrEthylene(monthValue);
                }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改SUB Utility Consumption
     */
    @Override
    public int updateSUBUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("sub_con_electric".equals(tableDatum.getDictLabel())) { report.setSubConElectric(monthValue); }
                if ("sub_con_ng".equals(tableDatum.getDictLabel())) { report.setSubConNg(monthValue); }
                if ("sub_con_fg_fr_eu".equals(tableDatum.getDictLabel())) { report.setSubConFgFrEu(monthValue); }
                if ("sub_con_lpg".equals(tableDatum.getDictLabel())) { report.setSubConLpg(monthValue); }
                if ("sub_con_hhp_steam".equals(tableDatum.getDictLabel())) { report.setSubConHhpSteam(monthValue); }
                if ("sub_con_mp_steam".equals(tableDatum.getDictLabel())) { report.setSubConMpSteam(monthValue); }
                if ("sub_con_lp_steam".equals(tableDatum.getDictLabel())) { report.setSubConLpSteam(monthValue); }
                if ("sub_con_p_condensate".equals(tableDatum.getDictLabel())) { report.setSubConPCondensate(monthValue); }
                if ("sub_con_cw".equals(tableDatum.getDictLabel())) { report.setSubConCw(monthValue); }
                if ("sub_con_n2".equals(tableDatum.getDictLabel())) { report.setSubConN2(monthValue); }
                if ("sub_con_ia_pa".equals(tableDatum.getDictLabel())) { report.setSubConIaPa(monthValue); }
                if ("sub_con_hppa".equals(tableDatum.getDictLabel())) { report.setSubConHppa(monthValue); }
                if ("sub_con_production_water".equals(tableDatum.getDictLabel())) { report.setSubConProductionWater(monthValue); }
                if ("sub_con_hp_steam_fr_sub_net".equals(tableDatum.getDictLabel())) { report.setSubConHpSteamFrSubNet(monthValue); }
                if ("sub_con_bfw".equals(tableDatum.getDictLabel())) { report.setSubConBfw(monthValue); }
                if ("sub_con_eo_eg_purge_gas".equals(tableDatum.getDictLabel())) { report.setSubConEoEgPurgeGas(monthValue); }
                if ("sub_con_h2_fr_syngas_as_fule".equals(tableDatum.getDictLabel())) { report.setSubConH2FrSyngasAsFule(monthValue); }
                if ("sub_con_hp_product".equals(tableDatum.getDictLabel())) { report.setSubConHpProduct(monthValue); }
                if ("sub_con_sub1_fg_fic1302".equals(tableDatum.getDictLabel())) { report.setSubConSub1FgFic1302(monthValue); }
                if ("sub_con_sub2_fg_fic2302".equals(tableDatum.getDictLabel())) { report.setSubConSub2FgFic2302(monthValue); }
                if ("sub_con_total_ng_fc3702".equals(tableDatum.getDictLabel())) { report.setSubConTotalNgFc3702(monthValue); }
                if ("sub_con_cost_output".equals(tableDatum.getDictLabel())) { report.setSubConCostOutput(monthValue); }
                if ("sub_con_zfy".equals(tableDatum.getDictLabel())) { report.setSubConZfy(monthValue); }
                if ("sub_con_gljcl".equals(tableDatum.getDictLabel())) { report.setSubConGljcl(monthValue); }
                if ("sub_con_cc".equals(tableDatum.getDictLabel())) { report.setSubConCc(monthValue); }
                if ("sub_con_sc".equals(tableDatum.getDictLabel())) { report.setSubConSc(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改SCTF Utility Consumption
     */
    @Override
    public int updateSctfUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("sctf_con_electric".equals(tableDatum.getDictLabel())) {
                    report.setSctfConElectric(monthValue);
                }
                if ("sctf_con_ng".equals(tableDatum.getDictLabel())) {
                    report.setSctfConNg(monthValue);
                }
                if ("sctf_con_fg_fr_eu".equals(tableDatum.getDictLabel())) {
                    report.setSctfConFgFrEu(monthValue);
                }
                if ("sctf_con_lpg".equals(tableDatum.getDictLabel())) {
                    report.setSctfConLpg(monthValue);
                }
                if ("sctf_con_hhp_steam".equals(tableDatum.getDictLabel())) {
                    report.setSctfConHhpSteam(monthValue);
                }
                if ("sctf_con_mp_steam".equals(tableDatum.getDictLabel())) {
                    report.setSctfConMpSteam(monthValue);
                }
                if ("sctf_con_lp_steam".equals(tableDatum.getDictLabel())) {
                    report.setSctfConLpSteam(monthValue);
                }
                if ("sctf_con_p_condensate".equals(tableDatum.getDictLabel())) {
                    report.setSctfConPCondensate(monthValue);
                }
                if ("sctf_con_cw".equals(tableDatum.getDictLabel())) {
                    report.setSctfConCw(monthValue);
                }
                if ("sctf_con_n2".equals(tableDatum.getDictLabel())) {
                    report.setSctfConN2(monthValue);
                }
                if ("sctf_con_ia_pa".equals(tableDatum.getDictLabel())) {
                    report.setSctfConIaPa(monthValue);
                }
                if ("sctf_con_hppa".equals(tableDatum.getDictLabel())) {
                    report.setSctfConHppa(monthValue);
                }
                if ("sctf_con_production_water".equals(tableDatum.getDictLabel())) {
                    report.setSctfConProductionWater(monthValue);
                }
                if ("sctf_con_hp_steam_fr_sub_net".equals(tableDatum.getDictLabel())) {
                    report.setSctfConHpSteamFrSubNet(monthValue);
                }
                if ("sctf_con_bfw".equals(tableDatum.getDictLabel())) {
                    report.setSctfConBfw(monthValue);
                }
                if ("sctf_con_contaminated_ww".equals(tableDatum.getDictLabel())) {
                    report.setSctfConContaminatedWw(monthValue);
                }
                if ("sctf_con_production_ww".equals(tableDatum.getDictLabel())) {
                    report.setSctfConProductionWw(monthValue);
                }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 修改KBI
     */
    @Override
    public int updateKbi(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("kbi_pcur".equals(tableDatum.getDictLabel())) { report.setKbiPcur(monthValue); }
                if ("kbi_energy_consumption".equals(tableDatum.getDictLabel())) { report.setKbiEnergyConsumption(monthValue); }
                if ("kbi_pepc".equals(tableDatum.getDictLabel())) { report.setKbiPepc(monthValue); }
                if ("kbi_c2_c3_production".equals(tableDatum.getDictLabel())) { report.setKbiC2C3Production(monthValue); }
                if ("kbi_c2_c3_target".equals(tableDatum.getDictLabel())) { report.setKbiC2C3Target(monthValue); }
                if ("kbi_c2_c3_target2".equals(tableDatum.getDictLabel())) { report.setKbiC2C3Target2(monthValue); }
                if ("kbi_c2_target".equals(tableDatum.getDictLabel())) { report.setKbiC2Target(monthValue); }
                if ("kbi_c2_target2".equals(tableDatum.getDictLabel())) { report.setKbiC2Target2(monthValue); }
                if ("kbi_lti".equals(tableDatum.getDictLabel())) { report.setKbiLti(monthValue); }
                if ("kbi_yepbf".equals(tableDatum.getDictLabel())) { report.setKbiYepbf(monthValue); }
                if ("kbi_yebf".equals(tableDatum.getDictLabel())) { report.setKbiYebf(monthValue); }
                if ("kbi_aeu_energy_consumption".equals(tableDatum.getDictLabel())) { report.setKbiAeuEnergyConsumption(monthValue); }
                if ("kbi_btx_production".equals(tableDatum.getDictLabel())) { report.setKbiBtxProduction(monthValue); }
                if ("kbi_btx_target".equals(tableDatum.getDictLabel())) { report.setKbiBtxTarget(monthValue); }
                if ("kbi_btx_target2".equals(tableDatum.getDictLabel())) { report.setKbiBtxTarget2(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateCrackerRawMaterial(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("nap".equals(tableDatum.getDictLabel())) { report.setNap(monthValue); }
                if ("c5".equals(tableDatum.getDictLabel())) { report.setC5(monthValue); }
                if ("c6_c8_na".equals(tableDatum.getDictLabel())) { report.setC6C8Na(monthValue); }
                if ("wison_ethane".equals(tableDatum.getDictLabel())) { report.setWisonEthane(monthValue); }
                if ("lpg_to_furnace".equals(tableDatum.getDictLabel())) { report.setLpgToFurnace(monthValue); }
                if ("raff3_fr_bd_and_2ph".equals(tableDatum.getDictLabel())) { report.setRaff3FrBdAnd2ph(monthValue); }
                if ("c2_fr_ldpe".equals(tableDatum.getDictLabel())) { report.setC2FrLdpe(monthValue); }
                if ("c3_fr_oxo".equals(tableDatum.getDictLabel())) { report.setC3FrOxo(monthValue); }
                if ("mixed_c3_c4".equals(tableDatum.getDictLabel())) { report.setMixedC3C4(monthValue); }
                if ("hy_c9".equals(tableDatum.getDictLabel())) { report.setHyC9(monthValue); }
                if ("pgu_offgas".equals(tableDatum.getDictLabel())) { report.setPguOffgas(monthValue); }
                if ("wash_oil".equals(tableDatum.getDictLabel())) { report.setWashOil(monthValue); }
                if ("toluene".equals(tableDatum.getDictLabel())) { report.setToluene(monthValue); }
                if ("hy_c4_fr_r800".equals(tableDatum.getDictLabel())) { report.setHyC4FrR800(monthValue); }
                if ("cracker_raw_input".equals(tableDatum.getDictLabel())) { report.setCrackerRawInput(monthValue); }
                if ("cracker_raw_feed".equals(tableDatum.getDictLabel())) { report.setCrackerRawFeed(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateCrackerOutputProduct(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("h2_produced".equals(tableDatum.getDictLabel())) { report.setH2Produced(monthValue); }
                if ("ethylen_produced".equals(tableDatum.getDictLabel())) { report.setEthylenProduced(monthValue); }
                if ("propylene_produced".equals(tableDatum.getDictLabel())) { report.setPropyleneProduced(monthValue); }
                if ("c3_c4_lpg_produced".equals(tableDatum.getDictLabel())) { report.setC3C4LpgProduced(monthValue); }
                if ("mixed_c4s_produced".equals(tableDatum.getDictLabel())) { report.setMixedC4sProduced(monthValue); }
                if ("rpg_produced".equals(tableDatum.getDictLabel())) { report.setRpgProduced(monthValue); }
                if ("po_flux_oil_produced".equals(tableDatum.getDictLabel())) { report.setPoFluxOilProduced(monthValue); }
                if ("naphthalene_produced".equals(tableDatum.getDictLabel())) { report.setNaphthaleneProduced(monthValue); }
                if ("ebo_produced".equals(tableDatum.getDictLabel())) { report.setEboProduced(monthValue); }
                if ("residue_oil_produced".equals(tableDatum.getDictLabel())) { report.setResidueOilProduced(monthValue); }
                if ("methane_produced".equals(tableDatum.getDictLabel())) { report.setMethaneProduced(monthValue); }
                if ("offgas_produced".equals(tableDatum.getDictLabel())) { report.setOffgasProduced(monthValue); }
                if ("cracker_output".equals(tableDatum.getDictLabel())) { report.setCrackerOutput(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateAromaticsRawMaterial(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("pgu_rpg2".equals(tableDatum.getDictLabel())) { report.setPguRpg2(monthValue); }
                if ("pgu_h2".equals(tableDatum.getDictLabel())) { report.setPguH2(monthValue); }
                if ("pgu_btx_produced".equals(tableDatum.getDictLabel())) { report.setPguBtxProduced(monthValue); }
                if ("pgu_btx_to_aeu".equals(tableDatum.getDictLabel())) { report.setPguBtxToAeu(monthValue); }
                if ("aromatics_raw_input".equals(tableDatum.getDictLabel())) { report.setAromaticsRawInput(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateAromaticsOutputProduct(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("aeu_benzene_produced".equals(tableDatum.getDictLabel())) { report.setAeuBenzeneProduced(monthValue); }
                if ("aeu_toluene_produced".equals(tableDatum.getDictLabel())) { report.setAeuTolueneProduced(monthValue); }
                if ("aeu_xylene_produced".equals(tableDatum.getDictLabel())) { report.setAeuXyleneProduced(monthValue); }
                if ("aeu_c6_c8_na_produced".equals(tableDatum.getDictLabel())) { report.setAeuC6C8NaProduced(monthValue); }
                if ("pgu_c5_produced".equals(tableDatum.getDictLabel())) { report.setPguC5Produced(monthValue); }
                if ("pgu_c9_produced".equals(tableDatum.getDictLabel())) { report.setPguC9Produced(monthValue); }
                if ("pgu_washoil_produced".equals(tableDatum.getDictLabel())) { report.setPguWashoilProduced(monthValue); }
                if ("pgu_offgas_produced".equals(tableDatum.getDictLabel())) { report.setPguOffgasProduced(monthValue); }
                if ("pgu_btx_change".equals(tableDatum.getDictLabel())) { report.setPguBtxChange(monthValue); }
                if ("pgu_btx_produced".equals(tableDatum.getDictLabel())) { report.setPguBtxProduced(monthValue); }
                if ("aeu_toluene_produced_m_eu".equals(tableDatum.getDictLabel())) { report.setAeuTolueneProducedMEu(monthValue); }
                if ("aromatics_output".equals(tableDatum.getDictLabel())) { report.setAromaticsOutput(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateProductYield(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("gaseity_yield".equals(tableDatum.getDictLabel())) { report.setGaseityYield(monthValue); }
                if ("tatal_yield".equals(tableDatum.getDictLabel())) { report.setTatalYield(monthValue); }
                if ("c3_c2_yield".equals(tableDatum.getDictLabel())) { report.setC3C2Yield(monthValue); }
                if ("h2_yield".equals(tableDatum.getDictLabel())) { report.setH2Yield(monthValue); }
                if ("ethylene_yield".equals(tableDatum.getDictLabel())) { report.setEthyleneYield(monthValue); }
                if ("propylene_yield".equals(tableDatum.getDictLabel())) { report.setPropyleneYield(monthValue); }
                if ("c3_c4_lpg_yield".equals(tableDatum.getDictLabel())) { report.setC3C4LpgYield(monthValue); }
                if ("c4s_yield".equals(tableDatum.getDictLabel())) { report.setC4sYield(monthValue); }
                if ("po_yield".equals(tableDatum.getDictLabel())) { report.setPoYield(monthValue); }
                if ("naphthalene_yield".equals(tableDatum.getDictLabel())) { report.setNaphthaleneYield(monthValue); }
                if ("ebo_yield".equals(tableDatum.getDictLabel())) { report.setEboYield(monthValue); }
                if ("ws_yield".equals(tableDatum.getDictLabel())) { report.setWsYield(monthValue); }
                if ("methane_yield".equals(tableDatum.getDictLabel())) { report.setMethaneYield(monthValue); }
                if ("offage_yield".equals(tableDatum.getDictLabel())) { report.setOffageYield(monthValue); }
                if ("rpg_yield".equals(tableDatum.getDictLabel())) { report.setRpgYield(monthValue); }
                if ("benzene_yield".equals(tableDatum.getDictLabel())) { report.setBenzeneYield(monthValue); }
                if ("toluene_yield".equals(tableDatum.getDictLabel())) { report.setTolueneYield(monthValue); }
                if ("xylene_yield".equals(tableDatum.getDictLabel())) { report.setXyleneYield(monthValue); }
                if ("c6_c8_na_yield".equals(tableDatum.getDictLabel())) { report.setC6C8NaYield(monthValue); }
                if ("c5_yield".equals(tableDatum.getDictLabel())) { report.setC5Yield(monthValue); }
                if ("c9_yield".equals(tableDatum.getDictLabel())) { report.setC9Yield(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateCrackerEnergyConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("cracker_energy_te_teo".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyTeTeo(monthValue); }
                if ("cracker_energy_te_tec".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyTeTec(monthValue); }
                if ("cracker_energy_ee_kgeot".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyEeKgeot(monthValue); }
                if ("cracker_energy_ee_kgect".equals(tableDatum.getDictLabel())) { report.setCrackerEnergyEeKgect(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateAromaticsEnergyConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("aromatics_energy_te_teo".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyTeTeo(monthValue); }
                if ("aromatics_energy_te_tec".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyTeTec(monthValue); }
                if ("aromatics_energy_ee_kgeot".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyEeKgeot(monthValue); }
                if ("aromatics_energy_ee_kgect".equals(tableDatum.getDictLabel())) { report.setAromaticsEnergyEeKgect(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updatePlantLoad(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("cracker_load".equals(tableDatum.getDictLabel())) { report.setCrackerLoad(monthValue); }
                if ("c2_c3_capacity".equals(tableDatum.getDictLabel())) { report.setC2C3Capacity(monthValue); }
                if ("ethylene_load".equals(tableDatum.getDictLabel())) { report.setEthyleneLoad(monthValue); }
                if ("ethylene_capacity".equals(tableDatum.getDictLabel())) { report.setEthyleneCapacity(monthValue); }
                if ("aeu_load".equals(tableDatum.getDictLabel())) { report.setAeuLoad(monthValue); }
                if ("btx_capacity".equals(tableDatum.getDictLabel())) { report.setBtxCapacity(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateOtherside(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("eu_loss".equals(tableDatum.getDictLabel())) { report.setEuLoss(monthValue); }
                if ("eu_loss_rate".equals(tableDatum.getDictLabel())) { report.setEuLossRate(monthValue); }
                if ("aeu_loss".equals(tableDatum.getDictLabel())) { report.setAeuLoss(monthValue); }
                if ("aeu_loss_rate".equals(tableDatum.getDictLabel())) { report.setAeuLossRate(monthValue); }
                if ("total_loss".equals(tableDatum.getDictLabel())) { report.setTotalLoss(monthValue); }
                if ("total_loss_rate".equals(tableDatum.getDictLabel())) { report.setTotalLossRate(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateSctuUtilityConsumption(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("sctu_consumption_fg".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionFg(monthValue); }
                if ("sctu_consumption_mp".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionMp(monthValue); }
                if ("sctu_consumption_lp".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionLp(monthValue); }
                if ("sctu_consumption_electirc".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionElectirc(monthValue); }
                if ("sctu_consumption_cw".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionCw(monthValue); }
                if ("sctu_consumption_pa_ia".equals(tableDatum.getDictLabel())) { report.setSctuConsumptionPaIa(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    @Override
    public int updateSummary(MonthlyUpdateVO monthlyUpdateVO) {
        // 受影响行数
        int affectedRows = 0;
        List<MonthlyProductionReportVO> tableData = monthlyUpdateVO.getTableData();
        long year = monthlyUpdateVO.getYear();
        Class clazz = null;
        try {
            clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.MonthlyProductionReportVO");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        for (MonthlyProductionReportVO tableDatum : tableData) {
            for (int i = 0; i < 12; i++) {
                TMonthlyProductionReport report = new TMonthlyProductionReport();
                report.setReportMonth((long)(i + 1));
                report.setReportYear(year);
                String monthValue = this.getMonthValue(i, clazz, tableDatum);
                if (monthValue == null) {
                    continue;
                }
                if ("summary_cl_yb".equals(tableDatum.getDictLabel())) { report.setSummaryClYb(monthValue); }
                if ("summary_cl_sny".equals(tableDatum.getDictLabel())) { report.setSummaryClSny(monthValue); }
                if ("summary_cl_c5_raff".equals(tableDatum.getDictLabel())) { report.setSummaryClC5Raff(monthValue); }
                if ("summary_cl_yw".equals(tableDatum.getDictLabel())) { report.setSummaryClYw(monthValue); }
                if ("summary_cl_jqtj".equals(tableDatum.getDictLabel())) { report.setSummaryClJqtj(monthValue); }
                if ("summary_cl_yxjy".equals(tableDatum.getDictLabel())) { report.setSummaryClYxjy(monthValue); }
                if ("summary_cl_hhc4".equals(tableDatum.getDictLabel())) { report.setSummaryClHhc4(monthValue); }
                if ("summary_cl_sb".equals(tableDatum.getDictLabel())) { report.setSummaryClSb(monthValue); }
                if ("summary_cl_ljtw".equals(tableDatum.getDictLabel())) { report.setSummaryClLjtw(monthValue); }
                if ("summary_cl_ljtj".equals(tableDatum.getDictLabel())) { report.setSummaryClLjtj(monthValue); }
                if ("summary_cl_ccsny".equals(tableDatum.getDictLabel())) { report.setSummaryClCcsny(monthValue); }
                if ("summary_cl_zqzh".equals(tableDatum.getDictLabel())) { report.setSummaryClZqzh(monthValue); }
                if ("summary_cl_lqs".equals(tableDatum.getDictLabel())) { report.setSummaryClLqs(monthValue); }
                if ("summary_cl_d".equals(tableDatum.getDictLabel())) { report.setSummaryClD(monthValue); }
                if ("summary_cl_rlq".equals(tableDatum.getDictLabel())) { report.setSummaryClRlq(monthValue); }
                if ("summary_cl_jzs".equals(tableDatum.getDictLabel())) { report.setSummaryClJzs(monthValue); }
                if ("summary_cl_tpny".equals(tableDatum.getDictLabel())) { report.setSummaryClTpny(monthValue); }
                if ("summary_sl_yb".equals(tableDatum.getDictLabel())) { report.setSummarySlYb(monthValue); }
                if ("summary_sl_sny".equals(tableDatum.getDictLabel())) { report.setSummarySlSny(monthValue); }
                if ("summary_sl_c5_raff".equals(tableDatum.getDictLabel())) { report.setSummarySlC5Raff(monthValue); }
                if ("summary_sl_yw".equals(tableDatum.getDictLabel())) { report.setSummarySlYw(monthValue); }
                if ("summary_sl_jqtj".equals(tableDatum.getDictLabel())) { report.setSummarySlJqtj(monthValue); }
                if ("summary_sl_yxjy".equals(tableDatum.getDictLabel())) { report.setSummarySlYxjy(monthValue); }
                if ("summary_sl_hhc4".equals(tableDatum.getDictLabel())) { report.setSummarySlHhc4(monthValue); }
                if ("summary_sl_sb".equals(tableDatum.getDictLabel())) { report.setSummarySlSb(monthValue); }
                if ("summary_sl_ljtw".equals(tableDatum.getDictLabel())) { report.setSummarySlLjtw(monthValue); }
                if ("summary_sl_ljtj".equals(tableDatum.getDictLabel())) { report.setSummarySlLjtj(monthValue); }
                if ("summary_sl_ccsny".equals(tableDatum.getDictLabel())) { report.setSummarySlCcsny(monthValue); }
                if ("summary_sl_zqzh".equals(tableDatum.getDictLabel())) { report.setSummarySlZqzh(monthValue); }
                if ("summary_sl_lqs".equals(tableDatum.getDictLabel())) { report.setSummarySlLqs(monthValue); }
                if ("summary_sl_d".equals(tableDatum.getDictLabel())) { report.setSummarySlD(monthValue); }
                if ("summary_sl_rlq".equals(tableDatum.getDictLabel())) { report.setSummarySlRlq(monthValue); }
                if ("summary_sl_jzs".equals(tableDatum.getDictLabel())) { report.setSummarySlJzs(monthValue); }
                if ("summary_sl_tpny".equals(tableDatum.getDictLabel())) { report.setSummarySlTpny(monthValue); }
                // 当前报告年份
                int reportYear = Integer.parseInt(report.getReportYear().toString());
                // 当前报告月份
                int reportMonth = Integer.parseInt(report.getReportMonth().toString());
                // 查询年份=reportYear，月份=reportMonth的月报数据
                int count = tMonthlyProductionReportMapper.selectTMonthlyProductionReportCountByDate(reportYear, reportMonth);
                if (count == 0) {   // 新增月报数据
                    affectedRows += tMonthlyProductionReportMapper.insertTMonthlyProductionReport(report);
                } else {    // 更新月报数据
                    affectedRows += tMonthlyProductionReportMapper.updateTMonthlyProductionReport(report);
                }
                // 同步更新月报数据
                SyncAfterMonthlyUpdateThread thread = new SyncAfterMonthlyUpdateThread(
                        (int)year,
                        (i + 1),
                        this.tMonthlyProductionReportMapper,
                        this.tMonthlyProductionPriceMapper
                );
                thread.run();
            }
        }
        return affectedRows;
    }

    /**
     * 导出Excel
     *
     * @param year
     * @return
     */
    @Override
    public AjaxResult export(Long year) {
        // 根据年份查询月报数据
        List<MonthlyProductionReportVO> crackerRawMaterial = this.selectCrackerRawMaterialByYear(year);
        List<MonthlyProductionReportVO> crackerOutputProduct = this.selectCrackerOutputProductByYear(year);
        List<MonthlyProductionReportVO> aromaticsRawMaterial = this.selectAromaticsRawMaterialByYear(year);
        List<MonthlyProductionReportVO> aromaticsOutputProduct = this.selectAromaticsOutputProductByYear(year);
        List<MonthlyProductionReportVO> eligibleProductRate = this.selectEligibleProductRateByYear(year);
        List<MonthlyProductionReportVO> productYield = this.selectProductYieldByYear(year);
        List<MonthlyProductionReportVO> crackerUtilityConsumption = this.selectCrackerUtilityConsumptionByYear(year);
        List<MonthlyProductionReportVO> crackerEnergyConsumption = this.selectCrackerEnergyConsumptionByYear(year);
        List<MonthlyProductionReportVO> aromaticsUtilityConsumption = this.selectAromaticsUtilityConsumptionByYear(year);
        List<MonthlyProductionReportVO> aromaticsEnergyConsumption = this.selectAromaticsEnergyConsumptionByYear(year);
        List<MonthlyProductionReportVO> plantLoad = this.selectPlantLoadByYear(year);
        List<MonthlyProductionReportVO> costFrEthylene = this.selectCostFrEthyleneByYear(year);
        List<MonthlyProductionReportVO> runingRate = this.selectRuningRateByYear(year);
        List<MonthlyProductionReportVO> shoudownHour = this.selectShoudownHourByYear(year);
        List<MonthlyProductionReportVO> otherside = this.selectOthersideByYear(year);
        List<MonthlyProductionReportVO> chemicalConsume = this.selectChemicalConsumeByYear(year);
        List<MonthlyProductionReportVO> sctuUtilityConsumption = this.selectSCTUUtilityConsumptionByYear(year);
        List<MonthlyProductionReportVO> subUtilityConsumption = this.selectSUBUtilityConsumptionByYear(year);
        List<MonthlyProductionReportVO> sctfUtilityConsumption = this.selectSCTFUtilityConsumptionByYear(year);
        List<MonthlyProductionReportVO> kbi = this.selectKbiByYear(year);
        List<MonthlyProductionReportVO> summary = this.selectSummaryByYear(year);
        // 创建工作簿
        XSSFWorkbook wb = new XSSFWorkbook();
        // 创建工作表
        XSSFSheet sheet = wb.createSheet(year + "年");
        // 单元格样式
        XSSFCellStyle styleYellow = wb.createCellStyle();
        styleYellow.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        styleYellow.setFillForegroundColor(IndexedColors.YELLOW1.getIndex());
        // 行数
        int rowNum = 21 * 2 + crackerRawMaterial.size() + crackerOutputProduct.size() + aromaticsRawMaterial.size()
                + aromaticsOutputProduct.size() + eligibleProductRate.size() + productYield.size()
                + crackerUtilityConsumption.size() + crackerEnergyConsumption.size() + aromaticsUtilityConsumption.size()
                + aromaticsEnergyConsumption.size() + plantLoad.size() + costFrEthylene.size()
                + runingRate.size() + shoudownHour.size() + otherside.size()
                + chemicalConsume.size() + sctuUtilityConsumption.size() + subUtilityConsumption.size()
                + sctfUtilityConsumption.size() + kbi.size() + summary.size();
        for (int i = 0; i < rowNum; i++) {
            // 创建行
            Row row = sheet.createRow(i);
            for (int j = 0; j < 17; j++) {
                if (i == 0 || i == 1 || i == 19 || i == 20 || i == 35 || i == 36 || i == 43 || i == 44 || i == 58 || i == 59 ||
                        i == 63 || i == 64 || i == 86 || i == 87 || i == 109 || i == 110 || i == 115 || i == 116 ||
                        i == 133 || i == 134 || i == 139 || i == 140 || i == 147 || i == 148 || i == 150 || i == 151 ||
                        i == 156 || i == 157 || i == 170 || i == 171 || i == 178 || i == 179 || i == 199 || i == 200 ||
                        i == 207 || i == 208 || i == 235 || i == 236 || i == 254 || i == 255 || i == 271 || i == 272) { // 表头行
                    Cell cell = row.createCell(j);
                    cell.setCellStyle(styleYellow);
                } else {    // 非表头行
                    Cell cell = row.createCell(j);
                }
            }
        }
        int rowCount = 0;
        rowCount = this.setTableHearder(sheet, rowCount, "Cracker Raw Material", 1);
        rowCount = this.setTableData(sheet, rowCount, crackerRawMaterial, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Cracker Output Product", 1);
        rowCount = this.setTableData(sheet, rowCount, crackerOutputProduct, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Aromatics Raw Material", 1);
        rowCount = this.setTableData(sheet, rowCount, aromaticsRawMaterial, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Aromatics Output Product", 1);
        rowCount = this.setTableData(sheet, rowCount, aromaticsOutputProduct, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Eligible Product Rate", 2);
        rowCount = this.setTableData(sheet, rowCount, eligibleProductRate, 2);
        rowCount = this.setTableHearder(sheet, rowCount, "Product Yield", 2);
        rowCount = this.setTableData(sheet, rowCount, productYield, 2);
        rowCount = this.setTableHearder(sheet, rowCount, "Cracker Utility Consumption", 1);
        rowCount = this.setTableData(sheet, rowCount, crackerUtilityConsumption, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Cracker Energy Consumption", 3);
        rowCount = this.setTableData(sheet, rowCount, crackerEnergyConsumption, 3);
        rowCount = this.setTableHearder(sheet, rowCount, "Aromatics Utility Consumption", 1);
        rowCount = this.setTableData(sheet, rowCount, aromaticsUtilityConsumption, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Aromatics Energy Consumption", 3);
        rowCount = this.setTableData(sheet, rowCount, aromaticsEnergyConsumption, 3);
        rowCount = this.setTableHearder(sheet, rowCount, "Plant Load", 3);
        rowCount = this.setTableData(sheet, rowCount, plantLoad, 3);
        rowCount = this.setTableHearder(sheet, rowCount, "Cost Fr Ethylene", 1);
        rowCount = this.setTableData(sheet, rowCount, costFrEthylene, 2);
        rowCount = this.setTableHearder(sheet, rowCount, "Runing Rate", 3);
        rowCount = this.setTableData(sheet, rowCount, runingRate, 3);
        rowCount = this.setTableHearder(sheet, rowCount, "Shoudown Hour", 1);
        rowCount = this.setTableData(sheet, rowCount, shoudownHour, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "Otherside", 3);
        rowCount = this.setTableData(sheet, rowCount, otherside, 3);
        rowCount = this.setTableHearder(sheet, rowCount, "Chemical Consume", 1);
        rowCount = this.setTableData(sheet, rowCount, chemicalConsume, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "SCTU Utility Consumption", 1);
        rowCount = this.setTableData(sheet, rowCount, sctuUtilityConsumption, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "SUB Utility Consumption", 1);
        rowCount = this.setTableData(sheet, rowCount, subUtilityConsumption, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "SCTF Utility Consumption", 1);
        rowCount = this.setTableData(sheet, rowCount, sctfUtilityConsumption, 1);
        rowCount = this.setTableHearder(sheet, rowCount, "KBI", 2);
        rowCount = this.setTableData(sheet, rowCount, kbi, 2);
        rowCount = this.setTableHearder(sheet, rowCount, "BCC装置主要原材料及公用工程消耗", 1);
        rowCount = this.setTableData(sheet, rowCount, summary, 1);
        // 输出文件
        FileOutputStream out = null;
        try {
            String filename = UUID.randomUUID().toString() + "_BYC乙烯装置生产报表汇总-" + year + ".xlsx";
            String downloadPath = RuoYiConfig.getDownloadPath() + filename;
            File desc = new File(downloadPath);
            if (!desc.getParentFile().exists())
            {
                desc.getParentFile().mkdirs();
            }
            out = new FileOutputStream(downloadPath);
            wb.write(out);
            return AjaxResult.success(filename);
        } catch (IOException e) {
            e.printStackTrace();
            log.error("导出Excel异常{}", e.getMessage());
            throw new CustomException("导出Excel失败，请联系网站管理员！");
        } finally {
            if (wb != null)
            {
                try
                {
                    wb.close();
                }
                catch (IOException e1)
                {
                    e1.printStackTrace();
                }
            }
            if (out != null)
            {
                try
                {
                    out.close();
                }
                catch (IOException e1)
                {
                    e1.printStackTrace();
                }
            }
        }
    }

    /**
     * 设置表数据
     *
     * @param sheet 当前工作表
     * @param rowCount 当前行数
     * @param dataList 表数据内容
     * @param dataType 表数据类型，1表示total，2表示avg，3表示total+avg
     * @return 当前行数
     */
    private int setTableData(XSSFSheet sheet, int rowCount, List<MonthlyProductionReportVO> dataList, int dataType) {
        for (int i  = 0; i < dataList.size(); i++) {
            MonthlyProductionReportVO monthlyProductionReportVO = dataList.get(i);
            XSSFRow row = sheet.getRow(rowCount);
            row.getCell(0).setCellValue(monthlyProductionReportVO.getTitle());
            row.getCell(1).setCellValue(monthlyProductionReportVO.getUnit());
            row.getCell(2).setCellValue(monthlyProductionReportVO.getCurrently());
            row.getCell(3).setCellValue(monthlyProductionReportVO.getJan());
            row.getCell(4).setCellValue(monthlyProductionReportVO.getFeb());
            row.getCell(5).setCellValue(monthlyProductionReportVO.getMar());
            row.getCell(6).setCellValue(monthlyProductionReportVO.getApr());
            row.getCell(7).setCellValue(monthlyProductionReportVO.getMay());
            row.getCell(8).setCellValue(monthlyProductionReportVO.getJun());
            row.getCell(9).setCellValue(monthlyProductionReportVO.getJul());
            row.getCell(10).setCellValue(monthlyProductionReportVO.getAug());
            row.getCell(11).setCellValue(monthlyProductionReportVO.getSep());
            row.getCell(12).setCellValue(monthlyProductionReportVO.getOct());
            row.getCell(13).setCellValue(monthlyProductionReportVO.getNov());
            row.getCell(14).setCellValue(monthlyProductionReportVO.getDec());
            if (dataType == 1) {
                row.getCell(15).setCellValue(monthlyProductionReportVO.getTotal());
            } else if (dataType == 2) {
                row.getCell(15).setCellValue(monthlyProductionReportVO.getAvg());
            } else if (dataType == 3) {
                row.getCell(15).setCellValue(monthlyProductionReportVO.getTotal());
                row.getCell(16).setCellValue(monthlyProductionReportVO.getAvg());
            }
            rowCount++;
        }
        return rowCount;
    }

    /**
     * 设置表头
     *
     * @param sheet 当前工作表
     * @param rowCount 当前行数
     * @param header 表头内容
     * @param headerType 表头类型，1表示total，2表示avg，3表示total+avg
     * @return 当前行数
     */
    private int setTableHearder(XSSFSheet sheet, int rowCount, String header, int headerType) {
        XSSFRow row0 = sheet.getRow(rowCount);
        row0.getCell(0).setCellValue(header);
        rowCount++;
        XSSFRow row1 = sheet.getRow(rowCount);
        row1.getCell(0).setCellValue("");
        row1.getCell(1).setCellValue("Unit");
        row1.getCell(2).setCellValue("Currently");
        row1.getCell(3).setCellValue("Jan");
        row1.getCell(4).setCellValue("Feb");
        row1.getCell(5).setCellValue("Mar");
        row1.getCell(6).setCellValue("Apr");
        row1.getCell(7).setCellValue("May");
        row1.getCell(8).setCellValue("Jun");
        row1.getCell(9).setCellValue("Jul");
        row1.getCell(10).setCellValue("Aug");
        row1.getCell(11).setCellValue("Sep");
        row1.getCell(12).setCellValue("Oct");
        row1.getCell(13).setCellValue("Nov");
        row1.getCell(14).setCellValue("Dec");
        if (headerType == 1) {
            row1.getCell(15).setCellValue("Total");
        } else if (headerType == 2) {
            row1.getCell(15).setCellValue("Avg");
        } else if (headerType == 3) {
            row1.getCell(15).setCellValue("Total");
            row1.getCell(16).setCellValue("Avg");
        }
        rowCount++;
        return rowCount;
    }
}
