Commit ad01b18a authored by 高飞's avatar 高飞

重复事件不推送1

parent 63d5614f
......@@ -151,6 +151,10 @@ 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());
......@@ -161,6 +165,20 @@ 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);//设置为未推送
int exists=traffAlarmRecordMapper.selectExitsTraffAlarm(traffAlarmRecord);
if(exists>0){
//存在直接返回
return;
}
Ftp ftp = ftpService.reloadFtp();
for (int i = 0; i < imgBase64List.size(); i++) {
/* 图片上传 */
......@@ -187,14 +205,6 @@ public void sendevent( Alarm trffClientMessage){
int recordid = traffAlarmRecordMapper.selectmax();
traffAlarmRecord.setRecordid((long)(recordid+1));
traffAlarmRecord.setProcessstatus("0");
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);//设置为未推送
traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
try {
......@@ -213,12 +223,7 @@ public void sendevent( Alarm trffClientMessage){
if (traffAlarmRecord != null && traffAlarmRecord.getRecordid() != null) {
traffAlarmRecordMapper.updateTraffAlarmRecordUrl(traffAlarmRecord);
}
if(traffAlarmRecord.getRecordtype().equalsIgnoreCase("roadworks") || traffAlarmRecord.getRecordtype().equalsIgnoreCase("roadworks_out_of_line"))
{
//工程类的更新10分钟之前该videoid 下的 工程类和行人闯入和违停的记录施工纠偏类型为1
traffAlarmRecordMapper.updateTraffAlarmRectificationType(traffAlarmRecord);
}
......
......@@ -25,4 +25,6 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co
int updateTraffAlarmRectificationType(Traffalarmrecord traffalarmrecord);
int selectExitsTraffAlarm(Traffalarmrecord traffalarmrecord);
}
\ No newline at end of file
......@@ -165,4 +165,5 @@
</select>
</mapper>
\ No newline at end of file
......@@ -142,5 +142,12 @@
</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.fdid=#{item.fdid,jdbcType=VARCHAR}
and a.channelid=#{item.channelid,jdbcType=VARCHAR}
</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