package com.gyee.frame.service.websocket;


import com.gyee.frame.common.spring.Constant;
import com.gyee.frame.common.spring.ConstantTR;
import com.gyee.frame.common.spring.InitialRunner;
import com.gyee.frame.common.spring.WpEnum;
import com.gyee.frame.model.auto.*;
import com.gyee.frame.model.custom.DNAVal;
import com.gyee.frame.model.custom.DataVo;
import com.gyee.frame.model.custom.MatrixVo;
import com.gyee.frame.model.custom.PointData;
import com.gyee.frame.service.*;
import com.gyee.frame.service.weather.WeatherDay5Service;
import com.gyee.frame.service.weather.WeatherService;
import com.gyee.frame.util.*;
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 GenreSetPushService {


    @Resource
    private WindPowerstationTestingPoint2Service windPowerstationTestingPoint2Service;
    @Resource
    private WindpowerinfodayService windpowerinfodayService;
    @Resource
    private ProjectPlanService projectPlanService;
    @Resource
    private RealPowerPushService realPowerPushService;
    @Resource
    private ShutdowneventService shutdowneventService;
    @Resource
    private WpMttrAndMtbMonthService wpMttrAndMtbMonthService;
    @Resource
    private WindTurbineTestingPointAiService windTurbineTestingPointAiService;
    @Resource
    private WeatherService weatherService;
    @Resource
    private WeatherDay5Service weatherDay5Service;
    @Resource
    private PowerToPowerService powerToPowerService;
    @Resource
    private RecommenmainMsSqlService recommenmainMsSqlService;
    @Resource
    private WobugeqService wobugeqService;
    @Resource
    private RecommenmainService recommenmainService;


    private final String QS = "0";
    private final String FD = "-1";
    private final String GF = "-2";
    private final String DEFAULT_FDC = "MHS_FDC";
    private final double YCFDLXS = 1.08;
    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();


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

        Map<String, Object> map = new HashMap<>();


        map.put(QS, findBasicDataInfo(QS));
        map.put(FD, findBasicDataInfo(FD));
        map.put(GF, findBasicDataInfo(GF));

        map.put("SBQ_FDC", findBasicDataInfo("SBQ_FDC"));
        map.put("SBQ02_GC", findBasicDataInfo("SBQ02_GC"));
        map.put("SBQ05_XL", findBasicDataInfo("SBQ05_XL"));
        return map;

    }

    public Map<String, Object> findBasicDataInfo(String id) throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        if (StringUtils.notEmp(id)) {


            Double zjrl = 0.0;
            Double zjts = 0.0;

            Double sjgl = 0.0;
            Double bzgl = 0.0;
            Double yfgl = 0.0;


            Calendar cal2 = Calendar.getInstance();
            cal2.add(Calendar.HOUR_OF_DAY, -1);
            cal2.set(Calendar.MINUTE, 0);
            cal2.set(Calendar.SECOND, 0);

            Date beginDate = cal2.getTime();
            cal2.add(Calendar.DAY_OF_MONTH, 1);
            Date endDate = cal2.getTime();
/*************************************************风场指标*************************************************************/

            Map<String, Object> fcmap = new HashMap<>();

            if (id.equals(QS) || id.equals(FD) || id.equals(GF)) {


                //初始化场站信息

                List<Windpowerstation> wplist = new ArrayList<>();

                for (Windpowerstation wp : InitialRunner.wpallls) {
                    if (id.equals(FD)) {
                        if (wp.getId().endsWith("FDC")) {
                            wplist.add(wp);
                        }
                    } else if (id.equals(GF)) {
                        if (wp.getId().endsWith("GDC")) {
                            wplist.add(wp);
                        }
                    } else if (id.equals(QS)) {
                        wplist.add(wp);
                    }

                }


                for (Windpowerstation wp : wplist) {

                    zjrl += wp.getCapacity();
                    zjts += wp.getQuantity();

                    WindPowerStationTestingPoint fczt = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wp.getId(), Constant.FJZT);
                    WindPowerStationTestingPoint fcgl = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wp.getId(), Constant.TPOINT_WP_SJGL);

                    Double fcztvalue = realApiUtil.getRealData(fczt).getPointValueInDouble();
                    Double fcglvalue = realApiUtil.getRealData(fcgl).getPointValueInDouble();

                    StringBuilder sb = new StringBuilder();
                    sb.append(wp.getId()).append("_").append("zjrl");
                    fcmap.put(String.valueOf(sb), wp.getCapacity());
                    sb.setLength(0);
                    sb.append(wp.getId()).append("_").append("zjts");
                    fcmap.put(String.valueOf(sb), Double.valueOf(wp.getQuantity()));
                    sb.setLength(0);
                    sb.append(wp.getId()).append("_").append("fczt");
                    fcmap.put(String.valueOf(sb), fcztvalue);
                    sb.setLength(0);
                    sb.append(wp.getId()).append("_").append("fcgl");
                    fcmap.put(String.valueOf(sb), MathUtil.twoBit(fcglvalue));

                    fcmap.put("name", wp.getName());
                    fcmap.put("id", wp.getId());
                }


            } else if (InitialRunner.wpmap.containsKey(id)) {

                if (InitialRunner.pjsmap.containsKey(id)) {
                    List<Project> pjls = InitialRunner.pjsmap.get(id);
                    for (Project pj : pjls) {
                        if (InitialRunner.lnsmap.containsKey(pj.getId())) {
                            List<Line> lnls = InitialRunner.lnsmap.get(pj.getId());
                            for (Line ln : lnls) {
                                zjrl += ln.getCapacity();
                                zjts += ln.getQuantity();

                                WindPowerStationTestingPoint fczt = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(ln.getId(), Constant.FJZT);
                                WindPowerStationTestingPoint fcgl = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(ln.getId(), Constant.TPOINT_WP_SJGL);

                                Double fcztvalue = realApiUtil.getRealData(fczt).getPointValueInDouble();
                                Double fcglvalue = realApiUtil.getRealData(fcgl).getPointValueInDouble();

                                StringBuilder sb = new StringBuilder();
                                sb.append(ln.getId()).append("_").append("zjrl");
                                fcmap.put(String.valueOf(sb), ln.getCapacity());
                                sb.setLength(0);
                                sb.append(ln.getId()).append("_").append("zjts");
                                fcmap.put(String.valueOf(sb), Double.valueOf(ln.getQuantity()));
                                sb.setLength(0);
                                sb.append(ln.getId()).append("_").append("fczt");
                                fcmap.put(String.valueOf(sb), fcztvalue);
                                sb.setLength(0);
                                sb.append(ln.getId()).append("_").append("fcgl");
                                fcmap.put(String.valueOf(sb), MathUtil.twoBit(fcglvalue));
                                fcmap.put("name", ln.getName());
                                fcmap.put("id", ln.getId());
                            }
                        }
                    }
                }
            } else if (InitialRunner.pjmap.containsKey(id)) {

                if (InitialRunner.lnsmap.containsKey(id)) {
                    List<Line> lnls = InitialRunner.lnsmap.get(id);
                    for (Line ln : lnls) {
                        zjrl += ln.getCapacity();
                        zjts += ln.getQuantity();

                        WindPowerStationTestingPoint fczt = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(ln.getId(), Constant.FJZT);
                        WindPowerStationTestingPoint fcgl = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(ln.getId(), Constant.TPOINT_WP_SJGL);

                        Double fcztvalue = realApiUtil.getRealData(fczt).getPointValueInDouble();
                        Double fcglvalue = realApiUtil.getRealData(fcgl).getPointValueInDouble();

                        StringBuilder sb = new StringBuilder();
                        sb.append(ln.getId()).append("_").append("zjrl");
                        fcmap.put(String.valueOf(sb), ln.getCapacity());
                        sb.setLength(0);
                        sb.append(ln.getId()).append("_").append("zjts");
                        fcmap.put(String.valueOf(sb), Double.valueOf(ln.getQuantity()));
                        sb.setLength(0);
                        sb.append(ln.getId()).append("_").append("fczt");
                        fcmap.put(String.valueOf(sb), fcztvalue);
                        sb.setLength(0);
                        sb.append(ln.getId()).append("_").append("fcgl");
                        fcmap.put(String.valueOf(sb), MathUtil.twoBit(fcglvalue));
                        fcmap.put("name", ln.getName());
                        fcmap.put("id", ln.getId());
                    }
                }
            } else if (InitialRunner.lnmap.containsKey(id)) {

                if (InitialRunner.lnsmap.containsKey(InitialRunner.lnmap.get(id).getProjectid())) {
                    List<Line> lnls = InitialRunner.lnsmap.get(InitialRunner.lnmap.get(id).getProjectid());
                    for (Line ln : lnls) {
                        zjrl += ln.getCapacity();
                        zjts += ln.getQuantity();

                        WindPowerStationTestingPoint fczt = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(ln.getId(), Constant.FJZT);
                        WindPowerStationTestingPoint fcgl = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(ln.getId(), Constant.TPOINT_WP_SJGL);

                        Double fcztvalue = realApiUtil.getRealData(fczt).getPointValueInDouble();
                        Double fcglvalue = realApiUtil.getRealData(fcgl).getPointValueInDouble();

                        StringBuilder sb = new StringBuilder();
                        sb.append(ln.getId()).append("_").append("zjrl");
                        fcmap.put(String.valueOf(sb), ln.getCapacity());
                        sb.setLength(0);
                        sb.append(ln.getId()).append("_").append("zjts");
                        fcmap.put(String.valueOf(sb), Double.valueOf(ln.getQuantity()));
                        sb.setLength(0);
                        sb.append(ln.getId()).append("_").append("fczt");
                        fcmap.put(String.valueOf(sb), fcztvalue);
                        sb.setLength(0);
                        sb.append(ln.getId()).append("_").append("fcgl");
                        fcmap.put(String.valueOf(sb), MathUtil.twoBit(fcglvalue));
                        fcmap.put("name", ln.getName());
                        fcmap.put("id", ln.getId());
                    }
                }
            }


            //所属风场指标
            map.put("fcmap", fcmap);

