package com.gyee.frame.service.websocket;


import com.google.common.collect.Maps;
import com.gyee.frame.common.spring.Constant;
import com.gyee.frame.common.spring.InitialRunner;
import com.gyee.frame.model.auto.*;
import com.gyee.frame.model.custom.PointData;
import com.gyee.frame.service.WarningRecordsService;
import com.gyee.frame.service.WindTurbineTestingPointAiService;
import com.gyee.frame.service.WindTurbineTestingPointDiService;
import com.gyee.frame.service.WindturbineinfodayService;
import com.gyee.frame.util.*;

import cn.hutool.core.date.DateUtil;

import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Service;

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

@Service
public class WtInfoPushService {

    @Resource
    private WindTurbineTestingPointDiService windTurbineTestingPointDiService;
    @Resource
    private WindTurbineTestingPointAiService windTurbineTestingPointAiService;

    @Resource
    private WindturbineinfodayService windturbineinfodayService;
    @Resource
    private WarningRecordsService warningRecordsService;
    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();

    String QS_FDC = "QS_FDC";

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

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

        map.put("MG01_01", findWtInfo("MG01_01"));
        map.put("SG01_01", findWtInfo("SG01_01"));
        map.put("XG01_01", findWtInfo("XG01_01"));
        map.put("NG01_01", findWtInfo("NG01_01"));
        map.put("QG01_01", findWtInfo("QG01_01"));
        return map;

    }

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

        List<Map<String, Object>> map = findWtInfoList(wpId);

        return map;

    }

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

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

        if (StringUtils.notEmp(id)) {

            if (InitialRunner.wtmap.containsKey(id)) {

                Map<String, String[]> namemap = new HashMap<String, String[]>();
                Windturbine wt = InitialRunner.wtmap.get(id);

                map.put("model", wt.getModelid());
                map.put("wpid", wt.getWindpowerstationid());
                map.put("pjid", wt.getProjectid());
                map.put("lnid", wt.getLineid());
                map.put("code", wt.getCode());
                Line ln= InitialRunner.lnmap.get(wt.getLineid());
                map.put("lnname", ln.getName());

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

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

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

                Map<String, Integer> bjnamemap = new HashMap<>();
                Map<String, Integer> clxnamemap = new HashMap<>();
                Map<String, Integer> fdjnamemap = new HashMap<>();
                Map<String, Integer> phnamemap = new HashMap<>();
                Map<String, Integer> yynamemap = new HashMap<>();
                Map<String, Integer> jcnamemap = new HashMap<>();




                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_FJKYL).getId());// 可利用率
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_RFDL).getId());// 日发电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_LLGL).getId());// 风机理论功率
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_YFGL).getId());// 风机应发功率
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_RFDLBZ).getId());// 日理论发电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_RFDLZS).getId());//  日应发电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.FJZT).getId());// 风机状态
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RGZSSDL).getId());// 风机日故障损失电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RJXSSDL).getId());// 风机日检修损失电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RQFSSDL).getId());// 风机日欠发损失电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RXDSSDL).getId());// 风机日限电损失电量
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RGZSSDL).getId());// 日场内受累检修
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RJXSSDL).getId());// 日场内受累故障
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RQFSSDL).getId());// 日场外受累电网
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.RXDSSDL).getId());// 日场外受累天气

                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_FJSSFS).getId());// 风速
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_FJGL).getId());// 风机功率
                if (wt.getWindpowerstationid().equals(QS_FDC)) {
                    zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.QSTPOINT_WT_FDJZS).getId());// 风机转数

                }else
                {
                    zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_FDJZS).getId());// 风机转数
                }
                zbls.add(windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, Constant.TPOINT_WT_JCWWD).getId());//环境温度

                keyls.add("FJKYL");// 可利用率
                keyls.add("RFDL");// 日发电量
                keyls.add("LLGL");// 风机理论功率
                keyls.add("YFGL");// 风机应发功率
                keyls.add("LLFDL");// 日理论发电量
                keyls.add("YFDL");//  日应发电量
                keyls.add("FJZT");// 风机状态
                keyls.add("GZSS");// 风机日故障损失电量
                keyls.add("JXSS");// 风机日检修损失电量
                keyls.add("XNSS");// 风机日欠发损失电量
                keyls.add("XDSS");// 风机日限电损失电量
                keyls.add("SLSS");// 日场内受累检修
                keyls.add("RJXSSDL");// 日场内受累故障
                keyls.add("RQFSSDL");// 日场外受累电网
                keyls.add("RXDSSDL");// 日场外受累天气
                keyls.add("FS");// 风速
                keyls.add("GL");// 平均风速功率
                keyls.add("FDJZS");//风机转数
                keyls.add("HJWD");////环境温度

                namemap.put("FJKYL",new String[]{"可利用率","%","ai",null});
                namemap.put("RFDL",new String[]{"日发电量","kwh","ai",null});
                namemap.put("LLGL",new String[]{"风机理论功率","kw","ai",null});
                namemap.put("YFGL",new String[]{"风机应发功率","kw","ai",null});
                namemap.put("LLFDL",new String[]{"日理论发电量","kwh","ai",null});
                namemap.put("YFDL",new String[]{"日应发电量","kwh","ai",null});
                namemap.put("FJZT",new String[]{"风机状态","","ai",null});
                namemap.put("GZSS",new String[]{"故障损失电量","kwh","ai",null});
                namemap.put("JXSS",new String[]{"检修损失电量","kwh","ai",null});
                namemap.put("XNSS",new String[]{"性能损失电量","kwh","ai",null});
                namemap.put("XDSS",new String[]{"限电损失电量","kwh","ai",null});
                namemap.put("SLSS",new String[]{"场内受累","kwh","ai",null});
                namemap.put("RJXSSDL",new String[]{"日场内受累检修","kwh","ai",null});
                namemap.put("RQFSSDL",new String[]{"场外受累电网","kwh","ai",null});
                namemap.put("RXDSSDL",new String[]{"场外受累天气","kwh","ai",null});
                namemap.put("FS",new String[]{"风速","m/s","ai",null});
                namemap.put("GL",new String[]{"功率","kw","ai",null});
                namemap.put("FDJZS",new String[]{"风机转数","rpm","ai",null});
                namemap.put("HJWD",new String[]{"环境温度","°c","ai",null});

