|
@@ -5,7 +5,7 @@
|
|
|
<resultMap id="BaseResultMap" type="com.zksy.base.warning.domain.EarlyWarning">
|
|
<resultMap id="BaseResultMap" type="com.zksy.base.warning.domain.EarlyWarning">
|
|
|
<id column="warning_id" property="warningId"/>
|
|
<id column="warning_id" property="warningId"/>
|
|
|
<result column="warning_no" property="warningNo"/>
|
|
<result column="warning_no" property="warningNo"/>
|
|
|
- <result column="warning_name" property="warningName"/>
|
|
|
|
|
|
|
+
|
|
|
<result column="warning_type" property="warningType"/>
|
|
<result column="warning_type" property="warningType"/>
|
|
|
<result column="warning_level" property="warningLevel"/>
|
|
<result column="warning_level" property="warningLevel"/>
|
|
|
<result column="warning_special" property="warningSpecial"/>
|
|
<result column="warning_special" property="warningSpecial"/>
|
|
@@ -16,8 +16,7 @@
|
|
|
<result column="device_code" property="deviceCode"/>
|
|
<result column="device_code" property="deviceCode"/>
|
|
|
<result column="device_name" property="deviceName"/>
|
|
<result column="device_name" property="deviceName"/>
|
|
|
<result column="location" property="location"/>
|
|
<result column="location" property="location"/>
|
|
|
- <result column="longitude" property="longitude"/>
|
|
|
|
|
- <result column="latitude" property="latitude"/>
|
|
|
|
|
|
|
+
|
|
|
<result column="ownership_unit" property="ownershipUnit"/>
|
|
<result column="ownership_unit" property="ownershipUnit"/>
|
|
|
<result column="publisher" property="publisher"/>
|
|
<result column="publisher" property="publisher"/>
|
|
|
<result column="publish_time" property="publishTime"/>
|
|
<result column="publish_time" property="publishTime"/>
|
|
@@ -34,85 +33,38 @@
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
|
- warning_id, warning_no, warning_name, warning_type, warning_level, warning_special,
|
|
|
|
|
|
|
+ warning_id, warning_no, warning_type, warning_level, warning_special,
|
|
|
disposal_deadline, stage_deadline, item_id, item_snapshot, device_code, device_name,
|
|
disposal_deadline, stage_deadline, item_id, item_snapshot, device_code, device_name,
|
|
|
- location, longitude, latitude, ownership_unit, publisher, publish_time, handler, reviewer,
|
|
|
|
|
|
|
+ location, ownership_unit, publisher, publish_time, handler, reviewer,
|
|
|
status, warning_content, process_instance_id, create_by, create_time, update_by,
|
|
status, warning_content, process_instance_id, create_by, create_time, update_by,
|
|
|
update_time, remark
|
|
update_time, remark
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<!-- The city-life project only contains water supply, drainage, gas and manhole warnings. -->
|
|
<!-- The city-life project only contains water supply, drainage, gas and manhole warnings. -->
|
|
|
<sql id="SupportedDashboardWarningTypes">
|
|
<sql id="SupportedDashboardWarningTypes">
|
|
|
- AND w.warning_type IN (
|
|
|
|
|
- 'WATER_PIPE', 'SEWER_PIPE', 'GAS_PIPE', 'MANHOLE',
|
|
|
|
|
- '1', '2', '3', '4',
|
|
|
|
|
- '供水', '供水管网', '供水管网预警',
|
|
|
|
|
- '排水', '排水管网', '排水管网预警',
|
|
|
|
|
- '燃气', '燃气管网', '燃气管网预警',
|
|
|
|
|
- '窨井', '窨井预警'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ AND EXISTS (SELECT 1 FROM app_user.warning_type wt WHERE wt.warning_code = w.warning_type)
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<sql id="DashboardWarningTypeFilter">
|
|
<sql id="DashboardWarningTypeFilter">
|
|
|
- <if test="warningType != null and warningType != ''">
|
|
|
|
|
- <choose>
|
|
|
|
|
- <when test="warningType == 'WATER_PIPE' or warningType == '1'.toString()">
|
|
|
|
|
- AND w.warning_type IN ('WATER_PIPE', '1', '供水', '供水管网', '供水管网预警')
|
|
|
|
|
- </when>
|
|
|
|
|
- <when test="warningType == 'SEWER_PIPE' or warningType == '2'.toString()">
|
|
|
|
|
- AND w.warning_type IN ('SEWER_PIPE', '2', '排水', '排水管网', '排水管网预警')
|
|
|
|
|
- </when>
|
|
|
|
|
- <when test="warningType == 'GAS_PIPE' or warningType == '3'.toString()">
|
|
|
|
|
- AND w.warning_type IN ('GAS_PIPE', '3', '燃气', '燃气管网', '燃气管网预警')
|
|
|
|
|
- </when>
|
|
|
|
|
- <when test="warningType == 'MANHOLE' or warningType == '4'.toString()">
|
|
|
|
|
- AND w.warning_type IN ('MANHOLE', '4', '窨井', '窨井预警')
|
|
|
|
|
- </when>
|
|
|
|
|
- <otherwise>
|
|
|
|
|
- AND w.warning_type = #{warningType}
|
|
|
|
|
- </otherwise>
|
|
|
|
|
- </choose>
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <if test="warningType != null and warningType != ''">AND w.warning_type = #{warningType}</if>
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<sql id="DashboardWarningLevelFilter">
|
|
<sql id="DashboardWarningLevelFilter">
|
|
|
- <if test="warningLevel != null and warningLevel != ''">
|
|
|
|
|
- <choose>
|
|
|
|
|
- <when test="warningLevel == '1'.toString()">
|
|
|
|
|
- AND w.warning_level IN ('1', 'BLUE', 'IV')
|
|
|
|
|
- </when>
|
|
|
|
|
- <when test="warningLevel == '2'.toString()">
|
|
|
|
|
- AND w.warning_level IN ('2', 'YELLOW', 'III')
|
|
|
|
|
- </when>
|
|
|
|
|
- <when test="warningLevel == '3'.toString()">
|
|
|
|
|
- AND w.warning_level IN ('3', 'ORANGE', 'II')
|
|
|
|
|
- </when>
|
|
|
|
|
- <when test="warningLevel == '4'.toString()">
|
|
|
|
|
- AND w.warning_level IN ('4', 'RED', 'I')
|
|
|
|
|
- </when>
|
|
|
|
|
- <otherwise>
|
|
|
|
|
- AND w.warning_level = #{warningLevel}
|
|
|
|
|
- </otherwise>
|
|
|
|
|
- </choose>
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <if test="warningLevel != null and warningLevel != ''">AND w.warning_level = #{warningLevel}</if>
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<sql id="DashboardWarningColumns">
|
|
<sql id="DashboardWarningColumns">
|
|
|
w.warning_id,
|
|
w.warning_id,
|
|
|
w.warning_no,
|
|
w.warning_no,
|
|
|
- w.warning_name,
|
|
|
|
|
|
|
+
|
|
|
w.warning_type,
|
|
w.warning_type,
|
|
|
- CASE
|
|
|
|
|
- WHEN w.warning_type IN ('WATER_PIPE', '1', '供水', '供水管网', '供水管网预警') THEN '供水管网'
|
|
|
|
|
- WHEN w.warning_type IN ('SEWER_PIPE', '2', '排水', '排水管网', '排水管网预警') THEN '排水管网'
|
|
|
|
|
- WHEN w.warning_type IN ('GAS_PIPE', '3', '燃气', '燃气管网', '燃气管网预警') THEN '燃气管网'
|
|
|
|
|
- WHEN w.warning_type IN ('MANHOLE', '4', '窨井', '窨井预警') THEN '窨井'
|
|
|
|
|
- END AS warning_type_name,
|
|
|
|
|
|
|
+ (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name,
|
|
|
w.warning_level,
|
|
w.warning_level,
|
|
|
w.warning_special,
|
|
w.warning_special,
|
|
|
w.location,
|
|
w.location,
|
|
|
- w.longitude,
|
|
|
|
|
- w.latitude,
|
|
|
|
|
|
|
+
|
|
|
w.ownership_unit,
|
|
w.ownership_unit,
|
|
|
w.publisher,
|
|
w.publisher,
|
|
|
w.publish_time,
|
|
w.publish_time,
|
|
@@ -129,7 +81,7 @@
|
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
|
SELECT warning_id, MAX(create_time) AS resolved_time
|
|
SELECT warning_id, MAX(create_time) AS resolved_time
|
|
|
FROM app_user.warning_disposal
|
|
FROM app_user.warning_disposal
|
|
|
- WHERE disposal_type IN ('RESOLVE', 'CLOSE', 'CLEAR')
|
|
|
|
|
|
|
+ WHERE disposal_type IN ('RESOLVE', 'CLOSE', 'CLEAR', 'AUTO_CLEAR')
|
|
|
GROUP BY warning_id
|
|
GROUP BY warning_id
|
|
|
) resolved_record ON resolved_record.warning_id = w.warning_id
|
|
) resolved_record ON resolved_record.warning_id = w.warning_id
|
|
|
</sql>
|
|
</sql>
|
|
@@ -174,14 +126,7 @@
|
|
|
COUNT(*) AS warning_count
|
|
COUNT(*) AS warning_count
|
|
|
FROM app_user.early_warning
|
|
FROM app_user.early_warning
|
|
|
WHERE status != 'DRAFT'
|
|
WHERE status != 'DRAFT'
|
|
|
- AND warning_type IN (
|
|
|
|
|
- 'WATER_PIPE', 'SEWER_PIPE', 'GAS_PIPE', 'MANHOLE',
|
|
|
|
|
- '1', '2', '3', '4',
|
|
|
|
|
- '供水', '供水管网', '供水管网预警',
|
|
|
|
|
- '排水', '排水管网', '排水管网预警',
|
|
|
|
|
- '燃气', '燃气管网', '燃气管网预警',
|
|
|
|
|
- '窨井', '窨井预警'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ AND EXISTS (SELECT 1 FROM app_user.warning_type wt WHERE wt.warning_code = early_warning.warning_type)
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND publish_time >= #{startTime}
|
|
AND publish_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -203,14 +148,7 @@
|
|
|
COUNT(*) AS warning_count
|
|
COUNT(*) AS warning_count
|
|
|
FROM app_user.early_warning
|
|
FROM app_user.early_warning
|
|
|
WHERE status != 'DRAFT'
|
|
WHERE status != 'DRAFT'
|
|
|
- AND warning_type IN (
|
|
|
|
|
- 'WATER_PIPE', 'SEWER_PIPE', 'GAS_PIPE', 'MANHOLE',
|
|
|
|
|
- '1', '2', '3', '4',
|
|
|
|
|
- '供水', '供水管网', '供水管网预警',
|
|
|
|
|
- '排水', '排水管网', '排水管网预警',
|
|
|
|
|
- '燃气', '燃气管网', '燃气管网预警',
|
|
|
|
|
- '窨井', '窨井预警'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ AND EXISTS (SELECT 1 FROM app_user.warning_type wt WHERE wt.warning_code = early_warning.warning_type)
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND publish_time >= #{startTime}
|
|
AND publish_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -231,14 +169,7 @@
|
|
|
COUNT(warning_id) AS status_count
|
|
COUNT(warning_id) AS status_count
|
|
|
FROM app_user.early_warning
|
|
FROM app_user.early_warning
|
|
|
WHERE status != 'DRAFT'
|
|
WHERE status != 'DRAFT'
|
|
|
- AND warning_type IN (
|
|
|
|
|
- 'WATER_PIPE', 'SEWER_PIPE', 'GAS_PIPE', 'MANHOLE',
|
|
|
|
|
- '1', '2', '3', '4',
|
|
|
|
|
- '供水', '供水管网', '供水管网预警',
|
|
|
|
|
- '排水', '排水管网', '排水管网预警',
|
|
|
|
|
- '燃气', '燃气管网', '燃气管网预警',
|
|
|
|
|
- '窨井', '窨井预警'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ AND EXISTS (SELECT 1 FROM app_user.warning_type wt WHERE wt.warning_code = early_warning.warning_type)
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND publish_time >= #{startTime}
|
|
AND publish_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
@@ -284,8 +215,8 @@
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
INNER JOIN app_user.warning_disposal d
|
|
INNER JOIN app_user.warning_disposal d
|
|
|
ON w.warning_id = d.warning_id
|
|
ON w.warning_id = d.warning_id
|
|
|
- AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT')
|
|
|
|
|
- WHERE w.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT', 'AUTO_CLEAR')
|
|
|
|
|
+ WHERE w.status IN ('HANDLED', 'CLOSED')
|
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND w.publish_time >= #{startTime}
|
|
AND w.publish_time >= #{startTime}
|
|
@@ -317,8 +248,8 @@
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
INNER JOIN app_user.warning_disposal d
|
|
INNER JOIN app_user.warning_disposal d
|
|
|
ON w.warning_id = d.warning_id
|
|
ON w.warning_id = d.warning_id
|
|
|
- AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT')
|
|
|
|
|
- WHERE w.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT', 'AUTO_CLEAR')
|
|
|
|
|
+ WHERE w.status IN ('HANDLED', 'CLOSED')
|
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND w.publish_time >= #{startTime}
|
|
AND w.publish_time >= #{startTime}
|
|
@@ -355,8 +286,8 @@
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
INNER JOIN app_user.warning_disposal d
|
|
INNER JOIN app_user.warning_disposal d
|
|
|
ON w.warning_id = d.warning_id
|
|
ON w.warning_id = d.warning_id
|
|
|
- AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT')
|
|
|
|
|
- WHERE w.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT', 'AUTO_CLEAR')
|
|
|
|
|
+ WHERE w.status IN ('HANDLED', 'CLOSED')
|
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND w.publish_time >= #{startTime}
|
|
AND w.publish_time >= #{startTime}
|
|
@@ -379,7 +310,7 @@
|
|
|
SELECT
|
|
SELECT
|
|
|
w.warning_id,
|
|
w.warning_id,
|
|
|
w.warning_no,
|
|
w.warning_no,
|
|
|
- w.warning_name,
|
|
|
|
|
|
|
+
|
|
|
COALESCE(w.warning_special, '其他') AS warning_special,
|
|
COALESCE(w.warning_special, '其他') AS warning_special,
|
|
|
w.publish_time,
|
|
w.publish_time,
|
|
|
MAX(d.create_time) AS dispose_time,
|
|
MAX(d.create_time) AS dispose_time,
|
|
@@ -388,8 +319,8 @@
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
INNER JOIN app_user.warning_disposal d
|
|
INNER JOIN app_user.warning_disposal d
|
|
|
ON w.warning_id = d.warning_id
|
|
ON w.warning_id = d.warning_id
|
|
|
- AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT')
|
|
|
|
|
- WHERE w.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND d.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT', 'AUTO_CLEAR')
|
|
|
|
|
+ WHERE w.status IN ('HANDLED', 'CLOSED')
|
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
|
<if test="startTime != null">
|
|
<if test="startTime != null">
|
|
|
AND w.publish_time >= #{startTime}
|
|
AND w.publish_time >= #{startTime}
|
|
@@ -400,7 +331,7 @@
|
|
|
<if test="warningSpecial != null and warningSpecial != ''">
|
|
<if test="warningSpecial != null and warningSpecial != ''">
|
|
|
AND w.warning_special = #{warningSpecial}
|
|
AND w.warning_special = #{warningSpecial}
|
|
|
</if>
|
|
</if>
|
|
|
- GROUP BY w.warning_id, w.warning_no, w.warning_name, w.warning_special, w.publish_time, w.status
|
|
|
|
|
|
|
+ GROUP BY w.warning_id, w.warning_no, w.warning_special, w.publish_time, w.status
|
|
|
HAVING MAX(d.create_time) >= w.publish_time
|
|
HAVING MAX(d.create_time) >= w.publish_time
|
|
|
ORDER BY dispose_hours
|
|
ORDER BY dispose_hours
|
|
|
<if test="sortType != null and sortType == 'desc'">
|
|
<if test="sortType != null and sortType == 'desc'">
|
|
@@ -525,7 +456,7 @@
|
|
|
SELECT
|
|
SELECT
|
|
|
w.warning_id,
|
|
w.warning_id,
|
|
|
w.warning_no,
|
|
w.warning_no,
|
|
|
- w.warning_name,
|
|
|
|
|
|
|
+
|
|
|
COALESCE(w.warning_type, '其他') AS warning_type,
|
|
COALESCE(w.warning_type, '其他') AS warning_type,
|
|
|
COALESCE(w.warning_special, '其他') AS warning_special,
|
|
COALESCE(w.warning_special, '其他') AS warning_special,
|
|
|
w.publish_time,
|
|
w.publish_time,
|
|
@@ -549,7 +480,7 @@
|
|
|
<if test="status != null and status != ''">
|
|
<if test="status != null and status != ''">
|
|
|
AND w.status = #{status}
|
|
AND w.status = #{status}
|
|
|
</if>
|
|
</if>
|
|
|
- GROUP BY w.warning_id, w.warning_no, w.warning_name, w.warning_type,
|
|
|
|
|
|
|
+ GROUP BY w.warning_id, w.warning_no, w.warning_type,
|
|
|
w.warning_special, w.publish_time, w.status
|
|
w.warning_special, w.publish_time, w.status
|
|
|
HAVING MIN(d.create_time) >= w.publish_time
|
|
HAVING MIN(d.create_time) >= w.publish_time
|
|
|
ORDER BY receive_hours
|
|
ORDER BY receive_hours
|
|
@@ -574,10 +505,10 @@
|
|
|
THEN 1 END) AS today_total,
|
|
THEN 1 END) AS today_total,
|
|
|
COUNT(CASE
|
|
COUNT(CASE
|
|
|
WHEN w.publish_time <= CURRENT_TIMESTAMP
|
|
WHEN w.publish_time <= CURRENT_TIMESTAMP
|
|
|
- AND w.status NOT IN ('DRAFT', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND w.status NOT IN ('DRAFT', 'CLOSED')
|
|
|
THEN 1 END) AS unresolved_count,
|
|
THEN 1 END) AS unresolved_count,
|
|
|
COUNT(CASE
|
|
COUNT(CASE
|
|
|
- WHEN w.status IN ('CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ WHEN w.status IN ('CLOSED')
|
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time) >= CURRENT_DATE
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time) >= CURRENT_DATE
|
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time)
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time)
|
|
|
< CAST(CURRENT_DATE AS TIMESTAMP) + CAST('1 day' AS INTERVAL)
|
|
< CAST(CURRENT_DATE AS TIMESTAMP) + CAST('1 day' AS INTERVAL)
|
|
@@ -606,7 +537,7 @@
|
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="category == 'resolved'">
|
|
<when test="category == 'resolved'">
|
|
|
- AND w.status IN ('CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND w.status IN ('CLOSED')
|
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time) >= CURRENT_DATE
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time) >= CURRENT_DATE
|
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time)
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time)
|
|
|
< CAST(CURRENT_DATE AS TIMESTAMP) + CAST('1 day' AS INTERVAL)
|
|
< CAST(CURRENT_DATE AS TIMESTAMP) + CAST('1 day' AS INTERVAL)
|
|
@@ -615,7 +546,7 @@
|
|
|
</when>
|
|
</when>
|
|
|
<otherwise>
|
|
<otherwise>
|
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
|
- AND w.status NOT IN ('DRAFT', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND w.status NOT IN ('DRAFT', 'CLOSED')
|
|
|
ORDER BY
|
|
ORDER BY
|
|
|
CASE w.warning_level
|
|
CASE w.warning_level
|
|
|
WHEN '4' THEN 1 WHEN 'RED' THEN 1
|
|
WHEN '4' THEN 1 WHEN 'RED' THEN 1
|
|
@@ -648,7 +579,7 @@
|
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
<include refid="SupportedDashboardWarningTypes"/>
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="category == 'resolved'">
|
|
<when test="category == 'resolved'">
|
|
|
- AND w.status IN ('CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND w.status IN ('CLOSED')
|
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time) >= CURRENT_DATE
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time) >= CURRENT_DATE
|
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time)
|
|
AND COALESCE(resolved_record.resolved_time, w.update_time, w.publish_time)
|
|
|
< CAST(CURRENT_DATE AS TIMESTAMP) + CAST('1 day' AS INTERVAL)
|
|
< CAST(CURRENT_DATE AS TIMESTAMP) + CAST('1 day' AS INTERVAL)
|
|
@@ -662,7 +593,7 @@
|
|
|
</when>
|
|
</when>
|
|
|
<otherwise>
|
|
<otherwise>
|
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
|
- AND w.status NOT IN ('DRAFT', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ AND w.status NOT IN ('DRAFT', 'CLOSED')
|
|
|
</otherwise>
|
|
</otherwise>
|
|
|
</choose>
|
|
</choose>
|
|
|
<include refid="DashboardWarningTypeFilter"/>
|
|
<include refid="DashboardWarningTypeFilter"/>
|
|
@@ -670,9 +601,8 @@
|
|
|
<if test="keyword != null and keyword != ''">
|
|
<if test="keyword != null and keyword != ''">
|
|
|
AND (
|
|
AND (
|
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.warning_name LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
|
|
+
|
|
|
OR w.warning_special LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.warning_special LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.location LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
@@ -703,8 +633,8 @@
|
|
|
<select id="selectDashboardHistorySummary" resultType="java.util.Map">
|
|
<select id="selectDashboardHistorySummary" resultType="java.util.Map">
|
|
|
SELECT
|
|
SELECT
|
|
|
COUNT(*) AS total_count,
|
|
COUNT(*) AS total_count,
|
|
|
- COUNT(CASE WHEN w.status IN ('CLOSED', 'RESOLVED') THEN 1 END) AS resolved_count,
|
|
|
|
|
- COUNT(CASE WHEN w.status NOT IN ('CLOSED', 'RESOLVED') THEN 1 END) AS active_count
|
|
|
|
|
|
|
+ COUNT(CASE WHEN w.status IN ('CLOSED') THEN 1 END) AS resolved_count,
|
|
|
|
|
+ COUNT(CASE WHEN w.status NOT IN ('CLOSED') THEN 1 END) AS active_count
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
WHERE w.status != 'DRAFT'
|
|
WHERE w.status != 'DRAFT'
|
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
@@ -745,8 +675,6 @@
|
|
|
<if test="keyword != null and keyword != ''">
|
|
<if test="keyword != null and keyword != ''">
|
|
|
AND (
|
|
AND (
|
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.warning_name LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
- OR w.location LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
@@ -796,9 +724,8 @@
|
|
|
<if test="keyword != null and keyword != ''">
|
|
<if test="keyword != null and keyword != ''">
|
|
|
AND (
|
|
AND (
|
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.warning_name LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
|
|
+
|
|
|
OR w.warning_special LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.warning_special LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.location LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
@@ -822,13 +749,7 @@
|
|
|
SELECT
|
|
SELECT
|
|
|
COUNT(*) AS total,
|
|
COUNT(*) AS total,
|
|
|
COUNT(DISTINCT NULLIF(w.ownership_unit, '')) AS ownership_count,
|
|
COUNT(DISTINCT NULLIF(w.ownership_unit, '')) AS ownership_count,
|
|
|
- MAX(CASE
|
|
|
|
|
- WHEN w.warning_level IN ('1', 'BLUE', 'IV') THEN 1
|
|
|
|
|
- WHEN w.warning_level IN ('2', 'YELLOW', 'III') THEN 2
|
|
|
|
|
- WHEN w.warning_level IN ('3', 'ORANGE', 'II') THEN 3
|
|
|
|
|
- WHEN w.warning_level IN ('4', 'RED', 'I') THEN 4
|
|
|
|
|
- ELSE NULL
|
|
|
|
|
- END) AS highest_level
|
|
|
|
|
|
|
+ MIN(CASE WHEN w.warning_level IN ('1', '2', '3', '4') THEN CAST(w.warning_level AS integer) END) AS highest_level
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
<where>
|
|
<where>
|
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
AND w.publish_time <= CURRENT_TIMESTAMP
|
|
@@ -839,9 +760,8 @@
|
|
|
<if test="keyword != null and keyword != ''">
|
|
<if test="keyword != null and keyword != ''">
|
|
|
AND (
|
|
AND (
|
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
w.warning_no LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.warning_name LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
|
|
+
|
|
|
OR w.warning_special LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.warning_special LIKE CONCAT('%', #{keyword}, '%')
|
|
|
- OR w.location LIKE CONCAT('%', #{keyword}, '%')
|
|
|
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
OR w.ownership_unit LIKE CONCAT('%', #{keyword}, '%')
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
@@ -849,12 +769,12 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectWarningList" resultType="java.util.Map">
|
|
<select id="selectWarningList" resultType="java.util.Map">
|
|
|
- SELECT w.*
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name
|
|
|
FROM early_warning w
|
|
FROM early_warning w
|
|
|
<where>
|
|
<where>
|
|
|
- <if test="warningName != null and warningName != ''">
|
|
|
|
|
- AND w.warning_name LIKE CONCAT('%', #{warningName}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <if test="warningNo != null and warningNo != ''">AND w.warning_no LIKE CONCAT('%',#{warningNo},'%')</if>
|
|
|
<if test="warningType != null and warningType != ''">
|
|
<if test="warningType != null and warningType != ''">
|
|
|
AND w.warning_type = #{warningType}
|
|
AND w.warning_type = #{warningType}
|
|
|
</if>
|
|
</if>
|
|
@@ -869,12 +789,11 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="searchWarnings" resultType="java.util.Map">
|
|
<select id="searchWarnings" resultType="java.util.Map">
|
|
|
- SELECT w.*
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name
|
|
|
FROM early_warning w
|
|
FROM early_warning w
|
|
|
<where>
|
|
<where>
|
|
|
- <if test="warningName != null and warningName != ''">
|
|
|
|
|
- AND w.warning_name LIKE CONCAT('%', #{warningName}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
<if test="warningNo != null and warningNo != ''">
|
|
<if test="warningNo != null and warningNo != ''">
|
|
|
AND w.warning_no LIKE CONCAT('%', #{warningNo}, '%')
|
|
AND w.warning_no LIKE CONCAT('%', #{warningNo}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -887,9 +806,6 @@
|
|
|
<if test="status != null and status != ''">
|
|
<if test="status != null and status != ''">
|
|
|
AND w.status = #{status}
|
|
AND w.status = #{status}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="location != null and location != ''">
|
|
|
|
|
- AND w.location LIKE CONCAT('%', #{location}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
<if test="publisher != null and publisher != ''">
|
|
<if test="publisher != null and publisher != ''">
|
|
|
AND w.publisher LIKE CONCAT('%', #{publisher}, '%')
|
|
AND w.publisher LIKE CONCAT('%', #{publisher}, '%')
|
|
|
</if>
|
|
</if>
|
|
@@ -918,7 +834,7 @@
|
|
|
<select id="selectTodoList" resultType="java.util.Map">
|
|
<select id="selectTodoList" resultType="java.util.Map">
|
|
|
SELECT
|
|
SELECT
|
|
|
t.*,
|
|
t.*,
|
|
|
- w.warning_name,
|
|
|
|
|
|
|
+ w.warning_no,
|
|
|
w.warning_type,
|
|
w.warning_type,
|
|
|
w.warning_level,
|
|
w.warning_level,
|
|
|
w.handler,
|
|
w.handler,
|
|
@@ -930,19 +846,19 @@
|
|
|
LEFT JOIN early_warning w ON t.warning_id = w.warning_id
|
|
LEFT JOIN early_warning w ON t.warning_id = w.warning_id
|
|
|
<where>
|
|
<where>
|
|
|
t.user_id = #{userId}
|
|
t.user_id = #{userId}
|
|
|
|
|
+ <if test="warningNo != null and warningNo != ''">AND w.warning_no LIKE CONCAT('%',#{warningNo},'%')</if>
|
|
|
<if test="todoType != null and todoType != ''">
|
|
<if test="todoType != null and todoType != ''">
|
|
|
AND t.todo_type = #{todoType}
|
|
AND t.todo_type = #{todoType}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="warningName != null and warningName != ''">
|
|
|
|
|
- AND w.warning_name LIKE CONCAT('%', #{warningName}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
</where>
|
|
</where>
|
|
|
ORDER BY t.create_time DESC
|
|
ORDER BY t.create_time DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 身份由服务端登录上下文传入,禁止使用请求中的 userName。 -->
|
|
<!-- 身份由服务端登录上下文传入,禁止使用请求中的 userName。 -->
|
|
|
<select id="selectMyTasks" resultType="java.util.Map">
|
|
<select id="selectMyTasks" resultType="java.util.Map">
|
|
|
- SELECT w.*, t.todo_id, t.todo_type, t.action_type, t.task_name, t.read_status,
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name, t.todo_id, t.todo_type, t.action_type, t.task_name, t.read_status,
|
|
|
t.create_time AS task_create_time, t.complete_time,
|
|
t.create_time AS task_create_time, t.complete_time,
|
|
|
(SELECT STRING_AGG(DISTINCT a.alarm_no, ',')
|
|
(SELECT STRING_AGG(DISTINCT a.alarm_no, ',')
|
|
|
FROM alarm_warning_rel rel JOIN alarm_data a ON a.id = rel.alarm_id
|
|
FROM alarm_warning_rel rel JOIN alarm_data a ON a.id = rel.alarm_id
|
|
@@ -959,7 +875,7 @@
|
|
|
<if test="q.todoType == null or q.todoType == ''">AND task.todo_type IN ('TODO', 'DONE')</if>
|
|
<if test="q.todoType == null or q.todoType == ''">AND task.todo_type IN ('TODO', 'DONE')</if>
|
|
|
) t JOIN early_warning w ON w.warning_id = t.warning_id
|
|
) t JOIN early_warning w ON w.warning_id = t.warning_id
|
|
|
WHERE t.task_rank = 1
|
|
WHERE t.task_rank = 1
|
|
|
- <if test="q.warningName != null and q.warningName != ''">AND w.warning_name LIKE CONCAT('%',#{q.warningName},'%')</if>
|
|
|
|
|
|
|
+
|
|
|
<if test="q.warningNo != null and q.warningNo != ''">AND w.warning_no LIKE CONCAT('%',#{q.warningNo},'%')</if>
|
|
<if test="q.warningNo != null and q.warningNo != ''">AND w.warning_no LIKE CONCAT('%',#{q.warningNo},'%')</if>
|
|
|
<if test="q.warningSpecial != null and q.warningSpecial != ''">AND w.warning_special LIKE CONCAT('%',#{q.warningSpecial},'%')</if>
|
|
<if test="q.warningSpecial != null and q.warningSpecial != ''">AND w.warning_special LIKE CONCAT('%',#{q.warningSpecial},'%')</if>
|
|
|
<if test="q.warningType != null and q.warningType != ''">AND w.warning_type = #{q.warningType}</if>
|
|
<if test="q.warningType != null and q.warningType != ''">AND w.warning_type = #{q.warningType}</if>
|
|
@@ -967,7 +883,6 @@
|
|
|
<if test="q.status != null and q.status != ''">AND w.status = #{q.status}</if>
|
|
<if test="q.status != null and q.status != ''">AND w.status = #{q.status}</if>
|
|
|
<if test="q.handler != null and q.handler != ''">AND w.handler LIKE CONCAT('%',#{q.handler},'%')</if>
|
|
<if test="q.handler != null and q.handler != ''">AND w.handler LIKE CONCAT('%',#{q.handler},'%')</if>
|
|
|
<if test="q.publisher != null and q.publisher != ''">AND w.publisher LIKE CONCAT('%',#{q.publisher},'%')</if>
|
|
<if test="q.publisher != null and q.publisher != ''">AND w.publisher LIKE CONCAT('%',#{q.publisher},'%')</if>
|
|
|
- <if test="q.location != null and q.location != ''">AND w.location LIKE CONCAT('%',#{q.location},'%')</if>
|
|
|
|
|
<if test="q.ownershipUnit != null and q.ownershipUnit != ''">AND w.ownership_unit LIKE CONCAT('%',#{q.ownershipUnit},'%')</if>
|
|
<if test="q.ownershipUnit != null and q.ownershipUnit != ''">AND w.ownership_unit LIKE CONCAT('%',#{q.ownershipUnit},'%')</if>
|
|
|
<if test="q.startTime != null and q.startTime != ''">AND w.publish_time >= CAST(#{q.startTime} AS TIMESTAMP)</if>
|
|
<if test="q.startTime != null and q.startTime != ''">AND w.publish_time >= CAST(#{q.startTime} AS TIMESTAMP)</if>
|
|
|
<if test="q.endTime != null and q.endTime != ''">AND w.publish_time <= CAST(#{q.endTime} AS TIMESTAMP)</if>
|
|
<if test="q.endTime != null and q.endTime != ''">AND w.publish_time <= CAST(#{q.endTime} AS TIMESTAMP)</if>
|
|
@@ -979,7 +894,9 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectProcessingWarnings" resultType="java.util.Map">
|
|
<select id="selectProcessingWarnings" resultType="java.util.Map">
|
|
|
- SELECT w.*
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name
|
|
|
FROM early_warning w
|
|
FROM early_warning w
|
|
|
<where>
|
|
<where>
|
|
|
AND w.status IN ('PENDING', 'RECEIVED', 'PROCESSING', 'HANDLED')
|
|
AND w.status IN ('PENDING', 'RECEIVED', 'PROCESSING', 'HANDLED')
|
|
@@ -994,7 +911,9 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectCompletedWarnings" resultType="java.util.Map">
|
|
<select id="selectCompletedWarnings" resultType="java.util.Map">
|
|
|
- SELECT w.*
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name
|
|
|
FROM early_warning w
|
|
FROM early_warning w
|
|
|
<where>
|
|
<where>
|
|
|
AND w.status = 'CLOSED'
|
|
AND w.status = 'CLOSED'
|
|
@@ -1015,7 +934,9 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectWarningDetail" resultType="java.util.Map">
|
|
<select id="selectWarningDetail" resultType="java.util.Map">
|
|
|
- SELECT w.*
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name
|
|
|
FROM early_warning w
|
|
FROM early_warning w
|
|
|
WHERE w.warning_id = #{warningId}
|
|
WHERE w.warning_id = #{warningId}
|
|
|
</select>
|
|
</select>
|
|
@@ -1075,7 +996,9 @@
|
|
|
GROUP BY equipment_code
|
|
GROUP BY equipment_code
|
|
|
),
|
|
),
|
|
|
warning_industry AS (
|
|
warning_industry AS (
|
|
|
- SELECT w.*, roots.industry_code, roots.industry_name
|
|
|
|
|
|
|
+ SELECT w.*, (SELECT wt.warning_name FROM app_user.warning_type wt WHERE wt.warning_code=w.warning_type ORDER BY wt.id LIMIT 1) AS warning_type_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='alert_level' AND dict_value=w.warning_level AND status='0' ORDER BY dict_sort LIMIT 1) AS warning_level_name,
|
|
|
|
|
+ (SELECT dict_label FROM app_user.sys_dict_data WHERE dict_type='pre_alarm_status' AND dict_value=w.status AND status='0' ORDER BY dict_sort LIMIT 1) AS status_name, roots.industry_code, roots.industry_name
|
|
|
FROM app_user.early_warning w
|
|
FROM app_user.early_warning w
|
|
|
LEFT JOIN equipment_map equipment ON equipment.equipment_code = w.device_code
|
|
LEFT JOIN equipment_map equipment ON equipment.equipment_code = w.device_code
|
|
|
LEFT JOIN app_user.equipment_type direct_type
|
|
LEFT JOIN app_user.equipment_type direct_type
|
|
@@ -1097,7 +1020,7 @@
|
|
|
completed_actions AS (
|
|
completed_actions AS (
|
|
|
SELECT disposal.warning_id, MAX(disposal.create_time) AS dispose_time
|
|
SELECT disposal.warning_id, MAX(disposal.create_time) AS dispose_time
|
|
|
FROM app_user.warning_disposal disposal
|
|
FROM app_user.warning_disposal disposal
|
|
|
- WHERE disposal.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT')
|
|
|
|
|
|
|
+ WHERE disposal.disposal_type IN ('HANDLE', 'RESOLVE', 'CLEAR', 'CLOSE', 'MISREPORT', 'AUTO_CLEAR')
|
|
|
GROUP BY disposal.warning_id
|
|
GROUP BY disposal.warning_id
|
|
|
)
|
|
)
|
|
|
</sql>
|
|
</sql>
|
|
@@ -1109,17 +1032,17 @@
|
|
|
COUNT(*) AS total_count,
|
|
COUNT(*) AS total_count,
|
|
|
SUM(CASE WHEN warning.status IN ('PENDING', 'RECEIVED') THEN 1 ELSE 0 END) AS pending_count,
|
|
SUM(CASE WHEN warning.status IN ('PENDING', 'RECEIVED') THEN 1 ELSE 0 END) AS pending_count,
|
|
|
SUM(CASE WHEN warning.status = 'PROCESSING' THEN 1 ELSE 0 END) AS processing_count,
|
|
SUM(CASE WHEN warning.status = 'PROCESSING' THEN 1 ELSE 0 END) AS processing_count,
|
|
|
- SUM(CASE WHEN warning.status IN ('HANDLED', 'CLOSED', 'RESOLVED') THEN 1 ELSE 0 END) AS completed_count,
|
|
|
|
|
- ROUND(100.0 * SUM(CASE WHEN warning.status IN ('HANDLED', 'CLOSED', 'RESOLVED') THEN 1 ELSE 0 END)
|
|
|
|
|
|
|
+ SUM(CASE WHEN warning.status IN ('HANDLED', 'CLOSED') THEN 1 ELSE 0 END) AS completed_count,
|
|
|
|
|
+ ROUND(100.0 * SUM(CASE WHEN warning.status IN ('HANDLED', 'CLOSED') THEN 1 ELSE 0 END)
|
|
|
/ NULLIF(COUNT(*), 0), 2) AS completion_rate,
|
|
/ NULLIF(COUNT(*), 0), 2) AS completion_rate,
|
|
|
ROUND(AVG(CASE
|
|
ROUND(AVG(CASE
|
|
|
- WHEN warning.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ WHEN warning.status IN ('HANDLED', 'CLOSED')
|
|
|
AND action.dispose_time >= warning.publish_time
|
|
AND action.dispose_time >= warning.publish_time
|
|
|
THEN EXTRACT(EPOCH FROM (CAST(action.dispose_time AS TIMESTAMPTZ)
|
|
THEN EXTRACT(EPOCH FROM (CAST(action.dispose_time AS TIMESTAMPTZ)
|
|
|
- CAST(warning.publish_time AS TIMESTAMPTZ))) / 3600
|
|
- CAST(warning.publish_time AS TIMESTAMPTZ))) / 3600
|
|
|
END), 2) AS avg_dispose_hours,
|
|
END), 2) AS avg_dispose_hours,
|
|
|
SUM(CASE
|
|
SUM(CASE
|
|
|
- WHEN warning.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ WHEN warning.status IN ('HANDLED', 'CLOSED')
|
|
|
AND action.dispose_time >= warning.publish_time
|
|
AND action.dispose_time >= warning.publish_time
|
|
|
AND EXTRACT(EPOCH FROM (CAST(action.dispose_time AS TIMESTAMPTZ)
|
|
AND EXTRACT(EPOCH FROM (CAST(action.dispose_time AS TIMESTAMPTZ)
|
|
|
- CAST(warning.publish_time AS TIMESTAMPTZ))) / 3600 > 24
|
|
- CAST(warning.publish_time AS TIMESTAMPTZ))) / 3600 > 24
|
|
@@ -1134,17 +1057,17 @@
|
|
|
|
|
|
|
|
<select id="selectIndustryStatusDistribution" resultType="java.util.Map">
|
|
<select id="selectIndustryStatusDistribution" resultType="java.util.Map">
|
|
|
<include refid="IndustryWarningCte"/>
|
|
<include refid="IndustryWarningCte"/>
|
|
|
- <!-- CLOSED 与 RESOLVED 是历史上并存的两个“已解除”编码,分析时统一为 CLOSED。 -->
|
|
|
|
|
|
|
+ <!-- 处置统计只使用 pre_alarm_status 字典中的 CLOSED 终态。 -->
|
|
|
SELECT industry_code,
|
|
SELECT industry_code,
|
|
|
industry_name,
|
|
industry_name,
|
|
|
- CASE WHEN status IN ('CLOSED', 'RESOLVED') THEN 'CLOSED' ELSE status END AS status,
|
|
|
|
|
|
|
+ CASE WHEN status IN ('CLOSED') THEN 'CLOSED' ELSE status END AS status,
|
|
|
COUNT(*) AS warning_count
|
|
COUNT(*) AS warning_count
|
|
|
FROM warning_industry
|
|
FROM warning_industry
|
|
|
GROUP BY industry_code,
|
|
GROUP BY industry_code,
|
|
|
industry_name,
|
|
industry_name,
|
|
|
- CASE WHEN status IN ('CLOSED', 'RESOLVED') THEN 'CLOSED' ELSE status END
|
|
|
|
|
|
|
+ CASE WHEN status IN ('CLOSED') THEN 'CLOSED' ELSE status END
|
|
|
ORDER BY industry_name,
|
|
ORDER BY industry_name,
|
|
|
- CASE WHEN status IN ('CLOSED', 'RESOLVED') THEN 'CLOSED' ELSE status END
|
|
|
|
|
|
|
+ CASE WHEN status IN ('CLOSED') THEN 'CLOSED' ELSE status END
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectIndustryEfficiencyComparison" resultType="java.util.Map">
|
|
<select id="selectIndustryEfficiencyComparison" resultType="java.util.Map">
|
|
@@ -1163,7 +1086,7 @@
|
|
|
THEN 1 ELSE 0 END) / NULLIF(COUNT(*), 0), 2) AS within_24h_rate
|
|
THEN 1 ELSE 0 END) / NULLIF(COUNT(*), 0), 2) AS within_24h_rate
|
|
|
FROM warning_industry warning
|
|
FROM warning_industry warning
|
|
|
INNER JOIN completed_actions action ON action.warning_id = warning.warning_id
|
|
INNER JOIN completed_actions action ON action.warning_id = warning.warning_id
|
|
|
- WHERE warning.status IN ('HANDLED', 'CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ WHERE warning.status IN ('HANDLED', 'CLOSED')
|
|
|
AND action.dispose_time >= warning.publish_time
|
|
AND action.dispose_time >= warning.publish_time
|
|
|
GROUP BY warning.industry_code, warning.industry_name
|
|
GROUP BY warning.industry_code, warning.industry_name
|
|
|
ORDER BY avg_dispose_hours DESC
|
|
ORDER BY avg_dispose_hours DESC
|
|
@@ -1173,7 +1096,7 @@
|
|
|
<include refid="IndustryWarningCte"/>
|
|
<include refid="IndustryWarningCte"/>
|
|
|
SELECT warning.warning_id,
|
|
SELECT warning.warning_id,
|
|
|
warning.warning_no,
|
|
warning.warning_no,
|
|
|
- warning.warning_name,
|
|
|
|
|
|
|
+
|
|
|
warning.device_code,
|
|
warning.device_code,
|
|
|
warning.device_name,
|
|
warning.device_name,
|
|
|
warning.industry_code,
|
|
warning.industry_code,
|
|
@@ -1192,8 +1115,8 @@
|
|
|
<if test="status != null and status != ''">
|
|
<if test="status != null and status != ''">
|
|
|
<choose>
|
|
<choose>
|
|
|
<!-- 页面只提供一个“已解除”筛选项,但兼容两种历史状态值。 -->
|
|
<!-- 页面只提供一个“已解除”筛选项,但兼容两种历史状态值。 -->
|
|
|
- <when test="status == 'CLOSED' or status == 'RESOLVED'">
|
|
|
|
|
- warning.status IN ('CLOSED', 'RESOLVED')
|
|
|
|
|
|
|
+ <when test="status == 'CLOSED'">
|
|
|
|
|
+ warning.status IN ('CLOSED')
|
|
|
</when>
|
|
</when>
|
|
|
<otherwise>
|
|
<otherwise>
|
|
|
warning.status = #{status}
|
|
warning.status = #{status}
|