Commit 63d5614f authored by 高飞's avatar 高飞

重复事件不推送

parent 0f7cd3fd
...@@ -159,7 +159,6 @@ public class TraffController { ...@@ -159,7 +159,6 @@ public class TraffController {
} }
public void sendevent( Alarm trffClientMessage){ public void sendevent( Alarm trffClientMessage){
List<String> imgBase64List = trffClientMessage.getImg_base64(); List<String> imgBase64List = trffClientMessage.getImg_base64();
Traffalarmrecord traffAlarmRecord = new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord = new Traffalarmrecord();
String imgEnumHead = "IMG"; String imgEnumHead = "IMG";
Ftp ftp = ftpService.reloadFtp(); Ftp ftp = ftpService.reloadFtp();
...@@ -214,6 +213,15 @@ public void sendevent( Alarm trffClientMessage){ ...@@ -214,6 +213,15 @@ public void sendevent( Alarm trffClientMessage){
if (traffAlarmRecord != null && traffAlarmRecord.getRecordid() != null) { if (traffAlarmRecord != null && traffAlarmRecord.getRecordid() != null) {
traffAlarmRecordMapper.updateTraffAlarmRecordUrl(traffAlarmRecord); traffAlarmRecordMapper.updateTraffAlarmRecordUrl(traffAlarmRecord);
} }
if(traffAlarmRecord.getRecordtype().equalsIgnoreCase("roadworks") || traffAlarmRecord.getRecordtype().equalsIgnoreCase("roadworks_out_of_line"))
{
//工程类的更新10分钟之前该videoid 下的 工程类和行人闯入和违停的记录施工纠偏类型为1
traffAlarmRecordMapper.updateTraffAlarmRectificationType(traffAlarmRecord);
}
//如果监控视频为空,延时加载重新获取 //如果监控视频为空,延时加载重新获取
if(null==recordBak.getVideopath() || "".equalsIgnoreCase(recordBak.getVideopath())) { if(null==recordBak.getVideopath() || "".equalsIgnoreCase(recordBak.getVideopath())) {
...@@ -241,10 +249,13 @@ public void sendevent( Alarm trffClientMessage){ ...@@ -241,10 +249,13 @@ public void sendevent( Alarm trffClientMessage){
//推送给第三方 //推送给第三方
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord); ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
log.info("调用接口推送给广达返回信息:" + obj.toString()); log.info("send to guangda:HTTP_OK" + obj.toString());
} }
} }
else{
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
log.info("send to guangda HttpURLConnection.HTTP_Fail--->response message:" + obj.toString());
}
} catch (IOException e) { } catch (IOException e) {
System.out.println(e.toString()); System.out.println(e.toString());
log.error(e.toString()); log.error(e.toString());
...@@ -254,16 +265,18 @@ public void sendevent( Alarm trffClientMessage){ ...@@ -254,16 +265,18 @@ public void sendevent( Alarm trffClientMessage){
} }
return 1; return 1;
},30, TimeUnit.SECONDS); //等待30秒钟执行 },50, TimeUnit.SECONDS); //等待50秒钟执行
}else { }else {
//推送给第三方 //推送给第三方
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord); ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
log.info("调用接口推送给广达返回信息:" + obj.toString()); log.info("send to guangda novideopath --->response message" + obj.toString());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("解析事件告警数据异常 :" + e.getMessage()); log.error("alarm fail :" + e.getMessage());
} }
} }
......
...@@ -23,4 +23,6 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co ...@@ -23,4 +23,6 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co
Integer statisTraffalarmrecordstatByDay(); Integer statisTraffalarmrecordstatByDay();
int updateTraffAlarmRectificationType(Traffalarmrecord traffalarmrecord);
} }
\ No newline at end of file
...@@ -132,9 +132,9 @@ public class FTPUtil { ...@@ -132,9 +132,9 @@ public class FTPUtil {
changeWorkingDirectory(ftpClient, path); changeWorkingDirectory(ftpClient, path);
flag = ftpClient.storeFile(filename, input); flag = ftpClient.storeFile(filename, input);
if (flag) { if (flag) {
log.info("FTP上传文件成功!"); log.info("FTP upload success!");
} else { } else {
log.info("FTP上传文件失败!"); log.info("FTP upload fail!");
} }
} else { } else {
flag = false; flag = false;
...@@ -143,10 +143,10 @@ public class FTPUtil { ...@@ -143,10 +143,10 @@ public class FTPUtil {
} }
} catch (IOException e) { } catch (IOException e) {
flag = false; flag = false;
log.error("FTP文件上传失败!", e); log.error("FTP upload fail!", e);
} catch (Exception e) { } catch (Exception e) {
flag = false; flag = false;
log.error("FTP文件上传失败!", e); log.error("FTP upload fail!", e);
} finally { } finally {
IOUtils.closeQuietly(input); IOUtils.closeQuietly(input);
closeConnect(ftpClient); closeConnect(ftpClient);
......
...@@ -126,7 +126,21 @@ ...@@ -126,7 +126,21 @@
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 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>
</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