/*********************************************************************变桨*********************************************************************************/

                List<String> uids = new ArrayList<>();
                List<String> msls = new ArrayList<>();

                if (wt.getWindpowerstationid().equals(QS_FDC)) {

                    uids.add(Constant.TPOINT_WT_RYBMQ1);
                    uids.add(Constant.TPOINT_WT_RYBMQ2);
                    uids.add(Constant.TPOINT_WT_RYBMQ3);
                    uids.add(Constant.TPOINT_WT_BJSD1);
                    uids.add(Constant.TPOINT_WT_BJSD2);
                    uids.add(Constant.TPOINT_WT_BJSD3);
                    uids.add(Constant.QSTPOINT_WT_U1YZDL);
                    uids.add(Constant.QSTPOINT_WT_U2YZDL);
                    uids.add(Constant.QSTPOINT_WT_U3YZDL);
                    uids.add(Constant.QSTPOINT_WT_U1YZDY);
                    uids.add(Constant.QSTPOINT_WT_U2YZDY);
                    uids.add(Constant.QSTPOINT_WT_U3YZDY);

                } else {

                    uids.add(Constant.TPOINT_WT_RYBMQ1);
                    uids.add(Constant.TPOINT_WT_RYBMQ2);
                    uids.add(Constant.TPOINT_WT_RYBMQ3);
                    uids.add(Constant.TPOINT_WT_BJSD1);
                    uids.add(Constant.TPOINT_WT_BJSD2);
                    uids.add(Constant.TPOINT_WT_BJSD3);
                    uids.add(Constant.TPOINT_WT_U1YZDL);
                    uids.add(Constant.TPOINT_WT_U2YZDL);
                    uids.add(Constant.TPOINT_WT_U3YZDL);
                    uids.add(Constant.TPOINT_WT_U1YZDY);
                    uids.add(Constant.TPOINT_WT_U2YZDY);
                    uids.add(Constant.TPOINT_WT_U3YZDY);

                }



                msls.add("RYBMQ1");
                msls.add("RYBMQ2");
                msls.add("RYBMQ3");
                msls.add("BJSD1");
                msls.add("BJSD2");
                msls.add("BJSD3");
                msls.add("U1YZDL");
                msls.add("U2YZDL");
                msls.add("U3YZDL");
                msls.add("U1YZDY");
                msls.add("U2YZDY");
                msls.add("U3YZDY");



                namemap.put("RYBMQ1",new String[]{"冗余编码器1","","ai",null});
                namemap.put("RYBMQ2",new String[]{"冗余编码器2","","ai",null});
                namemap.put("RYBMQ3",new String[]{"冗余编码器3","","ai",null});
                namemap.put("BJSD1",new String[]{"变桨速度1","","ai",null});
                namemap.put("BJSD2",new String[]{"变桨速度2","","ai",null});
                namemap.put("BJSD3",new String[]{"变桨速度3","","ai",null});
                namemap.put("U1YZDL",new String[]{"U1项绕组电流","A","ai",null});
                namemap.put("U2YZDL",new String[]{"U2项绕组电流","A","ai",null});
                namemap.put("U3YZDL",new String[]{"U3项绕组电流","A","ai",null});
                namemap.put("U1YZDY",new String[]{"U1项绕组电压","V","ai",null});
                namemap.put("U2YZDY",new String[]{"U2项绕组电压","V","ai",null});
                namemap.put("U3YZDY",new String[]{"U3项绕组电压","V","ai",null});

                namemap.put("YP1XW91",new String[]{"叶片1的91度限位","","di",null});
                namemap.put("YP2XW91",new String[]{"叶片2的91度限位","","di",null});
                namemap.put("YP3XW91",new String[]{"叶片3的91度限位","","di",null});
                namemap.put("YP1XW95",new String[]{"叶片1的95度限位","","di",null});
                namemap.put("YP2XW95",new String[]{"叶片2的95度限位","","di",null});
                namemap.put("YP3XW95",new String[]{"叶片3的95度限位","","di",null});



                initialpoint(id, zbls, keyls, bjnamemap,uids,msls);


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

                unicodels.add(Constant.TPOINT_WT_YP1XW91);
                unicodels.add(Constant.TPOINT_WT_YP2XW91);
                unicodels.add(Constant.TPOINT_WT_YP3XW91);
                unicodels.add(Constant.TPOINT_WT_YP1XW95);
                unicodels.add(Constant.TPOINT_WT_YP2XW95);
                unicodels.add(Constant.TPOINT_WT_YP3XW95);

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

                unmsls.add("YP1XW91");
                unmsls.add("YP2XW91");
                unmsls.add("YP3XW91");
                unmsls.add("YP1XW95");
                unmsls.add("YP2XW95");
                unmsls.add("YP3XW95");

                InitalDiMap(id, zbls, keyls, bjnamemap, unicodels, unmsls);

/**************************************************************************齿轮箱*****************************************************************************/

                msls=new ArrayList<>();
                uids=new ArrayList<>();
                uids.add(Constant.TPOINT_WT_RHYLWRKYL);
                uids.add(Constant.TPOINT_WT_RHYLWCKYL);
                uids.add(Constant.TPOINT_WT_CLXSRZ1WD);
                uids.add(Constant.TPOINT_WT_CLXRHYJRBH);
                uids.add(Constant.TPOINT_WT_CLXRHYLWYC);
                uids.add(Constant.TPOINT_WT_CLXRKYW);

                msls.add("RHYLWRKYL");
                msls.add("RHYLWCKYL");
                msls.add("CLXSRZ1WD");
                msls.add("CLXRHYJRBH");
                msls.add("CLXRHYLWYC");
                msls.add("CLXRKYW");

                initialpoint(id, zbls, keyls, clxnamemap,uids,msls);

                unicodels = new ArrayList<>();

                unicodels.add(Constant.TPOINT_WT_CLXYW);
                unicodels.add(Constant.TPOINT_WT_CLXRHYYL);
                unicodels.add(Constant.TPOINT_WT_CLXRHBDJBH);
                unicodels.add(Constant.TPOINT_WT_CLXRHYJRBH);
                unicodels.add(Constant.TPOINT_WT_CLXRHYLWYC);
                unicodels.add(Constant.TPOINT_WT_CLXYJRQBH);
                unicodels.add(Constant.TPOINT_WT_QDCLXRHJRQ);
                unicodels.add(Constant.TPOINT_WT_QDCLXRHGSBA);
                unicodels.add(Constant.TPOINT_WT_QDCLXRHGSBB);
                unicodels.add(Constant.TPOINT_WT_QDCLXYBJRQ);


                unmsls = new ArrayList<>();

                unmsls.add("CLXYW");
                unmsls.add("CLXRHYYL");
                unmsls.add("CLXRHBDJBH");
                unmsls.add("CLXRHYJRBH");
                unmsls.add("CLXRHYLWYC");
                unmsls.add("CLXYJRQBH");
                unmsls.add("QDCLXRHJRQ");
                unmsls.add("QDCLXRHGSBA");
                unmsls.add("QDCLXRHGSBB");
                unmsls.add("QDCLXYBJRQ");

                InitalDiMap(id, zbls, keyls, clxnamemap, unicodels, unmsls);


                namemap.put("RHYLWRKYL",new String[]{"润滑油滤网入口压力","bar","ai",null});
                namemap.put("RHYLWCKYL",new String[]{"润滑油滤网出口压力","bar","ai",null});
                namemap.put("CLXSRZ1WD",new String[]{"齿轮箱输入轴1温度","°c","ai",null});
                namemap.put("CLXRHYJRBH",new String[]{"齿轮箱输入轴2温度","°c","ai",null});
                namemap.put("CLXRHYLWYC",new String[]{"齿轮箱油温","°c","ai",null});
                namemap.put("CLXRKYW",new String[]{"齿轮箱入口油温","°c","ai",null});

                namemap.put("CLXYW",new String[]{"齿轮箱油位ok","","di",null});
                namemap.put("CLXRHYYL",new String[]{"齿轮箱润滑油压力ok","","di",null});
                namemap.put("CLXRHBDJBH",new String[]{"齿轮箱润滑泵电机保护ok","","di",null});
                namemap.put("CLXRHYJRBH",new String[]{"齿轮箱润滑油加热保护ok","","di",null});
                namemap.put("CLXRHYLWYC",new String[]{"齿轮箱润滑油滤网压差ok","","di",null});
                namemap.put("CLXYJRQBH",new String[]{"齿轮箱油加热器保护ok","","di",null});
                namemap.put("QDCLXRHJRQ",new String[]{"启动齿轮箱润滑加热器","","di",null});
                namemap.put("QDCLXRHGSBA",new String[]{"启动齿轮箱润滑高速泵a","","di",null});
                namemap.put("QDCLXRHGSBB",new String[]{"启动齿轮箱润滑高速泵b","","di",null});
                namemap.put("QDCLXYBJRQ",new String[]{"启动齿轮箱油泵加热器","","di",null});


/***********************************************************************发电机********************************************************************************/

                msls=new ArrayList<>();
                uids=new ArrayList<>();
                if (wt.getWindpowerstationid().equals(QS_FDC)) {

                    uids.add(Constant.QSTPOINT_WT_U1YZWD);
                    uids.add(Constant.QSTPOINT_WT_V1YZWD);
                    uids.add(Constant.QSTPOINT_WT_W1YZWD);
                    uids.add(Constant.TPOINT_WT_FDJZCAWD);
                    uids.add(Constant.TPOINT_WT_FDJZCBWD);
                    uids.add(Constant.TPOINT_WT_FDJLQFWD);
                    uids.add(Constant.TPOINT_WT_FDJHHWD);


                } else {

                    uids.add(Constant.TPOINT_WT_U1YZWD);
                    uids.add(Constant.TPOINT_WT_V1YZWD);
                    uids.add(Constant.TPOINT_WT_W1YZWD);
                    uids.add(Constant.TPOINT_WT_FDJZCAWD);
                    uids.add(Constant.TPOINT_WT_FDJZCBWD);
                    uids.add(Constant.TPOINT_WT_FDJLQFWD);
                    uids.add(Constant.TPOINT_WT_FDJHHWD);

                }

                msls.add("U1YZWD");
                msls.add("V1YZWD");
                msls.add("W1YZWD");
                msls.add("FDJZCAWD");
                msls.add("FDJZCBWD");
                msls.add("FDJLQFWD");
                msls.add("FDJHHWD");

                initialpoint(id, zbls, keyls, fdjnamemap,uids,msls);

                unicodels = new ArrayList<>();

                unicodels.add(Constant.TPOINT_WT_FDJJRQBHZC);
                unicodels.add(Constant.TPOINT_WT_QDFDJJRQ);
                unicodels.add(Constant.TPOINT_WT_FDJDSMS);
                unicodels.add(Constant.TPOINT_WT_QDKLFS1);
                unicodels.add(Constant.TPOINT_WT_QDKLFS2);
                unicodels.add(Constant.TPOINT_WT_KLFSBH1);
                unicodels.add(Constant.TPOINT_WT_KLFSBH2);
                unicodels.add(Constant.TPOINT_WT_QDSLFS1);
                unicodels.add(Constant.TPOINT_WT_QDSLFSBH1);
                unicodels.add(Constant.TPOINT_WT_LQSYL);
                unicodels.add(Constant.TPOINT_WT_FDJRHYBYW);
                unicodels.add(Constant.TPOINT_WT_QDFDJRHYB);


                unmsls = new ArrayList<>();

                unmsls.add("FDJJRQBHZC");
                unmsls.add("QDFDJJRQ");
                unmsls.add("FDJDSMS");
                unmsls.add("QDKLFS1");
                unmsls.add("QDKLFS2");
                unmsls.add("KLFSBH1");
                unmsls.add("KLFSBH2");
                unmsls.add("QDSLFS1");
                unmsls.add("QDSLFSBH1");
                unmsls.add("LQSYL");
                unmsls.add("FDJRHYBYW");
                unmsls.add("QDFDJRHYB");

                InitalDiMap(id, zbls, keyls, fdjnamemap, unicodels, unmsls);



                namemap.put("U1YZWD",new String[]{"U1绕组温度","°c","ai",null});
                namemap.put("V1YZWD",new String[]{"V1绕组温度","°c","ai",null});
                namemap.put("W1YZWD",new String[]{"W1绕组温度","°c","ai",null});
                namemap.put("FDJZCAWD",new String[]{"发电机轴承A温度","°c","ai",null});
                namemap.put("FDJZCBWD",new String[]{"发电机轴承B温度","°c","ai",null});
                namemap.put("FDJLQFWD",new String[]{"发电机冷却风温度","°c","ai",null});
                namemap.put("FDJHHWD",new String[]{"发电机滑环温度","°c","ai",null});


                namemap.put("FDJJRQBHZC",new String[]{"发电机加热器保护正常","","di",null});
                namemap.put("QDFDJJRQ",new String[]{"启动发电机加热器","","di",null});
                namemap.put("FDJDSMS",new String[]{"发电机电刷磨损ok","","di",null});
                namemap.put("QDKLFS1",new String[]{"启动空冷风扇1","","di",null});
                namemap.put("QDKLFS2",new String[]{"启动空冷风扇2","","di",null});
                namemap.put("KLFSBH1",new String[]{"空冷风扇保护1正常","","di",null});
                namemap.put("KLFSBH2",new String[]{"空冷风扇保护2正常","","di",null});
                namemap.put("QDSLFS1",new String[]{"启动水冷风扇1","","di",null});
                namemap.put("QDSLFSBH1",new String[]{"水冷风扇保护1正常","","di",null});
                namemap.put("LQSYL",new String[]{"冷却水压力ok","","di",null});
                namemap.put("FDJRHYBYW",new String[]{"发电机润滑油泵液位ok","","di",null});
                namemap.put("QDFDJRHYB",new String[]{"启动发电机润滑油泵","","di",null});

