Commit d6d4e1d1 by liuyang

2024-10-19 设备驾驶舱接口

parent 66491520
......@@ -346,4 +346,87 @@ public class ServiceHPBI003 extends ServiceBase {
return inInfo;
}
/**
* 查询报设备状态
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "设备监控",operType = "查询",operDesc = "查询设备状态")
public EiInfo queryBySbStatus(EiInfo inInfo) {
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
List<Map> result = DaoBase.getInstance().query("HPBI003.queryBySbStatus", params);
inInfo.set("result",result);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
return inInfo;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public EiInfo querySbYes(EiInfo inInfo){
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
params.put("logValues", Arrays.asList("1", "2", "4"));
List<Map> result = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HPBI003.queryBySbYes", params, 0,100);
List listMap2 = listMap.stream().map(map -> map.get("date")).sorted().distinct().collect(Collectors.toList());
Map<Object, List<Map>> listMap1 = listMap.stream().collect(Collectors.groupingBy(m -> m.get("deviceCode")));
for (Object key: listMap1.keySet()) {
Map<Object, Object> map = new HashMap<>();
map.put("name", key);
map.put("type", "line");
map.put("stack", "Total");
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
list1.add(map1.get("num"));
}
map.put("data", list1);
result.add(map);
}
inInfo.set("date", listMap2);
inInfo.set("name", listMap1.keySet());
inInfo.set(EiConstant.resultBlock, result);
return inInfo;
}
/**
* 近7日设备运行时长
* @param inInfo
* @return
*/
public EiInfo querySbNo(EiInfo inInfo){
Map params = EiInfoUtils.getFirstRow(inInfo);
if (params.containsKey("date")){
params.put("date", DateUtils.formatShort(params.get("date")));
}
params.put("logValues", Arrays.asList("3", "5", "6"));
List<Map> result = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HPBI003.queryBySbYes", params, 0,100);
List listMap2 = listMap.stream().map(map -> map.get("date")).sorted().distinct().collect(Collectors.toList());
Map<Object, List<Map>> listMap1 = listMap.stream().collect(Collectors.groupingBy(m -> m.get("deviceCode")));
for (Object key: listMap1.keySet()) {
Map<Object, Object> map = new HashMap<>();
map.put("name", key);
map.put("type", "line");
map.put("stack", "Total");
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
list1.add(map1.get("count"));
}
map.put("data", list1);
result.add(map);
}
inInfo.set("date", listMap2);
inInfo.set("name", listMap1.keySet());
inInfo.set(EiConstant.resultBlock, result);
return inInfo;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment