| | |
| | | import java.time.temporal.TemporalAdjusters;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Collection;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | |
| | | import java.util.concurrent.ExecutorCompletionService;
|
| | | import java.util.concurrent.ExecutorService;
|
| | | import java.util.concurrent.Executors;
|
| | | import java.util.stream.Collector;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | Map<String, List<Object>> resultMap = new HashMap<String, List<Object>>();
|
| | | List<Map<String, Object>> list = JSON.parseObject((String)parameters.get("items"), new TypeReference<List<Map<String, Object>>>() {});
|
| | | parameters.remove("items");
|
| | | Map<String, Object> timeType = JSON.parseObject((String)parameters.get("timeType"), new TypeReference<Map<String, Object>>() {});
|
| | | parameters.remove("timeType");
|
| | | parameters.putAll(timeType);
|
| | | |
| | | ExecutorService threadPool = Executors.newCachedThreadPool();
|
| | | CompletionService<Map<String, List<Object>>> cs = new ExecutorCompletionService<Map<String, List<Object>>>(threadPool);
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public List<Map<String, Object>> getMonitorPointOrDeviceAvgData(Map<String, Object> parameters) throws Exception {
|
| | | List<Map<String, Object>> resul ;
|
| | | List<Map<String, Object>> resultList ;
|
| | |
|
| | | String type = (String) parameters.get("type");
|
| | | String time = (String) parameters.get("time");
|
| | |
| | | //sensorKeys.clear();
|
| | | // 监控点平均值
|
| | | if (!parameters.containsKey("mac")) {
|
| | | resul = new ArrayList<Map<String,Object>>();
|
| | | resultList = new ArrayList<Map<String,Object>>();
|
| | | Integer monitorPointId = Integer.valueOf(parameters.get("monitorPoint").toString());
|
| | | List<Map<String, Object>> deviceVersions = deviceMapper.getDeviceVersionIdByMonitorPoint(monitorPointId);
|
| | | ExecutorService threadPool = Executors.newCachedThreadPool();
|
| | |
| | | for (String sensorKey : value.keySet()) {
|
| | | resultMap.put(sensorKey, value.get(sensorKey)[2]);
|
| | | }
|
| | | resul.add(resultMap);
|
| | | resultList.add(resultMap);
|
| | | }
|
| | | // 设备 平均值
|
| | | } else {
|
| | |
| | | parameters.put("sensorKeyColumn", sensorKeyColumn);
|
| | |
|
| | | }
|
| | | resul = historyMinutelyMapper.getMonitorPointOrDeviceAvgData(parameters);
|
| | | resultList = historyMinutelyMapper.getMonitorPointOrDeviceAvgData(parameters);
|
| | | }
|
| | | return resul;
|
| | | return resultList;
|
| | | }
|
| | |
|
| | | private String getSensorKeyColumnBySensors(List<Map<String, Object>> sensors,Map<String, Object> parameters) {
|
| | |
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public List<List<PairData>> queryLineChartDateByCrieria(LineChartCriteria lineChartCriteria){
|
| | | String sensorKey = lineChartCriteria.getSensorKey();
|
| | | TimePeriod timePeriod = lineChartCriteria.getTimePeriod();
|
| | | List<DataCondition> dataConditionList = lineChartCriteria.getDataConditions();
|
| | | List<List<PairData>> list = new ArrayList<>();
|
| | | dataConditionList.forEach(item -> {
|
| | | List<PairData> pairDataList = queryOneLineChartDateByCrieria(sensorKey,timePeriod,item);
|
| | | list.add(pairDataList);
|
| | | });
|
| | | return list;
|
| | | public Map<String, List<List<PairData>>> queryLineChartDateByCrieria(LineChartCriteria lineChartCriteria){
|
| | | Map<String,List<List<PairData>>> listMap = new HashMap<>();
|
| | | for(String sensorKey:lineChartCriteria.getSensorKeys()){
|
| | | TimePeriod timePeriod = lineChartCriteria.getTimePeriod();
|
| | | List<DataCondition> dataConditionList = lineChartCriteria.getDataConditions();
|
| | | List<List<PairData>> list = new ArrayList<>();
|
| | | dataConditionList.forEach(item -> {
|
| | | List<PairData> pairDataList = queryOneLineChartDateByCrieria(sensorKey,timePeriod,item);
|
| | | list.add(pairDataList);
|
| | | });
|
| | | listMap.put(sensorKey,list);
|
| | | }
|
| | |
|
| | | return listMap;
|
| | | }
|
| | |
|
| | | /**
|