package com.gyee.generation.service;//package com.gyee.generation.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.common.contant.ContantXk;
import com.gyee.common.model.PointData;
import com.gyee.common.model.StringUtils;
import com.gyee.generation.init.CacheContext;
import com.gyee.generation.model.auto.*;
import com.gyee.generation.model.vo.Location;
import com.gyee.generation.service.auto.IProEconPowerstationInfoDay5Service;
import com.gyee.generation.util.DateUtils;
import com.gyee.generation.util.PointUtil;
import com.gyee.generation.util.realtimesource.IEdosUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.*;

@Service
public class WindPowerInfo5UpdateService {

    @Resource
    private IEdosUtil edosUtil;

    @Resource
    private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;


    /**
     * 计算场站日信息
     */
    public void calWindpowerInfoDay(Date recordDate) throws Exception {
        Calendar c = Calendar.getInstance();
        c.setTime(recordDate);
        Date end = null;
        Date begin = null;
        if (c.get(Calendar.DAY_OF_MONTH) == 1) {
            c.add(Calendar.MONTH, -1);
            c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH));
            begin = DateUtils.truncate(c.getTime());
            c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
            end = DateUtils.truncate(c.getTime());
        } else {
            c.add(Calendar.DAY_OF_MONTH, -1);
            end = DateUtils.truncate(c.getTime());
            c.set(Calendar.DAY_OF_MONTH, 1);
            begin = DateUtils.truncate(c.getTime());
        }


        List<PointData> wtResultList = new ArrayList<>();
        for (ProBasicPowerstation wp : CacheContext.wpls) {
            if (CacheContext.wppointmap.containsKey(wp.getId())) {
                Map<String, ProBasicPowerstationPoint> pointmap = CacheContext.wppointmap.get(wp.getId());


                //                //昨日的统计结果
                List<ProEconPowerstationInfoDay5> pepid1ls = new ArrayList<>();

                QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper3 = new QueryWrapper<>();
                queryWrapper3.ge("record_date", DateUtils.truncate(begin))
                        .le("record_date", DateUtils.truncate(end))
                        .eq("location", Location.wp.getValue()).eq("windpowerstation_id", wp.getId());
                pepid1ls = proEconPowerstationInfoDay5Service.list(queryWrapper3);


                if (!pepid1ls.isEmpty()) {
                    for (ProEconPowerstationInfoDay5 day5 : pepid1ls) {
                        c.setTime(day5.getRecordDate());
                        c.set(Calendar.HOUR_OF_DAY, 23);
                        c.set(Calendar.MINUTE, 59);
                        c.set(Calendar.SECOND, 59);
                        List<PointData> list = extracted(c.getTime(), pointmap, day5);
                        wtResultList.addAll(list);
                    }

                }

                //*******************************************年信息统计*********************************************************/

            }


        }


        edosUtil.sendMultiPoint(wtResultList);


    }


    /**
     * 计算场站日信息
     */
    public void calWindpowerInfoDayCurry() throws Exception {
        Calendar c = Calendar.getInstance();

        Date end = null;
        if (c.get(Calendar.DAY_OF_MONTH) != 1) {
            List<PointData> wtResultList = new ArrayList<>();
            c.add(Calendar.DAY_OF_MONTH, -1);
            end = DateUtils.truncate(c.getTime());


            for (ProBasicPowerstation wp : CacheContext.wpls) {
                if (CacheContext.wppointmap.containsKey(wp.getId())) {
                    Map<String, ProBasicPowerstationPoint> pointmap = CacheContext.wppointmap.get(wp.getId());


                    //                //昨日的统计结果
                    List<ProEconPowerstationInfoDay5> pepid1ls = new ArrayList<>();

                    QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper3 = new QueryWrapper<>();
                    queryWrapper3.eq("record_date", DateUtils.truncate(end))
                            .eq("location", Location.wp.getValue()).eq("windpowerstation_id", wp.getId());
                    pepid1ls = proEconPowerstationInfoDay5Service.list(queryWrapper3);


                    if (!pepid1ls.isEmpty()) {
                        ProEconPowerstationInfoDay5 day5 = pepid1ls.get(0);
                        c = Calendar.getInstance();
                        List<PointData> list = extracted2(c.getTime(), pointmap, day5);
                        wtResultList.addAll(list);

                    }
                    //*******************************************年信息统计*********************************************************/
                }

            }
            edosUtil.sendMultiPoint(wtResultList);
        }


    }


    /**
     * 计算项目日信息
     */
    public void calProjectInfoDayCurry() throws Exception {

        Calendar c = Calendar.getInstance();

        Date end = null;

        if (c.get(Calendar.DAY_OF_MONTH) != 1) {
            List<PointData> wtResultList = new ArrayList<>();
            c.add(Calendar.DAY_OF_MONTH, -1);
            end = DateUtils.truncate(c.getTime());


            for (ProBasicProject pj : CacheContext.pjls) {
                if (CacheContext.propointmap.containsKey(pj.getId())) {
                    Map<String, ProBasicPowerstationPoint> pointmap = CacheContext.propointmap.get(pj.getId());


                    //昨日的统计结果
                    List<ProEconPowerstationInfoDay5> pepid1ls = new ArrayList<>();

                    QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper4 = new QueryWrapper<>();
                    queryWrapper4.eq("record_date", DateUtils.truncate(end))
                            .eq("location", Location.pj.getValue()).eq("project_id", pj.getId());
                    pepid1ls = proEconPowerstationInfoDay5Service.list(queryWrapper4);
                    //                        .stream()
                    //                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
                    //                                && i.getProjectId().equals(pj.getId())
                    //                                && i.getLocation().equals(Location.pj.getValue()))
                    //                        .collect(Collectors.toList());
                    if (!pepid1ls.isEmpty()) {
                        if (!pepid1ls.isEmpty()) {
                            ProEconPowerstationInfoDay5 day5 = pepid1ls.get(0);
                            c = Calendar.getInstance();
                            List<PointData> list = extracted2(c.getTime(), pointmap, day5);
                            wtResultList.addAll(list);
                        }

                    }

                }

            }
            edosUtil.updatePoint(wtResultList);

        }


    }

    /**
     * 计算项目日信息
     */
    public void calProjectInfoDay(Date recordDate) throws Exception {

        Calendar c = Calendar.getInstance();
        c.setTime(recordDate);
        Date end = null;
        Date begin = null;
        if (c.get(Calendar.DAY_OF_MONTH) == 1) {
            c.add(Calendar.MONTH, -1);
            c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH));
            begin = DateUtils.truncate(c.getTime());
            c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
            end = DateUtils.truncate(c.getTime());
        } else {
            c.add(Calendar.DAY_OF_MONTH, -1);
            end = DateUtils.truncate(c.getTime());
            c.set(Calendar.DAY_OF_MONTH, 1);
            begin = DateUtils.truncate(c.getTime());
        }

        List<PointData> wtResultList = new ArrayList<>();
        for (ProBasicProject pj : CacheContext.pjls) {
            if (CacheContext.propointmap.containsKey(pj.getId())) {
                Map<String, ProBasicPowerstationPoint> pointmap = CacheContext.propointmap.get(pj.getId());

                ProEconPowerstationInfoDay5 pewp = new ProEconPowerstationInfoDay5();

                //昨日的统计结果
                List<ProEconPowerstationInfoDay5> pepid1ls = new ArrayList<>();

                QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper4 = new QueryWrapper<>();
                queryWrapper4.ge("record_date", DateUtils.truncate(begin))
                        .le("record_date", DateUtils.truncate(end))
                        .eq("location", Location.pj.getValue()).eq("project_id", pj.getId());
                pepid1ls = proEconPowerstationInfoDay5Service.list(queryWrapper4);
                //                        .stream()
                //                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
                //                                && i.getProjectId().equals(pj.getId())
                //                                && i.getLocation().equals(Location.pj.getValue()))
                //                        .collect(Collectors.toList());
                if (!pepid1ls.isEmpty()) {
                    for (ProEconPowerstationInfoDay5 day5 : pepid1ls) {
                        c.setTime(day5.getRecordDate());
                        c.set(Calendar.HOUR_OF_DAY, 23);
                        c.set(Calendar.MINUTE, 59);
                        c.set(Calendar.SECOND, 59);
                        List<PointData> list = extracted(c.getTime(), pointmap, day5);
                        wtResultList.addAll(list);
                    }

                }

            }

        }
        edosUtil.updatePoint(wtResultList);

    }

    /**
     * 计算线路日信息
     */
    public void calLineInfoDay(Date recordDate) throws Exception {
        Calendar c = Calendar.getInstance();
        c.setTime(recordDate);
        Date end = null;
        Date begin = null;
        if (c.get(Calendar.DAY_OF_MONTH) == 1) {
            c.add(Calendar.MONTH, -1);
            c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH));
            begin = DateUtils.truncate(c.getTime());
            c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
            end = DateUtils.truncate(c.getTime());
        } else {
            c.add(Calendar.DAY_OF_MONTH, -1);
            end = DateUtils.truncate(c.getTime());
            c.set(Calendar.DAY_OF_MONTH, 1);
            begin = DateUtils.truncate(c.getTime());
        }

        List<PointData> wtResultList = new ArrayList<>();
        for (ProBasicLine ln : CacheContext.lnls) {
            if (CacheContext.linepointmap.containsKey(ln.getId())) {
                Map<String, ProBasicPowerstationPoint> pointmap = CacheContext.linepointmap.get(ln.getId());


                //昨日的统计结果

                List<ProEconPowerstationInfoDay5> pepid1ls = new ArrayList<>();

                QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper2 = new QueryWrapper<>();
                queryWrapper2.ge("record_date", DateUtils.truncate(begin))
                        .le("record_date", DateUtils.truncate(end)).eq("location", Location.ln.getValue()).eq("line_id", ln.getId());
                pepid1ls = proEconPowerstationInfoDay5Service.list(queryWrapper2);
                //                        .stream()
                //                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
                //                                && i.getLineId().equals(ln.getId())
                //                                && i.getLocation().equals(Location.ln.getValue()))
                //                        .collect(Collectors.toList());
                if (!pepid1ls.isEmpty()) {
                    for (ProEconPowerstationInfoDay5 day5 : pepid1ls) {
                        c.setTime(day5.getRecordDate());
                        c.set(Calendar.HOUR_OF_DAY, 23);
                        c.set(Calendar.MINUTE, 59);
                        c.set(Calendar.SECOND, 59);
                        List<PointData> list = extracted(c.getTime(), pointmap, day5);
                        wtResultList.addAll(list);
                    }

                }


            }

            edosUtil.updatePoint(wtResultList);
        }

    }

    private List<PointData> extracted(Date recordDate, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay5 lastday5) throws Exception {
        //*******************************************日信息统计*********************************************************/

        double rfdlsyz = null != lastday5.getRfdldb() ? lastday5.getRfdldb() : 0.0;
        double rswdlsyz = null != lastday5.getRswdldb() ? lastday5.getRswdldb() : 0.0;
        double rgwgwdlsyz = null != lastday5.getRgwgwdldb() ? lastday5.getRgwgwdldb() : 0.0;
        double rnwgwdlsyz = null != lastday5.getRnwgwdldb() ? lastday5.getRnwgwdldb() : 0.0;
        double rcydlsyz = 0.0;


        List<PointData> wtResultList = new ArrayList<>();


        if (pointmap.containsKey(ContantXk.RFDLSYZ) && StringUtils.notEmp(lastday5.getRfdldb()) && lastday5.getRfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.RFDLSYZ);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getRfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.RFDL) && StringUtils.notEmp(lastday5.getRfdldb()) && lastday5.getRfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.RFDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getRfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }
        if (pointmap.containsKey(ContantXk.RSWDL) && StringUtils.notEmp(lastday5.getRswdldb()) && lastday5.getRswdldb() > 0) {
            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.RSWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getRswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.RGWGWDL) && StringUtils.notEmp(lastday5.getRgwgwdldb()) && lastday5.getRgwgwdldb() > 0) {
            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.RGWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getRgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.RNWGWDL) && StringUtils.notEmp(lastday5.getRnwgwdldb()) && lastday5.getRnwgwdldb() > 0) {
            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.RNWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getRnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
        }


        if (pointmap.containsKey(ContantXk.RCYDL) && StringUtils.notEmp(rcydlsyz) && rcydlsyz > 0) {
            ProBasicPowerstationPoint rcydlpoint = pointmap.get(ContantXk.RCYDL);
            rcydlsyz = StringUtils.round(rfdlsyz - rswdlsyz + rgwgwdlsyz + rnwgwdlsyz, 2);
            wtResultList.add(PointUtil.createPointData(recordDate, rcydlsyz, rcydlpoint.getNemCode(), rcydlpoint.getName()));

        }


        //*******************************************日信息统计*********************************************************/

        //*******************************************月信息统计*********************************************************/

        double yfdlsyz = null != lastday5.getYfdldb() ? lastday5.getYfdldb() : 0.0;
        double yswdlsyz = null != lastday5.getYswdldb() ? lastday5.getYswdldb() : 0.0;
        double ygwgwdlsyz = null != lastday5.getYgwgwdldb() ? lastday5.getYgwgwdldb() : 0.0;
        double ynwgwdlsyz = null != lastday5.getYnwgwdldb() ? lastday5.getYnwgwdldb() : 0.0;
        double ycydlsyz = 0.0;


        if (pointmap.containsKey(ContantXk.YFDLSYZ) && StringUtils.notEmp(lastday5.getYfdldb()) && lastday5.getYfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.YFDLSYZ);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.YFDL) && StringUtils.notEmp(lastday5.getYfdldb()) && lastday5.getYfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.YFDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }
        if (pointmap.containsKey(ContantXk.YSWDL) && StringUtils.notEmp(lastday5.getYswdldb()) && lastday5.getYswdldb() > 0) {
            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.YSWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.YGWGWDL) && StringUtils.notEmp(lastday5.getYgwgwdldb()) && lastday5.getYgwgwdldb() > 0) {
            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.YGWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.YNWGWDL) && StringUtils.notEmp(lastday5.getYnwgwdldb()) && lastday5.getYnwgwdldb() > 0) {
            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.YNWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
        }


        if (pointmap.containsKey(ContantXk.YCYDL) && StringUtils.notEmp(ycydlsyz) && ycydlsyz > 0) {
            ProBasicPowerstationPoint rcydlpoint = pointmap.get(ContantXk.YCYDL);
            ycydlsyz = StringUtils.round(yfdlsyz - yswdlsyz + ygwgwdlsyz + ynwgwdlsyz, 2);
            wtResultList.add(PointUtil.createPointData(recordDate, ycydlsyz, rcydlpoint.getNemCode(), rcydlpoint.getName()));

        }


        //*******************************************月信息统计*********************************************************/

        //*******************************************年信息统计*********************************************************/
        double nfdlsyz = null != lastday5.getYfdldb() ? lastday5.getNfdldb() : 0.0;
        double nswdlsyz = null != lastday5.getYfdldb() ? lastday5.getNswdldb() : 0.0;
        double ngwgwdlsyz = null != lastday5.getYfdldb() ? lastday5.getNgwgwdldb() : 0.0;
        double nnwgwdlsyz = null != lastday5.getYfdldb() ? lastday5.getNnwgwdldb() : 0.0;
        double ncydlsyz = 0.0;


        if (pointmap.containsKey(ContantXk.NFDLSYZ) && StringUtils.notEmp(lastday5.getNfdldb()) && lastday5.getNfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.NFDLSYZ);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.NFDL) && StringUtils.notEmp(lastday5.getNfdldb()) && lastday5.getNfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.NFDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }
        if (pointmap.containsKey(ContantXk.NSWDL) && StringUtils.notEmp(lastday5.getNswdldb()) && lastday5.getNswdldb() > 0) {
            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.NSWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.NGWGWDL) && StringUtils.notEmp(lastday5.getNgwgwdldb()) && lastday5.getNgwgwdldb() > 0) {
            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.NGWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.NNWGWDL) && StringUtils.notEmp(lastday5.getNnwgwdldb()) && lastday5.getNnwgwdldb() > 0) {
            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.NNWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
        }


        if (pointmap.containsKey(ContantXk.NCYDL) && StringUtils.notEmp(ncydlsyz) && ncydlsyz > 0) {
            ProBasicPowerstationPoint ncydlpoint = pointmap.get(ContantXk.NCYDL);
            ncydlsyz = StringUtils.round(nfdlsyz - nswdlsyz + ngwgwdlsyz + nnwgwdlsyz, 2);
            wtResultList.add(PointUtil.createPointData(recordDate, ncydlsyz, ncydlpoint.getNemCode(), ncydlpoint.getName()));

        }


        return wtResultList;

    }

    private List<PointData> extracted2(Date recordDate, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay5 lastday5) throws Exception {
        //*******************************************日信息统计*********************************************************/

        double rfdlsyz = null != lastday5.getRfdldb() ? lastday5.getRfdldb() : 0.0;
        double rswdlsyz = null != lastday5.getRswdldb() ? lastday5.getRswdldb() : 0.0;
        double rgwgwdlsyz = null != lastday5.getRgwgwdldb() ? lastday5.getRgwgwdldb() : 0.0;
        double rnwgwdlsyz = null != lastday5.getRnwgwdldb() ? lastday5.getRnwgwdldb() : 0.0;
        double rcydlsyz = 0.0;


        List<PointData> wtResultList = new ArrayList<>();


        //*******************************************月信息统计*********************************************************/

        double yfdlsyz = null != lastday5.getYfdldb() ? lastday5.getYfdldb() : 0.0;
        double yswdlsyz = null != lastday5.getYswdldb() ? lastday5.getYswdldb() : 0.0;
        double ygwgwdlsyz = null != lastday5.getYgwgwdldb() ? lastday5.getYgwgwdldb() : 0.0;
        double ynwgwdlsyz = null != lastday5.getYnwgwdldb() ? lastday5.getYnwgwdldb() : 0.0;
        double ycydlsyz = 0.0;


        if (pointmap.containsKey(ContantXk.YFDLSYZ) && StringUtils.notEmp(lastday5.getYfdldb()) && lastday5.getYfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.YFDLSYZ);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.YFDL) && StringUtils.notEmp(lastday5.getYfdldb()) && lastday5.getYfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.YFDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }
        if (pointmap.containsKey(ContantXk.YSWDL) && StringUtils.notEmp(lastday5.getYswdldb()) && lastday5.getYswdldb() > 0) {
            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.YSWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.YGWGWDL) && StringUtils.notEmp(lastday5.getYgwgwdldb()) && lastday5.getYgwgwdldb() > 0) {
            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.YGWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.YNWGWDL) && StringUtils.notEmp(lastday5.getYnwgwdldb()) && lastday5.getYnwgwdldb() > 0) {
            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.YNWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
        }


        if (pointmap.containsKey(ContantXk.YCYDL) && StringUtils.notEmp(ycydlsyz) && ycydlsyz > 0) {
            ProBasicPowerstationPoint rcydlpoint = pointmap.get(ContantXk.YCYDL);
            ycydlsyz = StringUtils.round(yfdlsyz - yswdlsyz + ygwgwdlsyz + ynwgwdlsyz, 2);
            wtResultList.add(PointUtil.createPointData(recordDate, ycydlsyz, rcydlpoint.getNemCode(), rcydlpoint.getName()));

        }


        //*******************************************月信息统计*********************************************************/

        //*******************************************年信息统计*********************************************************/
        double nfdlsyz = null != lastday5.getYfdldb() ? lastday5.getNfdldb() : 0.0;
        double nswdlsyz = null != lastday5.getYfdldb() ? lastday5.getNswdldb() : 0.0;
        double ngwgwdlsyz = null != lastday5.getYfdldb() ? lastday5.getNgwgwdldb() : 0.0;
        double nnwgwdlsyz = null != lastday5.getYfdldb() ? lastday5.getNnwgwdldb() : 0.0;
        double ncydlsyz = 0.0;


        if (pointmap.containsKey(ContantXk.NFDLSYZ) && StringUtils.notEmp(lastday5.getNfdldb()) && lastday5.getNfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.NFDLSYZ);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.NFDL) && StringUtils.notEmp(lastday5.getNfdldb()) && lastday5.getNfdldb() > 0) {
            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.NFDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
        }
        if (pointmap.containsKey(ContantXk.NSWDL) && StringUtils.notEmp(lastday5.getNswdldb()) && lastday5.getNswdldb() > 0) {
            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.NSWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.NGWGWDL) && StringUtils.notEmp(lastday5.getNgwgwdldb()) && lastday5.getNgwgwdldb() > 0) {
            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.NGWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
        }

        if (pointmap.containsKey(ContantXk.NNWGWDL) && StringUtils.notEmp(lastday5.getNnwgwdldb()) && lastday5.getNnwgwdldb() > 0) {
            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.NNWGWDL);
            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
        }


        if (pointmap.containsKey(ContantXk.NCYDL) && StringUtils.notEmp(ncydlsyz) && ncydlsyz > 0) {
            ProBasicPowerstationPoint ncydlpoint = pointmap.get(ContantXk.NCYDL);
            ncydlsyz = StringUtils.round(nfdlsyz - nswdlsyz + ngwgwdlsyz + nnwgwdlsyz, 2);
            wtResultList.add(PointUtil.createPointData(recordDate, ncydlsyz, ncydlpoint.getNemCode(), ncydlpoint.getName()));

        }


        return wtResultList;

    }
}







