Commit 7208731a authored by wangjinjing's avatar wangjinjing

重复实践不推送

parent ad01b18a
......@@ -151,10 +151,6 @@ public class TraffController {
// importService.cleanCache();
// 将参数result中的部分数据存入redis中,并把格式校验成功的数据发布至对应频道中
// importService.cacheAndPublish(JsonUtil.beanToString(trffClientMessage));
//判断该事件在规定事件内是否发生过,发生过不需要入库
sendevent(trffClientMessage);
} catch (Exception e) {
log.error("MessageController receive putData error:" + e.toString());
......@@ -162,23 +158,42 @@ public class TraffController {
return ResultObj.ok(trffClientMessage);
}
public void sendevent( Alarm trffClientMessage){
List<String> imgBase64List = trffClientMessage.getImg_base64();
Traffalarmrecord traffAlarmRecord = new Traffalarmrecord();
String imgEnumHead = "IMG";
traffAlarmRecord.setAreaid(Long.valueOf(trffClientMessage.getDept()));
traffAlarmRecord.setRecordtype(trffClientMessage.getIncident_type().toLowerCase());
traffAlarmRecord.setVideourlfrom(trffClientMessage.getVideo_record_url());
traffAlarmRecord.setRecordtime(new Date(Long.valueOf(trffClientMessage.getTs())));
traffAlarmRecord.setCreatetime(new Date());
traffAlarmRecord.setObjlable(trffClientMessage.getObjLabel());
traffAlarmRecord.setPushstatus(9);//设置为未推送
String[] videoIdArr = trffClientMessage.getVideo_id().split("_");
traffAlarmRecord.setFdid(videoIdArr[0]);
Integer channelid = Integer.valueOf(videoIdArr[1]) + 1;
traffAlarmRecord.setChannelid(channelid);
//判断该事件在规定事件内是否发生过,发生过不需要入库
int exists=traffAlarmRecordMapper.selectExitsTraffAlarm(traffAlarmRecord);
if(exists>0){
//存在直接返回
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();
for (int i = 0; i < imgBase64List.size(); i++) {
/* 图片上传 */
......@@ -192,11 +207,6 @@ public void sendevent( Alarm trffClientMessage){
for (int i = 0; i < imgUrls.size(); 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)) {
/* 9:免审 */
......
......@@ -23,8 +23,12 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co
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 @@
<insert id="inserTraffAlarmRecord">
insert into traffalarmrecord
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="recordid != null" >recordid,</if>
<if test="algotype != null" >algotype,</if>
<if test="areaid != null" >areaid,</if>
<if test="fdid != null" >fdid,</if>
<if test="channelid != null" > channelid,</if>
<if test="channeletype != null" >channeletype,</if>
<if test="channelname != null" > channelname ,</if>
<if test="recordtime != null" > recordtime,</if>
<if test="recordtype != null" > recordtype,</if>
<if test="location != null" > location,</if>
<if test="img1urlfrom != null" >img1urlfrom,</if>
<if test="img1path != null" > img1path,</if>
<if test="img2urlfrom != null" >img2urlfrom,</if>
<if test="img2path != null" > img2path,</if>
<if test="img3urlfrom != null" >img3urlfrom,</if>
<if test="img3path != null" > img3path,</if>
<if test="img4urlfrom != null" >img4urlfrom,</if>
<if test="img4path != null" > img4path,</if>
<if test="img5urlfrom != null" >img5urlfrom,</if>
<if test="img5path != null" > img5path,</if>
<if test="videourlfrom != null" >videourlfrom,</if>
<if test="videopath != null" >videopath,</if>
<if test="retrytime != null" > retrytime,</if>
<if test="retrycount != null" > retrycount,</if>
<if test="recordlevel != null" > recordlevel,</if>
<if test="checkstatus != null" >checkstatus,</if>
<if test="creator != null" > creator,</if>
<if test="createtime != null" > createtime,</if>
<if test="updator != null" > updator,</if>
<if test="updatetime != null" >updatetime,</if>
<if test="remark != null" >remark,</if>
<if test="pushstatus != null" >pushstatus,</if>
<if test="pushdesc != null" > pushdesc,</if>
<if test="processstatus != null" > processstatus,</if>
<if test="objlable != null" > objlable,</if>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordid != null">recordid,</if>
<if test="algotype != null">algotype,</if>
<if test="areaid != null">areaid,</if>
<if test="fdid != null">fdid,</if>
<if test="channelid != null">channelid,</if>
<if test="channeletype != null">channeletype,</if>
<if test="channelname != null">channelname ,</if>
<if test="recordtime != null">recordtime,</if>
<if test="recordtype != null">recordtype,</if>
<if test="location != null">location,</if>
<if test="img1urlfrom != null">img1urlfrom,</if>
<if test="img1path != null">img1path,</if>
<if test="img2urlfrom != null">img2urlfrom,</if>
<if test="img2path != null">img2path,</if>
<if test="img3urlfrom != null">img3urlfrom,</if>
<if test="img3path != null">img3path,</if>
<if test="img4urlfrom != null">img4urlfrom,</if>
<if test="img4path != null">img4path,</if>
<if test="img5urlfrom != null">img5urlfrom,</if>
<if test="img5path != null">img5path,</if>
<if test="videourlfrom != null">videourlfrom,</if>
<if test="videopath != null">videopath,</if>
<if test="retrytime != null">retrytime,</if>
<if test="retrycount != null">retrycount,</if>
<if test="recordlevel != null">recordlevel,</if>
<if test="checkstatus != null">checkstatus,</if>
<if test="creator != null">creator,</if>
<if test="createtime != null">createtime,</if>
<if test="updator != null">updator,</if>
<if test="updatetime != null">updatetime,</if>
<if test="remark != null">remark,</if>
<if test="pushstatus != null">pushstatus,</if>
<if test="pushdesc != null">pushdesc,</if>
<if test="processstatus != null">processstatus,</if>
<if test="objlable != null">objlable,</if>
</trim>
<trim prefix="select" suffix="from dual" suffixOverrides="," >
<if test="recordid != null" >#{recordid},</if>
<if test="algotype != null" >#{algotype},</if>
<if test="areaid != null" >#{areaid},</if>
<if test="fdid != null" >#{fdid},</if>
<if test="channelid != null" >#{ channelid},</if>
<if test="channeletype != null" >#{channeletype},</if>
<if test="channelname != null" >#{ channelname },</if>
<if test="recordtime != null" >#{ recordtime},</if>
<if test="recordtype != null" >#{ recordtype},</if>
<if test="location != null" >#{ location},</if>
<if test="img1urlfrom != null" >#{img1urlfrom},</if>
<if test="img1path != null" >#{ img1path},</if>
<if test="img2urlfrom != null" >#{img2urlfrom},</if>
<if test="img2path != null" >#{ img2path},</if>
<if test="img3urlfrom != null" >#{img3urlfrom},</if>
<if test="img3path != null" >#{ img3path},</if>
<if test="img4urlfrom != null" >#{img4urlfrom},</if>
<if test="img4path != null" >#{ img4path},</if>
<if test="img5urlfrom != null" >#{img5urlfrom},</if>
<if test="img5path != null" >#{img5path},</if>
<if test="videourlfrom != null" >#{videourlfrom},</if>
<if test="videopath != null" >#{videopath},</if>
<if test="retrytime != null" >#{retrytime},</if>
<if test="retrycount != null" >#{retrycount},</if>
<if test="recordlevel != null" >#{recordlevel,jdbcType=INTEGER},</if>
<if test="checkstatus != null" >#{checkstatus,jdbcType=INTEGER},</if>
<if test="creator != null" >#{creator},</if>
<if test="createtime != null" >#{createtime},</if>
<if test="updator != null" >#{updator},</if>
<if test="updatetime != null" >#{updatetime},</if>
<if test="remark != null" >#{remark},</if>
<if test="pushstatus != null" >#{pushstatus},</if>
<if test="pushdesc != null" >#{pushdesc},</if>
<if test="processstatus != null" > #{processstatus},</if>
<if test="objlable != null" > #{objlable},</if>
<trim prefix="select" suffix="from dual" suffixOverrides=",">
<if test="recordid != null">#{recordid},</if>
<if test="algotype != null">#{algotype},</if>
<if test="areaid != null">#{areaid},</if>
<if test="fdid != null">#{fdid},</if>
<if test="channelid != null">#{ channelid},</if>
<if test="channeletype != null">#{channeletype},</if>
<if test="channelname != null">#{ channelname },</if>
<if test="recordtime != null">#{ recordtime},</if>
<if test="recordtype != null">#{ recordtype},</if>
<if test="location != null">#{ location},</if>
<if test="img1urlfrom != null">#{img1urlfrom},</if>
<if test="img1path != null">#{ img1path},</if>
<if test="img2urlfrom != null">#{img2urlfrom},</if>
<if test="img2path != null">#{ img2path},</if>
<if test="img3urlfrom != null">#{img3urlfrom},</if>
<if test="img3path != null">#{ img3path},</if>
<if test="img4urlfrom != null">#{img4urlfrom},</if>
<if test="img4path != null">#{ img4path},</if>
<if test="img5urlfrom != null">#{img5urlfrom},</if>
<if test="img5path != null">#{img5path},</if>
<if test="videourlfrom != null">#{videourlfrom},</if>
<if test="videopath != null">#{videopath},</if>
<if test="retrytime != null">#{retrytime},</if>
<if test="retrycount != null">#{retrycount},</if>
<if test="recordlevel != null">#{recordlevel,jdbcType=INTEGER},</if>
<if test="checkstatus != null">#{checkstatus,jdbcType=INTEGER},</if>
<if test="creator != null">#{creator},</if>
<if test="createtime != null">#{createtime},</if>
<if test="updator != null">#{updator},</if>
<if test="updatetime != null">#{updatetime},</if>
<if test="remark != null">#{remark},</if>
<if test="pushstatus != null">#{pushstatus},</if>
<if test="pushdesc != null">#{pushdesc},</if>
<if test="processstatus != null">#{processstatus},</if>
<if test="objlable != null">#{objlable},</if>
</trim>
......@@ -112,7 +112,7 @@
</select>
<insert id="statisTraffalarmrecordstatByDay" >
<insert id="statisTraffalarmrecordstatByDay">
insert into TRAFFALARMRECORDSTATE
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,
......@@ -126,28 +126,58 @@
and A.RECORDTIME<![CDATA[ < ]]>TRUNC(SYSDATE)
group by to_char(A.RECORDTIME,'yyyy-MM-DD'),recordtype,A.FDID,CHANNELID,areaid
</insert>
<update id="updateTraffAlarmRectificationType" parameterType="com.hzjt.domain.Traffalarmrecord">
UPDATE TRAFFALARMRECORD
<set>
<if test="item.processstatus != null">
rectificationtype=1,
</if>
</set>
from TRAFFALARMRECORD a,
(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
AND ( a.recordtime<![CDATA[ <= ]]> b.recordtime-10/(24*60))
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
</update>
<update id="updateTraffAlarmRectificationType" parameterType="com.hzjt.domain.Traffalarmrecord">
UPDATE TRAFFALARMRECORD
<set>
<if test="item.processstatus != null">
rectificationtype=1,
</if>
</set>
from TRAFFALARMRECORD a,
(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
AND ( a.recordtime<![CDATA[ <= ]]> b.recordtime-10/(24*60))
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
</update>
<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}
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.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>
</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