Commit 7208731a authored by wangjinjing's avatar wangjinjing

重复实践不推送

parent ad01b18a
...@@ -151,10 +151,6 @@ public class TraffController { ...@@ -151,10 +151,6 @@ public class TraffController {
// importService.cleanCache(); // importService.cleanCache();
// 将参数result中的部分数据存入redis中,并把格式校验成功的数据发布至对应频道中 // 将参数result中的部分数据存入redis中,并把格式校验成功的数据发布至对应频道中
// importService.cacheAndPublish(JsonUtil.beanToString(trffClientMessage)); // importService.cacheAndPublish(JsonUtil.beanToString(trffClientMessage));
//判断该事件在规定事件内是否发生过,发生过不需要入库
sendevent(trffClientMessage); sendevent(trffClientMessage);
} catch (Exception e) { } catch (Exception e) {
log.error("MessageController receive putData error:" + e.toString()); log.error("MessageController receive putData error:" + e.toString());
...@@ -162,23 +158,42 @@ public class TraffController { ...@@ -162,23 +158,42 @@ public class TraffController {
return ResultObj.ok(trffClientMessage); return ResultObj.ok(trffClientMessage);
} }
public void sendevent( Alarm trffClientMessage){ public void sendevent( Alarm trffClientMessage){
List<String> imgBase64List = trffClientMessage.getImg_base64();
Traffalarmrecord traffAlarmRecord = new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord = new Traffalarmrecord();
String imgEnumHead = "IMG";
traffAlarmRecord.setAreaid(Long.valueOf(trffClientMessage.getDept())); traffAlarmRecord.setAreaid(Long.valueOf(trffClientMessage.getDept()));
traffAlarmRecord.setRecordtype(trffClientMessage.getIncident_type().toLowerCase()); traffAlarmRecord.setRecordtype(trffClientMessage.getIncident_type().toLowerCase());
traffAlarmRecord.setVideourlfrom(trffClientMessage.getVideo_record_url());
traffAlarmRecord.setRecordtime(new Date(Long.valueOf(trffClientMessage.getTs()))); traffAlarmRecord.setRecordtime(new Date(Long.valueOf(trffClientMessage.getTs())));
traffAlarmRecord.setCreatetime(new Date()); String[] videoIdArr = trffClientMessage.getVideo_id().split("_");
traffAlarmRecord.setObjlable(trffClientMessage.getObjLabel()); traffAlarmRecord.setFdid(videoIdArr[0]);
traffAlarmRecord.setPushstatus(9);//设置为未推送 Integer channelid = Integer.valueOf(videoIdArr[1]) + 1;
traffAlarmRecord.setChannelid(channelid);
//判断该事件在规定事件内是否发生过,发生过不需要入库
int exists=traffAlarmRecordMapper.selectExitsTraffAlarm(traffAlarmRecord); int exists=traffAlarmRecordMapper.selectExitsTraffAlarm(traffAlarmRecord);
if(exists>0){ if(exists>0){
//存在直接返回 //存在直接返回
return; return;
} }
else{
//判断是否在正检时间内
exists=traffAlarmRecordMapper.selectInChecktimeTraffAlarm(traffAlarmRecord);
if(exists>0)
return;
}
traffAlarmRecord.setVideourlfrom(trffClientMessage.getVideo_record_url());
traffAlarmRecord.setCreatetime(new Date());
traffAlarmRecord.setObjlable(trffClientMessage.getObjLabel());
traffAlarmRecord.setPushstatus(9);//设置为未推送
//支持对某一个点位报施工事件后 倒推RECTIFYTIME 查看是否是施工事件 一段时间(时间可以配置)之前的停车事件和行人闯入事件矫正为施工事件
exists=traffAlarmRecordMapper.selectInworkRectifytimeTraffAlarm(traffAlarmRecord);
if(exists>0 && (traffAlarmRecord.getRecordtype().equalsIgnoreCase("no_motor_ban") ||traffAlarmRecord.getRecordtype().equalsIgnoreCase("illegal_parking") ))
{
//这个事件如果为停车事件或者行人闯入事件时,设置纠偏状态为1
}
List<String> imgBase64List = trffClientMessage.getImg_base64();
String imgEnumHead = "IMG";
Ftp ftp = ftpService.reloadFtp(); Ftp ftp = ftpService.reloadFtp();
for (int i = 0; i < imgBase64List.size(); i++) { for (int i = 0; i < imgBase64List.size(); i++) {
/* 图片上传 */ /* 图片上传 */
...@@ -192,11 +207,6 @@ public void sendevent( Alarm trffClientMessage){ ...@@ -192,11 +207,6 @@ public void sendevent( Alarm trffClientMessage){
for (int i = 0; i < imgUrls.size(); i++) { for (int i = 0; i < imgUrls.size(); i++) {
TraffAlarmRecordFromImgEnum.valueOf(imgEnumHead + i).setImg(traffAlarmRecord, imgUrls.get(i)); TraffAlarmRecordFromImgEnum.valueOf(imgEnumHead + i).setImg(traffAlarmRecord, imgUrls.get(i));
} }
String[] videoIdArr = trffClientMessage.getVideo_id().split("_");
String fdid = videoIdArr[0];
traffAlarmRecord.setFdid(fdid);
Integer channelid = Integer.valueOf(videoIdArr[1]) + 1;
traffAlarmRecord.setChannelid(channelid);
if (StringEnum.ONE.getValue().equals(checkEnable)) { if (StringEnum.ONE.getValue().equals(checkEnable)) {
/* 9:免审 */ /* 9:免审 */
......
...@@ -23,8 +23,12 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co ...@@ -23,8 +23,12 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co
Integer statisTraffalarmrecordstatByDay(); Integer statisTraffalarmrecordstatByDay();
int updateTraffAlarmRectificationType(Traffalarmrecord traffalarmrecord); Integer updateTraffAlarmRectificationType(Traffalarmrecord traffalarmrecord);
int selectExitsTraffAlarm(Traffalarmrecord traffalarmrecord); Integer selectExitsTraffAlarm(Traffalarmrecord traffalarmrecord);
Integer selectInChecktimeTraffAlarm(Traffalarmrecord traffalarmrecord);
Integer selectInworkRectifytimeTraffAlarm(Traffalarmrecord traffalarmrecord);
} }
\ No newline at end of file
...@@ -27,80 +27,80 @@ ...@@ -27,80 +27,80 @@
<insert id="inserTraffAlarmRecord"> <insert id="inserTraffAlarmRecord">
insert into traffalarmrecord insert into traffalarmrecord
<trim prefix="(" suffix=")" suffixOverrides="," > <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordid != null" >recordid,</if> <if test="recordid != null">recordid,</if>
<if test="algotype != null" >algotype,</if> <if test="algotype != null">algotype,</if>
<if test="areaid != null" >areaid,</if> <if test="areaid != null">areaid,</if>
<if test="fdid != null" >fdid,</if> <if test="fdid != null">fdid,</if>
<if test="channelid != null" > channelid,</if> <if test="channelid != null">channelid,</if>
<if test="channeletype != null" >channeletype,</if> <if test="channeletype != null">channeletype,</if>
<if test="channelname != null" > channelname ,</if> <if test="channelname != null">channelname ,</if>
<if test="recordtime != null" > recordtime,</if> <if test="recordtime != null">recordtime,</if>
<if test="recordtype != null" > recordtype,</if> <if test="recordtype != null">recordtype,</if>
<if test="location != null" > location,</if> <if test="location != null">location,</if>
<if test="img1urlfrom != null" >img1urlfrom,</if> <if test="img1urlfrom != null">img1urlfrom,</if>
<if test="img1path != null" > img1path,</if> <if test="img1path != null">img1path,</if>
<if test="img2urlfrom != null" >img2urlfrom,</if> <if test="img2urlfrom != null">img2urlfrom,</if>
<if test="img2path != null" > img2path,</if> <if test="img2path != null">img2path,</if>
<if test="img3urlfrom != null" >img3urlfrom,</if> <if test="img3urlfrom != null">img3urlfrom,</if>
<if test="img3path != null" > img3path,</if> <if test="img3path != null">img3path,</if>
<if test="img4urlfrom != null" >img4urlfrom,</if> <if test="img4urlfrom != null">img4urlfrom,</if>
<if test="img4path != null" > img4path,</if> <if test="img4path != null">img4path,</if>
<if test="img5urlfrom != null" >img5urlfrom,</if> <if test="img5urlfrom != null">img5urlfrom,</if>
<if test="img5path != null" > img5path,</if> <if test="img5path != null">img5path,</if>
<if test="videourlfrom != null" >videourlfrom,</if> <if test="videourlfrom != null">videourlfrom,</if>
<if test="videopath != null" >videopath,</if> <if test="videopath != null">videopath,</if>
<if test="retrytime != null" > retrytime,</if> <if test="retrytime != null">retrytime,</if>
<if test="retrycount != null" > retrycount,</if> <if test="retrycount != null">retrycount,</if>
<if test="recordlevel != null" > recordlevel,</if> <if test="recordlevel != null">recordlevel,</if>
<if test="checkstatus != null" >checkstatus,</if> <if test="checkstatus != null">checkstatus,</if>
<if test="creator != null" > creator,</if> <if test="creator != null">creator,</if>
<if test="createtime != null" > createtime,</if> <if test="createtime != null">createtime,</if>
<if test="updator != null" > updator,</if> <if test="updator != null">updator,</if>
<if test="updatetime != null" >updatetime,</if> <if test="updatetime != null">updatetime,</if>
<if test="remark != null" >remark,</if> <if test="remark != null">remark,</if>
<if test="pushstatus != null" >pushstatus,</if> <if test="pushstatus != null">pushstatus,</if>
<if test="pushdesc != null" > pushdesc,</if> <if test="pushdesc != null">pushdesc,</if>
<if test="processstatus != null" > processstatus,</if> <if test="processstatus != null">processstatus,</if>
<if test="objlable != null" > objlable,</if> <if test="objlable != null">objlable,</if>
</trim> </trim>
<trim prefix="select" suffix="from dual" suffixOverrides="," > <trim prefix="select" suffix="from dual" suffixOverrides=",">
<if test="recordid != null" >#{recordid},</if> <if test="recordid != null">#{recordid},</if>
<if test="algotype != null" >#{algotype},</if> <if test="algotype != null">#{algotype},</if>
<if test="areaid != null" >#{areaid},</if> <if test="areaid != null">#{areaid},</if>
<if test="fdid != null" >#{fdid},</if> <if test="fdid != null">#{fdid},</if>
<if test="channelid != null" >#{ channelid},</if> <if test="channelid != null">#{ channelid},</if>
<if test="channeletype != null" >#{channeletype},</if> <if test="channeletype != null">#{channeletype},</if>
<if test="channelname != null" >#{ channelname },</if> <if test="channelname != null">#{ channelname },</if>
<if test="recordtime != null" >#{ recordtime},</if> <if test="recordtime != null">#{ recordtime},</if>
<if test="recordtype != null" >#{ recordtype},</if> <if test="recordtype != null">#{ recordtype},</if>
<if test="location != null" >#{ location},</if> <if test="location != null">#{ location},</if>
<if test="img1urlfrom != null" >#{img1urlfrom},</if> <if test="img1urlfrom != null">#{img1urlfrom},</if>
<if test="img1path != null" >#{ img1path},</if> <if test="img1path != null">#{ img1path},</if>
<if test="img2urlfrom != null" >#{img2urlfrom},</if> <if test="img2urlfrom != null">#{img2urlfrom},</if>
<if test="img2path != null" >#{ img2path},</if> <if test="img2path != null">#{ img2path},</if>
<if test="img3urlfrom != null" >#{img3urlfrom},</if> <if test="img3urlfrom != null">#{img3urlfrom},</if>
<if test="img3path != null" >#{ img3path},</if> <if test="img3path != null">#{ img3path},</if>
<if test="img4urlfrom != null" >#{img4urlfrom},</if> <if test="img4urlfrom != null">#{img4urlfrom},</if>
<if test="img4path != null" >#{ img4path},</if> <if test="img4path != null">#{ img4path},</if>
<if test="img5urlfrom != null" >#{img5urlfrom},</if> <if test="img5urlfrom != null">#{img5urlfrom},</if>
<if test="img5path != null" >#{img5path},</if> <if test="img5path != null">#{img5path},</if>
<if test="videourlfrom != null" >#{videourlfrom},</if> <if test="videourlfrom != null">#{videourlfrom},</if>
<if test="videopath != null" >#{videopath},</if> <if test="videopath != null">#{videopath},</if>
<if test="retrytime != null" >#{retrytime},</if> <if test="retrytime != null">#{retrytime},</if>
<if test="retrycount != null" >#{retrycount},</if> <if test="retrycount != null">#{retrycount},</if>
<if test="recordlevel != null" >#{recordlevel,jdbcType=INTEGER},</if> <if test="recordlevel != null">#{recordlevel,jdbcType=INTEGER},</if>
<if test="checkstatus != null" >#{checkstatus,jdbcType=INTEGER},</if> <if test="checkstatus != null">#{checkstatus,jdbcType=INTEGER},</if>
<if test="creator != null" >#{creator},</if> <if test="creator != null">#{creator},</if>
<if test="createtime != null" >#{createtime},</if> <if test="createtime != null">#{createtime},</if>
<if test="updator != null" >#{updator},</if> <if test="updator != null">#{updator},</if>
<if test="updatetime != null" >#{updatetime},</if> <if test="updatetime != null">#{updatetime},</if>
<if test="remark != null" >#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="pushstatus != null" >#{pushstatus},</if> <if test="pushstatus != null">#{pushstatus},</if>
<if test="pushdesc != null" >#{pushdesc},</if> <if test="pushdesc != null">#{pushdesc},</if>
<if test="processstatus != null" > #{processstatus},</if> <if test="processstatus != null">#{processstatus},</if>
<if test="objlable != null" > #{objlable},</if> <if test="objlable != null">#{objlable},</if>
</trim> </trim>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</select> </select>
<insert id="statisTraffalarmrecordstatByDay" > <insert id="statisTraffalarmrecordstatByDay">
insert into TRAFFALARMRECORDSTATE insert into TRAFFALARMRECORDSTATE
SELECT A.FDID,CHANNELID, to_char(A.RECORDTIME,'yyyy-MM-DD')countdate,count(*) totalcount,recordtype eventtype,areaid, SELECT A.FDID,CHANNELID, to_char(A.RECORDTIME,'yyyy-MM-DD')countdate,count(*) totalcount,recordtype eventtype,areaid,
(select B.TDMC from SBTDSPSR B where A.FDID=B.SBBH and CHANNELID=B.TDBH and rownum=1)tdmc, (select B.TDMC from SBTDSPSR B where A.FDID=B.SBBH and CHANNELID=B.TDBH and rownum=1)tdmc,
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
and A.RECORDTIME<![CDATA[ < ]]>TRUNC(SYSDATE) and A.RECORDTIME<![CDATA[ < ]]>TRUNC(SYSDATE)
group by to_char(A.RECORDTIME,'yyyy-MM-DD'),recordtype,A.FDID,CHANNELID,areaid group by to_char(A.RECORDTIME,'yyyy-MM-DD'),recordtype,A.FDID,CHANNELID,areaid
</insert> </insert>
<update id="updateTraffAlarmRectificationType" parameterType="com.hzjt.domain.Traffalarmrecord"> <update id="updateTraffAlarmRectificationType" parameterType="com.hzjt.domain.Traffalarmrecord">
UPDATE TRAFFALARMRECORD UPDATE TRAFFALARMRECORD
<set> <set>
<if test="item.processstatus != null"> <if test="item.processstatus != null">
...@@ -134,20 +134,50 @@ ...@@ -134,20 +134,50 @@
</if> </if>
</set> </set>
from TRAFFALARMRECORD a, from TRAFFALARMRECORD a,
(select * from TRAFFALARMRECORD a,(select * from TRAFFALARMRECORD b where recordid=#{item.recordid,jdbcType=VARCHAR} )b (select * from TRAFFALARMRECORD a,(select * from TRAFFALARMRECORD b where
recordid=#{item.recordid,jdbcType=VARCHAR} )b
where a.fdid =b.fdid and a.channelid=b.channelid where a.fdid =b.fdid and a.channelid=b.channelid
AND ( a.recordtime<![CDATA[ <= ]]> b.recordtime-10/(24*60)) AND ( a.recordtime<![CDATA[ <= ]]> b.recordtime-10/(24*60))
AND recordtype in ('roadworks_out_of_line','roadworks'))b AND recordtype in ('roadworks_out_of_line','roadworks'))b
where recordtype in('illegal_parking','no_motor_ban') and a.fdid =b.fdid and a.channelid=b.channelid where recordtype in('illegal_parking','no_motor_ban') and a.fdid =b.fdid and a.channelid=b.channelid
</update> </update>
<select id="selectExitsTraffAlarm" parameterType="com.hzjt.domain.Traffalarmrecord" resultType="java.lang.Integer"> <select id="selectExitsTraffAlarm" parameterType="com.hzjt.domain.Traffalarmrecord" resultType="java.lang.Integer">
select count(1) from TRAFFALARMRECORD a,t_code b where a.recordtype=#{item.recordtype,jdbcType=VARCHAR} select count(1) from TRAFFALARMRECORD a,t_code b where a.recordtype=#{item.recordtype,jdbcType=VARCHAR}
and a.recordtype=LOWER (b.key)and recordtime>=sysdate-(b.pushchektime)/(24*60) and a.recordtype=LOWER (b.key)and recordtime>=sysdate-(b.REPEATTIME)/(24*60)
and a.fdid=#{item.fdid,jdbcType=VARCHAR}
and a.channelid=#{item.channelid,jdbcType=VARCHAR}
</select>
<select id="selectInChecktimeTraffAlarm" parameterType="com.hzjt.domain.Traffalarmrecord" resultType="java.lang.Integer">
select count(1) from TRAFFALARMRECORD a,t_code b
where a.recordtype=#{item.recordtype,jdbcType=VARCHAR}
and a.fdid=#{item.fdid,jdbcType=VARCHAR} and a.fdid=#{item.fdid,jdbcType=VARCHAR}
and a.channelid=#{item.channelid,jdbcType=VARCHAR} and a.channelid=#{item.channelid,jdbcType=VARCHAR}
and a.recordtype=LOWER (b.key)
and recordtime<![CDATA[ <= ]]>(select LASTCHECKTIME from videochecktime c where
a.fdid=#{item.fdid,jdbcType=VARCHAR}
and a.channelid=#{item.channelid,jdbcType=VARCHAR}
and recordtype=#{item.recordtype,jdbcType=VARCHAR})+(b.PUSHCHECKTIME)/(24*60)
and recordtime>(select LASTCHECKTIME from videochecktime c where
a.fdid=#{item.fdid,jdbcType=VARCHAR}
and a.channelid=#{item.channelid,jdbcType=VARCHAR}
and recordtype=#{item.recordtype,jdbcType=VARCHAR})
</select>
<select id="selectInworkRectifytimeTraffAlarm" parameterType="com.hzjt.domain.Traffalarmrecord" resultType="java.lang.Integer">
select count(1) from TRAFFALARMRECORD a,t_code b
where a.recordtype=#{item.recordtype,jdbcType=VARCHAR}
and a.recordtype=LOWER (b.key)
and a.fdid=#{item.fdid,jdbcType=VARCHAR}
and a.channelid=#{item.channelid,jdbcType=VARCHAR}
and recordtime>=#{item.recordtime,jdbcType=TIMESTAMP}-(b.RECTIFYTIME)/(24*60)
and recordtime<![CDATA[ < ]]>#{item.recordtime,jdbcType=TIMESTAMP}
and recordtype in ('roadworks_out_of_line','roadworks')
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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