whyclxw
3 天以前 d71e557ab43694ab40dc968f440a63ff97ea794c
src/main/java/com/whyc/service/AlmAnalysisParamService.java
@@ -68,9 +68,12 @@
            return new Response().set(1,false,"无对应分析属性");
        }else{
            //分组查看需要查询电源/电池实时表的哪些数据
            Map<String,  Map<String,Integer>> groupmap=groupPwrAndBatt(almAnalysisParam);
            Map<String,Integer> battMap=groupmap.get("batt");
            Map<String,Integer> pwrMap=groupmap.get("pwr");
            Map<String,  Map<String,Object>> groupmap=groupPwrAndBatt(almAnalysisParam);
            Map<String,Object> battMap=groupmap.get("batt");
            Map<String,Object> pwrMap=groupmap.get("pwr");
            Map<String,Object> mainMap=groupmap.get("main");
            mainMap.put("pwr",pwrMap.size());
            mainMap.put("batt",battMap.size());
            if(battgroupId!=null){
                if(battMap!=null&&battMap.size()>0){
                    List battHislist=getBattRealData(battgroupId,monthTimeList,battMap);
@@ -83,21 +86,24 @@
                    map.put("pwr",pwrHislist);
                }
            }
            return new Response().setII(1,true, map,"预警分析管理-电源主属性和分析属性");
            return new Response().setIIII(1,true, map,mainMap,almAnalysisParam,"预警分析管理-电源主属性和分析属性");
        }
    }
    //分组查看需要查询电源/电池实时表的哪些数据
    private  Map<String,  Map<String,Integer>> groupPwrAndBatt(AlmAnalysisParam almAnalysisParam) {
        Map<String,  Map<String,Integer>> map = new HashMap<>();
        Map<String,Integer> battMap=new HashMap<>();
        Map<String,Integer> pwrMap=new HashMap<>();
    private  Map<String,  Map<String,Object>> groupPwrAndBatt(AlmAnalysisParam almAnalysisParam) {
        Map<String,  Map<String,Object>> map = new HashMap<>();
        Map<String,Object> battMap=new HashMap<>();
        Map<String,Object> pwrMap=new HashMap<>();
        Map<String,Object> mainMap=new HashMap<>();
        if(almAnalysisParam.getMainFieldType()==1||almAnalysisParam.getMainFieldType()==2||almAnalysisParam.getMainFieldType()==3){
            if(almAnalysisParam.getMainField()!=null||almAnalysisParam.getMainField().length()>0){
                pwrMap.put(almAnalysisParam.getMainField(),almAnalysisParam.getMainFieldType());
                mainMap.put("main","pwr");
            }
        }else{
            if(almAnalysisParam.getMainField()!=null||almAnalysisParam.getMainField().length()>0){
                battMap.put(almAnalysisParam.getMainField(),almAnalysisParam.getMainFieldType());
                mainMap.put("main","batt");
            }
        }
        if(almAnalysisParam.getMinorField1Type()==1||almAnalysisParam.getMinorField1Type()==2||almAnalysisParam.getMinorField1Type()==3){
@@ -138,10 +144,11 @@
        }
        map.put("pwr",pwrMap);
        map.put("batt",battMap);
        map.put("main",mainMap);
        return map;
    }
    //连接池获取电源历史实时数据
    public List getPwrRealData(Integer powerId,List<List<Date>> monthTimeList,Map<String,Integer> pwrMap) throws InterruptedException {
    public List getPwrRealData(Integer powerId,List<List<Date>> monthTimeList,Map<String,Object> pwrMap) throws InterruptedException {
        List<ResAnalysis> dataList = new LinkedList<>();
        ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor();
        CountDownLatch latch = new CountDownLatch(monthTimeList.size());
@@ -171,7 +178,7 @@
    }
    //电池告警点击具体告警信息查看从告警开始时间到现在的历史实时数据
    public List getBattRealData(Integer battgroupId, List<List<Date>> monthTimeList,Map<String,Integer> battMap) throws ParseException, InterruptedException {
    public List getBattRealData(Integer battgroupId, List<List<Date>> monthTimeList,Map<String,Object> battMap) throws ParseException, InterruptedException {
        List<ResAnalysis> dataList = new LinkedList<>();
        ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor();
        CountDownLatch latch = new CountDownLatch(monthTimeList.size());
@@ -218,9 +225,12 @@
        //将属性拷贝至almAnalysisParam中
        copyProperties(almAnalysisParam,res);
        //分组查看需要查询电源/电池实时表的哪些数据
        Map<String,  Map<String,Integer>> groupmap=groupPwrAndBatt(almAnalysisParam);
        Map<String,Integer> battMap=groupmap.get("batt");
        Map<String,Integer> pwrMap=groupmap.get("pwr");
        Map<String,  Map<String,Object>> groupmap=groupPwrAndBatt(almAnalysisParam);
        Map<String,Object> battMap=groupmap.get("batt");
        Map<String,Object> pwrMap=groupmap.get("pwr");
        Map<String,Object> mainMap=groupmap.get("main");
        mainMap.put("pwr",pwrMap.size());
        mainMap.put("batt",battMap.size());
        if(res.getBattgroupId()!=null){
            if(battMap!=null&&battMap.size()>0){
                List battHislist=getBattRealData(res.getBattgroupId(),monthTimeList,battMap);
@@ -233,7 +243,7 @@
                map.put("pwr",pwrHislist);
            }
        }
        return new Response().setII(1,true, map,"预警分析管理-切换时间间隔和副属性");
        return new Response().setIIII(1,true, map,mainMap,almAnalysisParam,"预警分析管理-切换时间间隔和副属性");
    }
    //将属性拷贝至almAnalysisParam中
    private void copyProperties(AlmAnalysisParam almAnalysisParam, AnalysisChangeRes res) {