From 6971c195601ecc91b2b7b52af83efed9956dcfe0 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 09 Apr 2021 09:22:49 +0800
Subject: [PATCH] 接口提供:根据设备编码
---
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml | 186 +++++++++++++++++++++++++++++++++++++---------
1 files changed, 150 insertions(+), 36 deletions(-)
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
index cba9173..33af055 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/alarm/mapper/AlarmMapper.xml
@@ -31,16 +31,22 @@
<result column="bz" property="bz"/>
<result column="name" property="name"/>
<result column="cid" property="cid"/>
+ <result column="vaddress" property="vaddress"/>
+ <result column="aaddress" property="aaddress"/>
</resultMap>
<select id="selectAlarmPage" resultMap="alarmResultMap">
select
a.id,a.alarmType,a.alarmPeople,a.alarmTime,a.galarmPeople,a.sex,a.phoneNumber,a.place,a.content,a.waringType,a.bz,
- a.deviceNumber,a.region,a.district,
+ a.deviceNumber,a.region,a.district,a.vaddress,a.aaddress,
a.alarmId,a.LEVEL,e.jd,e.wd,a.jtype,a.rname,a.jjTime,a.province,a.city,a.cid,
e.serialNumber,e.oneContacts,e.ThreeContacts,e.twoContacts,e.onePhone,e.twoPhone,e.ThreePhone,
e.stype,
+ e.oneId,
+ e.twoId,
+ e.threeId,
+ e.deptId,
e.channelNumber from sys_alarm a
LEFT JOIN sys_equipment e on e.deviceNumber=a.deviceNumber
where 1=1
@@ -74,6 +80,20 @@
<if test="alarm.endTime!=null and alarm.endTime!=''">
and a.alarmTime<=#{alarm.endTime}
</if>
+ <if test="alarm.timeDesc!=null and alarm.timeDesc!=''">
+ <if test="alarm.timeDesc=='30分钟以上'">
+ and czTime-alarmTime>1800
+ </if>
+ <if test="alarm.timeDesc=='10-30分钟'">
+ and czTime-alarmTime>600 and czTime-alarmTime <1800
+ </if>
+ <if test="alarm.timeDesc=='5-10分钟'">
+ and czTime-alarmTime>300 and czTime-alarmTime <600
+ </if>
+ <if test="alarm.timeDesc=='小于5分钟'">
+ and czTime-alarmTime>0 and czTime-alarmTime <300
+ </if>
+ </if>
and a.waringType IN("紧急求救")
@@ -84,7 +104,7 @@
<select id="listAll" resultMap="alarmResultMap">
select a.id,a.alarmType,a.alarmPeople,a.alarmTime,a.galarmPeople,a.sex,a.phoneNumber,a.place,a.content,a.waringType,
- a.deviceNumber,a.region,a.district, a.alarmId,a.LEVEL,e.jd,e.wd,a.jtype,a.rname,a.jjTime,a.province,a.city,a.cid
+ a.deviceNumber,a.region,a.district, a.alarmId,a.LEVEL,e.jd,e.wd,a.jtype,a.rname,a.jjTime,a.province,a.city,a.cid,a.vaddress
from sys_alarm a LEFT JOIN sys_equipment e on e.deviceNumber=a.deviceNumber
</select>
@@ -102,6 +122,7 @@
a.content,
a.waringType,
a.deviceNumber,
+ a.vaddress,
a.region,
a.district,
a.alarmId,
@@ -139,7 +160,7 @@
</select>
<select id="getLimit" resultMap="alarmResultMap">
- select a.id,a.alarmType,a.alarmPeople,a.alarmTime,a.galarmPeople,a.sex,a.phoneNumber,a.place,a.content,a.waringType,
+ select a.id,a.alarmType,a.alarmPeople,a.alarmTime,a.galarmPeople,a.sex,a.phoneNumber,a.place,a.content,a.waringType,a.vaddress,
a.deviceNumber,a.region,a.district, a.alarmId,a.LEVEL,a.jd,a.wd,a.jtype,a.rname,a.jjTime,a.province,a.city,a.cid from sys_alarm a ORDER BY id DESC LIMIT 1
</select>
@@ -161,6 +182,7 @@
a.region,
a.district,
a.alarmId,
+ a.vaddress,
a.rname,
a.LEVEL,
a.cid,
@@ -223,10 +245,10 @@
</delete>
<!--新增-->
- <insert id="s" parameterType="org.springblade.jfpt.alarm.entity.Alarm">
- INSERT INTO sys_alarm (alarmType,alarmPeople,alarmTime,galarmPeople,sex,phoneNumber,place,content,waringType,deviceNumber,
+ <insert id="s" parameterType="org.springblade.jfpt.alarm.entity.Alarm" useGeneratedKeys="true" keyProperty="id">
+ INSERT INTO sys_alarm (alarmType,jjTime,alarmPeople,alarmTime,galarmPeople,sex,phoneNumber,place,content,waringType,deviceNumber,
region,district,alarmId,level,rname,coordinate,jd,wd,jtype,province,city,cid) VALUES
- (#{alarmType},#{alarmPeople},#{alarmTime},#{galarmPeople},#{sex},#{phoneNumber},#{place},#{content},#{waringType},
+ (#{alarmType},#{jjTime},#{alarmPeople},#{alarmTime},#{galarmPeople},#{sex},#{phoneNumber},#{place},#{content},#{waringType},
#{deviceNumber},#{region},#{district},#{alarmId},#{level},#{rname},POINT(#{jd},#{wd}),
#{jd},#{wd},#{jtype},#{province},#{city},#{cid})
</insert>
@@ -245,6 +267,7 @@
<select id="selectListSe" resultMap="alarmResultMap">
+
SELECT
a.id,
a.alarmType,
@@ -277,7 +300,7 @@
<update id="updateJtype">
- update sys_alarm SET jtype=#{jtype},bz=#{bz},jjTime=#{jjtime} where id=#{id}
+ update sys_alarm SET jtype=#{jtype},bz=#{bz} where id=#{id}
</update>
<update id="updatePoliceStatus">
@@ -287,10 +310,14 @@
<!--查询当天警情总数-->
<select id="selectAlarmCount" resultType="java.lang.Integer">
SELECT count(*) FROM `sys_alarm`
- where
+ where
waringType = '紧急求救'
- and
- to_days(alarmTime) = to_days(curdate())
+ <if test="conditionVo.status==0">
+ and to_days(alarmTime) = to_days(curdate())
+ </if>
+ <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''">
+ and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime}
+ </if>
</select>
@@ -320,29 +347,29 @@
) b
on
a.click_date = b.datetime
+ order by a.click_date asc
</select>
-
-<!-- <!–查询本日,本周,本月 主动报警的数量–>-->
-<!-- <select id="selectAlarmSum" resultType="java.util.HashMap">-->
-<!-- select sa.alarmType name,IFNULL(sb.count, 0) value from (select alarmType from sys_alarm GROUP BY alarmType) sa-->
-<!-- left join-->
-<!-- ( select alarmType,count(*) count from sys_alarm-->
-<!-- where 1=1-->
-<!-- <if test="conditionVo.status==0">-->
-<!-- and to_days(alarmTime) = to_days(now())-->
-<!-- </if>-->
-<!-- <if test="conditionVo.status==1">-->
-<!-- and YEARWEEK(date_format(alarmTime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)-->
-<!-- </if>-->
-<!-- <if test="conditionVo.status==2">-->
-<!-- and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')-->
-<!-- </if>-->
-<!-- group by alarmType-->
-<!-- ) sb-->
-<!-- on-->
-<!-- sa.alarmType = sb.alarmType-->
-<!-- </select>-->
+ <!-- <!–查询本日,本周,本月 主动报警的数量–>-->
+ <!-- <select id="selectAlarmSum" resultType="java.util.HashMap">-->
+ <!-- select sa.alarmType name,IFNULL(sb.count, 0) value from (select alarmType from sys_alarm GROUP BY alarmType) sa-->
+ <!-- left join-->
+ <!-- ( select alarmType,count(*) count from sys_alarm-->
+ <!-- where 1=1-->
+ <!-- <if test="conditionVo.status==0">-->
+ <!-- and to_days(alarmTime) = to_days(now())-->
+ <!-- </if>-->
+ <!-- <if test="conditionVo.status==1">-->
+ <!-- and YEARWEEK(date_format(alarmTime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)-->
+ <!-- </if>-->
+ <!-- <if test="conditionVo.status==2">-->
+ <!-- and date_format(alarmTime,'%Y%m') = date_format(now(),'%Y%m')-->
+ <!-- </if>-->
+ <!-- group by alarmType-->
+ <!-- ) sb-->
+ <!-- on-->
+ <!-- sa.alarmType = sb.alarmType-->
+ <!-- </select>-->
<!--查询本日,本周,本月 主动报警的数量-->
<select id="selectAlarmSum" resultType="java.util.HashMap">
@@ -380,13 +407,13 @@
<select id="queryPoliceTime" resultType="java.util.HashMap">
SELECT
- a.alarmPeople,
- a.alarmId,
- max( a.jjTime ) AS jjTime
+ a.alarmPeople,
+ a.alarmId,
+ max( a.jjTime ) AS jjTime
FROM
- sys_alarm a
+ sys_alarm a
WHERE
- 1 =1
+ 1 =1
<if test="policeIdArr!=null and policeIdArr.size>0">
and alarmId in
@@ -402,4 +429,91 @@
LIMIT 1
</select>
+
+ <select id="queryBa" resultType="java.util.HashMap">
+ SELECT
+ s.id,
+ s.CODE,
+ s.NAME,
+ s.real_name,
+ s.phone,
+ p.jd,
+ p.wd,
+ ST_ASTEXT ( e.coordinate )
+ FROM
+ jfpth.blade_user s
+ LEFT JOIN sys_position p ON p.snumber = s.
+ CODE LEFT JOIN sys_enclosure e ON e.anumber = s.CODE
+ WHERE
+ is_deleted != '1'
+ AND role_id = "1370562810882502657"
+ </select>
+
+ <update id="updateVaddress">
+ update sys_alarm SET vaddress=#{vaddress} where id=#{jid}
+ </update>
+
+
+ <select id="selectEq" resultType="java.util.HashMap">
+ SELECT COUNT(deviceNumber) as cou,deviceNumber FROM `sys_alarm` WHERE alarmTime like concat(concat('%', #{time}), '%') and waringType NOT IN("系统测试","主机重新上电") group by deviceNumber
+ </select>
+
+ <select id="selAlarmTimeCount" resultType="java.lang.Integer">
+ select count(*) from sys_alarm
+ where waringType = '紧急求救'
+ <if test="conditionVo.startTime!=null and conditionVo.startTime!='' and conditionVo.endTime!=null and conditionVo.endTime!=''">
+ and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime}
+ </if>
+ </select>
+
+ <!--查询当前时间段内一键求助报警的数据集合-->
+ <select id="selectAlarmList" resultType="org.springblade.jfpt.alarm.entity.Alarm">
+ SELECT waringType,alarmTime,alarmId,alarmPeople,jtype,czTime FROM `sys_alarm`
+ where waringType='紧急求救'
+ and alarmTime between #{conditionVo.startTime} and #{conditionVo.endTime}
+ </select>
+
+ <!--统计时间段内一键求助警情数量数据-->
+ <select id="selectAlarmTimeData" resultType="java.lang.Integer">
+ select ifnull(count,0) count from
+ (
+ SELECT @date := DATE_ADD( @date, INTERVAL + 1 DAY ) days FROM
+ (
+ SELECT @date := DATE_ADD( #{conditionVo.startTime}, INTERVAL - 1 DAY ) FROM sys_date
+ ) time
+ WHERE to_days( @date ) < to_days( #{conditionVo.endTime} )
+ ) a
+ left join
+ (
+ select DATE_FORMAT(alarmTime,'%Y-%m-%d') as datetime, count(*) as count from sys_alarm
+ where waringType = '紧急求救'
+ group by DATE_FORMAT(alarmTime,'%Y-%m-%d')
+ ) b
+ on
+ a.days = b.datetime
+ </select>
+
+
+ <!--查询本年所有月份的预警数量-->
+ <select id="queryYearAlarm" resultType="java.util.HashMap">
+
+ <if test="childList!=null and childList.size>0">
+
+ <foreach collection="childList" index="index" item="item" open="" separator="union all" close="">
+ SELECT
+ #{item} as month,count(ce.id) as count
+ FROM
+ sys_alarm as ce
+ WHERE
+ YEAR ( alarmTime ) = date_format(now(),'%Y%')
+ AND MONTH ( alarmTime ) = #{item}
+
+ AND waringType = "紧急求救"
+ AND deviceNumber = #{deviceNumber}
+
+ </foreach>
+ </if>
+
+ </select>
+
</mapper>
--
Gitblit v1.9.3