/*************************************************风场指标*************************************************************/

            Map<String, Object> tqmap = weatherService.getWeatherRealInfo(id);
            map.put("tqmap", tqmap);


            Map<String,Object> weathermap= weatherDay5Service.getWeatherRealDay5Info(id);
            map.put("tqmap5", weathermap);
            Map<String, Object> xtmap=tooltipAjax();
            map.put("xtmap", xtmap);
/*************************************************基础指标*************************************************************/
            Map<String, Object> jczbmap = new HashMap<>();


            if (InitialRunner.wpmap.containsKey(id)) {
                Windpowerstation wp = InitialRunner.wpmap.get(id);

                zjrl = wp.getCapacity();
                zjts = Double.valueOf(wp.getQuantity());


            } else if (InitialRunner.pjmap.containsKey(id)) {
                Project pj = InitialRunner.pjmap.get(id);

                zjrl = pj.getCapacity();
                zjts = Double.valueOf(pj.getQuantity());
            } else if (InitialRunner.lnmap.containsKey(id)) {
                Line ln = InitialRunner.lnmap.get(id);

                zjrl = ln.getCapacity();
                zjts = Double.valueOf(ln.getQuantity());
            }

            jczbmap.put("zjrl", zjrl);
            jczbmap.put("zjts", zjts);

            List<String> jczbls = new ArrayList<>();

            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_SJGL).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_RFDL).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_YFDL).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_NFDL).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_SSFS).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_SWDL).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.ZBZGL).getCode());
            jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_ZZSGL).getCode());


            double rfdl = 0.0;
            double yfdl = 0.0;
            double nfdl = 0.0;
            List<PointData> jczblist = realApiUtil.getRealData(jczbls);

            if (!jczblist.isEmpty() && jczblist.size() == jczbls.size()) {
                //实际功率
                sjgl = MathUtil.twoBit(jczblist.get(0).getPointValueInDouble());
                jczbmap.put("sjgl", sjgl);
                //日发电量
                rfdl = MathUtil.twoBit(jczblist.get(1).getPointValueInDouble());
                jczbmap.put("rfdl", rfdl);
                //月发电量
                yfdl = MathUtil.twoBit(jczblist.get(2).getPointValueInDouble());
                jczbmap.put("yfdl", yfdl);
                //年发电量
                nfdl = MathUtil.twoBit(jczblist.get(3).getPointValueInDouble());
                jczbmap.put("nfdl", nfdl);
                //月利用小时
                jczbmap.put("ylyxs", (new BigDecimal(jczblist.get(2).getPointValueInDouble()).multiply(new BigDecimal(10))).divide(new BigDecimal(zjrl), 2, RoundingMode.HALF_EVEN).doubleValue());
                //年利用小时
                jczbmap.put("nlyxs", (new BigDecimal(jczblist.get(3).getPointValueInDouble()).multiply(new BigDecimal(10))).divide(new BigDecimal(zjrl), 2, RoundingMode.HALF_EVEN).doubleValue());
                //实时风速
                jczbmap.put("ssfs", MathUtil.twoBit(jczblist.get(4).getPointValueInDouble()));
                //上网电量
                jczbmap.put("swdl", MathUtil.twoBit(jczblist.get(5).getPointValueInDouble()));
                //保证功率
                bzgl = new BigDecimal(jczblist.get(6).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
                jczbmap.put("bzgl", bzgl);
                //应发功率
                yfgl = new BigDecimal(jczblist.get(7).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
                jczbmap.put("yfgl", yfgl);

            } else {
                //实际功率
                jczbmap.put("sjgl", 0.0);
                //日发电量
                jczbmap.put("rfdl", 0.0);
                //月发电量
                jczbmap.put("yfdl", 0.0);
                //年发电量
                jczbmap.put("nfdl", 0.0);
                //月利用小时
                jczbmap.put("ylyxs", 0.0);
                //年利用小时
                jczbmap.put("nlyxs", 0.0);
                //实时风速
                jczbmap.put("ssfs", 0.0);
                //上网电量
                jczbmap.put("swdl", 0.0);
                //保证功率
                jczbmap.put("bzgl", 0.0);
                //应发功率
                jczbmap.put("yfgl", 0.0);

            }


            if (id.equals(QS)) {
                // 减排二氧化碳
                int jpeyht = (int) (realApiUtil.getRealData(ConstantTR.JPEYHT).getPointValueInDouble() * 10000);
                // 节约标煤
                int jybm = (int)(realApiUtil.getRealData(ConstantTR.JYBM).getPointValueInDouble() * 10000);
                // 减排二氧化硫
                int jpeyhl = (int)(realApiUtil.getRealData(ConstantTR.JPEYHL).getPointValueInDouble() * 10000);
                // 节约水
                int jys = (int)(realApiUtil.getRealData(ConstantTR.JYS).getPointValueInDouble() * 10000);

                Double gfsjgl = realApiUtil.getRealData(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(GF, Constant.TPOINT_WP_SJGL)).getPointValueInDouble();

                bzgl = bzgl + gfsjgl;
                yfgl = yfgl + gfsjgl;

                jczbmap.put("jpeyht", StringUtils.round(jpeyht, 2));
                jczbmap.put("jybm", StringUtils.round(jybm, 2));
                jczbmap.put("jpeyhl", StringUtils.round(jpeyhl, 2));
                jczbmap.put("jys", StringUtils.round(jys, 2));

            }

            // 安全天数
            Double aqts = realApiUtil.getRealData(ConstantTR.AQTS).getPointValueInDouble();
            jczbmap.put("aqts", StringUtils.round(aqts, 2));
            if (bzgl == 0.0) {
                bzgl = 1.0;
            }
            Double glbz = new BigDecimal(sjgl).divide(new BigDecimal(bzgl), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
            if (bzgl == 1) {
                bzgl = 0.0;
            }
            if (glbz > 100) {
                glbz = 100.0;
            }
            jczbmap.put("glbz", StringUtils.round(glbz, 2));

            Calendar c = Calendar.getInstance();

            int tempyear = c.get(Calendar.YEAR);
            int tempmonth = c.get(Calendar.MONTH) + 1;

            c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
            int daynum = c.get(Calendar.DAY_OF_MONTH);
            List<WpMttrAndMtbMonth> mmls = wpMttrAndMtbMonthService.getMttrAndMtbf(id, tempyear, tempmonth);

            if (!mmls.isEmpty()) {
                WpMttrAndMtbMonth mm = mmls.get(0);
                double stoptimes = mm.getStoprtimes();
                double stophours = mm.getStophours();
                double mttr = 0.0;
                double mtbf = mm.getWthours();
                if (stoptimes != 0) {
                    mttr = new BigDecimal(stophours).divide(new BigDecimal(stoptimes), 2, RoundingMode.HALF_EVEN).doubleValue();
                    mtbf = new BigDecimal(mm.getWthours()).divide(new BigDecimal(stoptimes), 2, RoundingMode.HALF_EVEN).doubleValue();

                }

                jczbmap.put("mttf", MathUtil.twoBit(mtbf-mttr));
                jczbmap.put("mttr", mttr);
                jczbmap.put("mtbf", mtbf);
            }else
            {
                jczbmap.put("mttf", 0);
                jczbmap.put("mttr", 0);
                jczbmap.put("mtbf", 0);
            }

            //预测发电上限
            if (null != zjrl) {
                double rfdlsx = zjrl*12;
                double yfdlsx = zjrl *12* daynum;
                jczbmap.put("rfdlsx", MathUtil.twoBit(rfdlsx));
                jczbmap.put("yfdlsx", MathUtil.twoBit(yfdlsx));
            }

            //预测发电量
            double rycfdl = rfdl * YCFDLXS;


//            Map<String,Object> weathermap= weatherDay5Service.getWeatherRealDay5Info(id);

            if(!weathermap.isEmpty() && weathermap.containsKey("ls"))
            {
                java.util.List<Map<String,Object>> weatherls=(java.util.List<Map<String,Object>>)weathermap.get("ls");
                if(!weatherls.isEmpty() && weatherls.size()>8 )
                {
                    Map<Double, Integer> speedmap = new HashMap<Double, Integer>();
                    for (int i=0;i<8;i++) {

                        Map<String,Object> wh=weatherls.get(i);

                        double fs=(double)wh.get("fs");

                        if (speedmap.containsKey(fs)) {
                            int temp = speedmap.get(fs) + 180;
                            speedmap.put(fs, temp);
                        } else {
                            speedmap.put(fs, 180);
                        }

                    }
                    rycfdl = powerToPowerService.getPowerByWp(speedmap, id, 1);
                }
            }

            if(rycfdl==0.0)
            {
                rycfdl = rfdl * YCFDLXS;
            }
            //预测电量临时算法=(月发电量+日预测发电量*(日历天数-当前日数))*预测发电量系数
            c = Calendar.getInstance();
            double yycfdl = (yfdl + rycfdl*(daynum-c.get(Calendar.DAY_OF_MONTH)))*YCFDLXS;
            jczbmap.put("rycfdl", MathUtil.twoBit(rycfdl));
            jczbmap.put("yycfdl", MathUtil.twoBit(yycfdl));

            map.put("jczbmap", jczbmap);


/*************************************************基础指标*************************************************************/


/*************************************************明细状态*************************************************************/

            Map<String, Double> mxztmap = new HashMap<>();

            if (id.equals(QS) || id.equals(FD) || id.equals(GF)) {

                //初始化场站信息

                List<Windpowerstation> wplist = new ArrayList<>();

                for (Windpowerstation wp : InitialRunner.wpallls) {
                    if (id.equals(FD)) {
                        if (wp.getId().endsWith("FDC")) {
                            wplist.add(wp);
                        }
                    } else if (id.equals(GF)) {
                        if (wp.getId().endsWith("GDC")) {
                            wplist.add(wp);
                        }
                    } else if (id.equals(QS)) {
                        wplist.add(wp);
                    }

                }


                //待机台数
                Double djnum = 0.0;
                //手动停机台数
                Double sdtjnum = 0.0;
                //正常发电台数
                Double zcfdnum = 0.0;
                //缺陷降出力台数
                Double qxjclnum = 0.0;
                // 限电降出力台数
                Double xdjclnum = 0.0;
                // 限电停机台数
                Double xdtjnum = 0.0;
                // 故障停机台数
                Double gztjnum = 0.0;
                // 场内受累停机台数
                Double cnsltjnum = 0.0;
                // 检修停机台数
                Double jxtjnum = 0.0;
                // 场内受累检修台数
                Double cnsljxnum = 0.0;
                // 电网受累台数
                Double dwslnum = 0.0;
                // 环境受累台数
                Double hjslnum = 0.0;
                // 风机离线台数
                Double lxnum = 0.0;
                for (Windpowerstation wp : wplist) {

                    List<Windturbine> wtls = InitialRunner.wp_wtmap.get(wp.getId());

                    List<MatrixVo> vos = new ArrayList<>();
                    List<String> fjzbls = new ArrayList<>();
                    List<String> gfzbls = new ArrayList<>();
                    //光伏没有明细计算点，所以区分开
                    if (wp.getId().endsWith("FDC")) {
                        for (Windturbine wt : wtls) {
                            //明细状态
                            fjzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.ZTMX).getId());
                        }
                    } else if (wp.getId().endsWith("GDC")) {
                        for (Windturbine wt : wtls) {
                            //状态
                            gfzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.FJZT).getId());
                        }
                    }


                    List<PointData> fjzblist = realApiUtil.getRealData(fjzbls);
                    List<PointData> gfzblist = realApiUtil.getRealData(gfzbls);

                    if (!fjzblist.isEmpty() && fjzblist.size() == fjzbls.size()) {


                        for (int i = 0; i < wtls.size(); i++) {
                            Windturbine wt = wtls.get(i);


                            double fjzt = MathUtil.twoBit(MathUtil.twoBit(fjzblist.get(i).getPointValueInDouble()));

                            switch (Double.valueOf(fjzt).intValue()) {
                                case 0:
                                    djnum++;
                                    break;
                                case 1:
                                    sdtjnum++;
                                    break;
                                case 2:
                                    zcfdnum++;
                                    break;
                                case 3:
                                    qxjclnum++;
                                    break;
                                case 4:
                                    xdjclnum++;
                                    break;
                                case 5:
                                    xdtjnum++;
                                    break;
                                case 6:
                                    gztjnum++;
                                    break;
                                case 7:
                                    cnsltjnum++;
                                    break;
                                case 8:
                                    jxtjnum++;
                                    break;
                                case 9:
                                    cnsljxnum++;
                                    break;
                                case 10:
                                    dwslnum++;
                                    break;
                                case 11:
                                    hjslnum++;
                                    break;
                                case 12:
                                    lxnum++;
                                    break;

                                default:

                                    break;
                            }
                        }
                    }

                    if (!gfzblist.isEmpty() && gfzblist.size() == gfzblist.size()) {
                        for (int i = 0; i < wtls.size(); i++) {
                            double gfzt = MathUtil.twoBit(MathUtil.twoBit(gfzblist.get(i).getPointValueInDouble()));
                            switch (Double.valueOf(gfzt).intValue()) {
                                case 0:
                                    djnum++;
                                    break;
                                case 1:
                                    zcfdnum++;
                                    break;
                                case 2:
                                    gztjnum++;
                                    break;
                                case 3:
                                    lxnum++;
                                    break;
                                case 4:
                                    jxtjnum++;
                                    break;
                                case 5:
                                    xdjclnum++;
                                    break;
                                case 6:
                                    xdjclnum++;
                                    break;

                                default:

                                    break;
                            }
                        }

                    }

                }

                mxztmap.put("jrts", djnum + sdtjnum + zcfdnum + qxjclnum + xdjclnum + xdtjnum + gztjnum + cnsltjnum + jxtjnum + cnsljxnum + dwslnum + hjslnum + lxnum);


                mxztmap.put("djts", djnum);
                mxztmap.put("sdtjts", sdtjnum);
                mxztmap.put("yxts", zcfdnum);
                mxztmap.put("fdjclts", qxjclnum);
                mxztmap.put("xdjclts", xdjclnum);
                mxztmap.put("xdtjts", xdtjnum);
                mxztmap.put("gzts", gztjnum);
                mxztmap.put("cnslgzts", cnsltjnum);
                mxztmap.put("jxts", jxtjnum);
                mxztmap.put("cnsljxts", cnsljxnum);
                mxztmap.put("dwslts", dwslnum);
                mxztmap.put("hjslts", hjslnum);
                mxztmap.put("lxts", lxnum);

            } else {

                //待机台数
                Double djnum = 0.0;
                //手动停机台数
                Double sdtjnum = 0.0;
                //正常发电台数
                Double zcfdnum = 0.0;
                //缺陷降出力台数
                Double qxjclnum = 0.0;
                // 限电降出力台数
                Double xdjclnum = 0.0;
                // 限电停机台数
                Double xdtjnum = 0.0;
                // 故障停机台数
                Double gztjnum = 0.0;
                // 场内受累停机台数
                Double cnsltjnum = 0.0;
                // 检修停机台数
                Double jxtjnum = 0.0;
                // 场内受累检修台数
                Double cnsljxnum = 0.0;
                // 电网受累台数
                Double dwslnum = 0.0;
                // 环境受累台数
                Double hjslnum = 0.0;
                // 风机离线台数
                Double lxnum = 0.0;


                if (id.endsWith("FDC")) {
                    List<String> mxztls = new ArrayList<>();
                    //待机台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.DJNUM).getCode());
                    //手动停机台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TJNUM).getCode());
                    //正常发电台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.FDNUM).getCode());
                    // 缺陷降出力台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.FDJCLNUM).getCode());
                    // 限电降出力台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.XDJCLNUM).getCode());
                    // 限电停机台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.XDTJNUM).getCode());
                    // 故障停机台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.GZNUM).getCode());
                    // 场内受累停机台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.CNGZNUM).getCode());
                    // 检修停机台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.JXNUM).getCode());
                    // 场内受累检修台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.CNJXNUM).getCode());
                    // 电网受累台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.DWSLNUM).getCode());
                    // 环境受累台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.HJSLNUM).getCode());
                    // 风机离线台数
                    mxztls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.LXNUM).getCode());


                    List<PointData> mxztlist = realApiUtil.getRealData(mxztls);

                    if (!mxztlist.isEmpty() && mxztlist.size() == mxztls.size()) {


                        //待机台数
                        djnum = MathUtil.twoBit(mxztlist.get(0).getPointValueInDouble());
                        mxztmap.put("djts", djnum);
                        //手动停机台数
                        sdtjnum = MathUtil.twoBit(mxztlist.get(1).getPointValueInDouble());
                        mxztmap.put("sdtjts", sdtjnum);
                        //正常发电台数
                        zcfdnum = MathUtil.twoBit(mxztlist.get(2).getPointValueInDouble());
                        mxztmap.put("yxts", zcfdnum);
                        //缺陷降出力台数
                        qxjclnum = MathUtil.twoBit(mxztlist.get(3).getPointValueInDouble());
                        mxztmap.put("fdjclts", qxjclnum);
                        // 限电降出力台数
                        xdjclnum = MathUtil.twoBit(mxztlist.get(4).getPointValueInDouble());
                        mxztmap.put("xdjclts", xdjclnum);
                        // 限电停机台数
                        xdtjnum = MathUtil.twoBit(mxztlist.get(5).getPointValueInDouble());
                        mxztmap.put("xdtjts", xdtjnum);
                        // 故障停机台数
                        gztjnum = MathUtil.twoBit(mxztlist.get(6).getPointValueInDouble());
                        mxztmap.put("gzts", gztjnum);
                        // 场内受累停机台数
                        cnsltjnum = MathUtil.twoBit(mxztlist.get(7).getPointValueInDouble());
                        mxztmap.put("cnslgzts", cnsltjnum);
                        // 检修停机台数
                        jxtjnum = MathUtil.twoBit(mxztlist.get(8).getPointValueInDouble());
                        mxztmap.put("jxts", jxtjnum);
                        // 场内受累检修台数
                        cnsljxnum = MathUtil.twoBit(mxztlist.get(9).getPointValueInDouble());
                        mxztmap.put("cnsljxts", cnsljxnum);
                        // 电网受累台数
                        dwslnum = MathUtil.twoBit(mxztlist.get(10).getPointValueInDouble());
                        mxztmap.put("dwslts", dwslnum);
                        // 环境受累台数
                        hjslnum = MathUtil.twoBit(mxztlist.get(11).getPointValueInDouble());
                        mxztmap.put("hjslts", hjslnum);
                        // 风机离线台数
                        lxnum = MathUtil.twoBit(mxztlist.get(12).getPointValueInDouble());
                        mxztmap.put("lxts", lxnum);


                        mxztmap.put("jrts", djnum + sdtjnum + zcfdnum + qxjclnum + xdjclnum + xdtjnum + gztjnum + cnsltjnum + jxtjnum + cnsljxnum + dwslnum + hjslnum + lxnum);

                    } else {

                        mxztmap.put("djts", 0.0);
                        mxztmap.put("sdtjts", 0.0);
                        mxztmap.put("yxts", 0.0);
                        mxztmap.put("fdjclts", 0.0);
                        mxztmap.put("xdjclts", 0.0);
                        mxztmap.put("xdtjts", 0.0);
                        mxztmap.put("gzts", 0.0);
                        mxztmap.put("cnslgzts", 0.0);
                        mxztmap.put("jxts", 0.0);
                        mxztmap.put("cnsljxts", 0.0);
                        mxztmap.put("dwslts", 0.0);
                        mxztmap.put("hjslts", 0.0);
                        mxztmap.put("lxts", 0.0);
                        mxztmap.put("jrts", 0.0);
                    }

                }else if (id.endsWith("GDC")){
                    List<String> gfzbls = new ArrayList<>();

                    List<Windturbine> wtls = InitialRunner.wp_wtmap.get(id);
                    for(Windturbine wt:wtls) {
                        //状态
                        gfzbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), Constant.FJZT).getId());
                    }
                    List<PointData> gfzblist = realApiUtil.getRealData(gfzbls);
                    if (!gfzblist.isEmpty() && gfzblist.size() == gfzblist.size()) {
                        for (int i = 0; i < wtls.size(); i++) {
                            double gfzt = MathUtil.twoBit(MathUtil.twoBit(gfzblist.get(i).getPointValueInDouble()));
                            switch (Double.valueOf(gfzt).intValue()) {
                                case 0:
                                    djnum++;
                                    break;
                                case 1:
                                    zcfdnum++;
                                    break;
                                case 2:
                                    gztjnum++;
                                    break;
                                case 3:
                                    lxnum++;
                                    break;
                                case 4:
                                    jxtjnum++;
                                    break;
                                case 5:
                                    xdjclnum++;
                                    break;
                                case 6:
                                    xdjclnum++;
                                    break;
                                default:
                                    break;
                            }

                        }
                    }

                    //待机台数
                    mxztmap.put("djts", djnum);
                    //正常发电台数
                    mxztmap.put("yxts", zcfdnum);
                    // 限电降出力台数
                    mxztmap.put("xdjclts", xdjclnum);
                    // 故障停机台数
                    mxztmap.put("gzts", gztjnum);
                    // 检修停机台数
                    mxztmap.put("jxts", jxtjnum);
                    // 电网受累台数
                    mxztmap.put("dwslts", dwslnum);
                    // 风机离线台数
                    mxztmap.put("lxts", lxnum);
                    mxztmap.put("sdtjts", 0.0);
                    mxztmap.put("fdjclts", 0.0);
                    mxztmap.put("xdtjts", 0.0);
                    mxztmap.put("cnslgzts", 0.0);
                    mxztmap.put("cnsljxts", 0.0);
                    mxztmap.put("hjslts", 0.0);

                    mxztmap.put("jrts", djnum + sdtjnum + zcfdnum + qxjclnum + xdjclnum + xdtjnum + gztjnum + cnsltjnum + jxtjnum + cnsljxnum + dwslnum + hjslnum + lxnum);
                }else {
                    mxztmap.put("djts", 0.0);
                    mxztmap.put("sdtjts", 0.0);
                    mxztmap.put("yxts", 0.0);
                    mxztmap.put("fdjclts", 0.0);
                    mxztmap.put("xdjclts", 0.0);
                    mxztmap.put("xdtjts", 0.0);
                    mxztmap.put("gzts", 0.0);
                    mxztmap.put("cnslgzts", 0.0);
                    mxztmap.put("jxts", 0.0);
                    mxztmap.put("cnsljxts", 0.0);
                    mxztmap.put("dwslts", 0.0);
                    mxztmap.put("hjslts", 0.0);
                    mxztmap.put("lxts", 0.0);
                    mxztmap.put("jrts", 0.0);
                }
            }
            map.put("mxztmap", mxztmap);
