Commit 900ed303 authored by kiritoausna's avatar kiritoausna

2022-5.28

parent e094b47b
...@@ -77,4 +77,10 @@ public class WebMonitorChartController { ...@@ -77,4 +77,10 @@ public class WebMonitorChartController {
MonitorChartVo getmonbase = iWebMonitorChartService.getmonbasevisual(request); MonitorChartVo getmonbase = iWebMonitorChartService.getmonbasevisual(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK);
} }
@ApiOperation(value = "监测点模块信息_大屏使用")
@GetMapping("tailingno")
public ResponseEntity<Object> getvisual(HttpServletRequest request,String tailingno) {
MonitorChartVo getmonbase = iWebMonitorChartService.getmonbasevisual(request,tailingno);
return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK);
}
} }
...@@ -45,6 +45,13 @@ public interface IWebMonitorChartService extends IService<WebMonitorChart> { ...@@ -45,6 +45,13 @@ public interface IWebMonitorChartService extends IService<WebMonitorChart> {
*/ */
MonitorChartVo getmonbasevisual(HttpServletRequest request); MonitorChartVo getmonbasevisual(HttpServletRequest request);
/**
* 获取监测点信息
*
* @return
*/
MonitorChartVo getmonbasevisual(HttpServletRequest request,String tailno);
/** /**
* 根据当前尾矿库获取chart * 根据当前尾矿库获取chart
* *
......
...@@ -21,6 +21,7 @@ import me.zhengjie.utils.SecurityUtils; ...@@ -21,6 +21,7 @@ import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
...@@ -229,6 +230,102 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe ...@@ -229,6 +230,102 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe
return monitorChartVo; return monitorChartVo;
} }
@Override
public MonitorChartVo getmonbasevisual(HttpServletRequest request, String tailno) {
//获取设备的状态
List<HashMap<String, Object>> hashMaps = drybeachequipinforService.dryStateCount(request);
//获取所有设备的实时数据
List<RealDataVo> realData = (List<RealDataVo>) redisUtils.get("realData");
//获取设备的实时报警状态
List<HashMap<String, Object>> realalarm = tabAbnormalMapper.realalarm();
MonitorChartVo monitorChartVo = getsimplemonbase(request, tailno);
List<WebMonitorPointsVo> points = monitorChartVo.getPoints();
if (!ObjectUtils.isEmpty(points)) {
for (WebMonitorPointsVo point : points) {
List<HashMap<String, Object>> items = point.getItems();
if (!ObjectUtils.isEmpty(items)) {
for (HashMap<String, Object> item : items) {
String id1 = (String) item.get("id");
for (HashMap<String, Object> hashMap : hashMaps) {
String equipno = (String) hashMap.get("equipno");
if (equipno.equals(id1)) {
Long state = (Long) hashMap.get("state");
item.put("state", state);
break;
}
;
}
String id = (String) item.get("id");
for (HashMap<String, Object> map : realalarm) {
String equipno = (String) map.get("equipno");
if (equipno.equals(id)) {
item.put("alarmlevel", map.get("alarmlevel"));
break;
}
}
for (RealDataVo realDataVo : realData) {
if (realDataVo.getEquipno().equals(id)) {
List<Map> keys = (List<Map>) realDataVo.getKeys();
HashMap<String, Object> data = realDataVo.getData();
Set<String> strings = data.keySet();
for (Map key : keys) {
Set keyset1 = key.keySet();
for (Object o : keyset1) {
String s = (String) key.get(o.toString());
for (String string : strings) {
if (s.equals(string)) {
key.put(o.toString(), data.get(string));
}
}
}
}
item.put("realdata", keys);
}
}
}
}
}
}
return monitorChartVo;
}
public MonitorChartVo getsimplemonbase(HttpServletRequest request, String tailno) {
//构建返回结构
MonitorChartVo monitorChartVo = new MonitorChartVo();
//获取对应尾矿库的图片
WebMonitorChart webMonitorChart = webMonitorChartMapper.getpic(tailno);
HashMap<String, Integer> id1 = webMonitorChartMapper.getId(tailno);
if (id1 != null) {
Integer cid = id1.get("id");
monitorChartVo.setChart(webMonitorChart);
//获取对应检测项配置的监测点信息
List<WebMonitorPointsVo> webMonitorPointsVos = webMonitorPointsMapper.getbycid(cid);
if (webMonitorPointsVos != null) {
List<HashMap<String, Object>> links = webMonitorLinkMapper.getByChartId(cid);
if (links != null) {
//遍历监测信息
for (WebMonitorPointsVo webMonitorPointsVo : webMonitorPointsVos) {
List<HashMap<String, Object>> hashMaps = new ArrayList<>();
Integer id = webMonitorPointsVo.getId();
String guid = webMonitorPointsVo.getGuid();
//遍历监测点和设备关系
for (HashMap<String, Object> link : links) {
String pointid = (String) link.get("pointid");
if (pointid.equals(guid)) {
hashMaps.add(link);
}
}
webMonitorPointsVo.setItems(hashMaps);
}
}
monitorChartVo.setPoints(webMonitorPointsVos);
}
}
return monitorChartVo;
}
@Override @Override
public WebMonitorChart getbytailno(HttpServletRequest request) { public WebMonitorChart getbytailno(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
......
...@@ -30,14 +30,4 @@ public class ReadJsonFileUtil { ...@@ -30,14 +30,4 @@ public class ReadJsonFileUtil {
} }
return map; return map;
} }
public static void main(String[] args) {
/* //Map<String,String> result = ReadJsonFileUtil.getMap("dbdata");
for (Map.Entry map : result.entrySet()) {
System.out.println("key:" + map.getKey());
System.out.println("value:" + map.getValue());
}
}*/
}
} }
\ No newline at end of file
...@@ -388,10 +388,6 @@ public class ServiceUtil { ...@@ -388,10 +388,6 @@ public class ServiceUtil {
} }
public static void imgQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) { public static void imgQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) {
/* String sensorname = dataQueryCriteria.getSensorname();
if (sensorname != null) {
queryWrapper.eq("sensorname", sensorname);
}*/
String code = dataQueryCriteria.getCode(); String code = dataQueryCriteria.getCode();
if (code != null) { if (code != null) {
queryWrapper.eq("sensorid", code); queryWrapper.eq("sensorid", code);
...@@ -425,10 +421,6 @@ public class ServiceUtil { ...@@ -425,10 +421,6 @@ public class ServiceUtil {
} }
public static void rgImgQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) { public static void rgImgQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) {
/* String sensorname = dataQueryCriteria.getSensorname();
if (sensorname != null) {
queryWrapper.eq("sensorname", sensorname);
}*/
String code = dataQueryCriteria.getCode(); String code = dataQueryCriteria.getCode();
if (code != null) { if (code != null) {
queryWrapper.eq("sensorid", code); queryWrapper.eq("sensorid", code);
......
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