1、首页增加无GGA统计
2、标签显示:编号+工点+告警原因
This commit is contained in:
parent
59506c7b1d
commit
c67372710f
@ -21,6 +21,14 @@ public interface GnssStatusMapper extends MPJBaseMapper<GnssStatus> {
|
|||||||
@Select({"select s.*, d.devicetype, d.group_id, d.name from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.state <> 0"})
|
@Select({"select s.*, d.devicetype, d.group_id, d.name from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.state <> 0"})
|
||||||
List<GnssStatusJoin> queryOnline();
|
List<GnssStatusJoin> queryOnline();
|
||||||
|
|
||||||
|
@Select({"select s.*, d.devicetype, d.group_id, d.name from gnssstatus s ,gnssdevices d where " +
|
||||||
|
"s.deviceid=d.deviceid and d.tenantid<>0 and d.opmode<>2"})
|
||||||
|
List<GnssStatusJoin> queryDeployed();
|
||||||
|
|
||||||
|
@Select({"select s.*, d.devicetype, d.group_id, d.name from gnssstatus s ,gnssdevices d where " +
|
||||||
|
"s.deviceid=d.deviceid and d.tenantid = #{tenantid} and d.opmode<>2"})
|
||||||
|
List<GnssStatusJoin> queryDeployedByTenant(int tenantid);
|
||||||
|
|
||||||
// 需要关联设备类型
|
// 需要关联设备类型
|
||||||
@Select({"select s.*, d.devicetype from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.deviceid = #{deviceId}"})
|
@Select({"select s.*, d.devicetype from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.deviceid = #{deviceId}"})
|
||||||
GnssStatusJoin queryByDeviceId(String deviceId);
|
GnssStatusJoin queryByDeviceId(String deviceId);
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package com.imdroid.beidou.controller;
|
package com.imdroid.beidou.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.github.yulichang.query.MPJQueryWrapper;
|
|
||||||
import com.imdroid.beidou.entity.Tenant;
|
import com.imdroid.beidou.entity.Tenant;
|
||||||
import com.imdroid.secapi.dto.*;
|
import com.imdroid.secapi.dto.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -10,6 +8,7 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@ -34,60 +33,46 @@ public class IndexController extends BasicController{
|
|||||||
@RequestMapping("/page/device_overview")
|
@RequestMapping("/page/device_overview")
|
||||||
public String deviceOverview(Model m, HttpSession session) {
|
public String deviceOverview(Model m, HttpSession session) {
|
||||||
initModel(m, session);
|
initModel(m, session);
|
||||||
Long deviceDeployedNum;
|
int deviceDeployedNum;
|
||||||
int deviceOfflineNum=0;
|
int deviceOfflineNum=0;
|
||||||
int warning1Num=0;//一般告警
|
int warning1Num=0;//一般告警
|
||||||
int warning2Num=0;//严重告警
|
int warning2Num=0;//严重告警
|
||||||
|
int noGGA = 0;
|
||||||
|
|
||||||
QueryWrapper<GnssDevice> deviceQueryWrapper = new QueryWrapper<>();
|
List<GnssStatusJoin> deviceList;
|
||||||
List<GnssStatus> deviceList;
|
|
||||||
if(tenantId == Tenant.SAAS_PROVIDER_ID){
|
if(tenantId == Tenant.SAAS_PROVIDER_ID){
|
||||||
// 统计所有企业设备
|
deviceList = statusMapper.queryDeployed();
|
||||||
deviceQueryWrapper.ne("tenantid", tenantId);
|
|
||||||
deviceQueryWrapper.ne("opmode", GnssDevice.OP_MODE_UNUSE);
|
|
||||||
// 设备数量
|
|
||||||
deviceDeployedNum = gnssDeviceMapper.selectCount(deviceQueryWrapper);
|
|
||||||
|
|
||||||
MPJQueryWrapper<GnssStatus> query = new MPJQueryWrapper<GnssStatus>()
|
|
||||||
.selectAll(GnssStatus.class)
|
|
||||||
.leftJoin("gnssdevices d on t.deviceid = d.deviceid")
|
|
||||||
.ne("t.tenantid", tenantId)
|
|
||||||
.ne("d.opmode", GnssDevice.OP_MODE_UNUSE)
|
|
||||||
.isNotNull("t.latitude")
|
|
||||||
.isNotNull("t.longitude")
|
|
||||||
.orderByDesc("t.warning");
|
|
||||||
|
|
||||||
deviceList = statusMapper.selectList(query);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// 统计本企业设备
|
deviceList = statusMapper.queryDeployedByTenant(tenantId);
|
||||||
// 统计所有企业设备
|
|
||||||
deviceQueryWrapper.eq("tenantid", tenantId);
|
|
||||||
deviceQueryWrapper.ne("opmode", GnssDevice.OP_MODE_UNUSE);
|
|
||||||
// 设备数量
|
|
||||||
deviceDeployedNum = gnssDeviceMapper.selectCount(deviceQueryWrapper);
|
|
||||||
|
|
||||||
MPJQueryWrapper<GnssStatus> query = new MPJQueryWrapper<GnssStatus>()
|
|
||||||
.selectAll(GnssStatus.class)
|
|
||||||
.leftJoin("gnssdevices d on t.deviceid = d.deviceid")
|
|
||||||
.eq("t.tenantid", tenantId)
|
|
||||||
.ne("d.opmode", GnssDevice.OP_MODE_UNUSE)
|
|
||||||
.isNotNull("t.latitude")
|
|
||||||
.isNotNull("t.longitude")
|
|
||||||
.orderByDesc("t.warning");
|
|
||||||
deviceList = statusMapper.selectList(query);
|
|
||||||
}
|
}
|
||||||
|
deviceDeployedNum = deviceList.size();
|
||||||
|
|
||||||
for(GnssStatus status:deviceList){
|
//for(GnssStatusJoin status:deviceList){遍历删除异常
|
||||||
|
Iterator<GnssStatusJoin> iterator = deviceList.iterator();
|
||||||
|
while(iterator.hasNext()){
|
||||||
|
GnssStatusJoin status=iterator.next();
|
||||||
if(status.getState() == GnssStatus.STATE_OFFLINE) deviceOfflineNum++;
|
if(status.getState() == GnssStatus.STATE_OFFLINE) deviceOfflineNum++;
|
||||||
if(status.getWarning() == WarningCfg.LEVEL_1) warning1Num++;
|
if(status.getWarning() == WarningCfg.LEVEL_1) warning1Num++;
|
||||||
else if(status.getWarning() == WarningCfg.LEVEL_2) warning2Num++;
|
else if(status.getWarning() == WarningCfg.LEVEL_2) warning2Num++;
|
||||||
|
|
||||||
|
// 剔除无经纬度的对象,不在地图上显示
|
||||||
|
if(status.getLatitude()==null || status.getLongitude()==null){
|
||||||
|
noGGA++;
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// 地图上显示工点名称
|
||||||
|
if(status.getName()!=null){
|
||||||
|
status.setDeviceid(status.getDeviceid() +" "+status.getName());
|
||||||
|
}
|
||||||
// 地图上显示告警原因
|
// 地图上显示告警原因
|
||||||
if(status.getWarning()!=WarningCfg.LEVEL_0){
|
if(status.getWarning()!=WarningCfg.LEVEL_0){
|
||||||
List<String> warningInfo= WarningCfg.parseCode(status.getWarningcode());
|
List<String> warningInfo= WarningCfg.parseCode(status.getWarningcode());
|
||||||
status.setDeviceid(status.getDeviceid() +" "+warningInfo);
|
status.setDeviceid(status.getDeviceid() +" "+warningInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m.addAttribute("deviceDeployedNum", deviceDeployedNum);
|
m.addAttribute("deviceDeployedNum", deviceDeployedNum);
|
||||||
m.addAttribute("deviceOnlineNum", deviceDeployedNum-deviceOfflineNum);
|
m.addAttribute("deviceOnlineNum", deviceDeployedNum-deviceOfflineNum);
|
||||||
@ -95,6 +80,7 @@ public class IndexController extends BasicController{
|
|||||||
m.addAttribute("warning1Num", warning1Num);
|
m.addAttribute("warning1Num", warning1Num);
|
||||||
m.addAttribute("warning2Num", warning2Num);
|
m.addAttribute("warning2Num", warning2Num);
|
||||||
m.addAttribute("warningTotalNum", warning1Num+warning2Num);
|
m.addAttribute("warningTotalNum", warning1Num+warning2Num);
|
||||||
|
m.addAttribute("noGGA", noGGA);
|
||||||
m.addAttribute("deviceList", deviceList);
|
m.addAttribute("deviceList", deviceList);
|
||||||
|
|
||||||
return "/page/device_overview";
|
return "/page/device_overview";
|
||||||
|
|||||||
@ -78,6 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="layui-col-xs3 layui-col-md4">
|
<div class="layui-col-xs3 layui-col-md4">
|
||||||
掉线数 <a style="color: #bd3004" th:text="${deviceOfflineNum}">0</a><br>
|
掉线数 <a style="color: #bd3004" th:text="${deviceOfflineNum}">0</a><br>
|
||||||
|
<div th:if="${noGGA>0}">无GGA <a style="color: #e7be1d" th:text="${noGGA}">0</a><br></div>
|
||||||
装机量 <a style="color: #000000" th:text="${deviceDeployedNum}">2020</a>
|
装机量 <a style="color: #000000" th:text="${deviceDeployedNum}">2020</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -108,7 +108,8 @@
|
|||||||
{field: 'devicetime', title: '设备时间'},
|
{field: 'devicetime', title: '设备时间'},
|
||||||
{field: 'state', title: '状态',templet: '#stateTrans'},
|
{field: 'state', title: '状态',templet: '#stateTrans'},
|
||||||
{field: 'warning', title: '告警',templet: '#warningTrans'},
|
{field: 'warning', title: '告警',templet: '#warningTrans'},
|
||||||
{field: 'location', title: '位置'},
|
{field: 'longitude', title: '经度'},
|
||||||
|
{field: 'latitude', title: '维度'},
|
||||||
{field: 'voltage', title: '电压'},
|
{field: 'voltage', title: '电压'},
|
||||||
{field: 'temperature', title: '温度'},
|
{field: 'temperature', title: '温度'},
|
||||||
{field: 'humidity', title: '湿度'},
|
{field: 'humidity', title: '湿度'},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user