Commit a109e694 by liuyang

2024-10-21

1.新增APP设备管理接口
parent a5c5fee2
......@@ -18,6 +18,21 @@ import java.util.stream.Collectors;
*/
public class ServiceHGSB010 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "设备监控",operType = "app查询",operDesc = "app查询设备状态")
public EiInfo queryAppBySbStatus(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("HGSB010.queryBySbStatus", params);
inInfo.set("result",result);
this.sbYes(inInfo, params);
this.sbNo(inInfo, params);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
return inInfo;
}
@OperationLogAnnotation(operModul = "设备监控",operType = "查询",operDesc = "查询设备状态")
public EiInfo queryBySbStatus(EiInfo inInfo) {
Map params = EiInfoUtils.getFirstRow(inInfo);
......@@ -95,4 +110,56 @@ public class ServiceHGSB010 extends ServiceEPBase {
inInfo.set(EiConstant.resultBlock, result);
return inInfo;
}
public void sbYes(EiInfo inInfo, Map params){
params.put("logValues", Arrays.asList("1", "2", "4"));
List<Map> result = (List<Map>) inInfo.get(EiConstant.resultBlock);
List<Map> list = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HGSB010.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);
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
Map map2 = new HashMap();
map2.put(map1.get("date"), map1.get("num"));
list1.add(map2);
}
map.put("data", list1);
list.add(map);
}
for (Map map: result) {
Map resultMap = list.stream().filter(m -> m.get("name").equals(map.get("deviceCode"))).findAny().get();
map.put("runTime", resultMap.get("data"));
}
}
public void sbNo(EiInfo inInfo, Map params){
params.put("logValues", Arrays.asList("3", "5", "6"));
List<Map> result = (List<Map>) inInfo.get(EiConstant.resultBlock);
List<Map> list = new ArrayList<>();
List<Map> listMap = DaoBase.getInstance().query("HGSB010.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);
List list1 = new ArrayList<>();
for (Map map1: listMap1.get(key)) {
Map map2 = new HashMap();
map2.put(map1.get("date"), map1.get("num"));
list1.add(map2);
}
map.put("data", list1);
list.add(map);
}
for (Map map: result) {
Map resultMap = list.stream().filter(m -> m.get("name").equals(map.get("deviceCode"))).findAny().get();
map.put("errerTime", resultMap.get("data"));
}
//inInfo.set("errerDate", listMap2);
//inInfo.set("errerTime", result);
}
}
......@@ -180,7 +180,7 @@
a.DEVICE_CODE as "deviceCode",
a.DEVICE_NAME as "deviceName",
a.DEVICE_MODEL as "deviceModel",
case when c.LOG_VALUE = 3 || c.LOG_VALUE = 5 || c.LOG_VALUE = 6 then '关机' else '开机' end as status
c.LOG_VALUE as "status"
from ${hggpSchema}.HGSB001 a
join ${hggpSchema}.HGSB010 c on a.DEVICE_CODE = c.EQUIPMENT_CODE
where
......
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