/*********************************************************************偏航**********************************************************************************/


                msls=new ArrayList<>();
                uids=new ArrayList<>();
                if (wt.getWindpowerstationid().equals(QS_FDC)) {

                    uids.add(Constant.TPOINT_WT_DFJD);
                    uids.add(Constant.QSTPOINT_WT_PHWZ);

                } else {

                    uids.add(Constant.TPOINT_WT_DFJD);
                    uids.add(Constant.TPOINT_WT_PHWZ);

                }

                msls.add("DFJD");
                msls.add("PHWZ");
                initialpoint(id, zbls, keyls, phnamemap,uids,msls);

                unicodels = new ArrayList<>();

                unicodels.add(Constant.TPOINT_WT_PHZJX);
                unicodels.add(Constant.TPOINT_WT_PHYJX);
                unicodels.add(Constant.TPOINT_WT_PHRQDQZC);
                unicodels.add(Constant.TPOINT_WT_ZPHDZ);
                unicodels.add(Constant.TPOINT_WT_PHDSCDK);
                unicodels.add(Constant.TPOINT_WT_YPHDZ);
                unicodels.add(Constant.TPOINT_WT_PHRQDQDZ);
                unicodels.add(Constant.TPOINT_WT_PHRQDQSN);
                unicodels.add(Constant.TPOINT_WT_PHBMQZL);
                unicodels.add(Constant.TPOINT_WT_JLDZ);
                unicodels.add(Constant.TPOINT_WT_PHCGQMTOK);
                unicodels.add(Constant.TPOINT_WT_PHCGQOK);
                unicodels.add(Constant.TPOINT_WT_PHZCRHYW);
                unicodels.add(Constant.TPOINT_WT_PHRHBZCBH);
                unicodels.add(Constant.TPOINT_WT_PHDJ1BH);
                unicodels.add(Constant.TPOINT_WT_PHDJ2BH);
                unicodels.add(Constant.TPOINT_WT_PHDJ3BH);
                unicodels.add(Constant.TPOINT_WT_PHDJ4BH);

                unmsls = new ArrayList<>();

                unmsls.add("PHZJX");
                unmsls.add("PHYJX");
                unmsls.add("PHRQDQZC");
                unmsls.add("ZPHDZ");
                unmsls.add("PHDSCDK");
                unmsls.add("YPHDZ");
                unmsls.add("PHRQDQDZ");
                unmsls.add("PHRQDQSN");
                unmsls.add("PHBMQZL");
                unmsls.add("JLDZ");
                unmsls.add("PHCGQMTOK");
                unmsls.add("PHCGQOK");
                unmsls.add("PHZCRHYW");
                unmsls.add("PHRHBZCBH");
                unmsls.add("PHDJ1BH");
                unmsls.add("PHDJ2BH");
                unmsls.add("PHDJ3BH");
                unmsls.add("PHDJ4BH");

                InitalDiMap(id, zbls, keyls, phnamemap, unicodels, unmsls);



                namemap.put("DFJD",new String[]{"对风角度","","ai",null});
                namemap.put("PHWZ",new String[]{"偏航位置","","ai",null});


                namemap.put("PHZJX",new String[]{"偏航左极限位置","","di",null});
                namemap.put("PHYJX",new String[]{"偏航右极限位置","","di",null});
                namemap.put("PHRQDQZC",new String[]{"偏航软启动器正常","","di",null});
                namemap.put("PHDSCDK",new String[]{"左偏航动作","","di",null});
                namemap.put("YPHDZ",new String[]{"偏航电刹车打开","","di",null});
                namemap.put("PHRQDQDZ",new String[]{"偏航软启动器动作","","di",null});
                namemap.put("PHRQDQSN",new String[]{"偏航软启动器使能","","di",null});
                namemap.put("PHBMQZL",new String[]{"偏航编码器置零","","di",null});
                namemap.put("JLDZ",new String[]{"解缆动作","","di",null});
                namemap.put("PHCGQMTOK",new String[]{"偏航传感器mtOK","","di",null});
                namemap.put("PHCGQOK",new String[]{"偏航传感器OK","","di",null});
                namemap.put("PHZCRHYW",new String[]{"偏航轴承润滑液位ok","","di",null});
                namemap.put("PHRHBZCBH",new String[]{"偏航润滑泵轴承保护ok","","di",null});
                namemap.put("PHDJ1BH",new String[]{"偏航电机1保护OK","","di",null});
                namemap.put("PHDJ2BH",new String[]{"偏航电机2保护OK","","di",null});
                namemap.put("PHDJ3BH",new String[]{"偏航电机3保护OK","","di",null});
                namemap.put("PHDJ4BH",new String[]{"偏航电机4保护OK","","di",null});

/****************************************************************液压***************************************************************************************/

                msls=new ArrayList<>();
                uids=new ArrayList<>();
                uids.add(Constant.TPOINT_WT_YYXTYY);
                uids.add(Constant.TPOINT_WT_ZZSCXTYY);
                uids.add(Constant.TPOINT_WT_FDJLQSWD);
                uids.add(Constant.TPOINT_WT_YYYW);

                msls.add("YYXTYY");
                msls.add("ZZSCXTYY");
                msls.add("FDJLQSWD");
                msls.add("YYYW");
                initialpoint(id, zbls, keyls, yynamemap,uids,msls);

                unicodels = new ArrayList<>();

                unicodels.add(Constant.TPOINT_WT_YYYWDCX);
                unicodels.add(Constant.TPOINT_WT_YYYYW);
                unicodels.add(Constant.TPOINT_WT_YLSCYY);
                unicodels.add(Constant.TPOINT_WT_YYBDJBH);
                unicodels.add(Constant.TPOINT_WT_YYYJRQBH);


                unmsls = new ArrayList<>();

                unmsls.add("YYYWDCX");
                unmsls.add("YYYYW");
                unmsls.add("YLSCYY");
                unmsls.add("YYBDJBH");
                unmsls.add("YYYJRQBH");

                InitalDiMap(id, zbls, keyls, yynamemap, unicodels, unmsls);


                namemap.put("YYXTYY",new String[]{"液压系统油压","bar","ai",null});
                namemap.put("ZZSCXTYY",new String[]{"转子刹车系统液压","bar","ai",null});
                namemap.put("FDJLQSWD",new String[]{"液压油温","°c","ai",null});
                namemap.put("YYYW",new String[]{"液压系统油压","bar","ai",null});

                namemap.put("YYYWDCX",new String[]{"液压油温度超限","","di",null});
                namemap.put("YYYYW",new String[]{"液压油液位ok","","di",null});
                namemap.put("YLSCYY",new String[]{"叶轮刹车液压ok","","di",null});
                namemap.put("YYBDJBH",new String[]{"液压泵电机保护","","di",null});
                namemap.put("YYYJRQBH",new String[]{"液压油加热器保护","","di",null});

