change - 设备监控页面监控单元模块参数配置修改

main
wenjy 3 years ago
parent c4e0a7c130
commit f7d1233057

@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.json.JsonUtils; import com.ruoyi.common.json.JsonUtils;
import com.ruoyi.system.domain.BaseDeviceParam;
import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.system.domain.BaseSensorInfo; import com.ruoyi.system.domain.BaseSensorInfo;
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto; import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
import com.ruoyi.system.domain.dto.BaseSensorInfoDto; import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
import com.ruoyi.system.service.IBaseDeviceParamService;
import com.ruoyi.system.service.IBaseMonitorunitInfoService; import com.ruoyi.system.service.IBaseMonitorunitInfoService;
import com.ruoyi.system.service.IBaseSensorInfoService; import com.ruoyi.system.service.IBaseSensorInfoService;
import lombok.Data; import lombok.Data;
@ -39,6 +41,9 @@ public class DeviceMonitorController {
@Autowired private StringRedisTemplate redisTemplate; @Autowired private StringRedisTemplate redisTemplate;
@Autowired
private IBaseDeviceParamService baseDeviceParamService;
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/** /**
@ -119,8 +124,15 @@ public class DeviceMonitorController {
@ResponseBody @ResponseBody
public String getMonitorUnitInfo(String monitorunitId) { public String getMonitorUnitInfo(String monitorunitId) {
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos = List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList( baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo(monitorunitId));
new BaseMonitorunitInfo(monitorunitId)); baseMonitorunitInfoDtos.forEach(x->{
List<BaseDeviceParam> baseDeviceParams = baseDeviceParamService.selectBaseDeviceParamList(new BaseDeviceParam(x.getMonitorunitId(), 0L));
BaseDeviceParam[] deviceParams = new BaseDeviceParam[baseDeviceParams.size()];
for (int i = 0; i < baseDeviceParams.size(); i++){
deviceParams[i] = baseDeviceParams.get(i);
}
x.setDeviceParams(deviceParams);
});
return JSONArray.toJSONString(baseMonitorunitInfoDtos); return JSONArray.toJSONString(baseMonitorunitInfoDtos);
} }

@ -416,12 +416,12 @@
</div> </div>
<div class="sensor-Text" id="sensor-text"> <div class="sensor-Text" id="sensor-text">
<p>设备编号:<span>10kv 主变压器001</span></p> <!--<p>设备编号:<span>10kv 主变压器001</span></p>
<p>设备型号:<span>SC(B)10型干式电力变压器</span></p> <p>设备型号:<span>SC(B)10型干式电力变压器</span></p>
<p>启用时间:<span>2020年1月20日</span></p> <p>启用时间:<span>2020年1月20日</span></p>
<p>所属变电站:<span>新疆某某变电站</span></p> <p>所属变电站:<span>新疆某某变电站</span></p>
<p>测试参数-1<span>xxxxx</span></p> <p>测试参数-1<span>xxxxx</span></p>
<p>测试参数-2<span>xxxxx</span></p> <p>测试参数-2<span>xxxxx</span></p>-->
</div> </div>
@ -469,7 +469,7 @@
multiSelect: $('#chk-select-multi').is(':checked'), multiSelect: $('#chk-select-multi').is(':checked'),
onNodeSelected: function (event, node) { onNodeSelected: function (event, node) {
$('#selectable-output').prepend('<p>' + node.text + ' was selected</p>'); $('#selectable-output').prepend('<p>' + node.text + ' was selected</p>');
if(node.nodeId > 0){ if (node.nodeId > 0) {
monitorUnitModule(node.href); monitorUnitModule(node.href);
sensorCollectionRefresh(node.href); sensorCollectionRefresh(node.href);
} }
@ -500,10 +500,10 @@
<script type="text/javascript"> <script type="text/javascript">
$(() => { $(() => {
let unitId = getParams("id"); let unitId = getParams("id");
if( unitId != null) { if (unitId != null) {
monitorUnitModule(unitId) monitorUnitModule(unitId)
sensorCollectionRefresh(unitId); sensorCollectionRefresh(unitId);
}else{ } else {
$.ajax({ $.ajax({
url: "/iot/deviceMonitor/getFirstMonitorUnit", url: "/iot/deviceMonitor/getFirstMonitorUnit",
type: "get", type: "get",
@ -523,15 +523,19 @@
type: "get", type: "get",
dataType: 'JSON', dataType: 'JSON',
success: (res) => { success: (res) => {
console.log("监控单元信息:" + res[0].deviceParams)
$('#transformer-model').html(""); $('#transformer-model').html("");
let e = '<img src="' + res[0].monitorunitImage + '" >'; let e = '<img src="' + res[0].monitorunitImage + '" >';
$("#transformer-model").append(e); $("#transformer-model").append(e);
$('#sensor-text').html(""); $('#sensor-text').html("");
let html = '<p>设备编号:<span>' + res[0].monitorunitName + '</span></p>\n' + let html = '<p>设备编号:<span>' + res[0].monitorunitName + '</span></p>';
' <p>设备型号:<span>' + res[0].monitorunitName + '</span></p>\n' + if(res[0].deviceParams.length > 0){
' <p>启用时间:<span>' + formatter(res[0].createTime, "yyyy-MM-dd") + '</span></p>\n' + res[0].deviceParams.map(x => {
' <p>所属变电站:<span>' + res[0].substationName + '</span></p>'; html += '<p>' + x.paramTitle + '<span>' + x.paramValue + '</span></p>';
});
}
html += ' <p>所属变电站:<span>' + res[0].substationName + '</span></p>';
$("#sensor-text").append(html); $("#sensor-text").append(html);
}, },
error: () => { error: () => {
@ -585,10 +589,10 @@
console.log(result); console.log(result);
switch (result.type) { switch (result.type) {
case "CMD_REPORTDATA": case "CMD_REPORTDATA":
reportData(result); reportData(result);
break; break;
case "CMD_SENSORSTATUS": case "CMD_SENSORSTATUS":
reportStatus(result); reportStatus(result);
break; break;
default: default:
break; break;
@ -634,7 +638,7 @@
document.getElementById(result.sensorId + "collectTime").innerHTML = result['collectTime'] == null ? "-" : collectTime(result['collectTime']); document.getElementById(result.sensorId + "collectTime").innerHTML = result['collectTime'] == null ? "-" : collectTime(result['collectTime']);
} }
//上报设备状态 //上报设备状态
const reportStatus = function(result) { const reportStatus = function (result) {
document.getElementById(result.sensorId + "sensorStatus").innerHTML = result['sensorStatus'] == null ? "-" : sensorStatus(result['sensorStatus']); document.getElementById(result.sensorId + "sensorStatus").innerHTML = result['sensorStatus'] == null ? "-" : sensorStatus(result['sensorStatus']);
} }
</script> </script>

Loading…
Cancel
Save