whyclxw
14 小时以前 05b98aee3034e9fd06ca7018999796b1490bed36
src/main/java/com/whyc/service/SubTablePageInfoService.java
@@ -700,7 +700,7 @@
        return list;
    }
    //实时数据数据曲线统计-交流单元
    public List<ResRealDataAc> getPwrHisAcData(String tableName, Integer granularity, Date recordDatetime, Date recordDatetime1
    public List<ResRealDataAc> getSticRealAcData(String tableName, Integer granularity, Date recordDatetime, Date recordDatetime1
            , Integer maxRecordNum, Integer minRecordNum, Map<String, List<String>> propertyInfo) {
        String  propertyStr = propertyInfo.values().stream()
                .flatMap(List::stream)
@@ -879,7 +879,7 @@
    }
    //电池数据历史实时处理
    public List<RealDateDTO> getBattRealDataHis(BattRealdataId realdata, int granularity,Integer maxRecordNum,Integer minRecordNum) {
        String sql=" select record_time, group_vol, online_vol,group_curr,load_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num  " +
        String sql=" select distinct record_time, group_vol, online_vol,group_curr,load_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num  " +
                "               from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " +
                "               where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " +
                "               and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' "+
@@ -906,7 +906,42 @@
        });
        return list;
    }
    //实时数据统计曲线--核容设备
    public List<ResRealDataAc> getSticRealHrData(BattRealdataId realdata, Integer granularity, Integer maxRecordNum, Integer minRecordNum, Map<String, List<String>> propertyInfo) {
        String  propertyStr = propertyInfo.values().stream()
                .flatMap(List::stream)
                .collect(Collectors.joining(","));
        String sql=" select distinct record_time, "+propertyStr+" "+
                "               from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " +
                "               where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " +
                "               and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' "+
                "               and (record_num-"+minRecordNum+")%"+granularity+"=0 or record_num="+maxRecordNum+" or record_num="+minRecordNum ;
        List<ResRealDataAc> list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                List<ResRealDataAc> list=new ArrayList<>();
                while (rs.next()){
                    ResRealDataAc data=new ResRealDataAc();
                    data.setRecordDatetime(rs.getTimestamp("record_time"));
                    Map<String,Map<String,Float>>dataMap=new HashMap<>();
                    for (Map.Entry<String, List<String>> entry : propertyInfo.entrySet()) {
                        String key = entry.getKey();
                        List<String> valueList = entry.getValue();
                        Map<String,Float> propertyMap=new HashMap<>();
                        for (String value : valueList) {
                            Float propertyValue = rs.getFloat(value);
                            propertyMap.put(value,propertyValue);
                        }
                        dataMap.put(key,propertyMap);
                    }
                    data.setPropertyInfo(dataMap);
                    list.add(data);
                }
                return list;
            }
        });
        return list;
    }
    //系统概览获取前N笔核容设备信息
    public List<RealDateDTO> getBattDevData100(String tableName, Integer granularity, Date recordDatetime, Date recordDatetime1,Integer maxRecordNum,Integer minRecordNum) {
        String sql=" select record_time, group_vol, online_vol,group_curr, load_curr,record_num  " +
@@ -1139,4 +1174,5 @@
        });
        return list;
    }
}