/***********************************************************************机舱********************************************************************************/



                msls=new ArrayList<>();
                uids=new ArrayList<>();

                if (wt.getWindpowerstationid().equals(QS_FDC)) {

                    uids.add(Constant.TPOINT_WT_YPWZ1);
                    uids.add(Constant.TPOINT_WT_YPWZ2);
                    uids.add(Constant.TPOINT_WT_YPWZ3);
                    uids.add(Constant.TPOINT_WT_FJSSFS);
                    uids.add(Constant.TPOINT_WT_FJGL);
                    uids.add(Constant.TPOINT_WT_GLYS);
                    uids.add(Constant.QSTPOINT_WT_BJJD1);
                    uids.add(Constant.TPOINT_WT_FJPL);
                    uids.add(Constant.TPOINT_WT_WGGL);
                    uids.add(Constant.TPOINT_WT_FJFX);
                    uids.add(Constant.TPOINT_WT_YLZS);
                    uids.add(Constant.QSTPOINT_WT_FDJZS);
                    uids.add(Constant.TPOINT_WT_JCWWD);
                    uids.add(Constant.TPOINT_WT_JCWD);
                    uids.add(Constant.TPOINT_WT_TDGWD);
                    uids.add(Constant.TPOINT_WT_JCGWD);


                } else {

                    uids.add(Constant.TPOINT_WT_YPWZ1);
                    uids.add(Constant.TPOINT_WT_YPWZ2);
                    uids.add(Constant.TPOINT_WT_YPWZ3);
                    uids.add(Constant.TPOINT_WT_FJSSFS);
                    uids.add(Constant.TPOINT_WT_FJGL);
                    uids.add(Constant.TPOINT_WT_GLYS);
                    uids.add(Constant.TPOINT_WT_BJJD1);
                    uids.add(Constant.TPOINT_WT_FJPL);
                    uids.add(Constant.TPOINT_WT_WGGL);
                    uids.add(Constant.TPOINT_WT_FJFX);
                    uids.add(Constant.TPOINT_WT_YLZS);
                    uids.add(Constant.TPOINT_WT_FDJZS);
                    uids.add(Constant.TPOINT_WT_JCWWD);
                    uids.add(Constant.TPOINT_WT_JCWD);
                    uids.add(Constant.TPOINT_WT_TDGWD);
                    uids.add(Constant.TPOINT_WT_JCGWD);



                }

                msls.add("YPWZ1");
                msls.add("YPWZ2");
                msls.add("YPWZ3");
                msls.add("FJSSFS");
                msls.add("FJGL");
                msls.add("GLYS");
                msls.add("BJJD1");
                msls.add("FJPL");
                msls.add("WGGL");
                msls.add("FJFX");
                msls.add("YLZS");
                msls.add("FDJZS");
                msls.add("JCWWD");
                msls.add("JCWD");
                msls.add("TDGWD");
                msls.add("JCGWD");

                initialpoint(id, zbls, keyls, jcnamemap,uids,msls);

                unicodels = new ArrayList<>();

                unicodels.add(Constant.TPOINT_WT_YYYYW2);
                unicodels.add(Constant.TPOINT_WT_YYYWDCX2);
                unicodels.add(Constant.TPOINT_WT_YLSCYY2);
                unicodels.add(Constant.TPOINT_WT_YYBDJBH2);
                unicodels.add(Constant.TPOINT_WT_YYYJRQBH2);
                unicodels.add(Constant.TPOINT_WT_CLXYW2);
                unicodels.add(Constant.TPOINT_WT_CLXRHYYL2);
                unicodels.add(Constant.TPOINT_WT_CLXRHYJRBH2);
                unicodels.add(Constant.TPOINT_WT_FDJJRQBHZC2);
                unicodels.add(Constant.TPOINT_WT_LQSYL2);


                unmsls = new ArrayList<>();

                unmsls.add("YYYYW2");
                unmsls.add("YYYWDCX2");
                unmsls.add("YLSCYY2");
                unmsls.add("YYBDJBH2");
                unmsls.add("YYYJRQBH2");
                unmsls.add("CLXYW2");
                unmsls.add("CLXRHYYL2");
                unmsls.add("CLXRHYJRBH2");
                unmsls.add("FDJJRQBHZC2");
                unmsls.add("LQSYL2");

                InitalDiMap(id, zbls, keyls, jcnamemap, unicodels, unmsls);


                namemap.put("YPWZ1",new String[]{"叶片位置1","","ai",null});
                namemap.put("YPWZ2",new String[]{"叶片位置2","","ai",null});
                namemap.put("YPWZ3",new String[]{"叶片位置3","","ai",null});
                namemap.put("FJSSFS",new String[]{"风机实时风速","m/s","ai",null});
                namemap.put("FJGL",new String[]{"风机功率","kw","ai",null});
                namemap.put("GLYS",new String[]{"功率因数","Kvar","ai",null});
                namemap.put("BJJD1",new String[]{"变桨角度1","度","ai",null});
                namemap.put("FJPL",new String[]{"风机频率","Hz","ai",null});
                namemap.put("WGGL",new String[]{"无功功率","kw","ai",null});
                namemap.put("FJFX",new String[]{"风机风向","度","ai",null});
                namemap.put("YLZS",new String[]{"叶轮转速","rpm","ai",null});
                namemap.put("FDJZS",new String[]{"发电机转速","rpm","ai",null});
                namemap.put("JCWWD",new String[]{"机舱外温度","°c","ai",null});
                namemap.put("JCWD",new String[]{"机舱温度","°c","ai",null});
                namemap.put("TDGWD",new String[]{"塔底柜温度","°c","ai",null});
                namemap.put("JCGWD",new String[]{"机舱柜温度","°c","ai",null});


                namemap.put("YYYYW2",new String[]{"液压油液位ok","","di",null});
                namemap.put("YYYWDCX2",new String[]{"液压油温度超限","","di",null});
                namemap.put("YLSCYY2",new String[]{"叶轮刹车液压ok","","di",null});
                namemap.put("YYBDJBH2",new String[]{"液压泵电机保护","","di",null});
                namemap.put("YYYJRQBH2",new String[]{"液压油加热器保护","","di",null});
                namemap.put("CLXYW2",new String[]{"齿轮箱油位ok","","di",null});
                namemap.put("CLXRHYYL2",new String[]{"齿轮箱润滑油压力ok","","di",null});
                namemap.put("CLXRHYJRBH2",new String[]{"齿轮箱润滑油泵保护开关故障","","di",null});
                namemap.put("FDJJRQBHZC2",new String[]{"发电机加热器保护正常","","di",null});
                namemap.put("LQSYL2",new String[]{"冷却水压力ok","","di",null});


/*******************************************************************************************************************************************************/

                  Map<String, Object> jczbmap = new HashMap<>();
