package com.gyee.runeconomy.service.monitor;/*
@author   谢生杰
@date   2023/4/12-8:59
*/

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.common.contant.ContantXk;
import com.gyee.common.model.PointData;
import com.gyee.common.util.DateUtils;
import com.gyee.common.vo.benchmark.FjjxbVo;
import com.gyee.runeconomy.init.CacheContext;
import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay1Service;
import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay5Service;
import com.gyee.runeconomy.service.bmk.BenchmarkingService;
import com.gyee.runeconomy.util.MathUtil;
import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;

@Service
public class StationMonitorService {
    @Resource
    private IEdosUtil edosUtil;
    @Resource
    private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;

    @Resource
    private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;

    @Resource
    private BenchmarkingService benchmarkingService;

    public Map<String, Object> caldata(String wpid) throws Exception {

        String getype = "-2";
        if (wpid.contains("FDC")) {
            getype = "-1";
        }
        Calendar cale = Calendar.getInstance();

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

        cale.set(Calendar.DAY_OF_MONTH, 1);

        Date begin = DateUtils.truncate(cale.getTime());

        String beginDates = formatter.format(begin.getTime());

        cale = Calendar.getInstance();

        Date end = DateUtils.truncate(cale.getTime());

        String endDates = formatter.format(end.getTime());

        List<FjjxbVo> monthvos = benchmarkingService.performance(null, getype, "1", beginDates, endDates, wpid, null, null, null, null);
        Map<String, FjjxbVo> monthvomap = new HashMap<>();
        if (!monthvos.isEmpty()) {
            for (FjjxbVo vo : monthvos) {
                monthvomap.put(vo.getId(), vo);
            }
        }
        cale = Calendar.getInstance();

        cale.set(Calendar.MONTH, 0);
        cale.set(Calendar.DAY_OF_MONTH, 1);

        begin = DateUtils.truncate(cale.getTime());

        beginDates = formatter.format(begin.getTime());

        cale = Calendar.getInstance();

        end = DateUtils.truncate(cale.getTime());

        endDates = formatter.format(end.getTime());

        List<FjjxbVo> yearvos = benchmarkingService.performance(null, getype, "1", beginDates, endDates, wpid, null, null, null, null);
        Map<String, FjjxbVo> yearvomap = new HashMap<>();
        if (!yearvos.isEmpty()) {
            for (FjjxbVo vo : yearvos) {
                yearvomap.put(vo.getId(), vo);
            }
        }
        Map<String, Object> resultMap = new HashMap<>();
        Map<String, ProBasicPowerstation> wpmap = CacheContext.wpmap;
        Map<String, ProBasicPowerstationPoint> powerstationPointMap = CacheContext.wppointmap.get(wpid);
        ProBasicPowerstation proBasicPowerstation = wpmap.get(wpid);
        resultMap.put("jrts", proBasicPowerstation.getJrquantityJz() + proBasicPowerstation.getJrquantityZc() + proBasicPowerstation.getJrwindQuantityHs() + proBasicPowerstation.getJrwindQuantityLd());
        List<String> points = new ArrayList<>();
        List<String> points1 = new ArrayList<>();
        points.add(powerstationPointMap.get(ContantXk.DJTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.DJTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.SDTJTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YXTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.XNTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.QXJCLTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.GZTJTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.GZTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.CNSLGZTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.JXTJTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.JXTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.CNSLJXTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.XDTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.XDTJTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.XDJCLTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.SLTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.CWSLDWTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.CWSLTQTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.TXZDTS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.LXTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.TXZDTSMX).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RFDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YFDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NFDL).getNemCode());
        if (proBasicPowerstation.getWindType().equals("-1")) {
            points.add(powerstationPointMap.get(ContantXk.SSPJFS).getNemCode());
            resultMap.put("czlx", "风电场");
            resultMap.put("jrrl", proBasicPowerstation.getJrwindCapacity());
            resultMap.put("zzjrl", proBasicPowerstation.getWindCapacity());
        } else {
            points1.add(powerstationPointMap.get(ContantXk.GCGZQD).getNemCode());
            points.add(powerstationPointMap.get(ContantXk.SSPJGZD).getNemCode());
            resultMap.put("czlx", "光电场");
            resultMap.put("jrrl", proBasicPowerstation.getJrCapacity());
            resultMap.put("zzjrl", proBasicPowerstation.getCapacity());
        }
        points.add(powerstationPointMap.get(ContantXk.SSZGL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YLYXS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NLYXS).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.FNLYL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.SBKLYL).getNemCode());

        points.add(powerstationPointMap.get(ContantXk.RGZSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RCNSLGZSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RJXSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RCNSLJXSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RDJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RQXJCLSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RSDTJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RXNSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RXDTJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RXDJCLSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RCWSLDWSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.RCWSLTQSSDL).getNemCode());

        points.add(powerstationPointMap.get(ContantXk.YGZSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YCNSLGZSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YJXSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YCNSLJXSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YDJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YQXJCLSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YSDTJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YXNSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YXDTJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YXDJCLSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YCWSLDWSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.YCWSLTQSSDL).getNemCode());

        points.add(powerstationPointMap.get(ContantXk.NGZSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NCNSLGZSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NJXSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NCNSLJXSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NDJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NQXJCLSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NSDTJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NXNSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NXDTJSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NXDJCLSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NCWSLDWSSDL).getNemCode());
        points.add(powerstationPointMap.get(ContantXk.NCWSLTQSSDL).getNemCode());

        points.add(powerstationPointMap.get(ContantXk.AQTS).getNemCode());

        List<PointData> realData = edosUtil.getRealData(points);
        List<PointData> realData1 = edosUtil.getRealData(points1);
        resultMap.put("djts", realData.get(0).getPointValueInDouble());
        resultMap.put("dfts", realData.get(1).getPointValueInDouble());
        resultMap.put("sdtjts", realData.get(2).getPointValueInDouble());
        resultMap.put("bwts", realData.get(3).getPointValueInDouble());
        resultMap.put("fdts", realData.get(4).getPointValueInDouble());
        resultMap.put("jclts", realData.get(5).getPointValueInDouble());
        resultMap.put("gzts", realData.get(6).getPointValueInDouble());
        resultMap.put("gztjts", realData.get(7).getPointValueInDouble());
        resultMap.put("gzslts", realData.get(8).getPointValueInDouble());
        resultMap.put("jxts", realData.get(9).getPointValueInDouble());
        resultMap.put("jxtjts", realData.get(10).getPointValueInDouble());
        resultMap.put("jxslts", realData.get(11).getPointValueInDouble());
        resultMap.put("xdts", realData.get(12).getPointValueInDouble());
        resultMap.put("xdtjts", realData.get(13).getPointValueInDouble());
        resultMap.put("xdjclts", realData.get(14).getPointValueInDouble());
        resultMap.put("slts", realData.get(15).getPointValueInDouble());
        resultMap.put("sldwts", realData.get(16).getPointValueInDouble());
        resultMap.put("slhjts", realData.get(17).getPointValueInDouble());
        resultMap.put("lxts", realData.get(18).getPointValueInDouble());
        resultMap.put("zclxts", realData.get(19).getPointValueInDouble());
        resultMap.put("wzlxts", realData.get(20).getPointValueInDouble());

        List<ProEconPowerstationInfoDay5> qwt1 = null;
        List<ProEconPowerstationInfoDay5> qwt2 = null;

        // 获取当前日期 暂时
        Date currentDate5 = new Date();

        // 创建 Calendar 对象，并设置为当前日期
        Calendar calendar5 = Calendar.getInstance();
        calendar5.setTime(currentDate5);

        // 设置 beginDate 为前一天的早上六点
        calendar5.add(Calendar.DAY_OF_MONTH, -1);
        calendar5.set(Calendar.HOUR_OF_DAY, 6);
        calendar5.set(Calendar.MINUTE, 0);
        calendar5.set(Calendar.SECOND, 0);
        calendar5.set(Calendar.MILLISECOND, 0);
        Date beginDate = calendar5.getTime();

        // 设置 endDate 为当天的23点59分59秒
        calendar5.set(Calendar.HOUR_OF_DAY, 23);
        calendar5.set(Calendar.MINUTE, 59);
        calendar5.set(Calendar.SECOND, 59);
        calendar5.set(Calendar.MILLISECOND, 999);
        Date endDate = calendar5.getTime();


        Calendar calendar6 = Calendar.getInstance();
        calendar6.setTime(currentDate5);

        // 设置 beginDate 为前一天的早上六点
        calendar6.add(Calendar.DAY_OF_MONTH, 0);
        calendar6.set(Calendar.HOUR_OF_DAY, 6);
        calendar6.set(Calendar.MINUTE, 0);
        calendar6.set(Calendar.SECOND, 0);
        calendar6.set(Calendar.MILLISECOND, 0);
        Date beginDate1 = calendar6.getTime();

        // 设置 endDate 为当天的23点59分59秒
        calendar6.set(Calendar.HOUR_OF_DAY, 23);
        calendar6.set(Calendar.MINUTE, 59);
        calendar6.set(Calendar.SECOND, 59);
        calendar6.set(Calendar.MILLISECOND, 999);
        Date endDate1 = calendar6.getTime();

        QueryWrapper<ProEconPowerstationInfoDay5> qw1 = new QueryWrapper<>();

        qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpid);
        qw1.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, beginDate, endDate);
        qwt1 = proEconPowerstationInfoDay5Service.list(qw1);

        BigDecimal yfdl1 = null;
        BigDecimal nfdl1 = null;
        for (ProEconPowerstationInfoDay5 dla : qwt1) {
            yfdl1 = dla.getYfdldb();
            nfdl1 = dla.getNfdldb();
        }

        if (yfdl1 == null || nfdl1 == null) {
            yfdl1 = BigDecimal.valueOf(100);
            nfdl1 = BigDecimal.valueOf(100);
        }
        QueryWrapper<ProEconPowerstationInfoDay5> qw2 = new QueryWrapper<>();

        qw2.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpid);
        qw2.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, beginDate1, endDate1);
        qwt2 = proEconPowerstationInfoDay5Service.list(qw2);

        BigDecimal rfdl1 = null;
        for (ProEconPowerstationInfoDay5 dla1 : qwt2) {
            rfdl1 = dla1.getRfdldb();
        }
        double rfdl = realData.get(21).getPointValueInDouble();
        rfdl = new BigDecimal(rfdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

        //        rfdl1 = rfdl1.divide(new BigDecimal("10000")).setScale(2, RoundingMode.HALF_UP);

        resultMap.put("rfdl", rfdl);
        //        resultMap.put("rfdl",rfdl1 );
        double yfdl = realData.get(22).getPointValueInDouble();
        yfdl = new BigDecimal(yfdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        yfdl1 = yfdl1.divide(new BigDecimal("10000")).setScale(2, RoundingMode.HALF_UP);
        //        resultMap.put("yfdl", yfdl1.add(BigDecimal.valueOf(rfdl)));
        resultMap.put("yfdl", yfdl1);
        double nfdl = realData.get(23).getPointValueInDouble();
        nfdl = new BigDecimal(nfdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        nfdl1 = nfdl1.divide(new BigDecimal("10000")).setScale(2, RoundingMode.HALF_UP);
        //        resultMap.put("nfdl", nfdl1.add(BigDecimal.valueOf(rfdl)));
        resultMap.put("nfdl", nfdl1);
        if (proBasicPowerstation.getWindType().equals("-1")) {
            resultMap.put("sspjfsgzd", realData.get(24).getPointValueInDouble());
        } else {
            resultMap.put("sspjfsgzd", realData1.get(0).getPointValueInDouble());
        }
        resultMap.put("yggl", MathUtil.twoBit(realData.get(25).getPointValueInDouble() / 1000));
        resultMap.put("fhl", (proBasicPowerstation.getJrwindCapacity() + proBasicPowerstation.getJrCapacity()) != 0 ? realData.get(25).getPointValueInDouble() / (proBasicPowerstation.getJrwindCapacity() + proBasicPowerstation.getJrCapacity()) * 100 : 0);
        //        resultMap.put("ylyxs", realData.get(26).getPointValueInDouble());

        BigDecimal zjrl = null;
        if (proBasicPowerstation.getWindType().equals("-1")) {
            zjrl = BigDecimal.valueOf(proBasicPowerstation.getJrwindCapacity() / 10000);
        } else if (proBasicPowerstation.getWindType().equals("-2")) {
            zjrl = BigDecimal.valueOf(proBasicPowerstation.getJrCapacity() / 10000);
        }
        //        resultMap.put("ylyxs", yfdl1.add(BigDecimal.valueOf(rfdl)).divide(zjrl ,2, RoundingMode.HALF_UP));
        resultMap.put("ylyxs", yfdl1.divide(zjrl, 2, RoundingMode.HALF_UP));
        //        resultMap.put("nlyxs", realData.get(27).getPointValueInDouble());
        //        resultMap.put("nlyxs", nfdl1.add(BigDecimal.valueOf(rfdl)).divide(zjrl ,2, RoundingMode.HALF_UP));
        resultMap.put("nlyxs", nfdl1.divide(zjrl, 2, RoundingMode.HALF_UP));


        //        resultMap.put("yfgnlyl", realData.get(28).getPointValueInDouble());
        resultMap.put("ysbklyl", realData.get(29).getPointValueInDouble());
        resultMap.put("ysbklyl", Math.random() * 10 + 90);

        double rgzssdl = realData.get(30).getPointValueInDouble() + realData.get(31).getPointValueInDouble();
        rgzssdl = new BigDecimal(rgzssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("rgzssdl", rgzssdl);
        double rwhssdl = realData.get(32).getPointValueInDouble() + realData.get(33).getPointValueInDouble();
        rwhssdl = new BigDecimal(rwhssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("rwhssdl", rwhssdl);
        double rxnssdl = realData.get(34).getPointValueInDouble() + realData.get(35).getPointValueInDouble() + realData.get(36).getPointValueInDouble() + realData.get(37).getPointValueInDouble();
        rxnssdl = new BigDecimal(rxnssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("rxnssdl", rxnssdl);
        double rxdssdl = realData.get(38).getPointValueInDouble() + realData.get(39).getPointValueInDouble();
        rxdssdl = new BigDecimal(rxdssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("rxdssdl", rxdssdl);
        double rslssdl = realData.get(40).getPointValueInDouble() + realData.get(41).getPointValueInDouble();
        rslssdl = new BigDecimal(rslssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("rslssdl", rslssdl);

        double ygzssdl = realData.get(42).getPointValueInDouble() + realData.get(43).getPointValueInDouble();
        ygzssdl = new BigDecimal(ygzssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("ygzssdl", ygzssdl);
        double ywhssdl = realData.get(44).getPointValueInDouble() + realData.get(45).getPointValueInDouble();
        ywhssdl = new BigDecimal(ywhssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("ywhssdl", ywhssdl);
        double yxnssdl = realData.get(46).getPointValueInDouble() + realData.get(47).getPointValueInDouble() + realData.get(48).getPointValueInDouble() + realData.get(49).getPointValueInDouble();
        yxnssdl = new BigDecimal(yxnssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("yxnssdl", yxnssdl);
        double yxdssdl = realData.get(50).getPointValueInDouble() + realData.get(51).getPointValueInDouble();
        yxdssdl = new BigDecimal(yxdssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("yxdssdl", yxdssdl);
        double yslssdl = realData.get(52).getPointValueInDouble() + realData.get(53).getPointValueInDouble();
        yslssdl = new BigDecimal(yslssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("yslssdl", yslssdl);
        if (monthvomap.containsKey(wpid)) {
            FjjxbVo vo = monthvomap.get(wpid);
            resultMap.put("ygzssdl", vo.getFjhjx());
            ygzssdl = vo.getFjhjx();
            resultMap.put("ywhssdl", vo.getJhjx());
            ywhssdl = vo.getJhjx();
            resultMap.put("yxnssdl", vo.getXn());
            yxnssdl = vo.getXn();
            resultMap.put("yxdssdl", vo.getXd());
            yxdssdl = vo.getXd();
            resultMap.put("yslssdl", vo.getSl());
            yslssdl = vo.getSl();
        }
        double ngzssdl = realData.get(54).getPointValueInDouble() + realData.get(55).getPointValueInDouble();
        ngzssdl = new BigDecimal(ngzssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("ngzssdl", ngzssdl);
        double nwhssdl = realData.get(56).getPointValueInDouble() + realData.get(57).getPointValueInDouble();
        nwhssdl = new BigDecimal(nwhssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("nwhssdl", nwhssdl);
        double nxnssdl = realData.get(58).getPointValueInDouble() + realData.get(59).getPointValueInDouble() + realData.get(60).getPointValueInDouble() + realData.get(61).getPointValueInDouble();
        nxnssdl = new BigDecimal(nxnssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("nxnssdl", nxnssdl);
        double nxdssdl = realData.get(62).getPointValueInDouble() + realData.get(63).getPointValueInDouble();
        nxdssdl = new BigDecimal(nxdssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("nxdssdl", nxdssdl);
        double nslssdl = realData.get(64).getPointValueInDouble() + realData.get(65).getPointValueInDouble();
        nslssdl = new BigDecimal(nslssdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
        resultMap.put("nslssdl", nslssdl);

        if (yearvomap.containsKey(wpid)) {
            FjjxbVo vo = yearvomap.get(wpid);
            resultMap.put("ngzssdl", vo.getFjhjx());

            resultMap.put("nwhssdl", vo.getJhjx());

            resultMap.put("nxnssdl", vo.getXn());

            resultMap.put("nxdssdl", vo.getXd());

            resultMap.put("nslssdl", vo.getSl());
        }


        double llfdl = yfdl1.doubleValue() + ygzssdl + ywhssdl + yxnssdl + yxdssdl + yslssdl;
        double yfgnlyl = 0.0;
        if (llfdl != 0) {
            yfgnlyl = yfdl1.divide(new BigDecimal(llfdl), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
        }

        resultMap.put("yfgnlyl", yfgnlyl);
        resultMap.put("aqts", realData.get(66).getPointValueInDouble());
        resultMap.put("czmc", proBasicPowerstation.getAname());
        resultMap.put("czlx", proBasicPowerstation.getModel());
        resultMap.put("hzrl", proBasicPowerstation.getAppCapacity());
        resultMap.put("zjrl", proBasicPowerstation.getConCapacity());
        resultMap.put("bwrl", proBasicPowerstation.getGridCapacity());
        resultMap.put("dzrl", proBasicPowerstation.getHoiCapacity());
        resultMap.put("jwd", proBasicPowerstation.getLongitude() + "," + proBasicPowerstation.getLatitude());
        resultMap.put("spbwsj", proBasicPowerstation.getFirstGridTime());
        resultMap.put("zctysj", proBasicPowerstation.getWholeGridTime());
        resultMap.put("cftsl", proBasicPowerstation.getAnemoNumber());
        resultMap.put("syzsl", proBasicPowerstation.getStationNumber());
        resultMap.put("czwz", proBasicPowerstation.getAddress());
        return resultMap;
    }

    public List<ProEconPowerstationInfoDay5> hisdata(String wpid) {

        QueryWrapper<ProEconPowerstationInfoDay5> qw = new QueryWrapper<>();
        qw.lambda().le(ProEconPowerstationInfoDay5::getRecordDate, DateUtils.today()).ge(ProEconPowerstationInfoDay5::getRecordDate, DateUtils.getMonthFirst(DateUtils.today()));
        qw.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpid).orderByAsc(ProEconPowerstationInfoDay5::getRecordDate);
        List<ProEconPowerstationInfoDay5> list = proEconPowerstationInfoDay5Service.list(qw);
        return list;
    }
}