//

/*************************************************明细状态*************************************************************/

/*************************************************五项损失**************************************************************/

            Map<String, Double> wxssmap = new HashMap<>();
            List<String> wxssls = new ArrayList<>();

            // 日场内受累检修
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RLZSSDL).getCode());
            // 日场内受累故障
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSZSSDL).getCode());
            // 月场内受累检修
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YLZSSDL).getCode());
            // 月场内受累故障
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSZSSDL).getCode());
            // 年场内受累检修
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NLZSSDL).getCode());
            // 年场内受累故障
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSZSSDL).getCode());

            //日待机损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSDJZSDL).getCode());
            //日手动停机损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSSTZSDL).getCode());
            //日性能损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RXNZSDL).getCode());
            //日缺陷降出力损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSQXZSDL).getCode());
            //日故障损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RGZSSDL).getCode());
            //日检修损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RJXSSDL).getCode());

            //月待机损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSDJZSDL).getCode());
            //月手动停机损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSSTZSDL).getCode());
            //月性能损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YXNZSDL).getCode());
            //月缺陷降出力损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSQXZSDL).getCode());
            //月故障损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YGZSSDL).getCode());
            //月检修损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YJXSSDL).getCode());


            //年待机损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSDJZSDL).getCode());
            //年手动停机损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSSTZSDL).getCode());
            //年性能损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NXNZSDL).getCode());
            //年缺陷降出力损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSQXZSDL).getCode());
            //年故障损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NGZSSDL).getCode());
            //年检修损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NJXSSDL).getCode());


            //日限电损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RXDSSDL).getCode());
            //月限电损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YXDSSDL).getCode());
            //年限电损失
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NXDSSDL).getCode());


            //日场外受累电网
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RWZSSDL).getCode());
            // 日场外受累天气
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RTZSSDL).getCode());
            // 月场外受累电网
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YWZSSDL).getCode());
            // 月场外受累天气
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YTZSSDL).getCode());
            // 年场外受累电网
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NWZSSDL).getCode());
            // 年场外受累天气
            wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NTZSSDL).getCode());

            List<PointData> wxsslist = realApiUtil.getRealData(wxssls);

            if (!wxsslist.isEmpty() && wxsslist.size() == wxssls.size()) {

                Double rjxsl = MathUtil.twoBit(wxsslist.get(0).getPointValueInDouble());
                // 日场内受累故障
                Double rgzzsl = MathUtil.twoBit(wxsslist.get(1).getPointValueInDouble());
                // 月场内受累检修
                Double yjxsl = MathUtil.twoBit(wxsslist.get(2).getPointValueInDouble());
                // 月场内受累故障
                Double ygzzsl = MathUtil.twoBit(wxsslist.get(3).getPointValueInDouble());
                // 年场内受累检修
                Double njxsl = MathUtil.twoBit(wxsslist.get(4).getPointValueInDouble());
                // 年场内受累故障
                Double ngzzsl = MathUtil.twoBit(wxsslist.get(5).getPointValueInDouble());

//                wxssmap.put("rjxsl", rjxsl);
//                wxssmap.put("rgzzsl", rgzzsl);
//                wxssmap.put("yjxsl", yjxsl);
//                wxssmap.put("ygzzsl", ygzzsl);
//                wxssmap.put("njxsl", njxsl);
//                wxssmap.put("ngzzsl", ngzzsl);

                //日待机损失
                Double rdjss = MathUtil.twoBit(wxsslist.get(6).getPointValueInDouble());
                //日手动停机损失
                Double rsdtjss = MathUtil.twoBit(wxsslist.get(7).getPointValueInDouble());
                //日性能损失
                Double rxnss = MathUtil.twoBit(wxsslist.get(8).getPointValueInDouble());
                //日缺陷降出力损失
                Double rqxjclss = MathUtil.twoBit(wxsslist.get(9).getPointValueInDouble());

                //日欠发损失=日待机损失+日手动停机损失+日性能损失+日缺陷降出力损失
                Double rqfssdl = new BigDecimal(rdjss + rsdtjss + rxnss + rqxjclss).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                Double rgzss = MathUtil.twoBit(wxsslist.get(10).getPointValueInDouble());
                //日故障损失电量=日故障损失+日故障受累
                Double rgzssdl = new BigDecimal(rgzss + rgzzsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                //日检修损失电量=日检修损失+日检修受累
                Double rjxss = MathUtil.twoBit(wxsslist.get(11).getPointValueInDouble());
                Double rjxssdl = new BigDecimal(rjxss + rjxsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();


                wxssmap.put("rqfssdl", rqfssdl);
                wxssmap.put("rgzssdl", rgzssdl);
                wxssmap.put("rjxssdl", rjxssdl);

                // 月场内受累检修
                Double ydjss = MathUtil.twoBit(wxsslist.get(12).getPointValueInDouble());
                // 月场内受累检修
                Double ysdtjss = MathUtil.twoBit(wxsslist.get(13).getPointValueInDouble());
                // 月场内受累检修
                Double yxnss = MathUtil.twoBit(wxsslist.get(14).getPointValueInDouble());
                // 月场内受累检修
                Double yqxjclss = MathUtil.twoBit(wxsslist.get(15).getPointValueInDouble());
                //月欠发损失=月待机损失+月手动停机损失+月性能损失+月缺陷降出力损失
                Double yqfssdl = new BigDecimal(ydjss + ysdtjss + yxnss + yqxjclss).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                Double ygzss = MathUtil.twoBit(wxsslist.get(16).getPointValueInDouble());
                //月故障损失电量=月故障损失+月故障受累
                Double ygzssdl = new BigDecimal(ygzss + ygzzsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                Double yjxss = MathUtil.twoBit(wxsslist.get(17).getPointValueInDouble());
                //月检修损失电量=月检修损失+月检修受累
                Double yjxssdl = new BigDecimal(yjxss + yjxsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                wxssmap.put("yqfssdl", yqfssdl);
                wxssmap.put("ygzssdl", ygzssdl);
                wxssmap.put("yjxssdl", yjxssdl);

                // 年场内受累检修
                Double ndjss = MathUtil.twoBit(wxsslist.get(18).getPointValueInDouble());
                // 年场内受累检修
                Double nsdtjss = MathUtil.twoBit(wxsslist.get(19).getPointValueInDouble());
                // 年场内受累检修
                Double nxnss = MathUtil.twoBit(wxsslist.get(20).getPointValueInDouble());
                // 年场内受累检修
                Double nqxjclss = MathUtil.twoBit(wxsslist.get(21).getPointValueInDouble());

                Double nqfssdl = new BigDecimal(ndjss + nsdtjss + nxnss + nqxjclss).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                Double ngzss = MathUtil.twoBit(wxsslist.get(22).getPointValueInDouble());
                //年故障损失电量=年故障损失+年故障受累
                Double ngzssdl = new BigDecimal(ngzss + ngzzsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                Double njxss = MathUtil.twoBit(wxsslist.get(23).getPointValueInDouble());
                //年检修损失电量=年检修损失+年检修受累
                Double njxssdl = new BigDecimal(njxss + njxsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                wxssmap.put("nqfssdl", nqfssdl);
                wxssmap.put("ngzssdl", ngzssdl);
                wxssmap.put("njxssdl", njxssdl);

                double temp = 0.0;
                temp = MathUtil.twoBit(wxsslist.get(24).getPointValueInDouble());
                Double rxdssdl = new BigDecimal(temp).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                temp = MathUtil.twoBit(wxsslist.get(25).getPointValueInDouble());
                Double yxdssdl = new BigDecimal(temp).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                temp = MathUtil.twoBit(wxsslist.get(26).getPointValueInDouble());
                Double nxdssdl = new BigDecimal(temp).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                wxssmap.put("rxdssdl", StringUtils.round(rxdssdl < 0.0 ? 0.0 : rxdssdl, 2));
                wxssmap.put("yxdssdl", StringUtils.round(yxdssdl < 0.0 ? 0.0 : yxdssdl, 2));
                wxssmap.put("nxdssdl", StringUtils.round(nxdssdl < 0.0 ? 0.0 : nxdssdl, 2));

                Double rdwsl = MathUtil.twoBit(wxsslist.get(27).getPointValueInDouble());
                Double rtqsl = MathUtil.twoBit(wxsslist.get(28).getPointValueInDouble());
                Double rslssdl = new BigDecimal(rdwsl + rtqsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                Double ydwsl = MathUtil.twoBit(wxsslist.get(29).getPointValueInDouble());
                Double ytqsl = MathUtil.twoBit(wxsslist.get(30).getPointValueInDouble());
                Double yslssdl = new BigDecimal(ydwsl + ytqsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
                Double ndwsl = MathUtil.twoBit(wxsslist.get(31).getPointValueInDouble());
                Double ntqsl = MathUtil.twoBit(wxsslist.get(32).getPointValueInDouble());
                Double nslssdl = new BigDecimal(ndwsl + ntqsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                wxssmap.put("rslssdl", rslssdl);
                wxssmap.put("yslssdl", yslssdl);
                wxssmap.put("nslssdl", nslssdl);


                double rllfdl=rfdl+rgzssdl+rjxssdl+rqfssdl+rxdssdl+rslssdl;
                if(rllfdl!=0)
                {
                    double rfnlyl=new BigDecimal(rfdl).divide(new BigDecimal(rllfdl), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                    wxssmap.put("rfnlyl", rfnlyl);
                }else
                {
                    wxssmap.put("rfnlyl", 0.0);
                }

                double yllfdl=yfdl+ygzssdl+yjxssdl+yqfssdl+yxdssdl+yslssdl;
                if(yllfdl!=0)
                {
                    double yfnlyl=new BigDecimal(yfdl).divide(new BigDecimal(yllfdl), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                    wxssmap.put("yfnlyl", yfnlyl);
                }else
                {
                    wxssmap.put("yfnlyl", 0.0);
                }

                double nllfdl=nfdl+ngzssdl+njxssdl+nqfssdl+nxdssdl+nslssdl;
                if(nllfdl!=0)
                {
                    double nfnlyl=new BigDecimal(nfdl).divide(new BigDecimal(nllfdl), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                    wxssmap.put("nfnlyl", nfnlyl);
                }else
                {
                    wxssmap.put("nfnlyl", 0.0);
                }

                //环比风能利用率
                Map<String, Double> hbmap=getHbWs(id);
                if(hbmap.containsKey("rfnlyl"))
                {
                    double rhb=hbmap.get("rfnlyl");
                    wxssmap.put("rfnlyl_hb", MathUtil.twoBit(wxssmap.get("rfnlyl")-rhb));
                }
                if(hbmap.containsKey("yfnlyl"))
                {
                    double yhb=hbmap.get("yfnlyl");
                    wxssmap.put("yfnlyl_hb", MathUtil.twoBit(wxssmap.get("yfnlyl")-yhb));
                }
                if(hbmap.containsKey("nfnlyl"))
                {
                    double nhb=hbmap.get("nfnlyl");
                    wxssmap.put("nfnlyl_hb", MathUtil.twoBit(wxssmap.get("nfnlyl")-nhb));
                }
            } else {

                wxssmap.put("rjxsl", 0.0);
                wxssmap.put("rgzzsl", 0.0);
                wxssmap.put("yjxsl", 0.0);
                wxssmap.put("ygzzsl", 0.0);
                wxssmap.put("njxsl", 0.0);
                wxssmap.put("ngzzsl", 0.0);
                wxssmap.put("rqfssdl", 0.0);
                wxssmap.put("rgzssdl", 0.0);
                wxssmap.put("rjxssdl", 0.0);

                wxssmap.put("yqfssdl", 0.0);
                wxssmap.put("ygzssdl", 0.0);
                wxssmap.put("yjxssdl", 0.0);

                wxssmap.put("nqfssdl", 0.0);
                wxssmap.put("ngzssdl", 0.0);
                wxssmap.put("njxssdl", 0.0);


                wxssmap.put("rxdssdl", 0.0);
                wxssmap.put("yxdssdl", 0.0);
                wxssmap.put("nxdssdl", 0.0);


                wxssmap.put("rslssdl", 0.0);
                wxssmap.put("yslssdl", 0.0);
                wxssmap.put("nslssdl", 0.0);

            }



            map.put("wxssmap", wxssmap);

/****************************************************五项损失************************************************************/
/****************************************************日功率曲线**********************************************************/

//            List<DataVo> glvos = realPowerPushService.findRealPower(id);
//            map.put("glvos", glvos);
/*************************************************日功率曲线*************************************************************/

/****************************************************日电量历史**********************************************************/

//            List<DataVo> rdlvos = findPowerWpBar(id);
//            map.put("rdlvos", rdlvos);
/*************************************************日电量历史*************************************************************/

/*************************************************悬停指标*************************************************************/


/************************************************悬停指标*************************************************************/

/*************************************************关系库指标*************************************************************/

            Map<String, Double> gxkmap = new HashMap<>();

            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.DAY_OF_MONTH,1);
            Date begin=cal.getTime();
            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
            Date end= cal.getTime();
            int tjsl=totalTarget(id,begin,end);
            gxkmap.put("tjsl", Double.valueOf(tjsl));
            int gdsl=wobugeqService.totalNum(DateUtils.truncate(begin),DateUtils.truncate(end));

            if(gdsl!=0)
            {
                Double tjl = new BigDecimal(tjsl).divide(new BigDecimal(gdsl), 2, RoundingMode.HALF_EVEN).doubleValue();
                gxkmap.put("tjl", tjl);
            }else
            {
                gxkmap.put("tjl", 0.0);
            }

            int sjtjsl=recommenmainService.getRecommenmainnum(id,DateUtils.truncate(begin),DateUtils.truncate(end));
            gxkmap.put("sjtjsl", Double.valueOf(sjtjsl));
            cal = Calendar.getInstance();
            List<Windpowerinfoday> wpdls = windpowerinfodayService.getWindpowerinfodayList(id, DateUtils.truncate(cal.getTime()));
            if (!wpdls.isEmpty()) {
                Windpowerinfoday wd = wpdls.get(0);
                gxkmap.put("ndxkyss", wd.getYeardxkyxs());
                gxkmap.put("nsbklyl", wd.getYearsbklyl());
                gxkmap.put("nzhcydl", wd.getYearzhcydl());

                gxkmap.put("ysbklyl", wd.getMonthsbklyl());
                gxkmap.put("ydxkyss", wd.getMonthdxkyxs());
                gxkmap.put("yzhcydl", wd.getMonthzhcydl());


                switch (id) {
                    case "0":
                        gxkmap.put("yzhcydl", 1.56);
                        break;
                    case "-1":
                        gxkmap.put("yzhcydl", 1.32);
                        break;
                    case "-2":
                        gxkmap.put("yzhcydl", 1.78);
                        break;
                    case "MHS_FDC":
                        gxkmap.put("yzhcydl", 1.06);
                        break;
                    case "NSS_FDC":
                        gxkmap.put("yzhcydl", 1.52);
                        break;
                    case "QS_FDC":
                        gxkmap.put("yzhcydl", 1.37);
                        break;
                    case "SBQ_FDC":
                        gxkmap.put("yzhcydl", 1.68);
                        break;
                    case "XS_FDC":
                        gxkmap.put("yzhcydl", 0.82);
                        break;
                    case "DWK_GDC":
                        gxkmap.put("yzhcydl", 0.0);
                        break;
                    case "PL_GDC":
                        gxkmap.put("yzhcydl", 2.1);
                        break;
                    case "XH_GDC":
                        gxkmap.put("yzhcydl", 1.83);
                        break;
                    case "MCH_GDC":
                        gxkmap.put("yzhcydl", 1.58);
                        break;
                    default:
                        break;
                }

                gxkmap.put("rsbklyl", wd.getDaysbklyl());
                gxkmap.put("rzhcydl", wd.getDayzhcydl());
                gxkmap.put("rdxkyss", wd.getDaydxkyxs());

                gxkmap.put("ndjxs", wd.getYearstoptime());
                gxkmap.put("nyxxs", wd.getYearruntime());
                gxkmap.put("ngzxs", wd.getYearfaulttime());


                cal = Calendar.getInstance();
                cal.add(Calendar.MONTH,-1);
                cal.set(Calendar.DAY_OF_MONTH,1);
                begin=cal.getTime();
                cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
                end= cal.getTime();
                int tjsl_hb=totalTarget(id,begin,end);
                gxkmap.put("tjsl_hb", Double.valueOf(tjsl_hb));
                int gdsl_hb=wobugeqService.totalNum(DateUtils.truncate(begin),DateUtils.truncate(end));

                if(gdsl_hb!=0)
                {
                    Double tjl_hb = new BigDecimal(tjsl_hb).divide(new BigDecimal(gdsl_hb), 2, RoundingMode.HALF_EVEN).doubleValue();
                    gxkmap.put("tjl_hb", tjl_hb);
                }else
                {
                    gxkmap.put("tjl_hb", 0.0);
                }

                int sjtjsl_hb=recommenmainService.getRecommenmainnum(id,DateUtils.truncate(begin),DateUtils.truncate(end));
                gxkmap.put("sjtjsl_hb", Double.valueOf(sjtjsl-sjtjsl_hb));
                List<Windpowerinfoday> hbwpdls = windpowerinfodayService.getWindpowerinfodayList(id, DateUtils.truncate(cal.getTime()));
                if (!hbwpdls.isEmpty()) {

                    Windpowerinfoday hbwd = wpdls.get(0);
                    gxkmap.put("ndxkyss_hb", MathUtil.twoBit(wd.getYeardxkyxs()-hbwd.getYeardxkyxs()));
                    gxkmap.put("nsbklyl_hb", MathUtil.twoBit(wd.getYearsbklyl()-hbwd.getYearsbklyl()));
                    gxkmap.put("nzhcydl_hb", MathUtil.twoBit(wd.getYearzhcydl()-hbwd.getYearzhcydl()));

                    gxkmap.put("ysbklyl_hb", MathUtil.twoBit(wd.getMonthsbklyl()-hbwd.getMonthsbklyl()));
                    gxkmap.put("yzhcydl_hb", MathUtil.twoBit(wd.getMonthzhcydl()-hbwd.getMonthzhcydl()));
                    gxkmap.put("ydxkyss_hb", MathUtil.twoBit(wd.getMonthdxkyxs()-hbwd.getMonthdxkyxs()));


                    gxkmap.put("rsbklyl_hb", MathUtil.twoBit(wd.getDaysbklyl()-hbwd.getDaysbklyl()));
                    gxkmap.put("rzhcydl_hb", MathUtil.twoBit(wd.getDayzhcydl()-hbwd.getDayzhcydl()));
                    gxkmap.put("rdxkyss_hb", MathUtil.twoBit(wd.getDaydxkyxs()-hbwd.getDaydxkyxs()));
                }

            } else {
                gxkmap.put("ndxkyss", 0.0);
                gxkmap.put("nsbklyl", 0.0);

                gxkmap.put("ysbklyl", 0.0);
                gxkmap.put("yzhcydl", 0.0);


                gxkmap.put("ndjxs", 0.0);
                gxkmap.put("nyxxs", 0.0);
                gxkmap.put("ngzxs", 0.0);
            }
            cal = Calendar.getInstance();
            cal.setTime(new Date());
            int year = cal.get(Calendar.YEAR);
            List<ProjectPlan> pjls = projectPlanService.getProjectPlanList(String.valueOf(year));

            // 获取计划发电量信息
            setPlanInfo(gxkmap, pjls, id);

            Double ywcl = 0.0;
            Double nwcl = 0.0;

            Double yfdljh = 0.0;
            Double nfdljh = 0.0;

            //Double yfdltemp = jczbmap.get("yfdl");
            nfdl = (Double) jczbmap.get("nfdl");

            yfdljh = gxkmap.get("yfdljh");
            nfdljh = gxkmap.get("nfdljh");

            if(yfdljh!=0)
            {
                //与月计划发电量结合判断月预测发电量
                if(yycfdl<yfdljh)
                {
                    jczbmap.put("yycfdl", MathUtil.twoBit(yfdljh*1.05));
                }else if(yycfdl>(yfdljh*1.2))
                {
                    jczbmap.put("yycfdl", MathUtil.twoBit(yfdljh*1.2));
                }
            }


            if (yfdljh == 0.0) {
                nfdljh = 1.0;
            }
            if (yfdljh != 0.0) {
                ywcl = new BigDecimal(yfdl).divide(new BigDecimal(yfdljh), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
            }
            if (nfdljh == 0.0) {
                nfdljh = 1.0;
            }
            if (nfdljh != 0.0) {
                nwcl = new BigDecimal(nfdl).divide(new BigDecimal(nfdljh), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
            }

            if (yfdljh > 100) {
                yfdljh = 100.0;
            }
            if (nfdljh > 100) {
                nfdljh = 100.0;
            }

            gxkmap.put("ywcl", StringUtils.round(ywcl, 2));
            gxkmap.put("nwcl", StringUtils.round(nwcl, 2));

            map.put("gxkmap", gxkmap);
        }
/*************************************************关系库指标**************************************************************/

        return map;
    }



    public Map<String, Object> findPowerInfo(String id) throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        if (StringUtils.notEmp(id)) {


            /****************************************************日功率曲线**********************************************************/

            List<DataVo> glvos = realPowerPushService.findRealPower(id);
            map.put("glvos", glvos);
            /*************************************************日功率曲线*************************************************************/

            /****************************************************日电量历史**********************************************************/

            List<DataVo> rdlvos = findPowerWpBar(id);
            map.put("rdlvos", rdlvos);
            /*************************************************日电量历史*************************************************************/

        }

        return map;
    }





    public int totalTarget(String id,Date beginDate,Date endDate) throws Exception {
        int num=0;
        String wpId=null;
        String wtId=null;
        if (StringUtils.notEmp(id)) {


            StringBuilder sb=new StringBuilder();
            if (id.equals(GF)) {
                return 0;
            } else if (InitialRunner.wpmap.containsKey(id)) {
                wpId=id;
            } else if (InitialRunner.pjmap.containsKey(id)) {
                for (Windturbine wt : InitialRunner.pj_wtmap.get(id)) {
                    sb.append("'").append(wt.getId()).append("',");
                }
            } else if (InitialRunner.lnmap.containsKey(id)) {
                for (Windturbine wt : InitialRunner.ln_wtmap.get(id)) {
                    sb.append("'").append(wt.getId()).append("',");
                }
            }

            if(sb.length()>0)
            {
                wtId=String.valueOf(sb.substring(0,sb.length()-1));
            }
            num=recommenmainMsSqlService.totalList(wpId,wtId,beginDate,endDate);
        }
        return num;
    }

    private List<DataVo> findPowerWpBar(String wpId) throws Exception {
        List<DataVo> vos = new ArrayList<DataVo>();
        if (StringUtils.empty(wpId)) {
            wpId = "0";
        }

        Calendar c = Calendar.getInstance();
        c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH));
        c.add(Calendar.DAY_OF_MONTH, 1);
        // c.add(Calendar.MONTH, -1);
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        Date beginDate = c.getTime();

        c = Calendar.getInstance();
        // c.add(Calendar.MONTH, -1);
        c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
        c.add(Calendar.DAY_OF_MONTH, 2);
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        Date endDate = c.getTime();
        c = Calendar.getInstance();
        long num = c.get(Calendar.DAY_OF_MONTH);
        // long num = 30;

        WindPowerStationTestingPoint rfdlai = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_RFDL);
        WindPowerStationTestingPoint swdlai = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SWDL);
        WindPowerStationTestingPoint gwdlai = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_GWDL);
        WindPowerStationTestingPoint ssfs = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SSFS);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        List<PointData> rfdls = realApiUtil.getHistoryDatasSnap(rfdlai, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 86400L);
        List<PointData> swdls = realApiUtil.getHistoryDatasSnap(swdlai, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 86400L);
        List<PointData> gwdls = realApiUtil.getHistoryDatasSnap(gwdlai, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 86400L);
        List<PointData> ssfss =null;
        if(wpId.equals("PL_GDC"))
        {
            ssfss = realApiUtil.getHistoryDatasSnap("PLGGL.NX_GD_PLG_YC_P1_L1_001_QXZ0001", beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 86400L);
        }else
        {
            ssfss = realApiUtil.getHistoryDatasSnap(ssfs, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 86400L);
        }
        if (!rfdls.isEmpty() && !swdls.isEmpty() && !gwdls.isEmpty()
                && rfdls.size() == swdls.size() && rfdls.size() == gwdls.size()
        ) {
            Calendar cal = Calendar.getInstance();
            int today = c.get(Calendar.DAY_OF_MONTH);
            // int today = 30;
            for (int i = 0; i < rfdls.size(); i++) {
                DataVo vo = new DataVo();

                Date date = new Date(rfdls.get(i).getPointTime() * 1000);
                cal.setTime(date);

                // vo.setTime(dateformat.parse(entry.getKey()).getTime());

                if (i + 1 <= today) {
                    vo.setTimestr(i + 1 + "");
                    vo.setValue1(StringUtils.round(rfdls.get(i).getPointValueInDouble(), 2));// 日发电量
                    vo.setValue2(StringUtils.round(swdls.get(i).getPointValueInDouble(), 2));// 上网电量
                    vo.setValue3(StringUtils.round(gwdls.get(i).getPointValueInDouble(), 2));// 购网电量
                    vo.setSpeed(StringUtils.round(ssfss.get(i).getPointValueInDouble(), 2));
                } else {
                    vo.setTimestr(i + 1 + "");
                    vo.setValue1(0.0);// 日发电量
                    vo.setValue2(0.0);// 上网电量
                    vo.setValue3(0.0);// 购网电量
                    vo.setSpeed(0.0);
                }

                vos.add(vo);
            }
        }

        if (vos.size() < 31) {
            for (int i = 0; i < 30; i++) {
                DataVo vo = new DataVo();
                vo.setTimestr("");

                vo.setValue1(0.0);// 日发电量
                vo.setValue2(0.0);// 上网电量
                vo.setValue3(0.0);// 购网电量
                vo.setSpeed(0.0);
                vos.add(vo);
                if (vos.size() == 31) {
                    break;
                }
            }
        }

        return vos;
    }

    private   Map<String, Double> getHbWs(String id) throws Exception {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.MONTH,-1);
        Map<String, Double> wxssmap = new HashMap<>();
        List<String> wxssls = new ArrayList<>();

        // 日场内受累检修
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RLZSSDL).getCode());
        // 日场内受累故障
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSZSSDL).getCode());
        // 月场内受累检修
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YLZSSDL).getCode());
        // 月场内受累故障
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSZSSDL).getCode());
        // 年场内受累检修
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NLZSSDL).getCode());
        // 年场内受累故障
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSZSSDL).getCode());

        //日待机损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSDJZSDL).getCode());
        //日手动停机损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSSTZSDL).getCode());
        //日性能损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RXNZSDL).getCode());
        //日缺陷降出力损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RSQXZSDL).getCode());
        //日故障损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RGZSSDL).getCode());
        //日检修损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RJXSSDL).getCode());

        //月待机损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSDJZSDL).getCode());
        //月手动停机损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSSTZSDL).getCode());
        //月性能损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YXNZSDL).getCode());
        //月缺陷降出力损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YSQXZSDL).getCode());
        //月故障损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YGZSSDL).getCode());
        //月检修损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YJXSSDL).getCode());


        //年待机损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSDJZSDL).getCode());
        //年手动停机损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSSTZSDL).getCode());
        //年性能损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NXNZSDL).getCode());
        //年缺陷降出力损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NSQXZSDL).getCode());
        //年故障损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NGZSSDL).getCode());
        //年检修损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NJXSSDL).getCode());


        //日限电损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RXDSSDL).getCode());
        //月限电损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YXDSSDL).getCode());
        //年限电损失
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NXDSSDL).getCode());


        //日场外受累电网
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RWZSSDL).getCode());
        // 日场外受累天气
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.RTZSSDL).getCode());
        // 月场外受累电网
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YWZSSDL).getCode());
        // 月场外受累天气
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.YTZSSDL).getCode());
        // 年场外受累电网
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NWZSSDL).getCode());
        // 年场外受累天气
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.NTZSSDL).getCode());
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_RFDL).getCode());
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_YFDL).getCode());
        wxssls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(id, Constant.TPOINT_WP_NFDL).getCode());


        String[] ids=new String[wxssls.size()];

        DNAVal[] wxsslist = realApiUtil.getHistMatrix(wxssls.toArray(ids),DateUtils.truncate(cal.getTime()).getTime());

        if (wxsslist.length == wxssls.size()) {




            Double rjxsl = MathUtil.twoBit(wxsslist[0].DValue);
            // 日场内受累故障
            Double rgzzsl = MathUtil.twoBit(wxsslist[1].DValue);
            // 月场内受累检修
            Double yjxsl = MathUtil.twoBit(wxsslist[2].DValue);
            // 月场内受累故障
            Double ygzzsl = MathUtil.twoBit(wxsslist[3].DValue);
            // 年场内受累检修
            Double njxsl = MathUtil.twoBit(wxsslist[4].DValue);
            // 年场内受累故障
            Double ngzzsl = MathUtil.twoBit(wxsslist[5].DValue);

//                wxssmap.put("rjxsl", rjxsl);
//                wxssmap.put("rgzzsl", rgzzsl);
//                wxssmap.put("yjxsl", yjxsl);
//                wxssmap.put("ygzzsl", ygzzsl);
//                wxssmap.put("njxsl", njxsl);
//                wxssmap.put("ngzzsl", ngzzsl);

            //日待机损失
            Double rdjss = MathUtil.twoBit(wxsslist[6].DValue);
            //日手动停机损失
            Double rsdtjss = MathUtil.twoBit(wxsslist[7].DValue);
            //日性能损失
            Double rxnss = MathUtil.twoBit(wxsslist[8].DValue);
            //日缺陷降出力损失
            Double rqxjclss = MathUtil.twoBit(wxsslist[9].DValue);

            //日欠发损失=日待机损失+日手动停机损失+日性能损失+日缺陷降出力损失
            Double rqfssdl = new BigDecimal(rdjss + rsdtjss + rxnss + rqxjclss).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

            Double rgzss = MathUtil.twoBit(wxsslist[10].DValue);
            //日故障损失电量=日故障损失+日故障受累
            Double rgzssdl = new BigDecimal(rgzss + rgzzsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            //日检修损失电量=日检修损失+日检修受累
            Double rjxss = MathUtil.twoBit(wxsslist[11].DValue);
            Double rjxssdl = new BigDecimal(rjxss + rjxsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();


            wxssmap.put("rqfssdl", rqfssdl);
            wxssmap.put("rgzssdl", rgzssdl);
            wxssmap.put("rjxssdl", rjxssdl);

            // 月场内受累检修
            Double ydjss = MathUtil.twoBit(wxsslist[12].DValue);
            // 月场内受累检修
            Double ysdtjss = MathUtil.twoBit(wxsslist[13].DValue);
            // 月场内受累检修
            Double yxnss = MathUtil.twoBit(wxsslist[14].DValue);
            // 月场内受累检修
            Double yqxjclss = MathUtil.twoBit(wxsslist[15].DValue);
            //月欠发损失=月待机损失+月手动停机损失+月性能损失+月缺陷降出力损失
            Double yqfssdl = new BigDecimal(ydjss + ysdtjss + yxnss + yqxjclss).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

            Double ygzss = MathUtil.twoBit(wxsslist[16].DValue);
            //月故障损失电量=月故障损失+月故障受累
            Double ygzssdl = new BigDecimal(ygzss + ygzzsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            Double yjxss = MathUtil.twoBit(wxsslist[17].DValue);
            //月检修损失电量=月检修损失+月检修受累
            Double yjxssdl = new BigDecimal(yjxss + yjxsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

            wxssmap.put("yqfssdl", yqfssdl);
            wxssmap.put("ygzssdl", ygzssdl);
            wxssmap.put("yjxssdl", yjxssdl);

            // 年场内受累检修
            Double ndjss = MathUtil.twoBit(wxsslist[18].DValue);
            // 年场内受累检修
            Double nsdtjss = MathUtil.twoBit(wxsslist[19].DValue);
            // 年场内受累检修
            Double nxnss = MathUtil.twoBit(wxsslist[20].DValue);
            // 年场内受累检修
            Double nqxjclss = MathUtil.twoBit(wxsslist[21].DValue);

            Double nqfssdl = new BigDecimal(ndjss + nsdtjss + nxnss + nqxjclss).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

            Double ngzss = MathUtil.twoBit(wxsslist[22].DValue);
            //年故障损失电量=年故障损失+年故障受累
            Double ngzssdl = new BigDecimal(ngzss + ngzzsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            Double njxss = MathUtil.twoBit(wxsslist[23].DValue);
            //年检修损失电量=年检修损失+年检修受累
            Double njxssdl = new BigDecimal(njxss + njxsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

            wxssmap.put("nqfssdl", nqfssdl);
            wxssmap.put("ngzssdl", ngzssdl);
            wxssmap.put("njxssdl", njxssdl);

            double temp = 0.0;
            temp = MathUtil.twoBit(wxsslist[24].DValue);
            Double rxdssdl = new BigDecimal(temp).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            temp = MathUtil.twoBit(wxsslist[25].DValue);
            Double yxdssdl = new BigDecimal(temp).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            temp = MathUtil.twoBit(wxsslist[26].DValue);
            Double nxdssdl = new BigDecimal(temp).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

            wxssmap.put("rxdssdl", StringUtils.round(rxdssdl < 0.0 ? 0.0 : rxdssdl, 2));
            wxssmap.put("yxdssdl", StringUtils.round(yxdssdl < 0.0 ? 0.0 : yxdssdl, 2));
            wxssmap.put("nxdssdl", StringUtils.round(nxdssdl < 0.0 ? 0.0 : nxdssdl, 2));

            Double rdwsl = MathUtil.twoBit(wxsslist[27].DValue);
            Double rtqsl = MathUtil.twoBit(wxsslist[28].DValue);
            Double rslssdl = new BigDecimal(rdwsl + rtqsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            Double ydwsl = MathUtil.twoBit(wxsslist[29].DValue);
            Double ytqsl = MathUtil.twoBit(wxsslist[30].DValue);
            Double yslssdl = new BigDecimal(ydwsl + ytqsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
            Double ndwsl = MathUtil.twoBit(wxsslist[31].DValue);
            Double ntqsl = MathUtil.twoBit(wxsslist[32].DValue);
            Double nslssdl = new BigDecimal(ndwsl + ntqsl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();


            double rfdl=MathUtil.twoBit(wxsslist[33].DValue);
            double yfdl=MathUtil.twoBit(wxsslist[34].DValue);
            double nfdl=MathUtil.twoBit(wxsslist[35].DValue);
            wxssmap.put("rslssdl", rslssdl);
            wxssmap.put("yslssdl", yslssdl);
            wxssmap.put("nslssdl", nslssdl);


            double rllfdl=rfdl+rgzssdl+rjxssdl+rqfssdl+rxdssdl+rslssdl;
            if(rllfdl!=0)
            {
                double rfnlyl=new BigDecimal(rfdl).divide(new BigDecimal(rllfdl), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                wxssmap.put("rfnlyl", rfnlyl);
            }else
            {
                wxssmap.put("rfnlyl", 0.0);
            }

            double yllfdl=yfdl+ygzssdl+yjxssdl+yqfssdl+yxdssdl+yslssdl;
            if(yllfdl!=0)
            {
                double yfnlyl=new BigDecimal(yfdl).divide(new BigDecimal(yllfdl), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                wxssmap.put("yfnlyl", yfnlyl);
            }else
            {
                wxssmap.put("yfnlyl", 0.0);
            }

            double nllfdl=nfdl+ngzssdl+njxssdl+nqfssdl+nxdssdl+nslssdl;
            if(nllfdl!=0)
            {
                double nfnlyl=new BigDecimal(nfdl).divide(new BigDecimal(nllfdl), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                wxssmap.put("nfnlyl", nfnlyl);
            }else
            {
                wxssmap.put("nfnlyl", 0.0);
            }


        }

        return wxssmap;
    }

    public List<DataVo> findPowerWpChart(String wpId) throws Exception {
        List<DataVo> vos = new ArrayList<DataVo>();
        if (StringUtils.empty(wpId)) {
            wpId = "0";
        }

        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);

        Date beginDate = cal.getTime();

        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
        Date endDate = cal.getTime();

        long num = DateUtils.hoursDiff(beginDate, endDate) ;

        cal = Calendar.getInstance();
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        for (int i = 0; i < num; i++) {

            DataVo vo = new DataVo();

            vo.setTime(cal.getTime().getTime());
//                vo.setValue1(0.0);// 应发功率
//                vo.setValue2(0.0);// 实发功率
//                vo.setValue3(0.0);// 理论功率
//                vo.setValue4(0.0);// 预测功率
//                vo.setValue5(0.0);// 保证功率
//                vo.setValue6(0.0);// 平均风速
//                vo.setValue7(0.0);// 24小时预测功率
//                vo.setValue8(0.0);// 72小时预测功率
//                vo.setValue9(0.0);// 最优功率律

            vos.add(vo);
            cal.add(Calendar.HOUR_OF_DAY,1);
        }

        cal = Calendar.getInstance();
        endDate = cal.getTime();

        // long num = 30;

        WindPowerStationTestingPoint rfdlai = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_RFDL);
        WindPowerStationTestingPoint sjgl = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SJGL);

        WindPowerStationTestingPoint ssfs =ssfs = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SSFS);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        List<PointData> rfdls = realApiUtil.getHistoryDatasSnap(rfdlai, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 3600L);
        List<PointData> sjglls = realApiUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 3600L);
        List<PointData> ssfss =new ArrayList<>();

        if(wpId.equals("PL_GDC"))
        {
            ssfss = realApiUtil.getHistoryDatasSnap("PLGGL.NX_GD_PLG_YC_P1_L1_001_QXZ0001", beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 3600L);
        }else
        {
            ssfss = realApiUtil.getHistoryDatasSnap(ssfs, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 3600L);
        }
        if (!rfdls.isEmpty() && !sjglls.isEmpty()
                && rfdls.size() == sjglls.size()
        ) {
            int count = 0;
            double temp = 0;
            for (int i = 0; i < rfdls.size(); i++) {
                vos.get(i).setTime(rfdls.get(i).getPointTime()* 1000);

                temp = rfdls.get(i).getPointValueInDouble();
                vos.get(i).setValue1(StringUtils.round(temp, 2));// 日发电量
                temp = sjglls.get(i).getPointValueInDouble();
                vos.get(i).setValue2(StringUtils.round(temp, 2));// 实际功率
                temp = ssfss.get(i).getPointValueInDouble();
                vos.get(i).setValue3(StringUtils.round(temp, 2));// 风速
            }
        }

        return vos;
    }
    private void setPlanInfo(Map<String, Double> gxkmap, List<ProjectPlan> planls, String id) {

        double yfdljh = 0.0;
        double nfdljh = 0.0;

        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        int month = cal.get(Calendar.MONTH) + 1;
        int num = 1;

        List<ProjectPlan> planlist = new ArrayList<>();

        for (ProjectPlan pl : planls) {
            if (id.equals(QS)) {
                planlist.add(pl);
            } else if (id.equals(FD)) {
                if (pl.getWindpower().endsWith("FDC")) {
                    planlist.add(pl);
                }
            } else if (id.equals(GF)) {
                if (pl.getWindpower().endsWith("GDC")) {
                    planlist.add(pl);
                }
            } else if (InitialRunner.wpmap.containsKey(id)) {
                if (pl.getWindpower().equals(id)) {
                    planlist.add(pl);
                }
            } else if (InitialRunner.pjmap.containsKey(id)) {
                if (pl.getProjectid().equals(id)) {
                    planlist.add(pl);
                }
            } else if (InitialRunner.lnmap.containsKey(id)) {
                Line ln = InitialRunner.lnmap.get(id);

                if (InitialRunner.lnsmap.containsKey(ln.getProjectid())) {
                    List<Line> linels = InitialRunner.lnsmap.get(ln.getProjectid());
                    if (!linels.isEmpty()) {
                        num = linels.size();
                    }
                } else {
                    num = 1;
                }

                if (pl.getProjectid().equals(ln.getProjectid())) {
                    planlist.add(pl);
                }
            }
        }

        for (ProjectPlan plan : planlist) {

            double fdl = null != plan.getGeneratingcapacity() ? Double.valueOf(plan.getGeneratingcapacity()) : 0.0;

            if (StringUtils.notEmp(plan.getMonth())) {
                int planmonth = Integer.valueOf(plan.getMonth());
                if (planmonth == month) {

                    yfdljh = yfdljh + fdl;
                }

                nfdljh = nfdljh + fdl;
            }
        }

        if (InitialRunner.lnmap.containsKey(id)) {
            yfdljh = new BigDecimal(yfdljh).divide(new BigDecimal(num), 2, RoundingMode.HALF_EVEN).doubleValue();
            nfdljh = new BigDecimal(nfdljh).divide(new BigDecimal(num), 2, RoundingMode.HALF_EVEN).doubleValue();
        }
        gxkmap.put("yfdljh", StringUtils.round(yfdljh, 0));
        gxkmap.put("nfdljh", StringUtils.round(nfdljh, 0));


    }


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

        Map<String, Object> resultmap = new HashMap<String, Object>();
        for (Windpowerstation wp : InitialRunner.wpallls) {

            Map<String, Double> retValue = new HashMap<String, Double>();
            String wpId = wp.getId();

            if (InitialRunner.wpmap.containsKey(wpId)) {
                Windpowerstation station = InitialRunner.wpmap.get(wpId);
                retValue.put("jd", station.getLongitude() == null ? 0 : StringUtils.round(station.getLongitude(), 2));
                retValue.put("wd", station.getLatitude() == null ? 0 : StringUtils.round(station.getLatitude(), 2));

                retValue.put("zjts", StringUtils.round(station.getQuantity(), 0));
                Map<String, WindPowerStationTestingPoint> map;


//                WindPowerStationTestingPoint2 yxts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_YXTS);
//                WindPowerStationTestingPoint2 djts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_DJTS);
//                WindPowerStationTestingPoint2 jxts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_WHTJ);
//                WindPowerStationTestingPoint2 tjts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_GZTJ);
//                WindPowerStationTestingPoint2 lxts = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WT_TXZD);
//
//                PointData ptValue = realApiUtil.getRealData(yxts);
//                retValue.put("yxts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
//
//                ptValue = realApiUtil.getRealData(djts);
//                retValue.put("djts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
//
//                ptValue = realApiUtil.getRealData(jxts);
//                retValue.put("jxts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
//
//                ptValue = realApiUtil.getRealData(tjts);
//                retValue.put("tjts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
//
//                ptValue = realApiUtil.getRealData(lxts);
//                retValue.put("lxts", StringUtils.round(ptValue.getPointValueInDouble(), 0));
//
//                if (wpId.endsWith("GDC")) {
//                    WindPowerStationTestingPoint2 wd = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_FCCFTWD);
//
//                    if (StringUtils.notEmp(wd)) {
//                        ptValue = realApiUtil.getRealData(wd);
//                        retValue.put("cftwd", StringUtils.round(ptValue.getPointValueInDouble(), 2));
//                    } else {
//                        retValue.put("cftwd", 0.0);
//                    }
//
//                }
                PointData ptValue =null;
                if (wpId.equals(WpEnum.MHS_FDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.MHSFGL_AI000305);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1893.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.JSFW_MHSSFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.NSS_FDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.NSSWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1810.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.NSSPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.QS_FDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.QSWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1573.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.QSPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));

                } else if (wpId.equals(WpEnum.SBQ_FDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.SBQFGL_AI000305);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1357.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.JSFW_SBSSFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.DWK_GDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.DWKWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1100.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.DWKPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.PL_GDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.PLWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1080.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.PLPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.MCH_GDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.MCHWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1360.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.MCHPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.XH_GDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.XHWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1385.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.XHPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                }  else if (wpId.equals(WpEnum.HZJ_GDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.HZJWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 1385.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.HZJPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                } else if (wpId.equals(WpEnum.XS_FDC.name())) {
                    ptValue = realApiUtil.getRealData(ConstantTR.XSWD);
                    retValue.put("dqwd", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                    retValue.put("hb", 2210.0);
                    ptValue = realApiUtil.getRealData(ConstantTR.XSPJFS);
                    retValue.put("ssfs", StringUtils.round(ptValue.getPointValueInDouble(), 0));
                }

                WindPowerStationTestingPoint glpoint = windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(wpId, Constant.TPOINT_WP_SJGL);
                ptValue = realApiUtil.getRealData(glpoint.getCode());
                retValue.put("gl", StringUtils.round(ptValue.getPointValueInDouble(), 0));
            }
            resultmap.put(wpId,retValue);
        }
        return resultmap;
    }

    public  Map<String,Object> getWeatherRealDay5Info(String wpId) throws Exception {
        Map<String,Object> map=new HashMap<>();
        if (StringUtils.notEmp(wpId)) {


            map= weatherDay5Service.getWeatherRealDay5Info(wpId);

        }
        return map;
    }

}


