Commit 4b4847d9 authored by wangjinjing's avatar wangjinjing

videoid

parent 5aa5aa09
...@@ -17,7 +17,7 @@ import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; ...@@ -17,7 +17,7 @@ import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
@SpringBootApplication @SpringBootApplication
@ServletComponentScan @ServletComponentScan
@MapperScan("com.hzjt.mapper") @MapperScan("com.hzjt.mapper")
@PropertySource("file:${spring.profiles.path}") //@PropertySource("file:${spring.profiles.path}")
public class HZJTApplication { public class HZJTApplication {
@Bean @Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapterSingle, MessageListenerAdapter listenerAdapterList) { RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapterSingle, MessageListenerAdapter listenerAdapterList) {
......
...@@ -121,7 +121,7 @@ public class TraffController { ...@@ -121,7 +121,7 @@ public class TraffController {
} }
String videoId = trffClientMessage.getVideo_id(); String videoId = trffClientMessage.getVideo_id();
if (StringUtils.isBlank(videoId) || !videoId.contains("_") || videoId.split("_").length != 2) { if (StringUtils.isBlank(videoId)) {
// 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);
} }
...@@ -130,10 +130,16 @@ public class TraffController { ...@@ -130,10 +130,16 @@ public class TraffController {
// log.info("[事件推送]->设备" + videoId + "-推送已达到限流限制"); // log.info("[事件推送]->设备" + videoId + "-推送已达到限流限制");
return ResultObj.error(ResponseEnum.E_9999.getCode(), "设备" + videoId + "请求过于频繁"); return ResultObj.error(ResponseEnum.E_9999.getCode(), "设备" + videoId + "请求过于频繁");
} }
String sbbh="";
String[] sbAndTd = videoId.split("_"); int tdbh=0;
String sbbh = sbAndTd[0]; if( videoId.contains("_") && videoId.split("_").length == 2) {
int tdbh = Integer.valueOf(sbAndTd[1]) + 1; String[] sbAndTd = videoId.split("_");
sbbh = sbAndTd[0];
tdbh = Integer.valueOf(sbAndTd[1]) + 1;
}
else {
sbbh=videoId;
}
List<Sbtdspsr> sbtdspsrs = sbtdspsrMapper.selectBySbbh(sbbh, tdbh); List<Sbtdspsr> sbtdspsrs = sbtdspsrMapper.selectBySbbh(sbbh, tdbh);
if (sbtdspsrs.isEmpty()) { if (sbtdspsrs.isEmpty()) {
...@@ -165,9 +171,15 @@ public class TraffController { ...@@ -165,9 +171,15 @@ public class TraffController {
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.setRecordtime(new Date(Long.valueOf(trffClientMessage.getTs()))); traffAlarmRecord.setRecordtime(new Date(Long.valueOf(trffClientMessage.getTs())));
String[] videoIdArr = trffClientMessage.getVideo_id().split("_"); Integer channelid=0;
traffAlarmRecord.setFdid(videoIdArr[0]); if(trffClientMessage.getVideo_id().contains("_")&& trffClientMessage.getVideo_id().split("_").length == 2) {
Integer channelid = Integer.valueOf(videoIdArr[1]) + 1; String[] videoIdArr = trffClientMessage.getVideo_id().split("_");
traffAlarmRecord.setFdid(videoIdArr[0]);
channelid = Integer.valueOf(videoIdArr[1]) + 1;
}
else{
traffAlarmRecord.setFdid(trffClientMessage.getVideo_id());
}
traffAlarmRecord.setChannelid(channelid); traffAlarmRecord.setChannelid(channelid);
//判断是否在正检时间内 //判断是否在正检时间内
...@@ -323,7 +335,7 @@ public class TraffController { ...@@ -323,7 +335,7 @@ public class TraffController {
rateLimiter = rateLimiterMap.get(videoId); rateLimiter = rateLimiterMap.get(videoId);
} else { } else {
RateLimiter value = RateLimiter.create(rate); RateLimiter value = RateLimiter.create(rate);
rateLimiter = rateLimiterMap.putIfAbsent(videoId, value); rateLimiter = rateLimiterMap.putIfAbsent(videoId, value);
if (rateLimiter == null) { if (rateLimiter == null) {
rateLimiter = value; rateLimiter = value;
} }
...@@ -337,9 +349,16 @@ public class TraffController { ...@@ -337,9 +349,16 @@ public class TraffController {
public ResultObj traffflow(@RequestBody Vehicles vehicles) { public ResultObj traffflow(@RequestBody Vehicles vehicles) {
if ("TRAFFIC_STATISTICS_VEHICLES".equalsIgnoreCase(vehicles.getType())) { if ("TRAFFIC_STATISTICS_VEHICLES".equalsIgnoreCase(vehicles.getType())) {
String[] sbAndTd = vehicles.getVideo_id().split("_"); String sbbh="";
String sbbh = sbAndTd[0]; int tdbh=0;
int tdbh = Integer.valueOf(sbAndTd[1]) + 1; if(vehicles.getVideo_id().contains("_")) {
String[] sbAndTd = vehicles.getVideo_id().split("_");
sbbh = sbAndTd[0];
tdbh = Integer.valueOf(sbAndTd[1]) + 1;
}
else {
sbbh=vehicles.getVideo_id();
}
//重置videoid //重置videoid
vehicles.setVideo_id(sbbh + "_" + tdbh); vehicles.setVideo_id(sbbh + "_" + tdbh);
//直接放入表中 //直接放入表中
......
...@@ -29,12 +29,12 @@ mybatis.configuration.default-statement-timeout=3000 ...@@ -29,12 +29,12 @@ mybatis.configuration.default-statement-timeout=3000
#spring.datasource.dbcp2.connection-properties=characterEncoding=utf8 #spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# Mysql���ݿ�-����Դ���� # Mysql���ݿ�-����Դ����
spring.datasource.username=test #spring.datasource.username=test
spring.datasource.password=test #spring.datasource.password=test
spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1523:helowin #spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1523:helowin
#spring.datasource.username=hzjt spring.datasource.username=hzjt
#spring.datasource.password=hzjt spring.datasource.password=hzjt
#spring.datasource.url=jdbc:oracle:thin:@33.50.1.22:1521:orcl spring.datasource.url=jdbc:oracle:thin:@33.65.219.103:1521:orcl
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
...@@ -62,7 +62,7 @@ spring.datasource.useGlobalDataSourceStat=true ...@@ -62,7 +62,7 @@ spring.datasource.useGlobalDataSourceStat=true
#redis #redis
# Redis��������ַ # Redis��������ַ
spring.redis.host=127.0.0.1 spring.redis.host=33.65.219.103
# Redis���������Ӷ˿� # Redis���������Ӷ˿�
spring.redis.port=6379 spring.redis.port=6379
# Redis�������������루Ĭ��Ϊ�գ� # Redis�������������루Ĭ��Ϊ�գ�
...@@ -81,12 +81,12 @@ spring.redis.pool.min-idle=0 ...@@ -81,12 +81,12 @@ spring.redis.pool.min-idle=0
spring.redis.timeout=2000 spring.redis.timeout=2000
#spring-session ʹ�� #spring-session ʹ��
spring.session.store-type=none spring.session.store-type=none
ip.host=33.57.1.22 ip.host=33.65.219.103
port=21 port=21
message.dept=33030 message.dept=33030
message.rate=10 message.rate=10
ftp.host=33.50.1.22:21:reader:reader ftp.host=33.65.219.103:21:hzjt:1qaz2wsx
alarm.subscribe.data.key=gs:traff:alarmlist alarm.subscribe.data.key=gs:traff:alarmlist
...@@ -94,7 +94,7 @@ alarm.subscribe.data.key=gs:traff:alarmlist ...@@ -94,7 +94,7 @@ alarm.subscribe.data.key=gs:traff:alarmlist
alarmrecord.check.enable=1 alarmrecord.check.enable=1
#spring.profiles.path= D:/imp/config/im/hzjt.properties #spring.profiles.path= D:/imp/config/im/hzjt.properties
spring.profiles.path= D:/hzjt_service/imp/config/im/hzjt.properties #spring.profiles.path= D:/hzjt_service/imp/config/im/hzjt.properties
spring.redis.cachekey.ftplist=gs:traff:global:cache:ftplist spring.redis.cachekey.ftplist=gs:traff:global:cache:ftplist
qingzhi.redis.token=gs:traff:qingzhi:token qingzhi.redis.token=gs:traff:qingzhi:token
qingzhi.devicewrite.url=http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite qingzhi.devicewrite.url=http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite
...@@ -107,4 +107,13 @@ mybatis.mapper-locations=classpath:mapper/*.xml ...@@ -107,4 +107,13 @@ mybatis.mapper-locations=classpath:mapper/*.xml
spring.mvc.throw-exception-if-no-handler-found=true spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=true spring.resources.add-mappings=true
gs.traff.cloud.web.fileagent.url=ftp://reader:reader@33.50.1.22:21/gstraff/ gs.traff.cloud.web.fileagent.url=ftp://reader:reader@33.50.1.22:21/gstraff/
jms.queueName=demo_queue jms.queueName=demo_queue
\ No newline at end of file alarmrecord.check.push.enable=1
alarmrecord.check.push.recordtype=1
flv.resisvalue=flvvalue
json.resisurl=http://33.50.1.21:57081/record/ecvs
flv.url=http://33.50.1.21:57080/ecvs/get_play_list
qingzhi.login.username=zksy
qingzhi.login.password=zksy@123
qingzhi.login.url=http://33.50.1.213:38080/api/auth/login
qingzhi.login.keepaliveurl=http://33.50.1.213:38080/api/auth/token/keepalive
\ 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