package com.gyee.frame.service.app.index;


import com.gyee.frame.common.spring.Constant;
import com.gyee.frame.common.spring.InitialRunner;
import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
import com.gyee.frame.model.auto.Windpowerstation;
import com.gyee.frame.model.custom.DataVo;
import com.gyee.frame.model.custom.PointData;
import com.gyee.frame.model.enumeration.Messagetype;
import com.gyee.frame.netty.websocket.util.SocketToolService;
import com.gyee.frame.service.WindpowerinfodayService;
import com.gyee.frame.util.DateUtils;
import com.gyee.frame.util.IRealTimeDataBaseUtil;
import com.gyee.frame.util.RealTimeDataBaseFactory;
import com.gyee.frame.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 *
 */
@Service
public class IndexDetailService extends SocketToolService {
	@Autowired
    private InitialRunner initialRunner;
    private static int decimal_digit = 2;
    IRealTimeDataBaseUtil mongodb= RealTimeDataBaseFactory.createRealTimeDataBase();
    @Resource
    private WindpowerinfodayService windpowerinfodayService;
    @Resource
    private FocastpowerService focastpowerService;
    String[] ycPoints = Constant.TPOINT_WP_FGLYC.split(",");
    String[] ycPoints2 = Constant.TPOINT_WP_FGLYC2.split(",");
    public void index_curve_columnar_windSpeed_power() throws Exception {
        ////System.out.println("pppppp");
        Map<String, List<DataVo>> pointDataMap = new HashMap();

        List<Windpowerstation> wpls = new ArrayList<>();
        Windpowerstation windpowerstationAll = new Windpowerstation();
        windpowerstationAll.setId("0");
        wpls.add(windpowerstationAll);
        for (Windpowerstation wp : InitialRunner.wpls) {
            wpls.add(wp);
        }


       for(Windpowerstation wp:wpls)
       {
           List<DataVo> vos=findRealPowerChar(wp.getId());
           pointDataMap.put(wp.getId(),vos);

       }

        this.pushToWeb("pageNumber_6", "functionNumber_6","all", pointDataMap, Messagetype.MESSAGE);

    }


