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"})
|
||||
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}"})
|
||||
GnssStatusJoin queryByDeviceId(String deviceId);
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
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.secapi.dto.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -10,6 +8,7 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@ -34,58 +33,44 @@ public class IndexController extends BasicController{
|
||||
@RequestMapping("/page/device_overview")
|
||||
public String deviceOverview(Model m, HttpSession session) {
|
||||
initModel(m, session);
|
||||
Long deviceDeployedNum;
|
||||
int deviceDeployedNum;
|
||||
int deviceOfflineNum=0;
|
||||
int warning1Num=0;//一般告警
|
||||
int warning2Num=0;//严重告警
|
||||
int noGGA = 0;
|
||||
|
||||
QueryWrapper<GnssDevice> deviceQueryWrapper = new QueryWrapper<>();
|
||||
List<GnssStatus> deviceList;
|
||||
List<GnssStatusJoin> deviceList;
|
||||
if(tenantId == Tenant.SAAS_PROVIDER_ID){
|
||||
// 统计所有企业设备
|
||||
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);
|
||||
deviceList = statusMapper.queryDeployed();
|
||||
}
|
||||
else{
|
||||
// 统计本企业设备
|
||||
// 统计所有企业设备
|
||||
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);
|
||||
deviceList = statusMapper.queryDeployedByTenant(tenantId);
|
||||
}
|
||||
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.getWarning() == WarningCfg.LEVEL_1) warning1Num++;
|
||||
else if(status.getWarning() == WarningCfg.LEVEL_2) warning2Num++;
|
||||
// 地图上显示告警原因
|
||||
if(status.getWarning()!=WarningCfg.LEVEL_0){
|
||||
List<String> warningInfo= WarningCfg.parseCode(status.getWarningcode());
|
||||
status.setDeviceid(status.getDeviceid() +" "+warningInfo);
|
||||
|
||||
// 剔除无经纬度的对象,不在地图上显示
|
||||
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){
|
||||
List<String> warningInfo= WarningCfg.parseCode(status.getWarningcode());
|
||||
status.setDeviceid(status.getDeviceid() +" "+warningInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +80,7 @@ public class IndexController extends BasicController{
|
||||
m.addAttribute("warning1Num", warning1Num);
|
||||
m.addAttribute("warning2Num", warning2Num);
|
||||
m.addAttribute("warningTotalNum", warning1Num+warning2Num);
|
||||
m.addAttribute("noGGA", noGGA);
|
||||
m.addAttribute("deviceList", deviceList);
|
||||
|
||||
return "/page/device_overview";
|
||||
|
||||
@ -78,6 +78,7 @@
|
||||
</div>
|
||||
<div class="layui-col-xs3 layui-col-md4">
|
||||
掉线数 <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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -108,7 +108,8 @@
|
||||
{field: 'devicetime', title: '设备时间'},
|
||||
{field: 'state', title: '状态',templet: '#stateTrans'},
|
||||
{field: 'warning', title: '告警',templet: '#warningTrans'},
|
||||
{field: 'location', title: '位置'},
|
||||
{field: 'longitude', title: '经度'},
|
||||
{field: 'latitude', title: '维度'},
|
||||
{field: 'voltage', title: '电压'},
|
||||
{field: 'temperature', title: '温度'},
|
||||
{field: 'humidity', title: '湿度'},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user