//                    Map<String, Object> bjmap = new HashMap<>();
//                    Map<String, Object> clxmap = new HashMap<>();
//                    Map<String, Object> fdjmap = new HashMap<>();
//                    Map<String, Object> phmap = new HashMap<>();
//                    Map<String, Object> yymap = new HashMap<>();
//                    Map<String, Object> jcmap = new HashMap<>();

                List<Object> bjls=new ArrayList<>();
                List<Object> clxls=new ArrayList<>();
                List<Object> fdjls=new ArrayList<>();
                List<Object> phls=new ArrayList<>();
                List<Object> yyls=new ArrayList<>();
                List<Object> jcls=new ArrayList<>();

                List<PointData> zblist = realApiUtil.getRealData(zbls);


                if (!zblist.isEmpty() && zblist.size() == zbls.size() && keyls.size() == zbls.size()) {
/**************************************************************基础指标***********************************************************************************/
                    jczbmap.put(keyls.get(0), MathUtil.twoBit(zblist.get(0).getPointValueInDouble()));// 可利用率
                    double rfdl = MathUtil.twoBit(zblist.get(1).getPointValueInDouble());
                    jczbmap.put(keyls.get(1), rfdl);// 日发电量
                    jczbmap.put(keyls.get(2), MathUtil.twoBit(zblist.get(2).getPointValueInDouble()));// 风机理论功率
                    jczbmap.put(keyls.get(3), MathUtil.twoBit(zblist.get(3).getPointValueInDouble()));// 风机应发功率
                    jczbmap.put(keyls.get(4), MathUtil.twoBit(zblist.get(4).getPointValueInDouble()));// 日理论发电量
                    jczbmap.put(keyls.get(5), MathUtil.twoBit(zblist.get(5).getPointValueInDouble()));// 日应发电量
                    jczbmap.put(keyls.get(6), MathUtil.twoBit(zblist.get(6).getPointValueInDouble()));// 风机状态

                    double rssdl = 0.0;
                    double rgzss = MathUtil.twoBit(zblist.get(7).getPointValueInDouble());
                    double rjxss = MathUtil.twoBit(zblist.get(8).getPointValueInDouble());
                    double rxnss = MathUtil.twoBit(zblist.get(9).getPointValueInDouble());
                    double rxdss = MathUtil.twoBit(zblist.get(10).getPointValueInDouble());

                    double rlzssdl = MathUtil.twoBit(zblist.get(11).getPointValueInDouble()); // 日场内受累检修
                    double rszssdl = MathUtil.twoBit(zblist.get(12).getPointValueInDouble()); // 日场内受累故障
                    double rwzssdl = MathUtil.twoBit(zblist.get(13).getPointValueInDouble()); // 日场外受累电网
                    double rtzssdl = MathUtil.twoBit(zblist.get(14).getPointValueInDouble()); // 日场外受累天气

                    jczbmap.put(keyls.get(7), StringUtils.round(rgzss + rlzssdl, 2));// 日故障损失电量
                    jczbmap.put(keyls.get(8), StringUtils.round(rjxss + rszssdl, 2));// 日维护损失电量
                    jczbmap.put(keyls.get(9), rxnss);// 日欠发损失电量

                    jczbmap.put(keyls.get(10), rxdss);// 日限电损失电量
                    jczbmap.put(keyls.get(11), StringUtils.round(rwzssdl + rtzssdl, 2));// 日受累损失电量

                    rssdl = rgzss + rjxss + rxnss + rxdss + rwzssdl + rtzssdl + rszssdl + rlzssdl;

                    jczbmap.put("RSSDL", StringUtils.round(rssdl, 2));// 风机日损失电量

                    jczbmap.put("RLLFDL", StringUtils.round(rssdl + rfdl, 2));// 风机日理论电量

                    jczbmap.put(keyls.get(15), MathUtil.twoBit(zblist.get(15).getPointValueInDouble()));// 风速
                    jczbmap.put(keyls.get(16), MathUtil.twoBit(zblist.get(16).getPointValueInDouble()));//功率
                    jczbmap.put(keyls.get(17), MathUtil.twoBit(zblist.get(17).getPointValueInDouble()));//发电机转数
                    jczbmap.put(keyls.get(18), MathUtil.twoBit(zblist.get(18).getPointValueInDouble()));//环境温度
/**************************************************************基础指标***********************************************************************************/

/**************************************************************变桨***********************************************************************************/


                    for(int i=0;i<keyls.size();i++)
                    {
                        if(bjnamemap.containsKey(keyls.get(i)))
                        {
                            int num=bjnamemap.get(keyls.get(i));

                            if(namemap.containsKey(keyls.get(i)))
                            {
                                String[] temparr=namemap.get(keyls.get(i));
                                temparr[3]=String.valueOf(MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));
                               // bjmap.put(keyls.get(i),temparr);//
                                bjls.add(temparr);
                            }

                        }

                        if(clxnamemap.containsKey(keyls.get(i)))
                        {
                            int num=clxnamemap.get(keyls.get(i));

                            if(namemap.containsKey(keyls.get(i)))
                            {
                                String[] temparr=namemap.get(keyls.get(i));
                                temparr[3]=String.valueOf(MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));
                               // clxmap.put(keyls.get(i),temparr);//
                                clxls.add(temparr);
                            }
                        }

                        if(fdjnamemap.containsKey(keyls.get(i)))
                        {
                            int num=fdjnamemap.get(keyls.get(i));

                            if(namemap.containsKey(keyls.get(i)))
                            {
                                String[] temparr=namemap.get(keyls.get(i));
                                temparr[3]=String.valueOf(MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));
//                                fdjmap.put(keyls.get(i),temparr);//
                                fdjls.add(temparr);
                            }
                        }

                        if(phnamemap.containsKey(keyls.get(i)))
                        {
                            int num=phnamemap.get(keyls.get(i));

                            if(namemap.containsKey(keyls.get(i)))
                            {
                                String[] temparr=namemap.get(keyls.get(i));
                                temparr[3]=String.valueOf(MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));
//                                phmap.put(keyls.get(i),temparr);//
                                phls.add(temparr);
                            }

                        }

                        if(yynamemap.containsKey(keyls.get(i)))
                        {
                            int num=yynamemap.get(keyls.get(i));

                            if(namemap.containsKey(keyls.get(i)))
                            {
                                String[] temparr=namemap.get(keyls.get(i));
                                temparr[3]=String.valueOf(MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));
//                                yymap.put(keyls.get(i),temparr);//
                                yyls.add(temparr);
                            }

                        }

                        if(jcnamemap.containsKey(keyls.get(i)))
                        {
                            int num=jcnamemap.get(keyls.get(i));

                            if(namemap.containsKey(keyls.get(i)))
                            {
                                String[] temparr=namemap.get(keyls.get(i));
                                if (keyls.get(i).equals("FDJZS")) {
                                    Equipmentmodel model = InitialRunner.mlmap.get(wt.getModelid());
                                    Double fdjzs = (zblist.get(num).getPointValueInDouble());
                                    if (model.getPowerproduction() == 2000) {
                                        temparr[3]=String.valueOf(StringUtils.round(fdjzs * 9.55, 2));
                                    } else {
                                        temparr[3]=String.valueOf(StringUtils.round(fdjzs, 2));
                                    }
                                }else{
                                    temparr[3]=String.valueOf(MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));
                                }

//                                jcmap.put(keyls.get(i),temparr);//
                                jcls.add(temparr);
                            }


                        }
                    }

/**************************************************************齿轮箱***********************************************************************************/



/**************************************************************发电机***********************************************************************************/


/**************************************************************偏航***********************************************************************************/

/**************************************************************液压***********************************************************************************/




/**************************************************************机舱***********************************************************************************/




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

                if(InitialRunner.mlmap.containsKey(wt.getModelid()))
                {
                    Equipmentmodel model=InitialRunner.mlmap.get(wt.getModelid());
                    jczbmap.put("zjrl",model.getPowerproduction());
                  //  jczbmap.add(new String[]{"装机容量","","ai",String.valueOf(model.getPowerproduction())});
                }

                map.put("jczbmap", jczbmap);
                map.put("bjmap", bjls);
                map.put("clxmap", clxls);

                map.put("fdjmap", fdjls);
                map.put("phmap", phls);

                map.put("yymap", yyls);
                map.put("jcmap", jcls);

