From d0ae7671d7d37d3f6bcd794ebfac5c472f25ae1b Mon Sep 17 00:00:00 2001 From: weidong Date: Wed, 29 Oct 2025 09:29:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E6=9C=80=E8=BF=912?= =?UTF-8?q?4=E5=B0=8F=E6=97=B6=E7=A6=BB=E7=BA=BF=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imdroid/secapi/dto/GnssStatusJoin.java | 3 +++ .../imdroid/secapi/dto/GnssStatusMapper.java | 10 ++++---- .../controller/GnssStatusController.java | 2 +- .../beidou/controller/IndexController.java | 24 ++++++++++++++----- .../templates/page/device_overview.html | 5 ++++ .../resources/templates/page/gnss_status.html | 1 + .../page/table/gnss_status_list.html | 5 ++-- 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusJoin.java b/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusJoin.java index 29cd1d6c..1bbaa12f 100644 --- a/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusJoin.java +++ b/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusJoin.java @@ -16,6 +16,9 @@ public class GnssStatusJoin { @ExcelProperty("租户id") Integer tenantid; + @ExcelProperty("租户名") + String tenantname; + @ExcelProperty("更新日期时间") LocalDateTime updatetime; diff --git a/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusMapper.java b/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusMapper.java index 4f24dbe2..8dfc668b 100644 --- a/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusMapper.java +++ b/sec-api/src/main/java/com/imdroid/secapi/dto/GnssStatusMapper.java @@ -22,23 +22,23 @@ public interface GnssStatusMapper extends MPJBaseMapper { @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.state <> 0"}) List queryOnline(); - @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid from gnssstatus s ,gnssdevices d where " + + @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid,d.tenantname from gnssstatus s ,gnssdevices d where " + "s.deviceid=d.deviceid and d.tenantid<>0 and d.opmode=0"}) List queryDeployed(); - @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid from gnssstatus s ,gnssdevices d where " + + @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid,d.tenantname from gnssstatus s ,gnssdevices d where " + "s.deviceid=d.deviceid and d.tenantid = #{tenantid} and d.opmode=0"}) List queryDeployedByTenant(int tenantid); //多个入参要用Param注解 - @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid from gnssstatus s ,gnssdevices d where " + + @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid,d.tenantname from gnssstatus s ,gnssdevices d where " + "s.deviceid=d.deviceid and d.tenantid = #{tenantid} and d.opmode=0 and d.project_id = #{projectName}"}) List queryDeployedByProject(@Param("tenantid") int tenantid, @Param("projectName") String projectName); // 需要关联设备类型 - @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.deviceid = #{deviceId}"}) + @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid,d.tenantname from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid and s.deviceid = #{deviceId}"}) GnssStatusJoin queryByDeviceId(String deviceId); - @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid"}) + @Select({"select s.*, d.devicetype, d.model, d.group_id, d.name, d.project_id,d.iccid,d.tenantname from gnssstatus s ,gnssdevices d where s.deviceid=d.deviceid"}) GnssStatusJoin queryAll(); } diff --git a/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssStatusController.java b/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssStatusController.java index f35e8254..85802ef7 100644 --- a/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssStatusController.java +++ b/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssStatusController.java @@ -99,7 +99,7 @@ public class GnssStatusController extends BasicController implements CommonExcel public MPJQueryWrapper prepareQueryWrapper() { return new MPJQueryWrapper() .selectAll(GnssStatus.class) - .select("d.devicetype as devicetype,d.remark as remark,d.iccid as iccid") + .select("d.devicetype as devicetype,d.remark as remark,d.iccid as iccid,d.tenantname as tenantname") .leftJoin("gnssdevices d on t.deviceid = d.deviceid") .orderByDesc("t.updatetime"); } diff --git a/sec-beidou/src/main/java/com/imdroid/beidou/controller/IndexController.java b/sec-beidou/src/main/java/com/imdroid/beidou/controller/IndexController.java index 4a858771..59f69ab0 100644 --- a/sec-beidou/src/main/java/com/imdroid/beidou/controller/IndexController.java +++ b/sec-beidou/src/main/java/com/imdroid/beidou/controller/IndexController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpSession; +import java.time.LocalDateTime; import java.util.Iterator; import java.util.List; @@ -39,15 +40,16 @@ public class IndexController extends BasicController{ @RequestMapping("/page/device_overview") public String deviceOverview(Model m, HttpSession session) { initModel(m, session); - int deviceDeployedNum; - int deviceOfflineNum=0; + int deviceDeployedNum = 0; + int deviceOfflineNum = 0; + int deviceOfflineNumIn24h = 0; int warning1Num=0;//一般告警 int warning2Num=0;//严重告警 int noGGA = 0; int noFix = 0; + long deviceNoFwdNum=0; //未推送设备数(同时满足:非SAAS服务商、使用状态正常、fwd_group_id和fwd_group_id2都为"不推送"的设备) - Long deviceNoFwdNum; QueryWrapper noFwdQueryWrapper = new QueryWrapper<>(); if (tenantId != Tenant.SAAS_PROVIDER_ID) { // 非SAAS服务商查询当前租户 @@ -63,7 +65,7 @@ public class IndexController extends BasicController{ // fwd_group_id为"不推送" noFwdQueryWrapper.eq("fwd_group_id", GnssGroupFwd.FWD_TYPE_NONE); // fwd_group_id2为"不推送"或为null - noFwdQueryWrapper.and(wrapper -> wrapper.eq("fwd_group_id2", GnssGroupFwd.FWD_TYPE_NONE).or().isNull("fwd_group_id2")); + //noFwdQueryWrapper.and(wrapper -> wrapper.eq("fwd_group_id2", GnssGroupFwd.FWD_TYPE_NONE).or().isNull("fwd_group_id2")); deviceNoFwdNum = gnssDeviceMapper.selectCount(noFwdQueryWrapper); List deviceList; @@ -76,11 +78,16 @@ public class IndexController extends BasicController{ deviceDeployedNum = deviceList.size(); //for(GnssStatusJoin status:deviceList){遍历删除异常 + LocalDateTime now = LocalDateTime.now(); Iterator iterator = deviceList.iterator(); while(iterator.hasNext()){ GnssStatusJoin status=iterator.next(); if(status.getState() == GnssStatus.STATE_OFFLINE) { deviceOfflineNum++; + if(status.getUpdatetime()!=null && + status.getUpdatetime().isAfter(now.minusHours(24))){ + deviceOfflineNumIn24h++; + } } else if((status.getWarningcode()&WarningCfg.TYPE_CONT_INVALID_RESULT) != 0) { noFix++; @@ -115,6 +122,7 @@ public class IndexController extends BasicController{ m.addAttribute("deviceDeployedNum", deviceDeployedNum); m.addAttribute("deviceOnlineNum", deviceDeployedNum-deviceOfflineNum); m.addAttribute("deviceOfflineNum", deviceOfflineNum); + m.addAttribute("deviceOfflineNumIn24h", deviceOfflineNumIn24h); m.addAttribute("warning1Num", warning1Num); m.addAttribute("warning2Num", warning2Num); m.addAttribute("warningTotalNum", warning1Num+warning2Num); @@ -144,7 +152,7 @@ public class IndexController extends BasicController{ Integer tenantId = getTenantId(session); if(tenantId == Tenant.SAAS_PROVIDER_ID) { queryWrapper.selectAll(GnssStatus.class) - .select("d.name as name", "d.devicetype as devicetype", "d.project_id as project_id") + .select("d.name as name", "d.devicetype as devicetype", "d.tenantname as tenantname","d.project_id as project_id") .leftJoin("gnssdevices d on t.deviceid = d.deviceid") .ne("d.tenantid", Tenant.SAAS_PROVIDER_ID) .eq("opmode", GnssDevice.OP_MODE_USE) @@ -152,7 +160,7 @@ public class IndexController extends BasicController{ } else{ queryWrapper.selectAll(GnssStatus.class) - .select("d.name as name", "d.devicetype as devicetype", "d.project_id as project_id") + .select("d.name as name", "d.devicetype as devicetype", "d.tenantname as tenantname", "d.project_id as project_id") .leftJoin("gnssdevices d on t.deviceid = d.deviceid") .eq("d.tenantid", tenantId) .eq("opmode", GnssDevice.OP_MODE_USE) @@ -164,6 +172,10 @@ public class IndexController extends BasicController{ if(query.equals("offline")){ queryWrapper.eq("state",GnssStatus.STATE_OFFLINE); } + else if(query.equals("offline_in24h")){ + queryWrapper.eq("state",GnssStatus.STATE_OFFLINE); + queryWrapper.ge("t.updatetime",LocalDateTime.now().minusHours(24)); + } else if(query.equals("nofixed")){ queryWrapper.eq("warningcode&"+WarningCfg.TYPE_CONT_INVALID_RESULT,WarningCfg.TYPE_CONT_INVALID_RESULT); } diff --git a/sec-beidou/src/main/resources/templates/page/device_overview.html b/sec-beidou/src/main/resources/templates/page/device_overview.html index 00f2798b..2b40c956 100644 --- a/sec-beidou/src/main/resources/templates/page/device_overview.html +++ b/sec-beidou/src/main/resources/templates/page/device_overview.html @@ -836,6 +836,11 @@ 掉线数 22 +
+ + 24小时掉线数 + 22 +
未推送数 diff --git a/sec-beidou/src/main/resources/templates/page/gnss_status.html b/sec-beidou/src/main/resources/templates/page/gnss_status.html index 73278088..5066439e 100644 --- a/sec-beidou/src/main/resources/templates/page/gnss_status.html +++ b/sec-beidou/src/main/resources/templates/page/gnss_status.html @@ -92,6 +92,7 @@ table = layui.table; var cfg_cols = [ {field: 'deviceid', title: '设备号', sort: true}, + {field: 'tenantname', title: '部门', sort: true}, {field: 'devicetype', title: '设备类型',templet: '#typeTrans'}, {field: 'updatetime', title: '更新时间', templet: "
{{layui.util.toDateString(d.updatetime, 'yyyy-MM-dd HH:mm:ss')}}
"}, {field: 'state', title: '状态',templet: '#stateTrans'}, diff --git a/sec-beidou/src/main/resources/templates/page/table/gnss_status_list.html b/sec-beidou/src/main/resources/templates/page/table/gnss_status_list.html index 4c3297bf..2edf3246 100644 --- a/sec-beidou/src/main/resources/templates/page/table/gnss_status_list.html +++ b/sec-beidou/src/main/resources/templates/page/table/gnss_status_list.html @@ -94,9 +94,10 @@ url: '/gnss/q_status/list', cols: [[ {field: 'deviceid', title: '设备号', width: 120, templet: '#deviceIdTpl', align: 'center',sort: true}, - {field: 'devicetype', title: '设备类型', templet: '#typeTrans', width: 100}, + {field: 'devicetype', title: '设备类型', templet: '#typeTrans', width: 80}, + {field: 'tenantname', title: '部门', width: 100}, {field: 'project_id', title: '项目号', width: 100}, - {field: 'name', title: '工点', width: 150}, + {field: 'name', title: '工点', width: 100}, {field: 'updatetime', title: '更新时间', templet: "
{{layui.util.toDateString(d.updatetime, 'yyyy-MM-dd HH:mm:ss')}}
", width: 170}, {field: 'state', title: '状态', templet: '#stateTrans', width: 80, align: 'center'}, {field: 'warning', title: '告警', templet: '#warningTrans', width: 80, align: 'center'},