    public List<DataVo> findRealPowerChar(String wpId) throws Exception {
        List<DataVo> vos = new ArrayList<DataVo>();

        Calendar cal = Calendar.getInstance();
        Date currentDate=cal.getTime();

        Date beginDate = null;
        Date endDate = null;
        if(cal.get(Calendar.HOUR_OF_DAY)==0 && cal.get(Calendar.MINUTE)==0 && cal.get(Calendar.SECOND)==0 )
        {
            beginDate = cal.getTime();
            cal.add(Calendar.DAY_OF_MONTH, 1);
            endDate = cal.getTime();
        }else
        {
            cal.set(Calendar.HOUR_OF_DAY, 0);
            cal.set(Calendar.MINUTE, 0);
            cal.set(Calendar.SECOND, 0);

            beginDate = cal.getTime();
        }



        // cal.set(Calendar.HOUR_OF_DAY, 23);
        // cal.set(Calendar.MINUTE, 45);
        // cal.set(Calendar.SECOND, 0);
        cal.setTime(currentDate);
        cal.set(Calendar.SECOND, 0);

        if (cal.get(Calendar.MINUTE) > 30) {
            cal.set(Calendar.MINUTE, 0);
            cal.add(Calendar.HOUR_OF_DAY, 1);
        }else
        {
            cal.set(Calendar.MINUTE, 30);
        }


        if(null==endDate)
        {
            endDate = cal.getTime();
        }

        long num = DateUtils.hoursDiff(beginDate, endDate) * 2;
        if (cal.get(Calendar.MINUTE) == 30) {
            num++;
        }
        String[] ycPoints = Constant.TPOINT_WP_FGLYC.split(",");
        String[] ycPoints2 = Constant.TPOINT_WP_FGLYC2.split(",");
        int length = 48;
        for (int i = 0; i < length; i++) {
            DataVo vo = new DataVo();

            vo.setValue1(0.0);// 预测功率
            vo.setValue2(0.0);// 理论功率
            vo.setValue3(0.0);// 实发功率
            vo.setValue4(0.0);// 平均风速
            vos.add(vo);
        }

        if (StringUtils.isNotEmpty(wpId)) {
            Map<String, WindPowerStationTestingPoint2> map =InitialRunner.stationPointmap.get(wpId);
            if (!wpId.equals("0") && !wpId.equals("-1") && !wpId.equals("-2")) {

                // /////////////////////////////////////////////
                WindPowerStationTestingPoint2 ycgl1 = map.get(ycPoints[0]);
                Date tempdate = null;
                if (num > 0) {
                    List<PointData> datas = mongodb.getHistoryDatasSnap(ycgl1, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 1800L);

                    for (int j = 0; j < datas.size(); j++) {

                        vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
                        vos.get(j).setValue1(StringUtils.round(datas.get(j).getPointValueInDouble(), 2));
                        if (j == datas.size() - 1) {
                            tempdate = new Date(datas.get(j).getPointTime() * 1000);
                            cal.setTime(tempdate);
                        }
                    }
                    int subresult = 0;
                    int total = 0;
                    if (length > datas.size()) {
                        subresult = length - datas.size();
                        if (subresult >= 8) {
                            subresult = 8;
                        }
                        for (int i = 0; i < subresult; i++) {
                            cal.add(Calendar.MINUTE, 30);
                            vos.get(datas.size() + i).setTime(cal.getTime().getTime());
                            WindPowerStationTestingPoint2 ycgl = map.get(ycPoints2[i]);
                            vos.get(datas.size() + i).setValue1(StringUtils.round(mongodb.getRealData(ycgl).getPointValueInDouble(), 2));
                        }
                        total = datas.size() + subresult;
                        subresult = length - (total);

                        if (subresult > 0)
                            for (int i = 0; i < subresult; i++) {
                                cal.add(Calendar.MINUTE, 30);
                                vos.get(total + i).setTime(cal.getTime().getTime());
                                vos.get(total + i).setValue1(null);
                            }
                    }
                    for (int k = 0; k < vos.size(); k++) {
                        vos.get(k).setValue7(24.0);
                    }
                }
            } else {
                List<Windpowerstation> stations = new ArrayList<Windpowerstation>();
                if (wpId.equals("") || wpId.equals("0")) {
                    for (Windpowerstation station : InitialRunner.wpallls) {
                        if (station.getId().endsWith("FDC") || station.getId().endsWith("GDC")) {
                            stations.add(station);
                        }
                    }
                } else if (wpId.equals("-1")) {
                    for (Windpowerstation station : InitialRunner.wpallls) {
                        if (station.getId().endsWith("FDC")) {
                            stations.add(station);
                        }
                    }
                } else {
                    for (Windpowerstation station : InitialRunner.wpallls) {
                        if (station.getId().endsWith("GDC")) {
                            stations.add(station);
                        }
                    }
                }
                for (Windpowerstation station : stations) {

                    Map<String, WindPowerStationTestingPoint2> wpmap = InitialRunner.stationPointmap.get(station.getId());
                    Date tempdate = null;

                    if (num > 0) {
                        WindPowerStationTestingPoint2 ycgl1 = wpmap.get(ycPoints[0]);

                        if(null !=ycgl1){
                            List<PointData> datas = mongodb.getHistoryDatasSnap(ycgl1, beginDate.getTime() / 1000, endDate.getTime() / 1000, num, 1800L);
                            if(datas.isEmpty())
                            {
                                continue;
                            }
                            for (int j = 0; j < datas.size(); j++) {
                                ////System.out.println(j);
                                vos.get(j).setTime(datas.get(j).getPointTime() * 1000);
                                vos.get(j).setValue1(StringUtils.round((vos.get(j).getValue4()==null?vos.get(0).getValue4():vos.get(j).getValue4()) + (datas.get(j)==null?datas.get(0).getPointValueInDouble():datas.get(j).getPointValueInDouble()), 2));
                                if (j == datas.size() - 1) {
                                    tempdate = new Date(datas.get(j).getPointTime() * 1000);
                                    cal.setTime(tempdate);
                                }
                            }
                            int subresult = 0;
                            int total = 0;
                            if (length > datas.size()) {
                                subresult = length - datas.size();
                                if (subresult >= 8) {
                                    subresult = 8;
                                }
                                for (int i = 0; i < subresult; i++) {
                                    cal.add(Calendar.MINUTE, 30);
                                    vos.get(datas.size() + i).setTime(cal.getTime().getTime());
                                    WindPowerStationTestingPoint2 ycgl = wpmap.get(ycPoints2[i]);
                                    vos.get(datas.size() + i).setValue1(StringUtils.round((vos.get(datas.size() + i).getValue4()==null?vos.get(0).getValue4():vos.get(datas.size() + i).getValue4()) + mongodb.getRealData(ycgl).getPointValueInDouble(), 2));
                                }
                                total = datas.size() + subresult;
                                subresult = length - (total);

                                if (subresult > 0)
                                    for (int i = 0; i < subresult; i++) {
                                        cal.add(Calendar.MINUTE, 30);
                                        vos.get(total + i).setTime(cal.getTime().getTime());
                                        vos.get(total + i).setValue1(null);
                                    }
                            }
                            for (int k = 0; k < vos.size(); k++) {
                                vos.get(k).setValue7(48.0);
                            }

                        }

                    }

                }

            }

            // / <summary>
            // / 理论
            // / </summary>
            // public const string ZLLGL = "ZLLGL";
            // / <summary>
            // / 保证
            // / </summary>
            // public const string ZBZGL = "ZBZGL";
            // / <summary>
            // / 应发
            // / </summary>
            // public const string ZZSGL = "ZZSGL";
            // / <summary>
            // / 实际
            // / </summary>
            // public const string SSZGL = "SSZGL";



            WindPowerStationTestingPoint2 llgl = map.get("ZLLGL");
            WindPowerStationTestingPoint2 sjgl = map.get(Constant.TPOINT_WP_SJGL);
            WindPowerStationTestingPoint2 pjfs = map.get(Constant.TPOINT_WP_SSFS);


            WindPowerStationTestingPoint2 gdsjgl = InitialRunner.stationPointmap.get("-2").get(Constant.TPOINT_WP_SJGL);
            List<PointData> gdsjglls = mongodb.getHistoryDatasSnap(gdsjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 1800L);



            try {
                if (null != llgl) {
                    List<PointData> llglls = mongodb.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 1800L);

                    int count = 0;
                    double temp1 = 0;
                    double temp2 = 0;
                    for (int i = 0; i < vos.size(); i++) {

                        if (i < llglls.size() && null!= llglls.get(i).getPointTime()) {

                            if (vos.get(i).getTime() <= DateUtils.getNowDate().getTime()) {
                                temp1 = llglls.get(i).getPointValueInDouble();
                                temp2 = gdsjglls.get(i).getPointValueInDouble();
                                temp1 = new BigDecimal(temp1).divide(new BigDecimal(100000), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
                                // temp2 = new BigDecimal(temp2).divide(
                                // new BigDecimal(100000), 2,
                                // RoundingMode.HALF_EVEN).multiply(
                                // new BigDecimal(100)).doubleValue();

                                if (Math.abs(temp1) < 10000) {

                                    if (wpId.equals("0")) {
                                        vos.get(i).setValue2(StringUtils.round(temp1 + temp2, 2));// 理论功率
                                    } else {
                                        vos.get(i).setValue2(StringUtils.round(temp1, 2));// 理论功率
                                    }

                                }

                                count++;
                            } else {
                                vos.get(i).setValue2(null);// 理论功率
                            }

                        }else {
                            vos.get(i).setValue2(null);// 理论功率
                        }
                    }
                    // for(int i=0;i<vos.size();i++){
                    // vos.get(i).setValue8((double)count);
                    // }
                }
            } catch (Exception e) {
                e.printStackTrace();
                // TODO: handle exception
            }



            if (null != sjgl) {
                List<PointData> sjglls = mongodb.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 1800L);
                int count = 0;
                double temp = 0;
                for (int i = 0; i < vos.size(); i++) {

                    if (i < sjglls.size() && null!= sjglls.get(i).getPointTime()) {

                        if (vos.get(i).getTime() <= DateUtils.getNowDate().getTime()) {
                            temp = sjglls.get(i).getPointValueInDouble();
                            if (Math.abs(temp) < 10000) {
                                vos.get(i).setValue3(StringUtils.round(temp, 2));// 实际功率
                            }

                            count++;
                        } else {
                            vos.get(i).setValue3(null);// 实际功率
                        }

                    }else {
                        vos.get(i).setValue3(null);// 理论功率
                    }
                }
                for (int i = 0; i < vos.size(); i++) {
                    vos.get(i).setValue8((double) count);
                }
            }
            try {
                if (null != pjfs) {
                    List<PointData> pjfsls = mongodb.getHistoryDatasSnap(pjfs, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 1800L);

                    double temp = 0;
                    for (int i = 0; i < vos.size(); i++) {

                        if (i < pjfsls.size() && null!= pjfsls.get(i).getPointTime()) {

                            if (vos.get(i).getTime() <= DateUtils.getNowDate().getTime()) {
                                temp = pjfsls.get(i).getPointValueInDouble();

                                if (Math.abs(temp) < 10000) {
                                    vos.get(i).setValue4(StringUtils.round(temp, 2));// 平均风速
                                }
                            } else {
                                vos.get(i).setValue4(null);// 平均风速
                            }

                        }else {
                            vos.get(i).setValue4(null);// 理论功率
                        }
                    }
                }
            } catch (Exception e) {
                // TODO: handle exception
            }

            // ////////////////////////////////////////////////
        }
        return vos;
    }

    public void index_curve_columnar_five_loss() throws Exception {

        Map<String, List<DataVo>> pointDataMap = new HashMap();

        List<Windpowerstation> wpls = new ArrayList<>();
        for (Windpowerstation wp : InitialRunner.wpls) {
            wpls.add(wp);
        }
        Windpowerstation windpowerstationAll = new Windpowerstation();
        windpowerstationAll.setId("0");
        wpls.add(windpowerstationAll);


        Calendar c = Calendar.getInstance();

        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.add(Calendar.DAY_OF_MONTH,2);
        Date endDate = c.getTime();
        c.add(Calendar.DAY_OF_MONTH,-7);
        Date beginDate = c.getTime();

        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;

        for (Windpowerstation windpowerstation : wpls) {

            List<DataVo> vos = new ArrayList<DataVo>();
            long length = 7;
            for (int i = 0; i < length; i++) {
                DataVo vo = new DataVo();

                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);// 应发电量
                vos.add(vo);
            }
            Map<String, WindPowerStationTestingPoint2> map = stationPointmap.get(windpowerstation.getId());

//            public static final String RGZZSDL = "RGZZSDL";// 故障
//            public static final String RSZZSDL = "RSZZSDL";// 故障
//            public static final String RJXZSDL = "RJXZSDL";// 维护
//            public static final String RLZZSDL = "RLZZSDL";// 维护
//            public static final String RQFZSDL = "RQFZSDL";// 性能
//            public static final String RXDZSDL = "RXDZSDL";// 限电
//            public static final String RWZZSDL = "RWZZSDL";// 受累
//            public static final String RTZZSDL = "RTZZSDL";// 受累

            WindPowerStationTestingPoint2 fdl = map.get(Constant.TPOINT_WP_RFDL);

            WindPowerStationTestingPoint2 gzss = map.get(Constant.RGZZSDL);
            WindPowerStationTestingPoint2 gzsl = map.get(Constant.RSZZSDL);

            WindPowerStationTestingPoint2 jxss = map.get(Constant.RJXZSDL);
            WindPowerStationTestingPoint2 jxsl = map.get(Constant.RLZZSDL);

            WindPowerStationTestingPoint2 xnss = map.get(Constant.RQFZSDL);
            WindPowerStationTestingPoint2 xdss = map.get(Constant.RXDZSDL);

            WindPowerStationTestingPoint2 slss = map.get(Constant.RWZZSDL);
            WindPowerStationTestingPoint2 slsl = map.get(Constant.RTZZSDL);

            Calendar cal = Calendar.getInstance();
            //发电量
            List<PointData> fdlls = mongodb.getHistoryDatasSnap(fdl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);

            for (int j = 0; j < fdlls.size(); j++) {

                vos.get(j).setTime((fdlls.get(j).getPointTime()-3600*24) * 1000);
                vos.get(j).setValue1(StringUtils.round(fdlls.get(j).getPointValueInDouble(),2));
            }

            try {

                //故障损失
                List<PointData> gzssls = mongodb.getHistoryDatasSnap(gzss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
                //故障受累失
                List<PointData> gzslls = mongodb.getHistoryDatasSnap(gzsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);

                double temp1 = 0;
                double temp2 = 0;
                for (int i = 0; i < vos.size(); i++) {

                   // temp1 =gzssls.get(i).getPointValueInDouble();
                    temp1 =new BigDecimal(gzssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                    //temp2 =gzslls.get(i).getPointValueInDouble();
                    temp2 =new BigDecimal(gzslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                    vos.get(i).setValue2(StringUtils.round(temp1+temp2, 2));// 故障损失

                }

            } catch (Exception e) {
                // TODO: handle exception
            }

            try {
                //检修损失
                List<PointData> jxssls = mongodb.getHistoryDatasSnap(jxss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
                //检修受累
                List<PointData> jxslls = mongodb.getHistoryDatasSnap(jxsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);

                double temp1 = 0;
                double temp2 = 0;
                for (int i = 0; i < vos.size(); i++) {

                   // temp1 = jxssls.get(i).getPointValueInDouble();
                    temp1 =new BigDecimal(jxssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                  //  temp2 = jxslls.get(i).getPointValueInDouble();
                    temp2 =new BigDecimal(jxslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                    vos.get(i).setValue3(StringUtils.round(temp1+temp2, 2));// 检修损失

                }

            } catch (Exception e) {
                // TODO: handle exception
            }

            try {
                //限电损失
                List<PointData> xdssls = mongodb.getHistoryDatasSnap(xdss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);

                double temp = 0;
                for (int i = 0; i < vos.size(); i++) {
                    //temp = xdssls.get(i).getPointValueInDouble();
                    temp =new BigDecimal(xdssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                    vos.get(i).setValue4(StringUtils.round(temp, 2));// 限电损失

                }

            } catch (Exception e) {
                // TODO: handle exception
            }
            try {
                //性能损失
                List<PointData> xnssls = mongodb.getHistoryDatasSnap(xnss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);

                double temp = 0;
                for (int i = 0; i < vos.size(); i++) {
                   // temp = xnssls.get(i).getPointValueInDouble();
                    temp =new BigDecimal(xnssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                    vos.get(i).setValue5(StringUtils.round(temp, 2));// 性能损失

                }

            } catch (Exception e) {
                // TODO: handle exception
            }

            try {
                //天气受累
                List<PointData> slssls = mongodb.getHistoryDatasSnap(slss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
                //电网受累
                List<PointData> slslls = mongodb.getHistoryDatasSnap(slsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);

                double temp1 = 0;
                double temp2 = 0;
                for (int i = 0; i < vos.size(); i++) {

                   // temp1 = slssls.get(i).getPointValueInDouble();
                    temp1 =new BigDecimal(slssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                   // temp2 = slslls.get(i).getPointValueInDouble();
                    temp2 =new BigDecimal(slslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();

                    vos.get(i).setValue6(StringUtils.round(temp1+temp2, 2));// 受累损失

                }

            } catch (Exception e) {
                // TODO: handle exception
            }

            for(DataVo vo:vos)
            {
                vo.setValue7(StringUtils.round(vo.getValue1()+vo.getValue2()+vo.getValue3()+vo.getValue4()+vo.getValue5()+vo.getValue6(), 2));
            }
            pointDataMap.put(windpowerstation.getId(),vos);

        }

        this.pushToWeb("pageNumber_6", "functionNumber_7","all", pointDataMap, Messagetype.MESSAGE);

    }


    public void index_windStation_card() throws Exception {
        ////System.out.println("000");
        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
        List<Windpowerstation> wpls = new ArrayList<>();
        for(Windpowerstation wp: InitialRunner.wpls){
            wpls.add(wp);
        }
        Windpowerstation windpowerstationAll = new Windpowerstation();
        windpowerstationAll.setId("0");
        wpls.add(windpowerstationAll);

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

        for(Windpowerstation windpowerstation:wpls){

            Map<String,Object> pointDataMap = new HashMap();
            double rfdl = 0;
            double ycdl = 0;
            double ssgl = 0;
            double ssfs = 0;


            try {
                //日发电量
                PointData rfdl_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_RFDL).getCode());
                rfdl = new BigDecimal(rfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
                pointDataMap.put("rfdl_real",rfdl_real);
                pointDataMap.put("rfdl",rfdl);
            }catch (Exception e){
                //System.out.println(e.getMessage());
            }

            try {
                //实时功率

                PointData ssgl_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SJGL).getCode());
                ssgl = new BigDecimal(ssgl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
                pointDataMap.put("ssgl",ssgl);
                pointDataMap.put("ssgl_real",ssgl_real);
            }catch (Exception e){
                //System.out.println(e.getMessage());
            }


            try{
                //实时风速
                PointData ssfs_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SSFS).getCode());
                ssfs = new BigDecimal(ssfs_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
                pointDataMap.put("ssfs",ssfs);
                pointDataMap.put("ssfs_real",ssfs_real);
            }catch (Exception e){
                //System.out.println(e.getMessage());
            }

            //预测发电量
            ycdl=focastpowerService.focastpower(windpowerstation.getId());
            ycdl =Double.valueOf( String.format("%.2f", ycdl));

            pointDataMap.put("ycdl",ycdl);

            windpowerstationpointDataMap.put(windpowerstation.getId(),pointDataMap);
        }


        this.pushToWeb("pageNumber_6","functionNumber_8","all",windpowerstationpointDataMap, Messagetype.MESSAGE);
    }


}
