Commit 214e16e8 authored by lisong's avatar lisong

96333统计分析添加警情归并逻辑

parent 45096d09
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
tz_alert_called a tz_alert_called a
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjoi.CODE96333 = a.device_id LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjoi.CODE96333 = a.device_id
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD
WHERE a.is_delete = 0 WHERE a.is_delete = 0 and a.father_alert is null
and a.skill_group = #{groupCode} and a.skill_group = #{groupCode}
<if test="workOrderNumber != null and workOrderNumber != ''"> <if test="workOrderNumber != null and workOrderNumber != ''">
AND a.work_order_number like AND a.work_order_number like
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
and arrive_time is not null and arrive_time is not null
and dispatch_time between #{startDate} and dispatch_time between #{startDate}
and #{endDate} and #{endDate}
and alert_id in (SELECT sequence_nbr from tz_alert_called where alarm_type_code = '960' and call_time between #{startDate} and #{endDate}) and alert_id in (SELECT sequence_nbr from tz_alert_called where alarm_type_code = '960' and call_time between #{startDate} and #{endDate} and father_alert is null)
) )
WHERE orgCode is not null WHERE orgCode is not null
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
LEFT JOIN idx_biz_jg_supervision_info jsi on tac.equipment_id = jsi.RECORD LEFT JOIN idx_biz_jg_supervision_info jsi on tac.equipment_id = jsi.RECORD
WHERE tac.alarm_type_code != '962' WHERE tac.alarm_type_code != '962'
and tac.equipment_id is not null and tac.equipment_id is not null
and call_time between #{startDate} and #{endDate} and tac.call_time between #{startDate} and #{endDate}
and tac.father_alert is null
) )
WHERE mainCode is not null WHERE mainCode is not null
GROUP BY equipmentId GROUP BY equipmentId
...@@ -34,10 +35,10 @@ ...@@ -34,10 +35,10 @@
)as equipNum, )as equipNum,
( (
SELECT count(1) from tz_alert_called WHERE equipment_id = #{equipId} and alarm_type_code = '960' SELECT count(1) from tz_alert_called WHERE equipment_id = #{equipId} and alarm_type_code = '960' and father_alert is null
) as trappedNum, ) as trappedNum,
( (
SELECT count(1) from tz_alert_called WHERE equipment_id = #{equipId} and alarm_type_code = '961' SELECT count(1) from tz_alert_called WHERE equipment_id = #{equipId} and alarm_type_code = '961' and father_alert is null
) as faultNum, ) as faultNum,
( (
SELECT ME_UNIT_NAME from idx_biz_jg_maintenance_record_info WHERE ME_UNIT_CREDIT_CODE = #{unitCode} limit 1 SELECT ME_UNIT_NAME from idx_biz_jg_maintenance_record_info WHERE ME_UNIT_CREDIT_CODE = #{unitCode} limit 1
......
...@@ -8,18 +8,18 @@ ...@@ -8,18 +8,18 @@
<select id="getTotal" resultType="java.util.Map"> <select id="getTotal" resultType="java.util.Map">
select select
(select count(1) from tz_alert_called where alarm_type_code = '961' and call_time between #{startDate} and #{endDate}) as faultNum, (select count(1) from tz_alert_called where alarm_type_code = '961' and call_time between #{startDate} and #{endDate} and father_alert is null) as faultNum,
(select count(1) from tz_alert_called where alarm_type_code = '960' and call_time between #{startDate} and #{endDate} ) as trappedNum (select count(1) from tz_alert_called where alarm_type_code = '960' and call_time between #{startDate} and #{endDate} and father_alert is null ) as trappedNum
</select> </select>
<select id="getStatisticsMessage" <select id="getStatisticsMessage"
resultType="com.yeejoin.amos.boot.module.elevator.api.entity.AlertPlaceStatistics"> resultType="com.yeejoin.amos.boot.module.elevator.api.entity.AlertPlaceStatistics">
SELECT SELECT
(SELECT count(1) FROM (SELECT count(1) FROM
tz_alert_called t1 tz_alert_called t1
LEFT JOIN idx_biz_jg_use_info t2 ON t1.equipment_id = t2.RECORD WHERE t2.USE_PLACE = #{placeCode} and t1.alarm_type_code = '960' and t1.call_time between #{startDate} and #{endDate}) as trappedNum, LEFT JOIN idx_biz_jg_use_info t2 ON t1.equipment_id = t2.RECORD WHERE t2.USE_PLACE = #{placeCode} and t1.alarm_type_code = '960' and t1.call_time between #{startDate} and #{endDate} and father_alert is null) as trappedNum,
(SELECT count(1) FROM (SELECT count(1) FROM
tz_alert_called t1 tz_alert_called t1
LEFT JOIN idx_biz_jg_use_info t2 ON t1.equipment_id = t2.RECORD WHERE t2.USE_PLACE = #{placeCode} and t1.alarm_type_code = '961' and t1.call_time between #{startDate} and #{endDate}) as faultNum LEFT JOIN idx_biz_jg_use_info t2 ON t1.equipment_id = t2.RECORD WHERE t2.USE_PLACE = #{placeCode} and t1.alarm_type_code = '961' and t1.call_time between #{startDate} and #{endDate} and father_alert is null) as faultNum
</select> </select>
</mapper> </mapper>
...@@ -6,19 +6,19 @@ ...@@ -6,19 +6,19 @@
resultType="com.yeejoin.amos.boot.module.elevator.api.entity.AlertRescueStatistics"> resultType="com.yeejoin.amos.boot.module.elevator.api.entity.AlertRescueStatistics">
SELECT (select count(1) SELECT (select count(1)
from tz_dispatch_task from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960') where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960' and father_alert is null)
and org_type_code = 'levelOneUnit') as levelOne, and org_type_code = 'levelOneUnit') as levelOne,
(select count(1) (select count(1)
from tz_dispatch_task from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960') where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960' and father_alert is null)
and org_type_code = 'levelTwoUnit') as levelTwo, and org_type_code = 'levelTwoUnit') as levelTwo,
(select count(1) (select count(1)
from tz_dispatch_task from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960') where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960' and father_alert is null)
and org_type_code = '953') as levelThree, and org_type_code = '953') as levelThree,
(select count(DISTINCT (response_org_id)) (select count(DISTINCT (response_org_id))
from tz_dispatch_task from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960') where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960' and father_alert is null)
and org_type_code = 'levelOneUnit') as maintenanceUnit, and org_type_code = 'levelOneUnit') as maintenanceUnit,
( SELECT count(1) from ( ( SELECT count(1) from (
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
(SELECT min(dispatch_time) from tz_dispatch_task where alert_id = t1.sequence_nbr and dispatch_time is not null ) as dis (SELECT min(dispatch_time) from tz_dispatch_task where alert_id = t1.sequence_nbr and dispatch_time is not null ) as dis
from tz_alert_called t1 where t1.biz_org_code like concat(#{orgCode}, '%') and t1.alarm_type_code = '960' and call_time BETWEEN #{startDate} and #{endDate} from tz_alert_called t1 where t1.biz_org_code like concat(#{orgCode}, '%') and t1.alarm_type_code = '960' and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null
) where extract(epoch from arr - dis ) &lt; 1800 ) where extract(epoch from arr - dis ) &lt; 1800
) as lessNum, ) as lessNum,
(SELECT count(1) from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and alarm_type_code = '960' and call_time BETWEEN #{startDate} and #{endDate}) as greaterNum, (SELECT count(1) from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and alarm_type_code = '960' and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null) as greaterNum,
( (
SELECT sum(extract(epoch from arr - dis )) from SELECT sum(extract(epoch from arr - dis )) from
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
(SELECT min(dispatch_time) from tz_dispatch_task where alert_id = t1.sequence_nbr and dispatch_time is not null ) as dis (SELECT min(dispatch_time) from tz_dispatch_task where alert_id = t1.sequence_nbr and dispatch_time is not null ) as dis
from tz_alert_called t1 where t1.biz_org_code like concat('50', '%') and t1.alarm_type_code = '960' and call_time BETWEEN #{startDate} and #{endDate} from tz_alert_called t1 where t1.biz_org_code like concat('50', '%') and t1.alarm_type_code = '960' and t1.call_time BETWEEN #{startDate} and #{endDate} and t1.father_alert is null
) ) as avgNum ) ) as avgNum
</select> </select>
......
...@@ -21,19 +21,19 @@ ...@@ -21,19 +21,19 @@
) AS elevatorNum, ) AS elevatorNum,
(SELECT COUNT(1) (SELECT COUNT(1)
FROM tz_alert_called FROM tz_alert_called
WHERE biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) AS emergencyEventsAll, WHERE biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null ) AS emergencyEventsAll,
(SELECT COUNT(1) (SELECT COUNT(1)
FROM tz_alert_called FROM tz_alert_called
WHERE alarm_type_code = '960' WHERE alarm_type_code = '960'
AND biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) AS trappedPeople, AND biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null) AS trappedPeople,
(SELECT COUNT(1) (SELECT COUNT(1)
FROM tz_alert_called FROM tz_alert_called
WHERE alarm_type_code = '961' WHERE alarm_type_code = '961'
AND biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) AS breakdownRescue, AND biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null) AS breakdownRescue,
(SELECT COUNT(1) (SELECT COUNT(1)
FROM tz_alert_called FROM tz_alert_called
WHERE alarm_type_code = '962' WHERE alarm_type_code = '962'
AND biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) AS complaint, AND biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null) AS complaint,
( (
SELECT ( SELECT (
( (
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
WHERE alert_called_id IN ( WHERE alert_called_id IN (
SELECT sequence_nbr SELECT sequence_nbr
FROM tz_alert_called FROM tz_alert_called
WHERE biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) WHERE biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null)
AND field_code = 'trapped_num' AND field_code = 'trapped_num'
) - ( ) - (
SELECT ifnull(SUM(field_value), 0) SELECT ifnull(SUM(field_value), 0)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
WHERE alert_called_id IN ( WHERE alert_called_id IN (
SELECT sequence_nbr SELECT sequence_nbr
FROM tz_alert_called FROM tz_alert_called
WHERE biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) WHERE biz_org_code LIKE concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and father_alert is null)
AND field_code = 'die_num' AND field_code = 'die_num'
) )
)) AS rescuePersonnel )) AS rescuePersonnel
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
and tac.equipment_id is not null and tac.equipment_id is not null
and use.ADDRESS is not null and use.ADDRESS is not null
and tac.call_time between #{startDate} and #{endDate} and tac.call_time between #{startDate} and #{endDate}
and tac.father_alert is null
) )
GROUP BY mainName, useName, address GROUP BY mainName, useName, address
ORDER BY address ORDER BY address
...@@ -34,10 +35,12 @@ ...@@ -34,10 +35,12 @@
) as equipNum, ) as equipNum,
( (
SELECT count(1) from tz_alert_called where alarm_type_code = '960' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate} SELECT count(1) from tz_alert_called where alarm_type_code = '960' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate}
and father_alert is null
) as trappedNum, ) as trappedNum,
( (
SELECT count(1) from tz_alert_called where alarm_type_code = '961' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate} SELECT count(1) from tz_alert_called where alarm_type_code = '961' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate}
and father_alert is null
) as faultNum ) as faultNum
</select> </select>
......
...@@ -157,6 +157,10 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -157,6 +157,10 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Override @Override
public Object selectAlertCalledById(Long id) { public Object selectAlertCalledById(Long id) {
AlertCalled alertCalled = this.getBaseMapper().selectById(id);
if (!ObjectUtils.isEmpty(alertCalled.getFatherAlert())){
id = alertCalled.getFatherAlert();
}
if(redisUtils.hasKey(RedisKey.TZS_ALERTCALLED_ID+id)){ if(redisUtils.hasKey(RedisKey.TZS_ALERTCALLED_ID+id)){
Object obj= redisUtils.get(RedisKey.TZS_ALERTCALLED_ID+id); Object obj= redisUtils.get(RedisKey.TZS_ALERTCALLED_ID+id);
return obj; return obj;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment