Commit b696dbfb by 宋祥

Merge remote-tracking branch 'origin/dev-sx' into dev-sx

parents a634797c c97cf03d
package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/10/21
* @description
*/
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);
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);
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("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);
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("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);
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;
}
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);
}
}
......@@ -20,7 +20,7 @@
</div>
<div style="width: 79%;margin-left: 3.2vw;height: 28vh;margin-top: 2vh">
<div class="content-device-img img">
<div class="title-content-device img">库库 1283</div>
<div class="title-content-device img">品库</div>
</div>
<img src="../../hggp/common/img/architectureDiagram.png" style="width: 100%;height: 100%" alt/>
</div>
......
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