Commit f458a099 authored by wangjinjing's avatar wangjinjing

修复监控id_0 的问题

parent b53579ab
*.js linguist-language=Java
*.css linguist-language=Java
*.html linguist-language=Java
...@@ -106,7 +106,7 @@ public class TraffController { ...@@ -106,7 +106,7 @@ public class TraffController {
@PostMapping("/alarmevent") @PostMapping("/alarmevent")
public ResultObj rece(@RequestBody Alarm trffClientMessage) { public ResultObj rece(@RequestBody Alarm trffClientMessage) {
log.info("alarmevent--------------"+trffClientMessage.toString()); // log.info("alarmevent--------------"+trffClientMessage.toString());
if (!TYPE.equals(trffClientMessage.getType())) { if (!TYPE.equals(trffClientMessage.getType())) {
return ResultObj.error(ResponseEnum.E_1002.getCode(), "type类型不正确"); return ResultObj.error(ResponseEnum.E_1002.getCode(), "type类型不正确");
} }
...@@ -125,11 +125,7 @@ public class TraffController { ...@@ -125,11 +125,7 @@ public class TraffController {
log.info("video_id值异常 值为:" + videoId); log.info("video_id值异常 值为:" + videoId);
return ResultObj.error(ResponseEnum.E_1002.getCode(), "video_id值异常 值为:" + videoId); return ResultObj.error(ResponseEnum.E_1002.getCode(), "video_id值异常 值为:" + videoId);
} }
/* 限流 */
if (!getRateLimiter(videoId).tryAcquire()) {
log.info("[事件推送]->设备" + videoId + "-推送已达到限流限制");
return ResultObj.error(ResponseEnum.E_9999.getCode(), "设备" + videoId + "请求过于频繁");
}
String sbbh=""; String sbbh="";
int tdbh=0; int tdbh=0;
if( videoId.contains("_") && videoId.split("_").length == 2) { if( videoId.contains("_") && videoId.split("_").length == 2) {
...@@ -139,8 +135,7 @@ public class TraffController { ...@@ -139,8 +135,7 @@ public class TraffController {
} }
else { else {
sbbh=videoId; sbbh=videoId;
//重新赋值videoid tdbh=0;
trffClientMessage.setVideo_id(videoId+"_0");
} }
List<Sbtdspsr> sbtdspsrs = sbtdspsrMapper.selectBySbbh(sbbh, tdbh); List<Sbtdspsr> sbtdspsrs = sbtdspsrMapper.selectBySbbh(sbbh, tdbh);
if (sbtdspsrs.isEmpty()) { if (sbtdspsrs.isEmpty()) {
...@@ -167,6 +162,7 @@ public class TraffController { ...@@ -167,6 +162,7 @@ public class TraffController {
} }
public void sendevent(Alarm trffClientMessage) { public void sendevent(Alarm trffClientMessage) {
webSocket.GroupSending(JsonUtil.beanToString(trffClientMessage));
Traffalarmrecord traffAlarmRecord = new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord = new Traffalarmrecord();
traffAlarmRecord.setAreaid(Long.valueOf(trffClientMessage.getDept())); traffAlarmRecord.setAreaid(Long.valueOf(trffClientMessage.getDept()));
traffAlarmRecord.setRecordtype(trffClientMessage.getIncident_type().toLowerCase()); traffAlarmRecord.setRecordtype(trffClientMessage.getIncident_type().toLowerCase());
...@@ -179,7 +175,7 @@ public class TraffController { ...@@ -179,7 +175,7 @@ public class TraffController {
} }
else{ else{
traffAlarmRecord.setFdid(trffClientMessage.getVideo_id().replace("_0","")); traffAlarmRecord.setFdid(trffClientMessage.getVideo_id().replace("_0",""));
channelid=0;
} }
traffAlarmRecord.setChannelid(channelid); traffAlarmRecord.setChannelid(channelid);
...@@ -247,7 +243,7 @@ public class TraffController { ...@@ -247,7 +243,7 @@ public class TraffController {
map.put("data", trffClientMessage); map.put("data", trffClientMessage);
map.put("recordid", recordid); map.put("recordid", recordid);
WebSocket.GroupSending(JsonUtil.beanToString(map)); webSocket.GroupSending(JsonUtil.beanToString(map));
traffAlarmRecord.setProcessstatus("0"); traffAlarmRecord.setProcessstatus("0");
traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord); traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
...@@ -257,7 +253,7 @@ public class TraffController { ...@@ -257,7 +253,7 @@ public class TraffController {
Map<String, Object> transferRecordMap = new HashMap<>(); Map<String, Object> transferRecordMap = new HashMap<>();
FileTransferManager.fetchUrlsFromRecord(traffAlarmRecord, transferRecordMap); FileTransferManager.fetchUrlsFromRecord(traffAlarmRecord, transferRecordMap);
List<TransferResult> results = FileTransferManager.transferFile(transferRecordMap, ftp, basepath); List<TransferResult> results = FileTransferManager.transferFile(transferRecordMap, ftp, basepath);
log.info("缓存数据上传结果:" + results.toString()); // log.info("缓存数据上传结果:" + results.toString());
Traffalarmrecord recordBak = FileTransferManager.traffAlarmRecordUrlUpdate(results); Traffalarmrecord recordBak = FileTransferManager.traffAlarmRecordUrlUpdate(results);
traffAlarmRecord.setImg2path(recordBak.getImg2path()); traffAlarmRecord.setImg2path(recordBak.getImg2path());
traffAlarmRecord.setImg3path(recordBak.getImg3path()); traffAlarmRecord.setImg3path(recordBak.getImg3path());
...@@ -365,7 +361,6 @@ public class TraffController { ...@@ -365,7 +361,6 @@ public class TraffController {
vehicles.setVideo_id(sbbh + "_" + tdbh); vehicles.setVideo_id(sbbh + "_" + tdbh);
//直接放入表中 //直接放入表中
List<Vehiclesdetail> vels = vehicles.getObjs(); List<Vehiclesdetail> vels = vehicles.getObjs();
int result = 0;
for (Vehiclesdetail detail : vels) { for (Vehiclesdetail detail : vels) {
Vehicle v = new Vehicle(); Vehicle v = new Vehicle();
v.setId(UUID.randomUUID().toString()); v.setId(UUID.randomUUID().toString());
...@@ -375,7 +370,7 @@ public class TraffController { ...@@ -375,7 +370,7 @@ public class TraffController {
v.setRuleTag(detail.getRuleTag()); v.setRuleTag(detail.getRuleTag());
v.setClassification_confidence(detail.getClassification_confidence()); v.setClassification_confidence(detail.getClassification_confidence());
v.setVideo_id(vehicles.getVideo_id()); v.setVideo_id(vehicles.getVideo_id());
result = traffFlowService.saveTraffFlowDetail(v); traffFlowService.saveTraffFlowDetail(v);
} }
...@@ -501,7 +496,7 @@ public class TraffController { ...@@ -501,7 +496,7 @@ public class TraffController {
map.put("type", "alarm"); map.put("type", "alarm");
map.put("data", alarm); map.put("data", alarm);
map.put("recordid", recordid); map.put("recordid", recordid);
WebSocket.GroupSending(JsonUtil.beanToString(map)); webSocket.GroupSending(JsonUtil.beanToString(map));
try { try {
//推送给第三方 //推送给第三方
...@@ -550,7 +545,7 @@ public class TraffController { ...@@ -550,7 +545,7 @@ public class TraffController {
map.put("type", "alarm"); map.put("type", "alarm");
map.put("data", alarm); map.put("data", alarm);
map.put("recordid", "33448"); map.put("recordid", "33448");
WebSocket.GroupSending(JsonUtil.beanToString(map)); webSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord=new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord=new Traffalarmrecord();
traffAlarmRecord.setRecordid(Long.parseLong("33448")); traffAlarmRecord.setRecordid(Long.parseLong("33448"));
traffAlarmRecord.setChannelid(new Integer(1)); traffAlarmRecord.setChannelid(new Integer(1));
...@@ -560,7 +555,7 @@ public class TraffController { ...@@ -560,7 +555,7 @@ public class TraffController {
// traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord); // traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
map.put("recordid", "33449"); map.put("recordid", "33449");
WebSocket.GroupSending(JsonUtil.beanToString(map)); webSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord2=new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord2=new Traffalarmrecord();
traffAlarmRecord2.setRecordid(Long.parseLong("33449")); traffAlarmRecord2.setRecordid(Long.parseLong("33449"));
traffAlarmRecord2.setChannelid(new Integer(1)); traffAlarmRecord2.setChannelid(new Integer(1));
...@@ -582,7 +577,7 @@ public class TraffController { ...@@ -582,7 +577,7 @@ public class TraffController {
map.put("type", "alarm"); map.put("type", "alarm");
map.put("data", alarm); map.put("data", alarm);
map.put("recordid", "3344656"); map.put("recordid", "3344656");
WebSocket.GroupSending(JsonUtil.beanToString(map)); webSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord=new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord=new Traffalarmrecord();
traffAlarmRecord.setRecordid(Long.parseLong("33446")); traffAlarmRecord.setRecordid(Long.parseLong("33446"));
traffAlarmRecord.setChannelid(new Integer(0)); traffAlarmRecord.setChannelid(new Integer(0));
...@@ -592,7 +587,7 @@ public class TraffController { ...@@ -592,7 +587,7 @@ public class TraffController {
traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord); traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
map.put("recordid", "3344766"); map.put("recordid", "3344766");
WebSocket.GroupSending(JsonUtil.beanToString(map)); webSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord2=new Traffalarmrecord(); Traffalarmrecord traffAlarmRecord2=new Traffalarmrecord();
traffAlarmRecord2.setRecordid(Long.parseLong("33447")); traffAlarmRecord2.setRecordid(Long.parseLong("33447"));
traffAlarmRecord2.setChannelid(new Integer(0)); traffAlarmRecord2.setChannelid(new Integer(0));
......
...@@ -68,23 +68,6 @@ public class WebSocket { ...@@ -68,23 +68,6 @@ public class WebSocket {
@OnMessage @OnMessage
public void OnMessage(String message) { public void OnMessage(String message) {
//判断是否需要指定发送,具体规则自定义 //判断是否需要指定发送,具体规则自定义
if (message.indexOf("videoid") >= 0) {
//连接查询近五分钟并开始每分钟推送数据
List<Map> map = new ArrayList<>();
List<Map> dDayFlowmap = traffFlowService.selectFiveAndDayFlow(name);
if (null != dDayFlowmap)
map.addAll(dDayFlowmap);
List<Map> TypeDayFlow = traffFlowService.selectFiveAndTypeDayFlow(name);
if (null != TypeDayFlow)
map.addAll(TypeDayFlow);
if (!map.isEmpty()) {
AppointSending(name, JSONUtil.toJsonStr(map));
}
}
if(message.indexOf("HEARTBEAT")>=0){ if(message.indexOf("HEARTBEAT")>=0){
Map map=new HashMap(); Map map=new HashMap();
map.put("type","HEARTBEAT"); map.put("type","HEARTBEAT");
...@@ -98,15 +81,19 @@ public class WebSocket { ...@@ -98,15 +81,19 @@ public class WebSocket {
* *
* @param message * @param message
*/ */
public static void GroupSending(String message) { public void GroupSending(String message) {
for (String name : webSocketSet.keySet()) {
try { for (String name : webSocketSet.keySet()) {
if (null != webSocketSet.get(name) && null != webSocketSet.get(name).session && null != webSocketSet.get(name).session.getBasicRemote()) try {
webSocketSet.get(name).session.getBasicRemote().sendText(message);
} catch (Exception e) { if (null != webSocketSet.get(name) && null != webSocketSet.get(name).session && null != webSocketSet.get(name).session.getBasicRemote())
e.printStackTrace(); synchronized (webSocketSet.get(name).session) {
webSocketSet.get(name).session.getBasicRemote().sendText(message);
}
} catch (Exception e) {
e.printStackTrace();
}
} }
}
} }
/** /**
......
...@@ -60,10 +60,9 @@ public class TraffdevicewriteresultService { ...@@ -60,10 +60,9 @@ public class TraffdevicewriteresultService {
List<ResultObj> resultObj = new ArrayList<>(); List<ResultObj> resultObj = new ArrayList<>();
try { try {
Traffdevicewriteresult param = new Traffdevicewriteresult(); Traffdevicewriteresult param = new Traffdevicewriteresult();
for (SbtdspsrParams val : sbtdspsrs) { for (SbtdspsrParams val : sbtdspsrs) {
threadService.submit(() -> { threadService.submit(() -> {
// log.info("sendtoguangda"+val.toString()); log.info("sendtoguangda"+val.toString());
ResultObj obj = sendToGuangda(val, param); ResultObj obj = sendToGuangda(val, param);
obj.setData(val.getSbbh() + "_" + val.getTdbh()); obj.setData(val.getSbbh() + "_" + val.getTdbh());
return obj; return obj;
...@@ -251,7 +250,7 @@ public class TraffdevicewriteresultService { ...@@ -251,7 +250,7 @@ public class TraffdevicewriteresultService {
log.error("deviceWritePost {} : redis token empty..", qztoken); log.error("deviceWritePost {} : redis token empty..", qztoken);
// return null; // return null;
// } // }
// log.info("qztoken send guangda without keepalive", qztoken); log.info("qztoken send guangda without keepalive", qztoken);
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.add("token", token);// headers.add("token", token);//
List<DeviceWriteParam> list = new ArrayList<>(); List<DeviceWriteParam> list = new ArrayList<>();
......
...@@ -15,18 +15,6 @@ mybatis.configuration.default-statement-timeout=3000 ...@@ -15,18 +15,6 @@ mybatis.configuration.default-statement-timeout=3000
#mybatis.mapperLocations = classpath:xxx.xml #mybatis.mapperLocations = classpath:xxx.xml
#logging.level.com.hzjt=debug #logging.level.com.hzjt=debug
## �������ݿ�-����Դ����
#spring.datasource.url=jdbc:dm://127.0.0.1:12345/auditlocal_cq
#spring.datasource.driver-class-name=dm.jdbc.driver.DmDriver
#spring.datasource.username=SYSDBA
#spring.datasource.password=SYSDBA
##���ӳ�����
#spring.datasource.type=org.apache.commons.dbcp.BasicDataSource
#spring.datasource.dbcp2.max-wait-millis=10000
#spring.datasource.dbcp2.min-idle=5
#spring.datasource.dbcp2.initial-size=5
#spring.datasoe.dbcp2.validation-query=SELECT x
#spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# Mysql���ݿ�-����Դ���� # Mysql���ݿ�-����Դ����
#spring.datasource.username=hzjt #spring.datasource.username=hzjt
...@@ -38,49 +26,33 @@ spring.datasource.url=jdbc:oracle:thin:@33.65.250.179:1521:helowin ...@@ -38,49 +26,33 @@ spring.datasource.url=jdbc:oracle:thin:@33.65.250.179:1521:helowin
spring.datasource.driverClassName=oracle.jdbc.OracleDriver spring.datasource.driverClassName=oracle.jdbc.OracleDriver
# druid # druid
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# ��ʼ����С����С�����
spring.datasource.initialSize=5 spring.datasource.initialSize=5
spring.datasource.minIdle=5 spring.datasource.minIdle=5
spring.datasource.maxActive=20 spring.datasource.maxActive=20
# ���û�ȡ���ӵȴ���ʱ��ʱ��
spring.datasource.maxWait=60000 spring.datasource.maxWait=60000
# ���ü����òŽ���һ�μ�⣬�����Ҫ�رյĿ������ӣ���λ�Ǻ���
spring.datasource.timeBetweenEvictionRunsMillis=60000 spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.testWhileIdle=true spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false spring.datasource.testOnReturn=false
# ��PSCache������ָ��ÿ��������PSCache�Ĵ�С
spring.datasource.poolPreparedStatements=true spring.datasource.poolPreparedStatements=true
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
# ���ü��ͳ�����ص�filters��ȥ�����ؽ���sql�޷�ͳ�ƣ�'wall'���ڷ���ǽ
spring.datasource.filters=stat,wall spring.datasource.filters=stat,wall
# ͨ��connectProperties��������mergeSql���ܣ���SQL��¼
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# �ϲ����DruidDataSource�ļ������ # �ϲ����DruidDataSource�ļ������
spring.datasource.useGlobalDataSourceStat=true spring.datasource.useGlobalDataSourceStat=true
#redis #redis
# Redis��������ַ
spring.redis.host=33.65.250.179 spring.redis.host=33.65.250.179
#spring.redis.host=127.0.0.1 #spring.redis.host=127.0.0.1
# Redis���������Ӷ˿�
spring.redis.port=6379 spring.redis.port=6379
# Redis�������������루Ĭ��Ϊ�գ�
#spring.redis.password=123456 #spring.redis.password=123456
# Redis���ݿ�������Ĭ��Ϊ0��
spring.redis.database=0 spring.redis.database=0
# ���ӳ������������ʹ�ø�ֵ��ʾû�����ƣ�
spring.redis.pool.max-active=8 spring.redis.pool.max-active=8
# ���ӳ���������ȴ�ʱ�䣨ʹ�ø�ֵ��ʾû�����ƣ�
spring.redis.pool.max-wait=5000 spring.redis.pool.max-wait=5000
# ���ӳ��е�����������
spring.redis.pool.max-idle=8 spring.redis.pool.max-idle=8
# ���ӳ��е���С��������
spring.redis.pool.min-idle=0 spring.redis.pool.min-idle=0
# ���ӳ�ʱʱ�䣨���룩
spring.redis.timeout=2000 spring.redis.timeout=2000
#spring-session ʹ��
spring.session.store-type=none spring.session.store-type=none
ip.host=33.65.250.179 ip.host=33.65.250.179
port=21 port=21
......
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
LEFT JOIN TRAFFDEVICEWRITERESULT A ON A.SBBH = TA.SBBH AND A.TDBH = TA.TDBH LEFT JOIN TRAFFDEVICEWRITERESULT A ON A.SBBH = TA.SBBH AND A.TDBH = TA.TDBH
LEFT JOIN TRAFFDEVICECONFIG B ON B.FDID = TA.SBBH AND B.CHANNELID = TA.TDBH LEFT JOIN TRAFFDEVICECONFIG B ON B.FDID = TA.SBBH AND B.CHANNELID = TA.TDBH
LEFT JOIN dept P ON P .dept_id = TA.xzbh LEFT JOIN dept P ON P .dept_id = TA.xzbh
WHERE 1=1 <where>
<if test="xhs !=null and xhs.size>0 "> <if test="xhs !=null and xhs.size>0 ">
and TA.XH IN and TA.XH IN
<foreach item="xh" collection="xhs" open="(" separator="," close=")"> <foreach item="xh" collection="xhs" open="(" separator="," close=")">
#{xh} #{xh}
</foreach> </foreach>
</if> </if>
</where>
</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