/**********************************************************************************************************************************************************/


            }


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

            Map<String, Object> gxkmap = new HashMap<>();
            Date date = DateUtils.truncate(new Date());
            List<WindTurbineInfoDay> wtdls = windturbineinfodayService.getWindturbineinfo(id, date);
            if (!wtdls.isEmpty()) {
                WindTurbineInfoDay wd = wtdls.get(0);
                gxkmap.put("ndxkyss", wd.getYeardxkyxs());
                gxkmap.put("nsbklyl", wd.getYearsbklyl());
                gxkmap.put("ydxkyss", wd.getMonthdxkyxs());
                gxkmap.put("ysbklyl", wd.getMonthsbklyl());

                gxkmap.put("yyxxs", wd.getMonthruntime());
                gxkmap.put("ygzxs", wd.getMonthfaulttime());
                gxkmap.put("yjxxs", wd.getMonthmaintaintime());
                gxkmap.put("ytjxs", wd.getMonhtstoptime());

                Map<String, Object> jczbmap =(Map<String, Object>)map.get("jczbmap");
                jczbmap.put("FJKYL", wd.getDaysbklyl());
                map.put("jczbmap", jczbmap);

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

                gxkmap.put("yyxxs", 0.0);
                gxkmap.put("ygzxs", 0.0);
                gxkmap.put("yjxxs", 0.0);
                gxkmap.put("ytjxs", 0.0);
            }

            WarningRecords warningRecords= warningRecordsService.getWarningRecords(id);

            if(null !=warningRecords && null !=warningRecords.getWarningid() && InitialRunner.warningmap.containsKey(warningRecords.getWarningid()))
            {
                Warning warning2=InitialRunner.warningmap.get(warningRecords.getWarningid());
                gxkmap.put("bjmc", warning2.getChinesetext());
                gxkmap.put("bjsj", DateUtils.formatDateTime(warningRecords.getWarningtime()));
            }
            map.put("gxkmap", gxkmap);

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

        return map;
    }

    private void InitalDiMap(String id, List<String> zbls, List<String> keyls, Map<String, Integer> map, List<String> unicodels, List<String> unmsls) {
        if(unmsls.size()==unicodels.size())
        {
            Map<String,String> tempmap=new HashMap<>();
            for(int i=0;i<unmsls.size();i++)
            {
                tempmap.put(unicodels.get(i),unmsls.get(i));
            }
            List<WindTurbineTestingPointDi> list = windTurbineTestingPointDiService.getWindTurbineTestingPointDi2List(id, unicodels);

            if (!list.isEmpty()) {

                for (int i=0;i<list.size();i++) {
                    WindTurbineTestingPointDi di=list.get(i);
                    if(map.containsKey(di.getUniformcode()))
                    {
                        continue;
                    }
                    if(null!=di.getId())
                    {
                        zbls.add(di.getId());//
                        if(tempmap.containsKey(di.getUniformcode()))
                        {
                            keyls.add(tempmap.get(di.getUniformcode()));
                            map.put(tempmap.get(di.getUniformcode()),zbls.size()-1);
                        }

                    }
                }
            }
        }
    }

    private void initialpoint(String id, List<String> zbls, List<String> keyls, Map<String, Integer> bjnamemap,List<String> uids ,List<String> msls) {

        if(msls.size()==uids.size())
        {
            for(int i=0;i<uids.size();i++)
            {
                WindTurbineTestingPointAi point= windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, uids.get(i));
                if(null!=point && null!=point.getId())
                {
                    zbls.add(point.getId());//
                    keyls.add(msls.get(i));//
                    bjnamemap.put(msls.get(i),zbls.size()-1);
                }
            }
        }


    }
