From 35d325f87d78d942d78a538dd36d5317f0876313 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 15 十月 2024 19:03:55 +0800
Subject: [PATCH] 异常恢复的统计数bug
---
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 15 ++++++++-------
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java | 11 +----------
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
index 504cd1b..713fc0b 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -879,8 +879,6 @@
matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_CAR)));
if (examineTag != null && examineTag.equals(1)) {
matchConditions.add(new Document("provinceTag", true));
- } else if (examineTag != null && examineTag.equals(2)) {
- matchConditions.add(new Document("deptTag", true));
}
// 鏋勫缓鑱氬悎绠¢亾
List<Document> pipeline = Arrays.asList(
@@ -889,7 +887,6 @@
.append("dataCount", new Document("$sum", "$dataCount"))
)
);
-
// 鎵ц鑱氬悎鏌ヨ骞惰幏鍙栫粨鏋�
AggregateIterable<Document> result = collection.aggregate(pipeline);
for (Document doc : result) {
@@ -899,7 +896,7 @@
results.add(homecarVO);
}
- //mongo鏌ョ偣浣嶅湪绾�
+ //TODO锛氬湪绾夸慨鏀癸紝闇�瑕佹妸妫�娴嬫捣搴蜂紭浜戞娴嬬殑缁撴灉瀛樺叆mongo锛宮ongo鏌ョ偣浣嶅湪绾�
MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online");
// 鏋勫缓鍩烘湰鐨�$match鏉′欢
List<Document> onlineMatch = new ArrayList<>();
@@ -907,8 +904,6 @@
onlineMatch.add(new Document("monitorType", new Document("$regex", "2")));
if (examineTag != null && examineTag.equals(1)) {
onlineMatch.add(new Document("provinceTag", true));
- } else if (examineTag != null && examineTag.equals(2)) {
- onlineMatch.add(new Document("deptTag", true));
}
// 鏋勫缓鑱氬悎绠¢亾
List<Document> onlinePipeline = Arrays.asList(
@@ -994,8 +989,6 @@
matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_FACE)));
if (examineTag != null && examineTag.equals(1)) {
matchConditions.add(new Document("provinceTag", true));
- } else if (examineTag != null && examineTag.equals(2)) {
- matchConditions.add(new Document("deptTag", true));
}
// 鏋勫缓鑱氬悎绠¢亾
List<Document> pipeline = Arrays.asList(
@@ -1022,8 +1015,6 @@
onlineMatch.add(new Document("monitorType", new Document("$regex", "3")));
if (examineTag != null && examineTag.equals(1)) {
onlineMatch.add(new Document("provinceTag", true));
- } else if (examineTag != null && examineTag.equals(2)) {
- onlineMatch.add(new Document("deptTag", true));
}
// 鏋勫缓鑱氬悎绠¢亾
List<Document> onlinePipeline = Arrays.asList(
diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index 85f8c3d..9f45051 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -385,19 +385,20 @@
</select>
<select id="recoveryException" resultType="java.util.Map">
- SELECT count(*) AS totalPosts,
- IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers,
- IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS postsPercentage,
- IFNULL(ROUND(SUM(IF(p.online = 1, 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage
- FROM t_monitor t
- LEFT JOIN t_yw_point p ON t.serial_number = p.serial_number
- left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0
+ SELECT count(*) AS totalPosts,
+ IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers,
+ IFNULL(SUM(IF(p.online = -1, 1, 0)), 0) AS postsPercentage,
+ IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS unknownNumbers,
+ IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage FROM t_monitor m
<where>
p.examine_status = 1
<!-- (p.recovery = 1 OR TIMESTAMPDIFF(DAY, p.recovery_time, NOW()) <![CDATA[<=]]> #{time}) -->
<if test="provinceTag!=null">
and p.province_tag = #{provinceTag}
</if>
+ <if test="deptTag!=null">
+ and p.dept_tag = #{deptTag}
+ </if>
${params.dataScope}
</where>
</select>
--
Gitblit v1.8.0