//    private void initialpoint(String id, List<String> zbls, List<String> keyls, Map<String, Integer> bjnamemap,List<String> uids) {
//
//        for(String uid:uids)
//        {
//            WindTurbineTestingPointAi2 point= windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, uid);
//            if(null!=point && null!=point.getId())
//            {
//                zbls.add(point.getId());//
//              // keyls.add(point.getUniformcode());//
//                bjnamemap.put(point.getUniformcode(),zbls.size()-1);
//            }
//        }
//
//    }



    public List<Map<String, Object>> findWtInfoList(String wpId) throws Exception {

        List<Map<String, Object>> vos=new ArrayList<>();

        if (StringUtils.notEmp(wpId)) {

            if (InitialRunner.wp_wtmap.containsKey(wpId)) {

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

                for(Windturbine wt:wtls)
                {
                    String id=wt.getId();


                    List<String> msls = new ArrayList<>();
                    List<String> zbls = new ArrayList<>();
                    List<String> keyls = new ArrayList<>();
                    List<String> uids = new ArrayList<>();
                    Map<String, Integer> namemap = new HashMap<>();

                    uids.add(Constant.TPOINT_WT_FDJLQFWD);//冷却风温度
                    uids.add(Constant.TPOINT_WT_FJGL);//有功功率
                    uids.add(Constant.TPOINT_WT_YYYW);//液压油温
                    uids.add(Constant.PCS_WD);//PSC温度


                    msls.add("FDJLQFWD");//冷却风温度
                    msls.add("FJGL");//有功功率
                    msls.add("YYYW");//液压油温
                    msls.add("PCS_WD");//PSC温度
                    if (wt.getWindpowerstationid().equals(QS_FDC)) {
                        uids.add(Constant.QSTPOINT_WT_U1YZWD);//U1绕组温度
                        uids.add(Constant.QSTPOINT_WT_V1YZWD);//V1绕组温度
                        uids.add(Constant.QSTPOINT_WT_W1YZWD);//W1绕组温度

                        msls.add("U1YZWD");//U1绕组温度
                        msls.add("V1YZWD");//V1绕组温度
                        msls.add("W1YZWD");//W1绕组温度
                    }else
                    {
                        uids.add(Constant.TPOINT_WT_U1YZWD);//U1绕组温度
                        uids.add(Constant.TPOINT_WT_V1YZWD);//V1绕组温度
                        uids.add(Constant.TPOINT_WT_W1YZWD);//W1绕组温度

                        msls.add("U1YZWD");//U1绕组温度
                        msls.add("V1YZWD");//V1绕组温度
                        msls.add("W1YZWD");//W1绕组温度
                    }
                    uids.add(Constant.TPOINT_WT_U2YZWD);//U2绕组温度
                    uids.add(Constant.TPOINT_WT_V2YZWD);//V2绕组温度
                    uids.add(Constant.TPOINT_WT_W2YZWD);//W2绕组温度
                    uids.add(Constant.TPOINT_WT_FDJZCAWD);//发电机轴承A温度
                    uids.add(Constant.TPOINT_WT_FDJZCBWD);//发电机轴承B温度
                    uids.add(Constant.TPOINT_WT_CLXWD);//齿轮箱油温
                    uids.add(Constant.TPOINT_WT_CLXSRZ1WD);//齿轮箱输入轴1温度
                    uids.add(Constant.TPOINT_WT_CLXSRZ2WD);//齿轮箱输入轴2温度
                    uids.add(Constant.TPOINT_WT_JCWD);//机舱温度
                    uids.add(Constant.TPOINT_WT_JCWWD);//机舱外温度
                    uids.add(Constant.TPOINT_WT_FDJHHWD);//发电机滑环温度


                    msls.add("U2YZWD");//U2绕组温度
                    msls.add("V2YZWD");//V2绕组温度
                    msls.add("W2YZWD");//W2绕组温度
                    msls.add("FDJZCAWD");//发电机轴承A温度
                    msls.add("FDJZCBWD");//发电机轴承B温度
                    msls.add("CLXWD");//齿轮箱油温
                    msls.add("CLXSRZ1WD");//齿轮箱输入轴1温度
                    msls.add("CLXSRZ2WD");//齿轮箱输入轴2温度
                    msls.add("JCWD");//机舱温度
                    msls.add("JCWWD");//机舱外温度
                    msls.add("FDJHHWD");//发电机滑环温度
                    
                    
                    initialpoint(id, zbls, keyls, namemap,uids,msls);
/*******************************************************************************************************************************************************/

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

                    zbmap.put("model", wt.getModelid());
                    zbmap.put("wpid", wt.getWindpowerstationid());
                    zbmap.put("pjid", wt.getProjectid());
                    zbmap.put("lnid", wt.getLineid());
                    zbmap.put("code", wt.getCode());
                    List<PointData> zblist = realApiUtil.getRealData(zbls);


                    if (!zblist.isEmpty() && zblist.size() == zbls.size() && keyls.size() == zbls.size()) {
/**************************************************************基础指标***********************************************************************************/



                        for(int i=0;i<keyls.size();i++)
                        {
                            if(namemap.containsKey(keyls.get(i)))
                            {
                                int num=namemap.get(keyls.get(i));
                                zbmap.put(keyls.get(i), MathUtil.twoBit(zblist.get(num).getPointValueInDouble()));//
                            }

                        }


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


                    } else {

                    }

                    for(String str:msls)
                    {
                        if(!zbmap.containsKey(str))
                        {
                            zbmap.put(str,null);
                        }
                    }
                    vos.add(zbmap);

                }
            }



        }

        return vos;
    }

	public List<Map<String, Object>> findInverterInfoList(String wpId) throws Exception {
		List<Map<String, Object>> vos = new ArrayList<>();
		if (StringUtils.notEmp(wpId) && InitialRunner.wp_wtmap.containsKey(wpId)) {
			List<Windturbine> wtls = InitialRunner.wp_wtmap.get(wpId);
			for (Windturbine wt : wtls) {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("model", wt.getModelid());
				map.put("wpid", wt.getWindpowerstationid());
				map.put("pjid", wt.getProjectid());
				map.put("lnid", wt.getLineid());
				map.put("code", wt.getCode());
				map.put("wtId", wt.getId());
				
				Line ln = InitialRunner.lnmap.get(wt.getLineid());
				map.put("lnname", ln.getName());
				List<String> zbls = new ArrayList<>();
				
				String[] codeName[] = { 
						{ "JSSSFS", "光照强度"}, 
						{ "AI130", "有功功率"}, 
						{ "AI067", "功率因数"}, 
						{ "AIG071", "机内温度"}, 
						{ "AIG072", "逆变效率" }, 
						{ "AI130", "功率"},
						{ "AIG104", "功率因数" }, 
						{ "RFDL", "日发电量" }, 
						{ "YFDL", "月发电量" }, 
						{ "NFDL", "年发电量" }, 
						{ "AIG064", "累计发电量" }
				};
				// 遍历定义码，获取测点Id集合
				Map<String, String> pointUniformMap = Maps.newHashMap();
				for (String[] str1 : codeName) {
					String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wt.getId(), str1[0]).getId();
					zbls.add(pointid);
					pointUniformMap.put(pointid, str1[0]);
				}
				// 获取测点值，与定义码绑定
				List<PointData> zblist = realApiUtil.getRealData(zbls);
//				Map<String, Object> uniformValueMap = Maps.newHashMap();
//				uniformValueMap.put("定义码对照", codeName);
				for (PointData p : zblist) {
					String ednaId = p.getEdnaId();
					Double val = MathUtil.twoBit(p.getPointValueInDouble());
					String uniformCode = pointUniformMap.get(ednaId);
					map.put(uniformCode, val);
				}
				vos.add(map);
			}
		}
		return vos;
	}

	public Object findInverterDI(String id) throws Exception {
		List<WindTurbineTestingPointDi> pointList = windTurbineTestingPointDiService.getWindTurbineTestingPointDi2List(id);
		Map<String, String> idName = Maps.newHashMap();
		List<String> pointids = Lists.newArrayList();
		for (WindTurbineTestingPointDi point : pointList) {
			idName.put(point.getId(), point.getName());
			pointids.add(point.getId());
		}
		List<PointData> realData = realApiUtil.getRealData(pointids);
		List<Object> onList = Lists.newArrayList();
		List<Object> allList = Lists.newArrayList();
		for (PointData p : realData) {
			Map<String, Object> row = Maps.newHashMap();
			row.put("id", p.getEdnaId());
			row.put("name", idName.get(p.getEdnaId()));
			row.put("value", p.getPointValueInDouble());
			allList.add(row);
			if (1 == p.getPointValueInDouble()) {
				onList.add(row);
			}
		}
		Map<String, Object> map = Maps.newHashMap();
		map.put("allList", allList);
		map.put("onList", onList);
		return map;
	}

	public List<Object> findInverterPowerCurve(String id) throws Exception {
		List<Object> list = Lists.newArrayList();
		Date now = new Date();
		Date date = DateUtil.beginOfDay(now);
		String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, "AI130").getId();
		while (date.before(now)) {
			Date begin = DateUtils.addMinutes(date, -30);
			List<PointData> histStat = realApiUtil.getHistStat(pointid, begin.getTime() / 1000, date.getTime() / 1000, 1L, 30L * 60, 0);
			Double val = 0D;
			if (histStat != null && !histStat.isEmpty() && histStat.get(0) != null) {
				val = histStat.get(0).getPointValueInDouble();
				val = MathUtil.twoBit(val);
			}
			list.add(val);
			date = DateUtils.addMinutes(date, 30);
		}
		return list;
	}

	public List<Object> findInverterInfo(String id) throws Exception {
		Map<String, Object> map = new HashMap<String, Object>();
		if (StringUtils.notEmp(id)) {
			if (InitialRunner.wtmap.containsKey(id)) {
				Windturbine wt = InitialRunner.wtmap.get(id);
				map.put("model", wt.getModelid());
				map.put("wpid", wt.getWindpowerstationid());
				map.put("pjid", wt.getProjectid());
				map.put("lnid", wt.getLineid());
				map.put("code", wt.getCode());
				Line ln = InitialRunner.lnmap.get(wt.getLineid());
				map.put("lnname", ln.getName());
				List<String> zbls = new ArrayList<>();
				String[] codeName[] = {
						{"AIG061", "交流电压","V"},
						{"AIG081", "直流电压","V"},
						{"AIG060", "交流电流","A"},
						{"AIG078", "直流电流","A"},
						{"AIG073", "电网频率","Hz"},
						{"AI130", "功率","W"},
						{"AIG104", "功率因数",""},
						{"RFDL", "日发电量","kwh"},//TODO 疑似 各厂发电量单位不統一
						{"YFDL", "月发电量","kwh"},
						{"NFDL", "年发电量","kwh"},
						{"AIG064", "累计发电量","kwh"},
						{"AIG071", "逆变器温度","℃"},
						{"AIG072", "效率",""},
						{"eyht", "累计二氧化碳减排量","kg"}
				};
				// 遍历定义码，获取测点Id集合
				Map<String, String> pointUniformMap = Maps.newHashMap();
				for (String[] str1 : codeName) {
					String pointid = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(id, str1[0]).getId();
					zbls.add(pointid);
					pointUniformMap.put(pointid, str1[0]);
				}
				// 获取测点值，与定义码绑定
				List<PointData> zblist = realApiUtil.getRealData(zbls);
				Map<String, Object> uniformValueMap = Maps.newHashMap();
				for (PointData p : zblist) {
					String ednaId = p.getEdnaId();
					Double val = MathUtil.twoBit(p.getPointValueInDouble());
					String uniformCode = pointUniformMap.get(ednaId);
					uniformValueMap.put(uniformCode, val);
				}
				// 遍历定义码，添加测点值、单位、名称
				List<Object> list = Lists.newArrayList();
				for (String[] str1 : codeName) {
					list.add(buildResult(str1[0], str1[1], uniformValueMap.get(str1[0]), str1[2]));
				}
				return list;
			}
		}
		return Lists.newArrayList();
	}

	private Map<String, Object> buildResult(String uniCode, String name, Object value, String unit) {
		Map<String, Object> map = Maps.newHashMap();
		map.put("uniCode", uniCode);
		map.put("name", name);
		map.put("value", value);
		map.put("unit", unit);
		return map;
	}

}
