Commit b0e0ee4f authored by wangjinjing's avatar wangjinjing

init

parent c4754bf5
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version> <version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.comsumer.cn</groupId> <groupId>com.comsumer.cn</groupId>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>1.0.5</version> <version>1.1.9</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -97,8 +97,36 @@ ...@@ -97,8 +97,36 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId> <artifactId>spring-boot-starter-amqp</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.jdom</groupId>-->
<!--<artifactId>jdom</artifactId>-->
<!--<version>1.1</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>commons-io</groupId>-->
<!--<artifactId>commons-io</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -4,7 +4,9 @@ import org.springframework.boot.SpringApplication; ...@@ -4,7 +4,9 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootApplication @SpringBootApplication
public class CXQuartzApplication extends SpringBootServletInitializer { public class CXQuartzApplication extends SpringBootServletInitializer {
......
package com.cx.cn.cxquartz.bean;
import com.cx.cn.cxquartz.vo.ImageList;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;
@JsonAutoDetect(fieldVisibility= JsonAutoDetect.Visibility.ANY, getterVisibility= JsonAutoDetect.Visibility.NONE)
public class GoalStructureParam {
@JsonProperty("Output")
private Map Output;
@JsonProperty("Model")
private int Model;
@JsonIgnore
private String apiout;
@JsonProperty("ImageList")
private List<ImageList> ImageList;
public void setModel(int Model) {
this.Model = Model;
}
public int getModel() {
return this.Model;
}
public void setApiout(String apiout) {
this.apiout = apiout;
}
public String getApiout() {
return this.apiout;
}
public Map getOutput() {
return Output;
}
public void setOutput(Map output) {
Output = output;
}
public List<com.cx.cn.cxquartz.vo.ImageList> getImageList() {
return ImageList;
}
public void setImageList(List<ImageList> imageList) {
ImageList = imageList;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.bean;
public class TaskResult {
private String devicecode;
private String recordtype;
private String timestamp;
private Long x;
private Long y;
private Long w;
private Long h;
private String url;
private String threshold;
private String sendtype;
public String getSendtype() {
return sendtype;
}
public void setSendtype(String sendtype) {
this.sendtype = sendtype;
}
public TaskResult(String devicecode, String recordtype, String timestamp, Long x, Long y, Long w, Long h, String url, String threshold, String sendtype) {
this.devicecode = devicecode;
this.recordtype = recordtype;
this.timestamp = timestamp;
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.url = url;
this.threshold = threshold;
this.sendtype = sendtype;
}
public String getUrl() {
return url;
}
public String getThreshold() {
return threshold;
}
public void setThreshold(String threshold) {
this.threshold = threshold;
}
public void setUrl(String url) {
this.url = url;
}
public String getDevicecode() {
return devicecode;
}
public void setDevicecode(String devicecode) {
this.devicecode = devicecode;
}
public String getRecordtype() {
return recordtype;
}
public void setRecordtype(String recordtype) {
this.recordtype = recordtype;
}
public Long getX() {
return x;
}
public void setX(Long x) {
this.x = x;
}
public Long getY() {
return y;
}
public void setY(Long y) {
this.y = y;
}
public Long getW() {
return w;
}
public void setW(Long w) {
this.w = w;
}
public Long getH() {
return h;
}
public void setH(Long h) {
this.h = h;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
}
package com.cx.cn.cxquartz.common;
public class Constants {
//线程数
public final static int THREAD_COUNT = 5;
//处理间隔时间
//mils
public final static int INTERVAL_MILS = 0;
//consumer失败后等待时间(mils)
public static final int ONE_SECOND = 1 * 1000;
//异常sleep时间(mils)
public static final int ONE_MINUTE = 1 * 60 * 1000;
//MQ消息retry时间
public static final int RETRY_TIME_INTERVAL = ONE_MINUTE;
//MQ消息有效时间
public static final int VALID_TIME = ONE_MINUTE;
}
...@@ -4,8 +4,8 @@ import com.cx.cn.cxquartz.helper.MessageHelper; ...@@ -4,8 +4,8 @@ import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants; import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService; import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.Sbtdspsr; import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.Trigger; import org.springframework.scheduling.Trigger;
...@@ -43,7 +43,7 @@ public class PerformedTaskCornChange implements SchedulingConfigurer { ...@@ -43,7 +43,7 @@ public class PerformedTaskCornChange implements SchedulingConfigurer {
scheduledTaskRegistrar.addTriggerTask(new Runnable() { scheduledTaskRegistrar.addTriggerTask(new Runnable() {
@Override @Override
public void run() { public void run() {
//判断最小执行时间, // 如果小于2分钟,立即执行所有设备的获取rtsp与hls 的服务,下次执行时间为间隔2分钟 //判断最小执行时间, 如果小于2分钟,立即执行所有设备的获取rtsp与hls 的服务,下次执行时间为间隔2分钟
// 如果大于2分钟,下次执行时间为间隔1秒 // 如果大于2分钟,下次执行时间为间隔1秒
Long time= sbtdspsrService.getPeriodicseconds(); Long time= sbtdspsrService.getPeriodicseconds();
if(time<1200){ if(time<1200){
...@@ -60,13 +60,6 @@ public class PerformedTaskCornChange implements SchedulingConfigurer { ...@@ -60,13 +60,6 @@ public class PerformedTaskCornChange implements SchedulingConfigurer {
correlationData); correlationData);
} }
} }
else{
//查询所有数据
}
} }
else { else {
setTimer(1000L); setTimer(1000L);
......
package com.cx.cn.cxquartz.config; package com.cx.cn.cxquartz.config;
import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.rabbit.batch.BatchingStrategy;
import org.springframework.amqp.rabbit.batch.SimpleBatchingStrategy;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.BatchingRabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
//@Configuration /***
* 设置配置rabbit批量消费
*/
@Configuration
public class RabbitConfig { public class RabbitConfig {
@Bean @Bean("batchQueueTaskScheduler")
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) { public TaskScheduler batchQueueTaskScheduler(){
RabbitTemplate template = new RabbitTemplate(connectionFactory); TaskScheduler taskScheduler=new ThreadPoolTaskScheduler();
template.setMessageConverter(new Jackson2JsonMessageConverter()); return taskScheduler;
return template; }
//批量处理rabbitTemplate
@Bean("batchQueueRabbitTemplate")
public BatchingRabbitTemplate batchQueueRabbitTemplate(ConnectionFactory connectionFactory,
@Qualifier("batchQueueTaskScheduler") TaskScheduler taskScheduler){
int batchSize=1;
int bufferLimit=1024; //1 K
long timeout=10000;
BatchingStrategy batchingStrategy=new SimpleBatchingStrategy(batchSize,bufferLimit,timeout);
return new BatchingRabbitTemplate(connectionFactory,batchingStrategy,taskScheduler);
} }
@Bean @Bean("batchQueueRabbitListenerContainerFactory")
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) { public SimpleRabbitListenerContainerFactory batchQueueRabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory); factory.setConnectionFactory(connectionFactory);
factory.setMessageConverter(new Jackson2JsonMessageConverter()); //设置批量
factory.setAcknowledgeMode(AcknowledgeMode.MANUAL); factory.setBatchListener(true);
factory.setConsumerBatchEnabled(true);//设置BatchMessageListener生效
factory.setBatchSize(10);//设置监听器一次批量处理的消息数量
return factory; return factory;
} }
} }
...@@ -26,28 +26,18 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; ...@@ -26,28 +26,18 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>(); RedisTemplate<String, Object> template = new RedisTemplate<>();
// 配置连接工厂
template.setConnectionFactory(factory); template.setConnectionFactory(factory);
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper om = new ObjectMapper(); ObjectMapper om = new ObjectMapper();
// 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jacksonSeial.setObjectMapper(om); jacksonSeial.setObjectMapper(om);
// 值采用json序列化
template.setValueSerializer(jacksonSeial); template.setValueSerializer(jacksonSeial);
//使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer()); template.setKeySerializer(new StringRedisSerializer());
// 设置hash key 和value序列化模式 // 设置hash key 和value序列化模式
template.setHashKeySerializer(new StringRedisSerializer()); template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(jacksonSeial); template.setHashValueSerializer(jacksonSeial);
template.afterPropertiesSet(); template.afterPropertiesSet();
return template; return template;
} }
...@@ -72,15 +62,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; ...@@ -72,15 +62,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) { public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForValue(); return redisTemplate.opsForValue();
} }
// @Bean
// public JedisConnectionFactory redisConnectionFactory() {
// JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
// jedisConnectionFactory.setHostName("<server-hostname-here>");
// jedisConnectionFactory.setPort(6379);
// jedisConnectionFactory.setPassword("<server-password-here>");
// jedisConnectionFactory.afterPropertiesSet();
// return jedisConnectionFactory;
// }
/** /**
* 对链表类型的数据操作 * 对链表类型的数据操作
* *
......
...@@ -8,6 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,6 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/**
* redis 消费者初始化
*/
@Configuration @Configuration
public class RedisPCQueueConfig { public class RedisPCQueueConfig {
...@@ -17,15 +20,12 @@ public class RedisPCQueueConfig { ...@@ -17,15 +20,12 @@ public class RedisPCQueueConfig {
// 初始化完毕后调取 init // 初始化完毕后调取 init
@Bean(initMethod = "init", destroyMethod = "destroy") @Bean(initMethod = "init", destroyMethod = "destroy")
public RedisMQConsumerContainer redisQueueConsumerContainer() { public RedisMQConsumerContainer redisQueueConsumerContainer() {
for(int i=0;i<2;i++) {
for(int i=0;i<6;i++) {
Consumer orderConsumer = new OrderConsumer(); Consumer orderConsumer = new OrderConsumer();
mqContainer.addConsumer( mqContainer.addConsumer(
QueueConfiguration.builder().queue("taskinfo").consumer(orderConsumer).build() QueueConfiguration.builder().queue("taskinfo").consumer(orderConsumer).build()
); );
} }
return mqContainer; return mqContainer;
} }
} }
package com.cx.cn.cxquartz.config; package com.cx.cn.cxquartz.config;
import com.cx.cn.cxquartz.redis.Consumer;
import com.cx.cn.cxquartz.redis.OrderConsumer;
import com.cx.cn.cxquartz.redis.QueueConfiguration;
import com.cx.cn.cxquartz.redis.container.RedisMQConsumerContainer;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.util.RestUtil;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.List;
@Configuration @Configuration
...@@ -23,33 +12,7 @@ public class ScheduleTaskConfig { ...@@ -23,33 +12,7 @@ public class ScheduleTaskConfig {
@Value("${file.getrtspbyurl}") @Value("${file.getrtspbyurl}")
private String getrtspbyurl; private String getrtspbyurl;
@Autowired
private SbtdspsrService sbtdspsrService;
//
// @Autowired
// RedisMQConsumerContainer mqContainer;
RestUtil restUtil=new RestUtil();
// /***
// * 每隔20分钟执行一遍判断rtsp 是否变换
// */
//// @Scheduled(cron = "0 0 2 * * ? ")
// private void statis() {
// //查询所有监控设备,更新rtsp 地址
// List<Sbtdspsr> sbtdpsrList= sbtdspsrService.list();
// //调用decice 端口获得新的rtsp 地址,如果与表里的一样无需更新,不一样则立即更新
// for(Sbtdspsr sbtd:sbtdpsrList)
// {
// restUtil.rtspChangeVlue(sbtd.getSbbh(),sbtd.getSqurllj(),getrtspbyurl);
// }
// }
// @Scheduled(cron = "0/5 * * * * ?")
// private void statistoday() {
// Consumer orderConsumer = new OrderConsumer();
// mqContainer.addConsumer(
// QueueConfiguration.builder().queue("taskinfo").consumer(orderConsumer).build()
// );
//
// }
} }
...@@ -9,43 +9,22 @@ import org.springframework.amqp.core.Queue; ...@@ -9,43 +9,22 @@ import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /***
* 生产者申明一个direct类型(直连型)交换机,然后发送消息到这个交换机指定路由键。 *推送告警信息给第三方
* 消费者指定消费这个交换机的这个路由键,即可接收到消息,其他消费者收不到。
* 用户登录直连型交换机配置
* 1. 声明Exchange交换器;
* 2. 声明Queue队列;
* 3. 绑定BindingBuilder绑定队列到交换器,并设置路由键;
* 消费者单纯的使用,其实可以不用添加这个配置,直接建后面的监听就好,使用注解来让监听器监听对应的队列即可。
* * 配置上了的话,其实消费者也是生成者的身份,也能推送该消息。
*/ */
@Configuration @Configuration
public class SendToDXConfig { public class SendToDXConfig {
/**
* 创建交换机
*
* @return
*/
@Bean @Bean
public DirectExchange sendToDXDirectExchange() { public DirectExchange sendToDXDirectExchange() {
return new DirectExchange(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getExchange()); return new DirectExchange(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getExchange());
} }
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean @Bean
public Queue sendToDXDirectQueue() { public Queue sendToDXDirectQueue() {
return new Queue(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getQueue(), true); return new Queue(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getQueue(), true);
} }
/**
* 将队列和交换机绑定,并设置用于匹配路由键
*
* @return
*/
@Bean @Bean
public Binding BindingSendToDXDirect() { public Binding BindingSendToDXDirect() {
return BindingBuilder.bind(sendToDXDirectQueue()).to(sendToDXDirectExchange()).with(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getRouteKey()); return BindingBuilder.bind(sendToDXDirectQueue()).to(sendToDXDirectExchange()).with(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getRouteKey());
......
...@@ -9,43 +9,22 @@ import org.springframework.amqp.core.Queue; ...@@ -9,43 +9,22 @@ import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /***
* 生产者申明一个direct类型(直连型)交换机,然后发送消息到这个交换机指定路由键。 * 推送声音告警给第三方
* 消费者指定消费这个交换机的这个路由键,即可接收到消息,其他消费者收不到。
* 用户登录直连型交换机配置
* 1. 声明Exchange交换器;
* 2. 声明Queue队列;
* 3. 绑定BindingBuilder绑定队列到交换器,并设置路由键;
* 消费者单纯的使用,其实可以不用添加这个配置,直接建后面的监听就好,使用注解来让监听器监听对应的队列即可。
* 配置上了的话,其实消费者也是生成者的身份,也能推送该消息。
*/ */
@Configuration @Configuration
public class SendToVoiceConfig { public class SendToVoiceConfig {
/**
* 创建交换机
*
* @return
*/
@Bean @Bean
public DirectExchange sendToVoiceDirectExchange() { public DirectExchange sendToVoiceDirectExchange() {
return new DirectExchange(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getExchange()); return new DirectExchange(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getExchange());
} }
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean @Bean
public Queue sendToVoiceDirectQueue() { public Queue sendToVoiceDirectQueue() {
return new Queue(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getQueue(), true); return new Queue(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getQueue(), true);
} }
/**
* 将队列和交换机绑定,并设置用于匹配路由键
*
* @return
*/
@Bean @Bean
public Binding BindingSendToVoiceDirect() { public Binding BindingSendToVoiceDirect() {
return BindingBuilder.bind(sendToVoiceDirectQueue()).to(sendToVoiceDirectExchange()).with(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getRouteKey()); return BindingBuilder.bind(sendToVoiceDirectQueue()).to(sendToVoiceDirectExchange()).with(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getRouteKey());
......
package com.cx.cn.cxquartz.config;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error.*"))).paths(Predicates.not(PathSelectors.regex("/info.*")))
.paths(Predicates.not(PathSelectors.regex("/autoconfig.*")))
.paths(Predicates.not(PathSelectors.regex("/health.*")))
.paths(Predicates.not(PathSelectors.regex("/metrics.*")))
.paths(Predicates.not(PathSelectors.regex("/mappings.*")))
.paths(Predicates.not(PathSelectors.regex("/trace.*")))
.paths(Predicates.not(PathSelectors.regex("/configprops.*")))
.paths(Predicates.not(PathSelectors.regex("/beans.*"))).paths(Predicates.not(PathSelectors.regex("/env.*")))
.paths(Predicates.not(PathSelectors.regex("/dump.*")))
.paths(Predicates.not(PathSelectors.regex("/auditevents.*")))
.paths(Predicates.not(PathSelectors.regex("/docs.*"))).paths(Predicates.not(PathSelectors.regex("/archaius.*")))
.paths(Predicates.not(PathSelectors.regex("/features.*")))
.paths(Predicates.not(PathSelectors.regex("/pause.*"))).paths(Predicates.not(PathSelectors.regex("/refresh.*")))
.paths(Predicates.not(PathSelectors.regex("/resume.*")))
.paths(Predicates.not(PathSelectors.regex("/actuator.*")))
.paths(Predicates.not(PathSelectors.regex("/jolokia.*")))
.paths(Predicates.not(PathSelectors.regex("/loggers.*")))
.paths(Predicates.not(PathSelectors.regex("/restart.*")))
.paths(Predicates.not(PathSelectors.regex("/service-registry/instance-status.*")))
.paths(Predicates.not(PathSelectors.regex("/logfile.*")))
.paths(Predicates.not(PathSelectors.regex("/channels.*"))).paths(Predicates.not(PathSelectors.regex("/bus.*")))
.paths(Predicates.not(PathSelectors.regex("/heapdump.*"))).build();
}
/**
* Swagger2主界面信息,描述api的基本信息用于展示
*
* @return
*/
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("video服务接口定义和规范").description("knotvideo服务接口定义和规范")
.termsOfServiceUrl("http://****.com/").contact(new Contact("@****.com", "", "")).version("1.0")
.license("版权所有 ?***").build();
}
}
...@@ -10,12 +10,7 @@ import org.springframework.context.annotation.Bean; ...@@ -10,12 +10,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /**
* 视频图片直连型交换机配置 *抽帧任务
* 1. 声明Exchange交换器;
* 2. 声明Queue队列;
* 3. 绑定BindingBuilder绑定队列到交换器,并设置路由键;
* 消费者单纯的使用,其实可以不用添加这个配置,直接建后面的监听就好,使用注解来让监听器监听对应的队列即可。
* 配置上了的话,其实消费者也是生成者的身份,也能推送该消息。
*/ */
@Configuration @Configuration
public class TaskComsumExchangeConfig { public class TaskComsumExchangeConfig {
...@@ -26,49 +21,20 @@ public class TaskComsumExchangeConfig { ...@@ -26,49 +21,20 @@ public class TaskComsumExchangeConfig {
* @return * @return
*/ */
@Bean @Bean
public DirectExchange OrderCancelDirectExchange() { public DirectExchange TaskConsumerDirectExchange() {
return new DirectExchange(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange()); return new DirectExchange(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange());
} }
// /**
// * 创建队列 true表示是否持久
// *
// * @return
// */
// @Bean
// public Queue OrderCancelDirectQueue() {
// return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue(), true);
// }
/** /**
* 创建队列 true表示是否持久 * 创建队列 true表示是否持久
* *
* @return * @return
*/ */
@Bean @Bean
public Queue Model1DirectQueue() { public Queue ModelDXDirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_1", true); return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_DX", true);
} }
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model2DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_2", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model3DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_3", true);
}
/** /**
* 创建队列 true表示是否持久 * 创建队列 true表示是否持久
...@@ -76,28 +42,8 @@ public class TaskComsumExchangeConfig { ...@@ -76,28 +42,8 @@ public class TaskComsumExchangeConfig {
* @return * @return
*/ */
@Bean @Bean
public Queue Model4DirectQueue() { public Queue ModelQSTDirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_4", true); return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_QST", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model5DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_5", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model0DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_0", true);
} }
/** /**
* 将队列和交换机绑定,并设置用于匹配路由键 * 将队列和交换机绑定,并设置用于匹配路由键
...@@ -105,14 +51,12 @@ public class TaskComsumExchangeConfig { ...@@ -105,14 +51,12 @@ public class TaskComsumExchangeConfig {
* @return * @return
*/ */
@Bean @Bean
public Binding BindingDirect() { public Binding BindingQSTDirect() { return BindingBuilder.bind(ModelQSTDirectQueue()).to(TaskConsumerDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_QST");
BindingBuilder.bind(Model1DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_1");
BindingBuilder.bind(Model2DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_2");
BindingBuilder.bind(Model3DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_3");
BindingBuilder.bind(Model4DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_4");
BindingBuilder.bind(Model5DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_5");
return BindingBuilder.bind(Model0DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_0");
} }
@Bean
public Binding BindingDXDirect(){
return BindingBuilder.bind(ModelDXDirectQueue()).to(TaskConsumerDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_DX");
} }
}
package com.cx.cn.cxquartz.config;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 视频图片直连型交换机配置
* 1. 声明Exchange交换器;
* 2. 声明Queue队列;
* 3. 绑定BindingBuilder绑定队列到交换器,并设置路由键;
* 消费者单纯的使用,其实可以不用添加这个配置,直接建后面的监听就好,使用注解来让监听器监听对应的队列即可。
* 配置上了的话,其实消费者也是生成者的身份,也能推送该消息。
*/
public class TaskComsumExchangeConfig_bak {
/**
* 创建交换机
*
* @return
*/
@Bean
public DirectExchange OrderCancelDirectExchange() {
return new DirectExchange(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange());
}
// /**
// * 创建队列 true表示是否持久
// *
// * @return
// */
// @Bean
// public Queue OrderCancelDirectQueue() {
// return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue(), true);
// }
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model1DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_1", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model2DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_2", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model3DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_3", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model4DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_4", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model5DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_5", true);
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue Model0DirectQueue() {
return new Queue(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getQueue()+"_0", true);
}
/**
* 将队列和交换机绑定,并设置用于匹配路由键
*
* @return
*/
@Bean
public Binding BindingDirect() {
BindingBuilder.bind(Model1DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_1");
BindingBuilder.bind(Model2DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_2");
BindingBuilder.bind(Model3DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_3");
BindingBuilder.bind(Model4DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_4");
BindingBuilder.bind(Model5DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_5");
return BindingBuilder.bind(Model0DirectQueue()).to(OrderCancelDirectExchange()).with(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_0");
}
}
...@@ -9,16 +9,6 @@ import org.springframework.amqp.core.Queue; ...@@ -9,16 +9,6 @@ import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/**
* 生产者申明一个direct类型(直连型)交换机,然后发送消息到这个交换机指定路由键。
* 消费者指定消费这个交换机的这个路由键,即可接收到消息,其他消费者收不到。
* 用户登录直连型交换机配置
* 1. 声明Exchange交换器;
* 2. 声明Queue队列;
* 3. 绑定BindingBuilder绑定队列到交换器,并设置路由键;
* 消费者单纯的使用,其实可以不用添加这个配置,直接建后面的监听就好,使用注解来让监听器监听对应的队列即可。
* 配置上了的话,其实消费者也是生成者的身份,也能推送该消息。
*/
@Configuration @Configuration
public class getSnapShotConfig { public class getSnapShotConfig {
/** /**
...@@ -27,7 +17,7 @@ public class getSnapShotConfig { ...@@ -27,7 +17,7 @@ public class getSnapShotConfig {
* @return * @return
*/ */
@Bean @Bean
public DirectExchange sendToVoiceDirectExchange() { public DirectExchange RTSPDirectExchange() {
return new DirectExchange(QueueConstants.QueueRTSPEnum.QUEUE_RTSP_ENUM.getExchange()); return new DirectExchange(QueueConstants.QueueRTSPEnum.QUEUE_RTSP_ENUM.getExchange());
} }
...@@ -37,7 +27,7 @@ public class getSnapShotConfig { ...@@ -37,7 +27,7 @@ public class getSnapShotConfig {
* @return * @return
*/ */
@Bean @Bean
public Queue sendToVoiceDirectQueue() { public Queue RTSPDirectQueue() {
return new Queue(QueueConstants.QueueRTSPEnum.QUEUE_RTSP_ENUM.getQueue(), true); return new Queue(QueueConstants.QueueRTSPEnum.QUEUE_RTSP_ENUM.getQueue(), true);
} }
...@@ -47,7 +37,7 @@ public class getSnapShotConfig { ...@@ -47,7 +37,7 @@ public class getSnapShotConfig {
* @return * @return
*/ */
@Bean @Bean
public Binding BindingSendToVoiceDirect() { public Binding BindingRTSPDirect() {
return BindingBuilder.bind(sendToVoiceDirectQueue()).to(sendToVoiceDirectExchange()).with(QueueConstants.QueueRTSPEnum.QUEUE_RTSP_ENUM.getRouteKey()); return BindingBuilder.bind(RTSPDirectQueue()).to(RTSPDirectExchange()).with(QueueConstants.QueueRTSPEnum.QUEUE_RTSP_ENUM.getRouteKey());
} }
} }
\ No newline at end of file
package com.cx.cn.cxquartz.controller;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.util.*;
import com.cx.cn.cxquartz.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
@RestController
@Api(description ="自动抓拍摄像头结果推送服务接口",tags = "自动抓拍摄像头结果推送服务")
public class AutoSnapController {
private static final Logger logger = LoggerFactory.getLogger(ExtController.class);
@Autowired
RabbitTemplate rabbitTemplate;
@Value("${file.rootpath}")
String rootpath;
@RequestMapping(value = "/AutoSnap", method = RequestMethod.POST)
@ApiOperation(value = "自动抓拍摄像头结果推送服务",notes = "上传xml和jpg文件")
public void AutoSnap(@RequestParam("file") MultipartFile[] file) {
/*如果文件不为空,保存文件*/
if (file != null && file.length>0 && file.length==2) {
//获得xml文件 和jpg文件
MultipartFile filexml=file[0].getName().endsWith(".xml")==true?file[0]:file[1];
MultipartFile filejpg=file[0].getName().endsWith(".jpg")||file[0].getName().endsWith(".jpeg") ==true?file[0]:file[1];
//获得xml文件里信息,获得图片地址,将信息与地址整合成rabbitmq 中的格式进行消费
try {
Document doc= XmlUtils.readDocument(filexml);
Capture vCACapture=new Capture();
XmlUtils.parseDocument(vCACapture,doc);
vCACapture.setDateTime(vCACapture.getDateTime()==null?null:DateUtils.dealDateFormat(vCACapture.getDateTime()));
//获得jpg 文件,将文件存放到某个路径下面
Calendar rightNow = Calendar.getInstance();
String filepath=rootpath+File.separator+rightNow.get(Calendar.YEAR)+File.separator+rightNow.get(Calendar.MONTH)+File.separator+vCACapture.getDeviceId()+File.separator+vCACapture.getDeviceId()+"_"+DateUtils.formatDateToNoSign(vCACapture.getDateTime())+".jpg";
//将文件copy到该路径下
File desfile=new File(filepath);
if (!desfile.getParentFile().exists()) {
desfile.getParentFile().mkdirs();
}
if (!desfile.exists()) {
desfile.createNewFile();
}
filejpg.transferTo(desfile);
//
Map map=new HashMap<>();
map.put("resourcePath",filepath);
map.put("timestamp", vCACapture.getDateTime() );
map.put("devicecode", vCACapture.getDeviceId());
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(QueueConstants.QueueAutoSnapEnum.QUEUE_AUTOSNAP_ENUM.getExchange(),
QueueConstants.QueueAutoSnapEnum.QUEUE_AUTOSNAP_ENUM.getRouteKey(),
MessageHelper.objToMsg(map),
correlationData);
//拼接数据为如下格式
// String result="{\n" +
// " \"ret\": 0,\n" +
// " \"desc\": \"succ!\",\n" +
// " \"url\": \"http://zjh189.ncpoi.cc:7080/download/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" +
// " \"resourcePath\": \"/home/ubuntu/pictures/slice/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" +
// " \"timestamp\": \"2021-09-08 13:41:31.031\",\n" +
// " \"devicecode\": \"33050300001327599605\"\n" +
// "}";
} catch (IOException e) {
e.printStackTrace();
logger.error("IOException",e);
}
}else{
logger.error("文件数量不是2个");
}
}
}
package com.cx.cn.cxquartz.controller; package com.cx.cn.cxquartz.controller;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.job.WebSocket; import com.cx.cn.cxquartz.job.WebSocket;
import com.cx.cn.cxquartz.service.quartz.*; import com.cx.cn.cxquartz.service.quartz.*;
import com.cx.cn.cxquartz.service.quartz.impl.EventWriteService; import com.cx.cn.cxquartz.service.quartz.impl.EventWriteService;
import com.cx.cn.cxquartz.util.*; import com.cx.cn.cxquartz.util.DateUtils;
import com.cx.cn.cxquartz.vo.*; import com.cx.cn.cxquartz.util.RestUtil;
import com.fasterxml.jackson.databind.ObjectMapper; import com.cx.cn.cxquartz.util.ResultUtil;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySource;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.*; import java.util.ArrayList;
import java.util.*;
import java.util.List; import java.util.List;
@RestController @RestController
@RequestMapping("/ext") @RequestMapping("/ext")
@PropertySource("classpath:file.properties") @PropertySource("classpath:file.properties")
@Api(description ="QST物体识别算法接口",tags = "QST物体识别算法接口")
public class ExtController { public class ExtController {
private static final Logger logger = LoggerFactory.getLogger(ExtController.class); private static final Logger logger = LoggerFactory.getLogger(AutoSnapController.class);
@Value("${file.rtspurl}") @Value("${file.rtspurl}")
private String rtspurl; private String rtspurl;
@Value("${file.recogurl}") @Value("${file.recogurl}")
...@@ -67,8 +68,6 @@ public class ExtController { ...@@ -67,8 +68,6 @@ public class ExtController {
@Autowired @Autowired
private SbtdspsrService sbtdspsrService; private SbtdspsrService sbtdspsrService;
@Autowired @Autowired
FtpService ftpService;
@Autowired
TraffAlarmRecordService traffAlarmRecordService; TraffAlarmRecordService traffAlarmRecordService;
@Autowired @Autowired
TraffPictureService traffPictureService; TraffPictureService traffPictureService;
...@@ -101,16 +100,10 @@ public class ExtController { ...@@ -101,16 +100,10 @@ public class ExtController {
} }
@RequestMapping(value = "/getRTSP/{photonum}", method = RequestMethod.POST) @RequestMapping(value = "/getRTSP/{photonum}", method = RequestMethod.POST)
@ApiOperation(value = "简单抽帧服务接口",notes = "")
public String getrtsp(@RequestBody String videoid, public String getrtsp(@RequestBody String videoid,
@PathVariable("photonum") Integer photonum) { @PathVariable("photonum") Integer photonum) {
//根据videoID查询 rtsp 值 //尝试抽取第一张图片
// List<Sbtdspsr> sbtdspsrlist = sbtdspsrService.selectByRtsp(videoid);
// if (sbtdspsrlist.size() == 0) {
// logger.info(videoid + "设备不存在");
// return ResultUtil.success();
// }
// Sbtdspsr sbtdspsr = sbtdspsrlist.get(0);
//尝试抽取第一张图片
List<String> imgUrls = new ArrayList<>(); List<String> imgUrls = new ArrayList<>();
TraffAlarmRecord traffAlarmRecord = new TraffAlarmRecord(); TraffAlarmRecord traffAlarmRecord = new TraffAlarmRecord();
try { try {
...@@ -139,15 +132,13 @@ public class ExtController { ...@@ -139,15 +132,13 @@ public class ExtController {
traffAlarmRecord.setChannelid(0); traffAlarmRecord.setChannelid(0);
traffAlarmRecord.setAreaid(Long.parseLong("-1")); traffAlarmRecord.setAreaid(Long.parseLong("-1"));
traffAlarmRecord.setPushstatus(9); traffAlarmRecord.setPushstatus(9);
//免审 //免审
traffAlarmRecord.setCheckstatus(9); traffAlarmRecord.setCheckstatus(9);
//未提取特征 //未提取特征
traffAlarmRecord.setProcessstatus("-2"); traffAlarmRecord.setProcessstatus("-2");
traffAlarmRecord.setImg1urlfrom(imgUrls.get(0)); traffAlarmRecord.setImg1urlfrom(imgUrls.get(0));
//异步新增五条数据 //异步新增五条数据
traffAlarmRecordService.inserTraffAlarmRecord(traffAlarmRecord); traffAlarmRecordService.inserTraffAlarmRecord(traffAlarmRecord);
return ResultUtil.success(); return ResultUtil.success();
} catch (Exception e) { } catch (Exception e) {
logger.error("ext/getRTSPr-->error:{}" + e.toString()); logger.error("ext/getRTSPr-->error:{}" + e.toString());
...@@ -158,10 +149,10 @@ public class ExtController { ...@@ -158,10 +149,10 @@ public class ExtController {
// //
// @RequestMapping(value = "/getDeviceSnapshotAndRecognize", method = RequestMethod.POST) // @RequestMapping(value = "/getDeviceSnapshotAndRecognize", method = RequestMethod.POST)
// public String getDeviceSnapshotAndRecognize(@RequestBody String taskno) { // public String getDeviceSnapshotAndRecognize(@RequestBody String taskno) {
// //根据判断监控是否存在,该监控检测的事件是什么 // //根据判断监控是否存在,该监控检测的事件是什么
// List<QuartzTaskInformations> mapList = sbtdspsrService.selectRecogByRtsp(taskno); // List<QuartzTaskInformations> mapList = sbtdspsrService.selectRecogByRtsp(taskno);
// String model = "1"; // String model = "1";
// //图片框选出来的范围 // //图片框选出来的范围
// Long[] roiarray; // Long[] roiarray;
// HttpEntity<GoalStructureParam> requestEntity = null; // HttpEntity<GoalStructureParam> requestEntity = null;
// if (null != mapList && !mapList.equals("") && mapList.size() > 0) { // if (null != mapList && !mapList.equals("") && mapList.size() > 0) {
...@@ -171,14 +162,14 @@ public class ExtController { ...@@ -171,14 +162,14 @@ public class ExtController {
// Map<String, Object> mapparam = new HashMap<>(); // Map<String, Object> mapparam = new HashMap<>();
// roiarray = new Long[4]; // roiarray = new Long[4];
// //
// //获得该监控的检测业务与检测范围 // //获得该监控的检测业务与检测范围
// for (QuartzTaskInformations taskinfo : mapList) { // for (QuartzTaskInformations taskinfo : mapList) {
// roiarray[0] = new Long(taskinfo.getObjectx()); // roiarray[0] = new Long(taskinfo.getObjectx());
// roiarray[1] = new Long(taskinfo.getObjecty()); // roiarray[1] = new Long(taskinfo.getObjecty());
// roiarray[2] = new Long(taskinfo.getObjectw()); // roiarray[2] = new Long(taskinfo.getObjectw());
// roiarray[3] = new Long(taskinfo.getObjecth()); // roiarray[3] = new Long(taskinfo.getObjecth());
// String devicecode=taskinfo.getExecuteparamter(); // String devicecode=taskinfo.getExecuteparamter();
// //查询该监控下面还没有经过分析的数据 // //查询该监控下面还没有经过分析的数据
// Map<String, Object> map = new HashMap<>(); // Map<String, Object> map = new HashMap<>();
// map.put("sbbh", devicecode); // map.put("sbbh", devicecode);
// map.put("recordtype", taskinfo.getRecordtype()); // map.put("recordtype", taskinfo.getRecordtype());
...@@ -198,7 +189,7 @@ public class ExtController { ...@@ -198,7 +189,7 @@ public class ExtController {
// try { // try {
// Map result = new ObjectMapper().readValue(maprecogdata, Map.class); // Map result = new ObjectMapper().readValue(maprecogdata, Map.class);
// if (null != result.get("ret") && result.get("ret").equals("200")) { // if (null != result.get("ret") && result.get("ret").equals("200")) {
// //变成为已分析 // //变成为已分析
// transferRecord.setProcessstatus("-1"); // transferRecord.setProcessstatus("-1");
// traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord); // traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord);
// String recordtype = taskinfo.getRecordtype(); // String recordtype = taskinfo.getRecordtype();
...@@ -207,26 +198,26 @@ public class ExtController { ...@@ -207,26 +198,26 @@ public class ExtController {
// jobTjParam.setDetectType(recordtype); // jobTjParam.setDetectType(recordtype);
// String imageurl = transferRecord.getImg1path(); // String imageurl = transferRecord.getImg1path();
// List<Map> points = new ArrayList<>(); // List<Map> points = new ArrayList<>();
// //分析结果数据 // //分析结果数据
// List<Map> objectresult = (List<Map>) result.get("ObjectList"); // List<Map> objectresult = (List<Map>) result.get("ObjectList");
// if (objectresult.size() < 1) { // if (objectresult.size() < 1) {
// logger.info(" objectresult is empty"); // logger.info(" objectresult is empty");
// continue; // continue;
// } // }
// //获得点位 // //获得点位
// logger.info("获得点位"); // logger.info("获得点位");
// TraffpictureParam traffpictureParamresult = new TraffpictureParam(); // TraffpictureParam traffpictureParamresult = new TraffpictureParam();
// traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult,Integer.parseInt(taskinfo.getMetatype()) // traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult,Integer.parseInt(taskinfo.getMetatype())
// , roiarray, imageurl, objectresult, jobTjParam, points); // , roiarray, imageurl, objectresult, jobTjParam, points);
// if(null==traffpictureParamresult){ // if(null==traffpictureParamresult){
// logger.info("人群密度未超或目标未出现"); // logger.info("人群密度未超或目标未出现");
// continue; // continue;
// } // }
// eventWriteService.setTraffpictureParam(recordtype, devicecode, // eventWriteService.setTraffpictureParam(recordtype, devicecode,
// transferRecord.getCreatetime(), // transferRecord.getCreatetime(),
// traffpictureParamresult); // traffpictureParamresult);
// //图片划线并上传 // //图片划线并上传
// logger.info("图片划线并上传"); // logger.info("图片划线并上传");
// String basepath = DateUtils.formatCurrDayYM() + // String basepath = DateUtils.formatCurrDayYM() +
// File.separator + DateUtils.formatCurrDayDD() + File.separator + // File.separator + DateUtils.formatCurrDayDD() + File.separator +
// devicecode; // devicecode;
...@@ -239,7 +230,7 @@ public class ExtController { ...@@ -239,7 +230,7 @@ public class ExtController {
// traffpictureParamresult.setProcessstatus("-1"); // traffpictureParamresult.setProcessstatus("-1");
// traffPictureService.updateTraffpicture(traffpictureParamresult); // traffPictureService.updateTraffpicture(traffpictureParamresult);
// //
// //回调 // //回调
// logger.info("send to dianxin data:{}",jobTjParam.toString()); // logger.info("send to dianxin data:{}",jobTjParam.toString());
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl()); // eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl());
// //
...@@ -254,34 +245,34 @@ public class ExtController { ...@@ -254,34 +245,34 @@ public class ExtController {
// // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata)); // // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata));
// eventWriteService.sendVoice(voicedata); // eventWriteService.sendVoice(voicedata);
// } // }
// //推送告警到前端 // //推送告警到前端
// webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult)); // webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult));
// } // }
// } catch (Exception ex) { // } catch (Exception ex) {
// logger.error(ex.toString()); // logger.error(ex.toString());
// } // }
// //其他数据如表 // //其他数据如表
// //getMetaData( objectresult ); // //getMetaData( objectresult );
// } // }
// } // }
// return ResultUtil.success(); // return ResultUtil.success();
// } else { // } else {
// logger.info("监控不属于该范围"); // logger.info("监控不属于该范围");
// } // }
// //更新record 表Progress 字段,0为 未检测,-2 为检测失败,将检测 // //更新record 表Progress 字段,0为 未检测,-2 为检测失败,将检测
// //结果进行额外封装入表 // //结果进行额外封装入表
// return ResultUtil.success(); // return ResultUtil.success();
// } // }
// @RequestMapping(value = "/getDeviceSnapshotAndRecognize", method = RequestMethod.POST) // @RequestMapping(value = "/getDeviceSnapshotAndRecognize", method = RequestMethod.POST)
// public String getDeviceSnapshotAndRecognize(@RequestBody String taskno) { // public String getDeviceSnapshotAndRecognize(@RequestBody String taskno) {
// //根据判断监控是否存在,该监控检测的事件是什么 // //根据判断监控是否存在,该监控检测的事件是什么
// List<QuartzTaskInformations> mapList = sbtdspsrService.selectRecogByRtsp(taskno); // List<QuartzTaskInformations> mapList = sbtdspsrService.selectRecogByRtsp(taskno);
// String model = "1"; // String model = "1";
// //图片框选出来的范围 // //图片框选出来的范围
// Long[] roiarray; // Long[] roiarray;
// String devicecode=""; // String devicecode="";
// if (null != mapList && !mapList.equals("") && mapList.size() > 0) { // if (null != mapList && !mapList.equals("") && mapList.size() > 0) {
// //查询该监控下面还没有经过分析的数据 // //查询该监控下面还没有经过分析的数据
// //Map<String, Object> map = new HashMap<>(); // //Map<String, Object> map = new HashMap<>();
// //map.put("sbbh", devicecode); // //map.put("sbbh", devicecode);
// //
...@@ -289,7 +280,7 @@ public class ExtController { ...@@ -289,7 +280,7 @@ public class ExtController {
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8); // headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
// Map<String, Object> mapparam = new HashMap<>(); // Map<String, Object> mapparam = new HashMap<>();
// roiarray = new Long[4]; // roiarray = new Long[4];
// //获得该监控的检测业务与检测范围 // //获得该监控的检测业务与检测范围
// for (QuartzTaskInformations taskinfo : mapList) { // for (QuartzTaskInformations taskinfo : mapList) {
// roiarray[0] = new Long(taskinfo.getObjectx()); // roiarray[0] = new Long(taskinfo.getObjectx());
// roiarray[1] = new Long(taskinfo.getObjecty()); // roiarray[1] = new Long(taskinfo.getObjecty());
...@@ -308,7 +299,7 @@ public class ExtController { ...@@ -308,7 +299,7 @@ public class ExtController {
// Map objectList = restTemplate.getForObject(recogurl + "?deviceCode={deviceCode}&model={model}&roi={roi}", Map.class, mapparam); // Map objectList = restTemplate.getForObject(recogurl + "?deviceCode={deviceCode}&model={model}&roi={roi}", Map.class, mapparam);
// //
// if (String.valueOf(objectList.get("ret")).equals("0")) { // if (String.valueOf(objectList.get("ret")).equals("0")) {
// //变成为已分析 // //变成为已分析
// // transferRecord.setProcessstatus("-1"); // // transferRecord.setProcessstatus("-1");
// // traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord); // // traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord);
// String recordtype=taskinfo.getRecordtype(); // String recordtype=taskinfo.getRecordtype();
...@@ -319,20 +310,20 @@ public class ExtController { ...@@ -319,20 +310,20 @@ public class ExtController {
// try { // try {
// Map maprecogdata =new ObjectMapper().readValue(objectList.get("recogdata").toString(),Map.class); // Map maprecogdata =new ObjectMapper().readValue(objectList.get("recogdata").toString(),Map.class);
// List<Map> points = new ArrayList<>(); // List<Map> points = new ArrayList<>();
// //分析结果数据 // //分析结果数据
// List<Map> objectresult = (List<Map>) maprecogdata.get("ObjectList"); // List<Map> objectresult = (List<Map>) maprecogdata.get("ObjectList");
// if(objectresult.size()<1){ // if(objectresult.size()<1){
// logger.info(" objectresult is empty"); // logger.info(" objectresult is empty");
// continue; // continue;
// } // }
// //获得点位 // //获得点位
// TraffpictureParam traffpictureParamresult = eventWriteService.getResult(Integer.parseInt(taskinfo.getMetatype()) // TraffpictureParam traffpictureParamresult = eventWriteService.getResult(Integer.parseInt(taskinfo.getMetatype())
// , roiarray,imageurl , objectresult, jobTjParam, points); // , roiarray,imageurl , objectresult, jobTjParam, points);
// //
// eventWriteService.setTraffpictureParam(recordtype,devicecode, // eventWriteService.setTraffpictureParam(recordtype,devicecode,
// objectList.get("timestamp").toString(), // objectList.get("timestamp").toString(),
// traffpictureParamresult); // traffpictureParamresult);
// //图片划线并上传 // //图片划线并上传
// String basepath = DateUtils.formatCurrDayYM()+ // String basepath = DateUtils.formatCurrDayYM()+
// File.separator+DateUtils.formatCurrDayDD()+ File.separator+ // File.separator+DateUtils.formatCurrDayDD()+ File.separator+
// devicecode ; // devicecode ;
...@@ -345,7 +336,7 @@ public class ExtController { ...@@ -345,7 +336,7 @@ public class ExtController {
// traffpictureParamresult.setProcessstatus("-1"); // traffpictureParamresult.setProcessstatus("-1");
// traffPictureService.updateTraffpicture(traffpictureParamresult); // traffPictureService.updateTraffpicture(traffpictureParamresult);
// //
// //回调 // //回调
//// logger.info("send to dianxin data:{}",JSONObject.toJSONString(jobTjParam)); //// logger.info("send to dianxin data:{}",JSONObject.toJSONString(jobTjParam));
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("")?callbackurl:taskinfo.getUrl()); // eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("")?callbackurl:taskinfo.getUrl());
// //
...@@ -360,12 +351,12 @@ public class ExtController { ...@@ -360,12 +351,12 @@ public class ExtController {
// // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata)); // // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata));
// eventWriteService.sendVoice(voicedata); // eventWriteService.sendVoice(voicedata);
// } // }
// //推送告警到前端 // //推送告警到前端
// webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult)); // webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult));
// } catch (Exception ex) { // } catch (Exception ex) {
// //
// } // }
// //其他数据如表 // //其他数据如表
// //getMetaData( objectresult ); // //getMetaData( objectresult );
// } // }
// //
...@@ -373,17 +364,17 @@ public class ExtController { ...@@ -373,17 +364,17 @@ public class ExtController {
// //} // //}
// return ResultUtil.success(); // return ResultUtil.success();
// } else { // } else {
// logger.info("监控不属于该范围"); // logger.info("监控不属于该范围");
// } // }
// //更新record 表Progress 字段,0为 未检测,-2 为检测失败,将检测 // //更新record 表Progress 字段,0为 未检测,-2 为检测失败,将检测
// //结果进行额外封装入表 // //结果进行额外封装入表
// return ResultUtil.success(); // return ResultUtil.success();
// } // }
// private void getMetaData( List<Map> objectresult ) { // private void getMetaData( List<Map> objectresult ) {
// if (null != metadata) { // if (null != metadata) {
// traffpictureParamresult.setMetatype(String.valueOf(metadata.get("Type"))); // traffpictureParamresult.setMetatype(String.valueOf(metadata.get("Type")));
// if ("1".equals(metadata.get("Type"))) { // if ("1".equals(metadata.get("Type"))) {
// //规定范围内检测到人 // //规定范围内检测到人
// Pedestrian meta = new ObjectMapper().convertValue(metadata, Pedestrian.class); // Pedestrian meta = new ObjectMapper().convertValue(metadata, Pedestrian.class);
// meta.setId(traffpictureParamresult.getId()); // meta.setId(traffpictureParamresult.getId());
// pedestrianService.insertpedestrian(meta); // pedestrianService.insertpedestrian(meta);
...@@ -428,10 +419,10 @@ public class ExtController { ...@@ -428,10 +419,10 @@ public class ExtController {
// } // }
// //
// } else if (null != metadata && "2".equals(metadata.get("Type"))) { // } else if (null != metadata && "2".equals(metadata.get("Type"))) {
// //车辆 // //车辆
// Traffic meta = new ObjectMapper().convertValue(metadata, Traffic.class); // Traffic meta = new ObjectMapper().convertValue(metadata, Traffic.class);
// meta.setId(traffpictureParamresult.getId()); // meta.setId(traffpictureParamresult.getId());
// //新增到车辆详情表 // //新增到车辆详情表
// trafficService.insertTraffic(meta); // trafficService.insertTraffic(meta);
// if (null != meta.getObjectBoundingBox()) { // if (null != meta.getObjectBoundingBox()) {
// //
...@@ -467,7 +458,7 @@ public class ExtController { ...@@ -467,7 +458,7 @@ public class ExtController {
// meta.getHeadBoundingBox().getH() // meta.getHeadBoundingBox().getH()
// )); // ));
// } // }
// //人骑车 // //人骑车
// } else if (null != metadata && "4".equals(metadata.get("Type"))) { // } else if (null != metadata && "4".equals(metadata.get("Type"))) {
// PeopleRideBicyc meta = new ObjectMapper().convertValue(metadata, PeopleRideBicyc.class); // PeopleRideBicyc meta = new ObjectMapper().convertValue(metadata, PeopleRideBicyc.class);
// meta.setId(traffpictureParamresult.getId()); // meta.setId(traffpictureParamresult.getId());
......
package com.cx.cn.cxquartz.controller;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.client.RestTemplate;
@Controller
public class IndexController {
private static final Logger logger = LoggerFactory.getLogger(IndexController.class);
@Autowired
private RestTemplate restTemplate;
@Value("${file.ftppath}")
private String ftppath;
@Autowired
TraffPictureService traffPictureService;
//
// @RequestMapping(value = "/", method = RequestMethod.GET)
// public String listTasks(Model model, @RequestParam(value = "currentPage", required = false, defaultValue = "1") String currentPage,
// @RequestParam(value = "taskNo", required = false) String taskNo, HttpServletRequest request) {
// try {
//
// List<QuartzTaskInformations> taskList = quartzService.getTaskList(taskNo, currentPage);
// for(QuartzTaskInformations task:taskList)
// {
// task.setSchedulerrule(task.getSchedulerrule().replaceAll("\\?","").replaceAll("\\*","").replaceAll("\\/",""));
//
// }
// int current = Integer.parseInt(currentPage);
// Page<QuartzTaskInformations> page = new Page(taskList, taskList.size(), current);
// model.addAttribute("taskList", taskList);
// model.addAttribute("size", taskList.size());
// model.addAttribute("currentPage", page.getCurrentPage());
// model.addAttribute("totalPage", page.getTotalPage());
// model.addAttribute("taskNo", taskNo);
// } catch (Exception e) {
// logger.error("首页跳转发生异常exceptions-->" + e.toString());
// }
// return "index";
// }
//
// @GetMapping("/getrealcamerasnapshot")
// @ResponseBody
// public String index(@RequestParam("url") String url,
// @RequestParam("refresh") String refresh) {
// return "{\"ret\": 0," +
// "\"desc\": \"succ!\"," +
// "\"url\": \"http://localhost:8089/snapshot/11111.jpg\"" +
// "}";
// }
//
//
// @PostMapping("/images/recog")
// @ResponseBody
// public String images(@RequestBody GoalStructureParam param) {
// return "{\"ret\":\"200\",\"error_msg\":\"OK\",\"ObjectList\":[{\"ImageID\":\"1\",\"ObjectID\":1,\"Metadata\":{\"Gender\":\"1\",\"Age\":\"32\",\"Angle\":\"128\",\"HeadBoundingBox\":{\"x\":96,\"y\":16,\"w\":107,\"h\":136},\"FaceBoundingBox\":{\"x\":115,\"y\":61,\"w\":57,\"h\":77},\"UpperBoundingBox\":{\"x\":34,\"y\":123,\"w\":232,\"h\":263},\"LowerBoundingBox\":{\"x\":74,\"y\":309,\"w\":176,\"h\":408},\"CoatLength\":\"2\",\"CoatTexture\":\"1\",\"CoatColor\":[\"2\"],\"CoatColorNums\":\"1\",\"TrousersLength\":\"1\",\"TrousersTexture\":\"1\",\"TrousersColor\":[\"5\"],\"TrousersColorNums\":\"1\",\"HairStyle\":\"2\",\"HasHat\":\"1\",\"HasGlasses\":\"0\",\"HasMask\":\"0\",\"HasBackpack\":\"0\",\"HasCarrybag\":\"0\",\"HasUmbrella\":\"0\",\"HasTrolley\":\"-1\",\"HasLuggage\":\"-1\",\"LuggageColor\":[],\"LuggageColorNums\":\"0\",\"HasKnife\":\"-1\",\"ObjectBoundingBox\":{\"x\":26,\"y\":13,\"w\":256,\"h\":708},\"TrafficViolation\":\"-1\",\"Type\":\"6\"},\"Feature\":\"UVNURgUA//0BCP4BAQcAAwQBBvsCB/v8Af4A+wD5+AcBAgL9AgIEAgH4AQQA+f77+P77AAAIA/8A+QQJ/fz8AgACBfsAAgAC/AcIAQD++fgCAAUB/gb//AEAAf4B/QP+AQD0/QMDAfkD+f//A/7+/AD6B/f7/AH7/gAFAAMBAPb/AAP//wAIBQD7Af0FAAD9AAgC/gYF/f/8DAAC//4BAP/6AgECAgADAPz++v0A/wD//fz5AAIB/f0IBAQA/v8CBwP//wYE+/sCCP0BBAMD/gQA/QH/AgL6AgX/BP7/+AD5A/75/QH+A/8H/QAACP//AQT7+QICAfv/Afj9A/0D/wAA/f/8/wYL/wACAQYAAAAD/ggAAQMABv/6BAIADPv+A/wEAQAA/AD5AwT///4BAPz8CgUCDf78AwEA/f4AA/8C/wQB/P8A/wEA/gsAAwEF/v0AAf7/+QQECAcGAP0AAgH//AAHBwD3/fwB+/7/AQj//wUFAP/+/gYBAgYD+fv/BwH8Af0EBAD+AP3++gIH+v8CAPQEAAT//gDzAP0A+AL6BP4I9wMJAP0CAPX6APz9/gALAP7/BgQD+wIDBPn+CwIH/fz7A/3+9wAJ/QD9AP/++wME/v/+Avv+APoFAAAB+gD5APn//gEGBAME/wX5/AD/CAL+9QD8BAD2/wMCCf38+/oB+f0C/f39AQL+AAEAAgAE/wEIA///AP8HAQT+8fn7AP4AAAMA+QQDAwIB//j+/QEAAAIAAgj/A/n8AAP9AQD8AQYF+PgAA/4B+gEE+QYA/wYAB/0BAQD+/P/+BQf5BwIAAPsBBAEGAP4JAwEE////AAEF/wL4AAAFAQYA/vz+/AACAv8CAwIA+wIAAAUJAP0C/wIHAAEABgQF/QAEAAL7BP0A//wC+vr+/AIGAwAEAP0A/P/8BAD//AD5+wQEAAEHAv/8AP77+vQEBP4BAAAAAAr7/wD5AgD7BAEA/gT7AAAEAAMABPkLAQYABff+/wEDAP8EA/4AAf8A/gX9+wACAv3//f7/BAH+Bf/+AAH/AAAE9wAHAP/+/P8DAQD7/QQB/P3/AwAAAQAB/wD+BwAB/vwAAAL/AAYAAAf/Af76+fj6AP4F/gD9AgIB/Qr59f8CAAMCBgQHAf0FAP34AAQH/P79/wQGBA4D+f4AA/v+AAAA+wIE/gIH+QP2AQQGAwAE/vwI/P4GBwD/AAX4AAP+/f0A/Af/AgEBA/v9BPgDBwAC/wD8Bv36A/gBAAH+AAX+BP/9AAIF+AD8Av4B/wT/AQAAAQL/BPwA/PsA/AMDBfb/+AEBCAL+//36APz//wEHBv3/BQAA/QP9+wABAQL6//4CAAH/CP/+AAMBAf0CAAD9+g==\",\"BucketID\":32,\"BucketIDList\":[32,87,20,68,45,78,10,6,52,65,1,94,79,16,61,38,55,89,43,51,60,27,54,25,17,83,9,40,14,22,50,44,18,66,82,4,48,31,69,77,90,63,92,73,70,84,67,23,12,3,74,47,21,41,28,96,36,97,5,85,39,95,64,26,80,53,91,37,34,57,46,15,2,93,11,98,75,81,56,0,24,62,86,13,19,71,72,7,58,29,59,49,88,76,35,99,33,30,42,8],\"FaceFeature\":\"AwQF+foK/vcCAAD4/wD7CQH39vP7/gz/CAAB/AX++AAI/v8D+gQAAP0G/wAA+/oAAAP+Af79CwEAAgAA+/oFBe/3AgIFAgP0/vr8Cf4C+AMHBPn5Afr5AQQGBQD58gMG+wQTAgTzAPr9BQYEA/j//gT8+wXx9wMC+gcH/wAC8v0A+gD7+wkE/gAA7wL78gX/AgIGBvr8AAgD/woEAvkEAwv5CP/8/fz+/fwMAvr7AgD4APcEAA0F//kAAAAG+gADAQEB/wD+AQgCBg35+QQC/vv//vcAAPgEAwAAAgD9Af32/wMLAwD8B/75AQIB+/z/+v4AA/n//gL8+/0BAPv//PgIAAD0CQALAAUF/fwA/wYBAQf9+/f++Af49gMB/AMABwAA9vr5//sE/PoD+QP6+wsA/wEB+QIC+/8B/wD88QkACAIAAPn5AAUD/QL++P4H/f3+A/gG/f8G/QkA8wD0BAMBBwD59AAB+QUA//v2/wEJAQD8DAL5CPoA+/b+/Qr5AwcA/AD+CAEDBgEH/Qb+AQUHAAQK/fUA+/sI9/0I+QcKBQP6/gX0+QgI9gIBAAMFAAAA/vcD/vYI9wj9+v76C/gAAgIH+gMHBP8IAAT6BgAI+vsJ/v7/DAUABgIA+gAHBf0D+/oDAwEABv359QAB+AEG8w7+//0ABf78CPr8Afs=\",\"FaceBucketID\":91,\"FaceBucketIDList\":[91,12,50,84,52,13,57,54,4,53,70,36,64,58,81,10,78,63,35,75,34,16,86,3,99,40,26,42,48,30,25,23,11,62,72,51,18,17,46,27,97,61,49,43,66,37,89,19,24,1,98,76,32,83,44,96,87,31,8,20,33,21,6,56,41,88,82,47,69,93,14,79,38,29,80,85,90,94,55,60,67,95,9,2,71,65,68,77,7,74,59,28,92,73,15,39,22,0,45,5],\"FaceQuality\":\"0.379721\",\"FaceYaw\":\"-0.135311\",\"FacePitch\":\"0.508456\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.555109\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1},{\"ImageID\":\"3\",\"ObjectID\":1,\"Metadata\":{\"Angle\":\"128\",\"VehicleClass\":\"1\",\"VehicleColor\":[\"9\"],\"VehicleColorNums\":\"1\",\"VehicleBrand\":\"\\u96ea\\u4f5b\\u5170-\\u79d1\\u9c81\\u5179-2009_2013\",\"VehicleMainBrandName\":\"\\u96ea\\u4f5b\\u5170\",\"VehicleSubBrandName\":\"\\u79d1\\u9c81\\u5179\",\"VehicleYearName\":\"2009_2013\",\"HasPlate\":\"1\",\"PlateClass\":\"1\",\"PlateColor\":\"2\",\"PlateNo\":\"\\u6d59AJ079B\",\"PlateNeatness\":\"2\",\"Sunvisor\":\"0\",\"Paper\":\"0\",\"Decoration\":\"0\",\"Drop\":\"1\",\"Tag\":\"1\",\"SafetyBelt\":{\"MainDriver\":\"-1\",\"CoDriver\":\"-1\"},\"HasCall\":\"-1\",\"HasSkylight\":\"0\",\"HasBaggage\":\"0\",\"HasAerial\":\"0\",\"HasCrash\":\"-1\",\"HasDanger\":\"0\",\"HighwayTollVehicles\":\"1\",\"ObjectBoundingBox\":{\"x\":41,\"y\":40,\"w\":894,\"h\":717},\"TrafficViolation\":\"-1\",\"Type\":\"6\"},\"Feature\":\"AAAAAAAAAAAAAAAPAAAAAAAKABQAAAAAAAAAAAAAAAAhAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAB0AAAAAAAAAAAAAEwELAAAAAAAAAAAAAAAAAAAAAAAFCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAABIAAAAAABMAAAEAAAAAAAAAAAAAAAAAABAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZAAAAHgAAAAAAAAAAAAAAAgAAAAAHAAATAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAAAAAAAAAcAAAAAB8AAAAAAAAAAAAAAAAAAAAAABoDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVAAAAAAAMDgAAAAAAAB0AAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAA=\",\"BucketID\":76,\"BucketIDList\":[76,91,82,57,36,51,75,55,71,43,84,63,8,98,83,65,90,60,35,3,37,39,74,2,12,9,1,20,79,32,95,49,33,58,42,66,38,69,45,56,59,0,87,19,41,34,21,14,13,6,4,26,68,96,72,7,85,29,48,40,88,99,23,46,27,18,77,78,11,97,17,50,15,61,16,31,80,44,52,25,10,86,92,5,54,53,73,89,94,93,70,62,30,47,64,22,28,67,81,24],\"FaceFeature\":\"\",\"FaceBucketID\":-1,\"FaceBucketIDList\":[],\"FaceQuality\":\"0.000000\",\"FaceYaw\":\"0.000000\",\"FacePitch\":\"0.000000\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.000000\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1},{\"ImageID\":\"4\",\"ObjectID\":1,\"Metadata\":{\"Gender\":\"1\",\"Age\":\"16\",\"Angle\":\"128\",\"BikeClass\":\"1\",\"SocialAttribute\":\"1\",\"Enterprise\":\"-1\",\"FaceBoundingBox\":{\"x\":145,\"y\":65,\"w\":54,\"h\":66},\"CoatLength\":\"2\",\"CoatTexture\":\"5\",\"CoatColor\":[\"2\"],\"CoatColorNums\":\"1\",\"HelmetColor\":\"-1\",\"HasHelmet\":\"0\",\"HasGlasses\":\"1\",\"HasMask\":\"0\",\"HasBackpack\":\"0\",\"HasCarrybag\":\"-1\",\"HasUmbrella\":\"0\",\"HasPlate\":\"-1\",\"PlateNo\":\"-1\",\"HasPassenger\":\"1\",\"ObjectBoundingBox\":{\"x\":54,\"y\":16,\"w\":276,\"h\":635},\"TrafficViolation\":\"-1\",\"Type\":\"6\"},\"Feature\":\"UVNURgUA/wACAf/3AfwEA/kC/AMAAwAEAQACAPv+AAAB/wMHAgEA/wAGAAj/+AD7APwCAwkD9wsAAP4CBvn7/wz5A/wBBP8D/QICCAUCBv/7AgABAv7+AAH9AAUC/AX/AvsC/P4CAv39BAMA/gAAAAIA/wT6/v77A/YEAPoB//sG//7+/wD+/QAA/AMAAAQCAvz8/P3/AAH9+gX8/wD8/fr7AQAD//oA+AECAAAFAAH+/QH7/gIHAgYA/vz+AwADAgQCAgAL+wD9BgMGBv8E+/oF/P4H/wMD/gQC/wQH/v/4Agn9BQAC/wAE/P37BP/7AgIA/gj8APv7CAL9/vkABgL7/fz9/AD1BwD7AwAAAwH7AAb7+v4AAwX6/PsDBwMA/wH9AQD8AQP8APz7/vb8APoDAAT8AP0FAwYG/P39/P4B/vkA/f8AAgQBB/0D+wAFBwX4Aff+Bvz2/wEEBAIABQQD/wABAAMA//0AAP/+/wAC9/4AAfz+AAEF/f/6CAD9Bfn/APn9CwP3BAABBAAIAfr8/wP/CQn9BgL+Bf38A/z89gf6AAf9//wABAP9AgT19/4DAQMCAQQDAAABBf76+gEC/Pv9//4E//76AAAACQAA//kE//sDCfsGA/z7AAD7BAMAAAIAAgMA/P0D/wIE/v36//wAAgX8/voCAAT8BAkCAgEBAfwG+gEA/vr++AYAAQL7AAcAAP8BAAH9Af8A+QD+Agj7+wID/AAB+QcD//4ACQMEAvv+AvwBB/r7/gL/+AL7A/78+/4AAP39/QEFAwEA/QECCfz6AfwE/QMAAwD/Av4HAPz/AP4F/ggD+gMH+/UH+wID/wQGBPr2BP8KBAP/+/7//AP2/QT6//4CBAAFBgAFBf4E//v9BgADAAH9/gb4BAQHAAEA/QIB/vsE+/8GAPb7Av79AAD4AP4B+wf+/P4ABf79/wD/+QQA+fkB/voAA/oDAQUDAP79BAkGAAn/AQMB//76APz8BQD9AgEB/Pf6/wcAAwcHAgEA/QH/AP/6A/75BP8E/QD+AgT+AwEF+PkC//37/f79/gAAAQUA+AEEAAX9/wL8AgAFAwAA+v8G+wQA/QEF/wD+BAAGAwABAf0JAgMD+wUGAf39APoA/gQHAAID/AAF//8GA//8/QUC/gEC/vwGAv0BAAD9/ggCAAYBAwL/AQD9/fYD/wIE/f/4BP4AAAD8+wH5Bwb7AAQF+v/0//j9+/v/AP4CAgAA/v4AAP7+Bfv/CwECAQD7CgH5AQEAAQQAAP76APkABQIBBv0JAwABBwD++wD+//35+QPy/v0FAAYC+QD9Avr5CgQIA/35/AADAQH6+AEIAwEEAAMA/AMD+wADAAP///kFBAEBAA==\",\"BucketID\":5,\"BucketIDList\":[5,3,83,30,43,82,55,80,46,51,61,79,97,67,21,91,88,90,99,12,23,0,1,36,47,54,37,27,14,50,16,8,53,25,52,29,18,60,38,98,62,4,15,2,20,22,17,96,65,44,75,59,93,66,31,10,45,48,13,7,57,76,72,77,56,94,81,87,95,6,92,69,74,39,35,26,34,71,41,85,64,49,24,42,73,78,58,63,89,11,86,68,32,28,19,9,40,33,70,84],\"FaceFeature\":\"BQD5+Af/BP4I/AD7AP/9AAcC/QT6/P4HAfr9B/sIBf8O/AD8BwYKCA0AAv77/gAE+gAL/wMA/QD9AAAG/vv8AAP7BvwBAAn4AAf/AQAOAP8A7wIBAv8EAwAFAf/5CPoABQEDBwEFBQb5/fb+AO4G+AAB/wML9PsAA/oHBwYF/Pz7/gUK9QUABgEE+wH8AgL6+gb3AwEAAxL7CwD/DPcFAf30AAPz/QAE/QAABvn9AwD2/wQCAwACAQAKBAUD/v0A/voE//0B+Ab//vkC+vj/AAH7+AL7A/sDAPj7Bvn+/QoGAwEA/v//AP4D+wQDAf8K/QP2BgD5/QD//gEKA/v+BwAAAf3xAf/+/gT9AwP8DADzBw4AAvn//wAE+QH5AQv3C+38/Pf9/QII8gID9wMFCggFAv/9AvsEBvkACP8G9/z9AP/7/fwE+v39DPgAAAAB/fr5A/n8/wIDAAQK/wH+AwAAAvwADQoKAgAFAfsF+vsE//35C/3zCAD9BPsB/wMGB/n5/Pv0+Pb+BPn5/wMKAQAB8fT9Awf++/YAAAICAwUG+wD0+fkBB/0AAAQIBfgEBPkG/wcJAgD7CAv1Avf9AQYAAAEDAPYC+foJ+/78APwD8f4A/gUBB/7///oLAwD/AAUD+/39+PsH+QIF9gMEA/oGAQsMBQkHA/wB+PwCAgA=\",\"FaceBucketID\":82,\"FaceBucketIDList\":[82,45,63,31,16,1,7,98,40,24,65,19,62,48,94,72,92,17,91,52,77,76,85,87,81,21,93,64,37,42,30,78,25,61,9,12,22,2,13,34,4,15,46,3,14,99,90,28,66,29,75,68,80,59,60,88,69,83,36,55,11,44,96,89,10,26,49,50,73,6,53,20,47,86,58,84,27,8,70,43,57,71,97,79,0,67,54,33,23,95,56,5,41,38,51,32,74,39,35,18],\"FaceQuality\":\"0.365118\",\"FaceYaw\":\"0.257412\",\"FacePitch\":\"0.390233\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.475882\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1},{\"ImageID\":\"2\",\"ObjectID\":1,\"Metadata\":{\"Gender\":\"1\",\"Age\":\"32\",\"HeadBoundingBox\":{\"x\":96,\"y\":16,\"w\":107,\"h\":136},\"FaceBoundingBox\":{\"x\":115,\"y\":61,\"w\":57,\"h\":77},\"HairStyle\":\"2\",\"HasHat\":\"1\",\"HasMask\":\"1\",\"HasGlasses\":\"0\",\"Type\":\"6\"},\"Feature\":\"UVNURgUA//0BCP4BAQcAAwQBBvsCB/v8Af4A+wD5+AcBAgL9AgIEAgH4AQQA+f77+P77AAAIA/8A+QQJ/fz8AgACBfsAAgAC/AcIAQD++fgCAAUB/gb//AEAAf4B/QP+AQD0/QMDAfkD+f//A/7+/AD6B/f7/AH7/gAFAAMBAPb/AAP//wAIBQD7Af0FAAD9AAgC/gYF/f/8DAAC//4BAP/6AgECAgADAPz++v0A/wD//fz5AAIB/f0IBAQA/v8CBwP//wYE+/sCCP0BBAMD/gQA/QH/AgL6AgX/BP7/+AD5A/75/QH+A/8H/QAACP//AQT7+QICAfv/Afj9A/0D/wAA/f/8/wYL/wACAQYAAAAD/ggAAQMABv/6BAIADPv+A/wEAQAA/AD5AwT///4BAPz8CgUCDf78AwEA/f4AA/8C/wQB/P8A/wEA/gsAAwEF/v0AAf7/+QQECAcGAP0AAgH//AAHBwD3/fwB+/7/AQj//wUFAP/+/gYBAgYD+fv/BwH8Af0EBAD+AP3++gIH+v8CAPQEAAT//gDzAP0A+AL6BP4I9wMJAP0CAPX6APz9/gALAP7/BgQD+wIDBPn+CwIH/fz7A/3+9wAJ/QD9AP/++wME/v/+Avv+APoFAAAB+gD5APn//gEGBAME/wX5/AD/CAL+9QD8BAD2/wMCCf38+/oB+f0C/f39AQL+AAEAAgAE/wEIA///AP8HAQT+8fn7AP4AAAMA+QQDAwIB//j+/QEAAAIAAgj/A/n8AAP9AQD8AQYF+PgAA/4B+gEE+QYA/wYAB/0BAQD+/P/+BQf5BwIAAPsBBAEGAP4JAwEE////AAEF/wL4AAAFAQYA/vz+/AACAv8CAwIA+wIAAAUJAP0C/wIHAAEABgQF/QAEAAL7BP0A//wC+vr+/AIGAwAEAP0A/P/8BAD//AD5+wQEAAEHAv/8AP77+vQEBP4BAAAAAAr7/wD5AgD7BAEA/gT7AAAEAAMABPkLAQYABff+/wEDAP8EA/4AAf8A/gX9+wACAv3//f7/BAH+Bf/+AAH/AAAE9wAHAP/+/P8DAQD7/QQB/P3/AwAAAQAB/wD+BwAB/vwAAAL/AAYAAAf/Af76+fj6AP4F/gD9AgIB/Qr59f8CAAMCBgQHAf0FAP34AAQH/P79/wQGBA4D+f4AA/v+AAAA+wIE/gIH+QP2AQQGAwAE/vwI/P4GBwD/AAX4AAP+/f0A/Af/AgEBA/v9BPgDBwAC/wD8Bv36A/gBAAH+AAX+BP/9AAIF+AD8Av4B/wT/AQAAAQL/BPwA/PsA/AMDBfb/+AEBCAL+//36APz//wEHBv3/BQAA/QP9+wABAQL6//4CAAH/CP/+AAMBAf0CAAD9+g==\",\"BucketID\":32,\"BucketIDList\":[32,87,20,68,45,78,10,6,52,65,1,94,79,16,61,38,55,89,43,51,60,27,54,25,17,83,9,40,14,22,50,44,18,66,82,4,48,31,69,77,90,63,92,73,70,84,67,23,12,3,74,47,21,41,28,96,36,97,5,85,39,95,64,26,80,53,91,37,34,57,46,15,2,93,11,98,75,81,56,0,24,62,86,13,19,71,72,7,58,29,59,49,88,76,35,99,33,30,42,8],\"FaceFeature\":\"AwQF+foK/vcCAAD4/wD7CQH39vP7/gz/CAAB/AX++AAI/v8D+gQAAP0G/wAA+/oAAAP+Af79CwEAAgAA+/oFBe/3AgIFAgP0/vr8Cf4C+AMHBPn5Afr5AQQGBQD58gMG+wQTAgTzAPr9BQYEA/j//gT8+wXx9wMC+gcH/wAC8v0A+gD7+wkE/gAA7wL78gX/AgIGBvr8AAgD/woEAvkEAwv5CP/8/fz+/fwMAvr7AgD4APcEAA0F//kAAAAG+gADAQEB/wD+AQgCBg35+QQC/vv//vcAAPgEAwAAAgD9Af32/wMLAwD8B/75AQIB+/z/+v4AA/n//gL8+/0BAPv//PgIAAD0CQALAAUF/fwA/wYBAQf9+/f++Af49gMB/AMABwAA9vr5//sE/PoD+QP6+wsA/wEB+QIC+/8B/wD88QkACAIAAPn5AAUD/QL++P4H/f3+A/gG/f8G/QkA8wD0BAMBBwD59AAB+QUA//v2/wEJAQD8DAL5CPoA+/b+/Qr5AwcA/AD+CAEDBgEH/Qb+AQUHAAQK/fUA+/sI9/0I+QcKBQP6/gX0+QgI9gIBAAMFAAAA/vcD/vYI9wj9+v76C/gAAgIH+gMHBP8IAAT6BgAI+vsJ/v7/DAUABgIA+gAHBf0D+/oDAwEABv359QAB+AEG8w7+//0ABf78CPr8Afs=\",\"FaceBucketID\":91,\"FaceBucketIDList\":[91,12,50,84,52,13,57,54,4,53,70,36,64,58,81,10,78,63,35,75,34,16,86,3,99,40,26,42,48,30,25,23,11,62,72,51,18,17,46,27,97,61,49,43,66,37,89,19,24,1,98,76,32,83,44,96,87,31,8,20,33,21,6,56,41,88,82,47,69,93,14,79,38,29,80,85,90,94,55,60,67,95,9,2,71,65,68,77,7,74,59,28,92,73,15,39,22,0,45,5],\"FaceQuality\":\"0.379721\",\"FaceYaw\":\"-0.135311\",\"FacePitch\":\"0.508456\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.555109\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1}]}";}
// @GetMapping("/images1/recog")
// @ResponseBody
// //http://zlsh.ncpoi.cc:7080/getDeviceSnapshotAndRecognize?deviceCode=33050300001327599605&model=7&roi=[10,10,10,10]
// public String getimages(@RequestParam("deviceCode") String deviceCode,
// @RequestParam("model") String model,
// @RequestParam("roi") Long[] roi) {
// return "{\"ret\":\"200\",\"error_msg\":\"OK\",\"ObjectList\":[{\"ImageID\":\"1\",\"ObjectID\":1,\"Metadata\":{\"Gender\":\"1\",\"Age\":\"32\",\"Angle\":\"128\",\"HeadBoundingBox\":{\"x\":96,\"y\":16,\"w\":107,\"h\":136},\"FaceBoundingBox\":{\"x\":115,\"y\":61,\"w\":57,\"h\":77},\"UpperBoundingBox\":{\"x\":34,\"y\":123,\"w\":232,\"h\":263},\"LowerBoundingBox\":{\"x\":74,\"y\":309,\"w\":176,\"h\":408},\"CoatLength\":\"2\",\"CoatTexture\":\"1\",\"CoatColor\":[\"2\"],\"CoatColorNums\":\"1\",\"TrousersLength\":\"1\",\"TrousersTexture\":\"1\",\"TrousersColor\":[\"5\"],\"TrousersColorNums\":\"1\",\"HairStyle\":\"2\",\"HasHat\":\"1\",\"HasGlasses\":\"0\",\"HasMask\":\"0\",\"HasBackpack\":\"0\",\"HasCarrybag\":\"0\",\"HasUmbrella\":\"0\",\"HasTrolley\":\"-1\",\"HasLuggage\":\"-1\",\"LuggageColor\":[],\"LuggageColorNums\":\"0\",\"HasKnife\":\"-1\",\"ObjectBoundingBox\":{\"x\":26,\"y\":13,\"w\":256,\"h\":708},\"TrafficViolation\":\"-1\",\"Type\":\"6\"},\"Feature\":\"UVNURgUA//0BCP4BAQcAAwQBBvsCB/v8Af4A+wD5+AcBAgL9AgIEAgH4AQQA+f77+P77AAAIA/8A+QQJ/fz8AgACBfsAAgAC/AcIAQD++fgCAAUB/gb//AEAAf4B/QP+AQD0/QMDAfkD+f//A/7+/AD6B/f7/AH7/gAFAAMBAPb/AAP//wAIBQD7Af0FAAD9AAgC/gYF/f/8DAAC//4BAP/6AgECAgADAPz++v0A/wD//fz5AAIB/f0IBAQA/v8CBwP//wYE+/sCCP0BBAMD/gQA/QH/AgL6AgX/BP7/+AD5A/75/QH+A/8H/QAACP//AQT7+QICAfv/Afj9A/0D/wAA/f/8/wYL/wACAQYAAAAD/ggAAQMABv/6BAIADPv+A/wEAQAA/AD5AwT///4BAPz8CgUCDf78AwEA/f4AA/8C/wQB/P8A/wEA/gsAAwEF/v0AAf7/+QQECAcGAP0AAgH//AAHBwD3/fwB+/7/AQj//wUFAP/+/gYBAgYD+fv/BwH8Af0EBAD+AP3++gIH+v8CAPQEAAT//gDzAP0A+AL6BP4I9wMJAP0CAPX6APz9/gALAP7/BgQD+wIDBPn+CwIH/fz7A/3+9wAJ/QD9AP/++wME/v/+Avv+APoFAAAB+gD5APn//gEGBAME/wX5/AD/CAL+9QD8BAD2/wMCCf38+/oB+f0C/f39AQL+AAEAAgAE/wEIA///AP8HAQT+8fn7AP4AAAMA+QQDAwIB//j+/QEAAAIAAgj/A/n8AAP9AQD8AQYF+PgAA/4B+gEE+QYA/wYAB/0BAQD+/P/+BQf5BwIAAPsBBAEGAP4JAwEE////AAEF/wL4AAAFAQYA/vz+/AACAv8CAwIA+wIAAAUJAP0C/wIHAAEABgQF/QAEAAL7BP0A//wC+vr+/AIGAwAEAP0A/P/8BAD//AD5+wQEAAEHAv/8AP77+vQEBP4BAAAAAAr7/wD5AgD7BAEA/gT7AAAEAAMABPkLAQYABff+/wEDAP8EA/4AAf8A/gX9+wACAv3//f7/BAH+Bf/+AAH/AAAE9wAHAP/+/P8DAQD7/QQB/P3/AwAAAQAB/wD+BwAB/vwAAAL/AAYAAAf/Af76+fj6AP4F/gD9AgIB/Qr59f8CAAMCBgQHAf0FAP34AAQH/P79/wQGBA4D+f4AA/v+AAAA+wIE/gIH+QP2AQQGAwAE/vwI/P4GBwD/AAX4AAP+/f0A/Af/AgEBA/v9BPgDBwAC/wD8Bv36A/gBAAH+AAX+BP/9AAIF+AD8Av4B/wT/AQAAAQL/BPwA/PsA/AMDBfb/+AEBCAL+//36APz//wEHBv3/BQAA/QP9+wABAQL6//4CAAH/CP/+AAMBAf0CAAD9+g==\",\"BucketID\":32,\"BucketIDList\":[32,87,20,68,45,78,10,6,52,65,1,94,79,16,61,38,55,89,43,51,60,27,54,25,17,83,9,40,14,22,50,44,18,66,82,4,48,31,69,77,90,63,92,73,70,84,67,23,12,3,74,47,21,41,28,96,36,97,5,85,39,95,64,26,80,53,91,37,34,57,46,15,2,93,11,98,75,81,56,0,24,62,86,13,19,71,72,7,58,29,59,49,88,76,35,99,33,30,42,8],\"FaceFeature\":\"AwQF+foK/vcCAAD4/wD7CQH39vP7/gz/CAAB/AX++AAI/v8D+gQAAP0G/wAA+/oAAAP+Af79CwEAAgAA+/oFBe/3AgIFAgP0/vr8Cf4C+AMHBPn5Afr5AQQGBQD58gMG+wQTAgTzAPr9BQYEA/j//gT8+wXx9wMC+gcH/wAC8v0A+gD7+wkE/gAA7wL78gX/AgIGBvr8AAgD/woEAvkEAwv5CP/8/fz+/fwMAvr7AgD4APcEAA0F//kAAAAG+gADAQEB/wD+AQgCBg35+QQC/vv//vcAAPgEAwAAAgD9Af32/wMLAwD8B/75AQIB+/z/+v4AA/n//gL8+/0BAPv//PgIAAD0CQALAAUF/fwA/wYBAQf9+/f++Af49gMB/AMABwAA9vr5//sE/PoD+QP6+wsA/wEB+QIC+/8B/wD88QkACAIAAPn5AAUD/QL++P4H/f3+A/gG/f8G/QkA8wD0BAMBBwD59AAB+QUA//v2/wEJAQD8DAL5CPoA+/b+/Qr5AwcA/AD+CAEDBgEH/Qb+AQUHAAQK/fUA+/sI9/0I+QcKBQP6/gX0+QgI9gIBAAMFAAAA/vcD/vYI9wj9+v76C/gAAgIH+gMHBP8IAAT6BgAI+vsJ/v7/DAUABgIA+gAHBf0D+/oDAwEABv359QAB+AEG8w7+//0ABf78CPr8Afs=\",\"FaceBucketID\":91,\"FaceBucketIDList\":[91,12,50,84,52,13,57,54,4,53,70,36,64,58,81,10,78,63,35,75,34,16,86,3,99,40,26,42,48,30,25,23,11,62,72,51,18,17,46,27,97,61,49,43,66,37,89,19,24,1,98,76,32,83,44,96,87,31,8,20,33,21,6,56,41,88,82,47,69,93,14,79,38,29,80,85,90,94,55,60,67,95,9,2,71,65,68,77,7,74,59,28,92,73,15,39,22,0,45,5],\"FaceQuality\":\"0.379721\",\"FaceYaw\":\"-0.135311\",\"FacePitch\":\"0.508456\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.555109\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1},{\"ImageID\":\"3\",\"ObjectID\":1,\"Metadata\":{\"Angle\":\"128\",\"VehicleClass\":\"1\",\"VehicleColor\":[\"9\"],\"VehicleColorNums\":\"1\",\"VehicleBrand\":\"\\u96ea\\u4f5b\\u5170-\\u79d1\\u9c81\\u5179-2009_2013\",\"VehicleMainBrandName\":\"\\u96ea\\u4f5b\\u5170\",\"VehicleSubBrandName\":\"\\u79d1\\u9c81\\u5179\",\"VehicleYearName\":\"2009_2013\",\"HasPlate\":\"1\",\"PlateClass\":\"1\",\"PlateColor\":\"2\",\"PlateNo\":\"\\u6d59AJ079B\",\"PlateNeatness\":\"2\",\"Sunvisor\":\"0\",\"Paper\":\"0\",\"Decoration\":\"0\",\"Drop\":\"1\",\"Tag\":\"1\",\"SafetyBelt\":{\"MainDriver\":\"-1\",\"CoDriver\":\"-1\"},\"HasCall\":\"-1\",\"HasSkylight\":\"0\",\"HasBaggage\":\"0\",\"HasAerial\":\"0\",\"HasCrash\":\"-1\",\"HasDanger\":\"0\",\"HighwayTollVehicles\":\"1\",\"ObjectBoundingBox\":{\"x\":41,\"y\":40,\"w\":894,\"h\":717},\"TrafficViolation\":\"-1\",\"Type\":\"6\"},\"Feature\":\"AAAAAAAAAAAAAAAPAAAAAAAKABQAAAAAAAAAAAAAAAAhAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAB0AAAAAAAAAAAAAEwELAAAAAAAAAAAAAAAAAAAAAAAFCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAABIAAAAAABMAAAEAAAAAAAAAAAAAAAAAABAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZAAAAHgAAAAAAAAAAAAAAAgAAAAAHAAATAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAAAAAAAAAcAAAAAB8AAAAAAAAAAAAAAAAAAAAAABoDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVAAAAAAAMDgAAAAAAAB0AAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAA=\",\"BucketID\":76,\"BucketIDList\":[76,91,82,57,36,51,75,55,71,43,84,63,8,98,83,65,90,60,35,3,37,39,74,2,12,9,1,20,79,32,95,49,33,58,42,66,38,69,45,56,59,0,87,19,41,34,21,14,13,6,4,26,68,96,72,7,85,29,48,40,88,99,23,46,27,18,77,78,11,97,17,50,15,61,16,31,80,44,52,25,10,86,92,5,54,53,73,89,94,93,70,62,30,47,64,22,28,67,81,24],\"FaceFeature\":\"\",\"FaceBucketID\":-1,\"FaceBucketIDList\":[],\"FaceQuality\":\"0.000000\",\"FaceYaw\":\"0.000000\",\"FacePitch\":\"0.000000\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.000000\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1},{\"ImageID\":\"4\",\"ObjectID\":1,\"Metadata\":{\"Gender\":\"1\",\"Age\":\"16\",\"Angle\":\"128\",\"BikeClass\":\"1\",\"SocialAttribute\":\"1\",\"Enterprise\":\"-1\",\"FaceBoundingBox\":{\"x\":145,\"y\":65,\"w\":54,\"h\":66},\"CoatLength\":\"2\",\"CoatTexture\":\"5\",\"CoatColor\":[\"2\"],\"CoatColorNums\":\"1\",\"HelmetColor\":\"-1\",\"HasHelmet\":\"0\",\"HasGlasses\":\"1\",\"HasMask\":\"0\",\"HasBackpack\":\"0\",\"HasCarrybag\":\"-1\",\"HasUmbrella\":\"0\",\"HasPlate\":\"-1\",\"PlateNo\":\"-1\",\"HasPassenger\":\"1\",\"ObjectBoundingBox\":{\"x\":54,\"y\":16,\"w\":276,\"h\":635},\"TrafficViolation\":\"-1\",\"Type\":\"6\"},\"Feature\":\"UVNURgUA/wACAf/3AfwEA/kC/AMAAwAEAQACAPv+AAAB/wMHAgEA/wAGAAj/+AD7APwCAwkD9wsAAP4CBvn7/wz5A/wBBP8D/QICCAUCBv/7AgABAv7+AAH9AAUC/AX/AvsC/P4CAv39BAMA/gAAAAIA/wT6/v77A/YEAPoB//sG//7+/wD+/QAA/AMAAAQCAvz8/P3/AAH9+gX8/wD8/fr7AQAD//oA+AECAAAFAAH+/QH7/gIHAgYA/vz+AwADAgQCAgAL+wD9BgMGBv8E+/oF/P4H/wMD/gQC/wQH/v/4Agn9BQAC/wAE/P37BP/7AgIA/gj8APv7CAL9/vkABgL7/fz9/AD1BwD7AwAAAwH7AAb7+v4AAwX6/PsDBwMA/wH9AQD8AQP8APz7/vb8APoDAAT8AP0FAwYG/P39/P4B/vkA/f8AAgQBB/0D+wAFBwX4Aff+Bvz2/wEEBAIABQQD/wABAAMA//0AAP/+/wAC9/4AAfz+AAEF/f/6CAD9Bfn/APn9CwP3BAABBAAIAfr8/wP/CQn9BgL+Bf38A/z89gf6AAf9//wABAP9AgT19/4DAQMCAQQDAAABBf76+gEC/Pv9//4E//76AAAACQAA//kE//sDCfsGA/z7AAD7BAMAAAIAAgMA/P0D/wIE/v36//wAAgX8/voCAAT8BAkCAgEBAfwG+gEA/vr++AYAAQL7AAcAAP8BAAH9Af8A+QD+Agj7+wID/AAB+QcD//4ACQMEAvv+AvwBB/r7/gL/+AL7A/78+/4AAP39/QEFAwEA/QECCfz6AfwE/QMAAwD/Av4HAPz/AP4F/ggD+gMH+/UH+wID/wQGBPr2BP8KBAP/+/7//AP2/QT6//4CBAAFBgAFBf4E//v9BgADAAH9/gb4BAQHAAEA/QIB/vsE+/8GAPb7Av79AAD4AP4B+wf+/P4ABf79/wD/+QQA+fkB/voAA/oDAQUDAP79BAkGAAn/AQMB//76APz8BQD9AgEB/Pf6/wcAAwcHAgEA/QH/AP/6A/75BP8E/QD+AgT+AwEF+PkC//37/f79/gAAAQUA+AEEAAX9/wL8AgAFAwAA+v8G+wQA/QEF/wD+BAAGAwABAf0JAgMD+wUGAf39APoA/gQHAAID/AAF//8GA//8/QUC/gEC/vwGAv0BAAD9/ggCAAYBAwL/AQD9/fYD/wIE/f/4BP4AAAD8+wH5Bwb7AAQF+v/0//j9+/v/AP4CAgAA/v4AAP7+Bfv/CwECAQD7CgH5AQEAAQQAAP76APkABQIBBv0JAwABBwD++wD+//35+QPy/v0FAAYC+QD9Avr5CgQIA/35/AADAQH6+AEIAwEEAAMA/AMD+wADAAP///kFBAEBAA==\",\"BucketID\":5,\"BucketIDList\":[5,3,83,30,43,82,55,80,46,51,61,79,97,67,21,91,88,90,99,12,23,0,1,36,47,54,37,27,14,50,16,8,53,25,52,29,18,60,38,98,62,4,15,2,20,22,17,96,65,44,75,59,93,66,31,10,45,48,13,7,57,76,72,77,56,94,81,87,95,6,92,69,74,39,35,26,34,71,41,85,64,49,24,42,73,78,58,63,89,11,86,68,32,28,19,9,40,33,70,84],\"FaceFeature\":\"BQD5+Af/BP4I/AD7AP/9AAcC/QT6/P4HAfr9B/sIBf8O/AD8BwYKCA0AAv77/gAE+gAL/wMA/QD9AAAG/vv8AAP7BvwBAAn4AAf/AQAOAP8A7wIBAv8EAwAFAf/5CPoABQEDBwEFBQb5/fb+AO4G+AAB/wML9PsAA/oHBwYF/Pz7/gUK9QUABgEE+wH8AgL6+gb3AwEAAxL7CwD/DPcFAf30AAPz/QAE/QAABvn9AwD2/wQCAwACAQAKBAUD/v0A/voE//0B+Ab//vkC+vj/AAH7+AL7A/sDAPj7Bvn+/QoGAwEA/v//AP4D+wQDAf8K/QP2BgD5/QD//gEKA/v+BwAAAf3xAf/+/gT9AwP8DADzBw4AAvn//wAE+QH5AQv3C+38/Pf9/QII8gID9wMFCggFAv/9AvsEBvkACP8G9/z9AP/7/fwE+v39DPgAAAAB/fr5A/n8/wIDAAQK/wH+AwAAAvwADQoKAgAFAfsF+vsE//35C/3zCAD9BPsB/wMGB/n5/Pv0+Pb+BPn5/wMKAQAB8fT9Awf++/YAAAICAwUG+wD0+fkBB/0AAAQIBfgEBPkG/wcJAgD7CAv1Avf9AQYAAAEDAPYC+foJ+/78APwD8f4A/gUBB/7///oLAwD/AAUD+/39+PsH+QIF9gMEA/oGAQsMBQkHA/wB+PwCAgA=\",\"FaceBucketID\":82,\"FaceBucketIDList\":[82,45,63,31,16,1,7,98,40,24,65,19,62,48,94,72,92,17,91,52,77,76,85,87,81,21,93,64,37,42,30,78,25,61,9,12,22,2,13,34,4,15,46,3,14,99,90,28,66,29,75,68,80,59,60,88,69,83,36,55,11,44,96,89,10,26,49,50,73,6,53,20,47,86,58,84,27,8,70,43,57,71,97,79,0,67,54,33,23,95,56,5,41,38,51,32,74,39,35,18],\"FaceQuality\":\"0.365118\",\"FaceYaw\":\"0.257412\",\"FacePitch\":\"0.390233\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.475882\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1},{\"ImageID\":\"2\",\"ObjectID\":1,\"Metadata\":{\"Gender\":\"1\",\"Age\":\"32\",\"HeadBoundingBox\":{\"x\":96,\"y\":16,\"w\":107,\"h\":136},\"FaceBoundingBox\":{\"x\":115,\"y\":61,\"w\":57,\"h\":77},\"HairStyle\":\"2\",\"HasHat\":\"1\",\"HasMask\":\"1\",\"HasGlasses\":\"0\",\"Type\":\"6\"},\"Feature\":\"UVNURgUA//0BCP4BAQcAAwQBBvsCB/v8Af4A+wD5+AcBAgL9AgIEAgH4AQQA+f77+P77AAAIA/8A+QQJ/fz8AgACBfsAAgAC/AcIAQD++fgCAAUB/gb//AEAAf4B/QP+AQD0/QMDAfkD+f//A/7+/AD6B/f7/AH7/gAFAAMBAPb/AAP//wAIBQD7Af0FAAD9AAgC/gYF/f/8DAAC//4BAP/6AgECAgADAPz++v0A/wD//fz5AAIB/f0IBAQA/v8CBwP//wYE+/sCCP0BBAMD/gQA/QH/AgL6AgX/BP7/+AD5A/75/QH+A/8H/QAACP//AQT7+QICAfv/Afj9A/0D/wAA/f/8/wYL/wACAQYAAAAD/ggAAQMABv/6BAIADPv+A/wEAQAA/AD5AwT///4BAPz8CgUCDf78AwEA/f4AA/8C/wQB/P8A/wEA/gsAAwEF/v0AAf7/+QQECAcGAP0AAgH//AAHBwD3/fwB+/7/AQj//wUFAP/+/gYBAgYD+fv/BwH8Af0EBAD+AP3++gIH+v8CAPQEAAT//gDzAP0A+AL6BP4I9wMJAP0CAPX6APz9/gALAP7/BgQD+wIDBPn+CwIH/fz7A/3+9wAJ/QD9AP/++wME/v/+Avv+APoFAAAB+gD5APn//gEGBAME/wX5/AD/CAL+9QD8BAD2/wMCCf38+/oB+f0C/f39AQL+AAEAAgAE/wEIA///AP8HAQT+8fn7AP4AAAMA+QQDAwIB//j+/QEAAAIAAgj/A/n8AAP9AQD8AQYF+PgAA/4B+gEE+QYA/wYAB/0BAQD+/P/+BQf5BwIAAPsBBAEGAP4JAwEE////AAEF/wL4AAAFAQYA/vz+/AACAv8CAwIA+wIAAAUJAP0C/wIHAAEABgQF/QAEAAL7BP0A//wC+vr+/AIGAwAEAP0A/P/8BAD//AD5+wQEAAEHAv/8AP77+vQEBP4BAAAAAAr7/wD5AgD7BAEA/gT7AAAEAAMABPkLAQYABff+/wEDAP8EA/4AAf8A/gX9+wACAv3//f7/BAH+Bf/+AAH/AAAE9wAHAP/+/P8DAQD7/QQB/P3/AwAAAQAB/wD+BwAB/vwAAAL/AAYAAAf/Af76+fj6AP4F/gD9AgIB/Qr59f8CAAMCBgQHAf0FAP34AAQH/P79/wQGBA4D+f4AA/v+AAAA+wIE/gIH+QP2AQQGAwAE/vwI/P4GBwD/AAX4AAP+/f0A/Af/AgEBA/v9BPgDBwAC/wD8Bv36A/gBAAH+AAX+BP/9AAIF+AD8Av4B/wT/AQAAAQL/BPwA/PsA/AMDBfb/+AEBCAL+//36APz//wEHBv3/BQAA/QP9+wABAQL6//4CAAH/CP/+AAMBAf0CAAD9+g==\",\"BucketID\":32,\"BucketIDList\":[32,87,20,68,45,78,10,6,52,65,1,94,79,16,61,38,55,89,43,51,60,27,54,25,17,83,9,40,14,22,50,44,18,66,82,4,48,31,69,77,90,63,92,73,70,84,67,23,12,3,74,47,21,41,28,96,36,97,5,85,39,95,64,26,80,53,91,37,34,57,46,15,2,93,11,98,75,81,56,0,24,62,86,13,19,71,72,7,58,29,59,49,88,76,35,99,33,30,42,8],\"FaceFeature\":\"AwQF+foK/vcCAAD4/wD7CQH39vP7/gz/CAAB/AX++AAI/v8D+gQAAP0G/wAA+/oAAAP+Af79CwEAAgAA+/oFBe/3AgIFAgP0/vr8Cf4C+AMHBPn5Afr5AQQGBQD58gMG+wQTAgTzAPr9BQYEA/j//gT8+wXx9wMC+gcH/wAC8v0A+gD7+wkE/gAA7wL78gX/AgIGBvr8AAgD/woEAvkEAwv5CP/8/fz+/fwMAvr7AgD4APcEAA0F//kAAAAG+gADAQEB/wD+AQgCBg35+QQC/vv//vcAAPgEAwAAAgD9Af32/wMLAwD8B/75AQIB+/z/+v4AA/n//gL8+/0BAPv//PgIAAD0CQALAAUF/fwA/wYBAQf9+/f++Af49gMB/AMABwAA9vr5//sE/PoD+QP6+wsA/wEB+QIC+/8B/wD88QkACAIAAPn5AAUD/QL++P4H/f3+A/gG/f8G/QkA8wD0BAMBBwD59AAB+QUA//v2/wEJAQD8DAL5CPoA+/b+/Qr5AwcA/AD+CAEDBgEH/Qb+AQUHAAQK/fUA+/sI9/0I+QcKBQP6/gX0+QgI9gIBAAMFAAAA/vcD/vYI9wj9+v76C/gAAgIH+gMHBP8IAAT6BgAI+vsJ/v7/DAUABgIA+gAHBf0D+/oDAwEABv359QAB+AEG8w7+//0ABf78CPr8Afs=\",\"FaceBucketID\":91,\"FaceBucketIDList\":[91,12,50,84,52,13,57,54,4,53,70,36,64,58,81,10,78,63,35,75,34,16,86,3,99,40,26,42,48,30,25,23,11,62,72,51,18,17,46,27,97,61,49,43,66,37,89,19,24,1,98,76,32,83,44,96,87,31,8,20,33,21,6,56,41,88,82,47,69,93,14,79,38,29,80,85,90,94,55,60,67,95,9,2,71,65,68,77,7,74,59,28,92,73,15,39,22,0,45,5],\"FaceQuality\":\"0.379721\",\"FaceYaw\":\"-0.135311\",\"FacePitch\":\"0.508456\",\"FaceRoll\":\"0.000000\",\"FaceBlurry\":\"0.555109\",\"ObjectImageData\":\"\",\"FaceImageData\":\"\",\"Index\":1}]}";}
//
/***
* 旧版本透露账号密码舍弃掉
* @param ftpPath
* @param request
* @param response
*/
// @GetMapping("/fielagent")
// @ResponseBody
// protected void fielagent(@RequestParam("ftpPath") String ftpPath, HttpServletRequest request, HttpServletResponse response) {
// long startTime = System.currentTimeMillis();
// FileInputStream hFile = null;
// OutputStream toClient = null;
// InputStream inputStream = null;
// BufferedInputStream bis = null;
// try {
// response.reset();
// response.setHeader("Expires", "Sat, 10 May 2059 12:00:00 GMT");
// response.setHeader("Cache-Control", "max-age=315360000");
//
// if (StringUtils.isNotBlank(ftpPath)) {
// //根据ftp path 查询
//
// if (ftpPath.endsWith(".jpg") || ftpPath.endsWith(".JPG") || ftpPath.endsWith(".png") || ftpPath.endsWith(".PNG") || ftpPath.endsWith(".gif") || ftpPath.endsWith(".GIF")) {
// response.setContentType("image/" + ftpPath.substring(ftpPath.lastIndexOf(".") + 1) + "; charset=utf-8");
// } else if (ftpPath.endsWith(".mp4") || ftpPath.endsWith(".MP4")) {
// response.setContentType("video/mpeg4; charset=utf-8");
// String mp4file = ftpPath.substring(ftpPath.lastIndexOf("/") + 1);
// response.setHeader("Content-Disposition", "attachment;fileName=" + mp4file);
// }
//
// String destUrl = ftpPath;
// destUrl = new String(destUrl.getBytes("ISO8859-1"), "GBK");
// String[] arr = destUrl.split(";");
// FtpURLConnection ftpUrl = null;
// HttpURLConnection httpUrl = null;
// for (int i = 0; i < arr.length; i++) {
// try {
// URL url = new URL(arr[i]);
// if (arr[i].toUpperCase().indexOf("FTP") != -1) { // ftp
// ftpUrl = (FtpURLConnection) url.openConnection();
// ftpUrl.setConnectTimeout(5000);
// ftpUrl.setReadTimeout(5000);
// bis = new BufferedInputStream(ftpUrl.getInputStream());
// response.setContentLength(ftpUrl.getContentLength());
// } else { // http
// httpUrl = (HttpURLConnection) url.openConnection();
// httpUrl.setConnectTimeout(5000);
// httpUrl.setReadTimeout(5000);
// bis = new BufferedInputStream(httpUrl.getInputStream());
// response.setContentLength(httpUrl.getContentLength());
// }
// toClient = response.getOutputStream();
// IOUtils.copy(bis, toClient);
// } catch (Exception e) {
// response.setContentType("text/html;charset=GBK");
// response.setCharacterEncoding("GBK");
// PrintWriter out = response.getWriter();
// out.write("无法打开图片!");
// out.flush();
// } finally {
// if (bis != null) {
// bis.close();
// }
// if (bis != null) {
// bis.close();
// }
// if (httpUrl != null) {
// httpUrl.disconnect();
// }
// if (ftpUrl != null) {
// ftpUrl.close();
// }
// if (toClient != null) {
// toClient.close();
// }
// }
// }
// return;
// }
//
// } catch (Exception e) {
// } finally {
// IOUtils.closeQuietly(bis);
// IOUtils.closeQuietly(toClient);
// IOUtils.closeQuietly(hFile);
// IOUtils.closeQuietly(inputStream);
// }
//
// }
//
//
//
// @GetMapping("/fielagent")
// @ResponseBody
// protected void fielagent(@RequestParam("ftpPath") String ftpPath, HttpServletRequest request, HttpServletResponse response) {
//
// long startTime = System.currentTimeMillis();
// FileInputStream hFile = null;
// OutputStream toClient = null;
// InputStream inputStream = null;
// BufferedInputStream bis = null;
// try {
// response.reset();
// response.setHeader("Expires", "Sat, 10 May 2059 12:00:00 GMT");
// response.setHeader("Cache-Control", "max-age=315360000");
//
// if (StringUtils.isNotBlank(ftpPath)) {
// //根据ftp path 查询 该traffpicture 的imagedata 的值,然后处理返回
//
// ftpPath= traffPictureService.queryimgdataByid(ftpPath);
//
// if (ftpPath.endsWith(".jpg") || ftpPath.endsWith(".JPG") || ftpPath.endsWith(".png") || ftpPath.endsWith(".PNG") || ftpPath.endsWith(".gif") || ftpPath.endsWith(".GIF")) {
// response.setContentType("image/" + ftpPath.substring(ftpPath.lastIndexOf(".") + 1) + "; charset=utf-8");
// } else if (ftpPath.endsWith(".mp4") || ftpPath.endsWith(".MP4")) {
// response.setContentType("video/mpeg4; charset=utf-8");
// String mp4file = ftpPath.substring(ftpPath.lastIndexOf("/") + 1);
// response.setHeader("Content-Disposition", "attachment;fileName=" + mp4file);
// }
//
// String destUrl = ftpPath;
// destUrl = new String(destUrl.getBytes("ISO8859-1"), "GBK");
// String[] arr = destUrl.split(";");
// FtpURLConnection ftpUrl = null;
// HttpURLConnection httpUrl = null;
// for (int i = 0; i < arr.length; i++) {
// try {
// URL url = new URL(arr[i]);
// if (arr[i].toUpperCase().indexOf("FTP") != -1) { // ftp
// ftpUrl = (FtpURLConnection) url.openConnection();
// ftpUrl.setConnectTimeout(5000);
// ftpUrl.setReadTimeout(5000);
// bis = new BufferedInputStream(ftpUrl.getInputStream());
// response.setContentLength(ftpUrl.getContentLength());
// } else { // http
// httpUrl = (HttpURLConnection) url.openConnection();
// httpUrl.setConnectTimeout(5000);
// httpUrl.setReadTimeout(5000);
// bis = new BufferedInputStream(httpUrl.getInputStream());
// response.setContentLength(httpUrl.getContentLength());
// }
// toClient = response.getOutputStream();
// IOUtils.copy(bis, toClient);
// } catch (Exception e) {
// response.setContentType("text/html;charset=GBK");
// response.setCharacterEncoding("GBK");
// PrintWriter out = response.getWriter();
// out.write("无法打开图片!");
// out.flush();
// } finally {
// if (bis != null) {
// bis.close();
// }
// if (bis != null) {
// bis.close();
// }
// if (httpUrl != null) {
// httpUrl.disconnect();
// }
// if (ftpUrl != null) {
// ftpUrl.close();
// }
// if (toClient != null) {
// toClient.close();
// }
// }
// }
// return;
// }
//
// } catch (Exception e) {
// } finally {
// IOUtils.closeQuietly(bis);
// IOUtils.closeQuietly(toClient);
// IOUtils.closeQuietly(hFile);
// IOUtils.closeQuietly(inputStream);
// }
//
// }
//
// @GetMapping("/api/alg/files")
// protected void files(@RequestParam("location") String location, HttpServletRequest request, HttpServletResponse response) {
// long startTime = System.currentTimeMillis();
// //ftp://reader:reader@33.50.1.22:21/
// //ftp.host=33.65.250.179:21:hzjt:1qaz2wsx
// String ftpPath="ftp://"+ftppath+"/"+location;
// FileInputStream hFile = null;
// OutputStream toClient = null;
// InputStream inputStream = null;
// BufferedInputStream bis = null;
// try {
// response.reset();
// response.setHeader("Expires", "Sat, 10 May 2059 12:00:00 GMT");
// response.setHeader("Cache-Control", "max-age=315360000");
//
// if (StringUtils.isNotBlank(ftpPath)) {
// if (ftpPath.endsWith(".jpg") || ftpPath.endsWith(".JPG") || ftpPath.endsWith(".png") || ftpPath.endsWith(".PNG") || ftpPath.endsWith(".gif") || ftpPath.endsWith(".GIF")) {
// response.setContentType("image/" + ftpPath.substring(ftpPath.lastIndexOf(".") + 1) + "; charset=utf-8");
// } else if (ftpPath.endsWith(".mp4") || ftpPath.endsWith(".MP4")) {
// response.setContentType("video/mpeg4; charset=utf-8");
// String mp4file = ftpPath.substring(ftpPath.lastIndexOf("/") + 1);
// response.setHeader("Content-Disposition", "attachment;fileName=" + mp4file);
// }
//
// String destUrl = ftpPath;
// destUrl = new String(destUrl.getBytes("ISO8859-1"), "GBK");
// String[] arr = destUrl.split(";");
// FtpURLConnection ftpUrl = null;
// HttpURLConnection httpUrl = null;
// for (int i = 0; i < arr.length; i++) {
// try {
// URL url = new URL(arr[i]);
// if (arr[i].toUpperCase().indexOf("FTP") != -1) { // ftp
// ftpUrl = (FtpURLConnection) url.openConnection();
// ftpUrl.setConnectTimeout(30000);
// ftpUrl.setReadTimeout(30000);
// bis = new BufferedInputStream(ftpUrl.getInputStream());
// response.setContentLength(ftpUrl.getContentLength());
// } else { // http
// httpUrl = (HttpURLConnection) url.openConnection();
// httpUrl.setConnectTimeout(30000);
// httpUrl.setReadTimeout(30000);
// bis = new BufferedInputStream(httpUrl.getInputStream());
// response.setContentLength(httpUrl.getContentLength());
// }
// toClient = response.getOutputStream();
// IOUtils.copy(bis, toClient);
// } catch (Exception e) {
// response.setContentType("text/html;charset=GBK");
// response.setCharacterEncoding("GBK");
// PrintWriter out = response.getWriter();
// out.write("无法打开图片!");
// out.flush();
// logger.info("ftpagent error:{} ",ftpUrl+e.toString());
// } finally {
// if (bis != null) {
// bis.close();
// }
// if (bis != null) {
// bis.close();
// }
// if (httpUrl != null) {
// httpUrl.disconnect();
// }
// if (ftpUrl != null) {
// ftpUrl.close();
// }
// if (toClient != null) {
// toClient.close();
// }
// }
// }
// return;
// }
//
// } catch (Exception e) {
// } finally {
// IOUtils.closeQuietly(bis);
// IOUtils.closeQuietly(toClient);
// IOUtils.closeQuietly(hFile);
// IOUtils.closeQuietly(inputStream);
// }
//
// }
}
\ No newline at end of file
package com.cx.cn.cxquartz.controller;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/video")
public class SbtdspsrController {
private static final Logger logger = LoggerFactory.getLogger(SbtdspsrController.class);
@Autowired
private SbtdspsrService sbtdspsrService;
//
// @RequestMapping(value = "/getSbtdspsrbyrtsp", method = RequestMethod.GET)
// public String addTaskpage() {
// return "addtask";
// }
// @RequestMapping(value = "/list", method = RequestMethod.GET)
// @ResponseBody
// public List<Sbtdspsr> list() {
// return sbtdspsrService.list();
//
// }
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.Autosnaptaskinfo;
import com.cx.cn.cxquartz.vo.Code;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Mapper
public interface AutoSanpMapper {
int insert(Autosnaptaskinfo taskinfo) ;
List<Autosnaptaskinfo> query(Autosnaptaskinfo taskinfo);
}
...@@ -18,6 +18,7 @@ public interface TraffAlarmRecordMapper { ...@@ -18,6 +18,7 @@ public interface TraffAlarmRecordMapper {
int updateTraffAlarmRecordUrl(TraffAlarmRecord traffalarmrecord); int updateTraffAlarmRecordUrl(TraffAlarmRecord traffalarmrecord);
List<TraffAlarmRecord> getTraffAlarmRecordByProgress(Map<String, Object> map); List<TraffAlarmRecord> getTraffAlarmRecordByProgress(Map<String, Object> map);
int updateTraffAlarmRecordProcess(TraffAlarmRecord traffalarmrecord); int updateTraffAlarmRecordProcess(TraffAlarmRecord traffalarmrecord);
} }
\ No newline at end of file
...@@ -342,8 +342,72 @@ public class QueueConstants { ...@@ -342,8 +342,72 @@ public class QueueConstants {
* 路由键 * 路由键
*/ */
String ROUTEKEY = "RabbitMQ.RouteKey.EventProcessingConsumer"; String ROUTEKEY = "RabbitMQ.RouteKey.EventProcessingConsumer";
}
public enum QueueAutoSnapEnum {
QUEUE_AUTOSNAP_ENUM(QueueConstants.QueueAutoSnapConsumer.EXCHANGE, QueueConstants.QueueAutoSnapConsumer.QUEUE,
QueueConstants.QueueAutoSnapConsumer.ROUTEKEY);
/**
* 交换机名称
*/
private String exchange;
/**
* 队列名称
*/
private String queue;
/**
* 路由键
*/
private String routeKey;
QueueAutoSnapEnum(String exchange, String queue, String routeKey) {
this.exchange = exchange;
this.queue = queue;
this.routeKey = routeKey;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
} }
public String getQueue() {
return queue;
}
public void setQueue(String queue) {
this.queue = queue;
}
public String getRouteKey() {
return routeKey;
}
public void setRouteKey(String routeKey) {
this.routeKey = routeKey;
}
}
/**
* 获得rtsp 或者hls的队列
*/
public interface QueueAutoSnapConsumer{
/**
* 交换机名称
*/
String EXCHANGE = "RabbitMQ.DirectExchange.AutoSnapConsumer";
/**
* 队列名称
*/
String QUEUE = "RabbitMQ.DirectQueue.AutoSnapConsumer";
/**
* 路由键
*/
String ROUTEKEY = "RabbitMQ.RouteKey.AutoSnapConsumer";
}
} }
...@@ -13,13 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -13,13 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.util.Map; import java.util.Map;
/**
* 在Consumer中, 真正的业务逻辑其实只是保存消息到各自的数据表中, 但我们又不得不在调用consume方法之前校验消费幂等性, 发送后, 还要更新消息状态为"已消费"状态, 并手动ack。
* 实际项目中, 可能还有很多生产者-消费者的应用场景, 如记录日志, 发送短信等等, 都需要rabbitmq, 如果每次都写这些重复的公用代码, 没必要, 也难以维护。
* 所以, 我们可以将公共代码抽离出来, 让核心业务逻辑只关心自己的实现, 而不用做其他操作, 其实就是AOP。
* <p>
* 为达到这个目的, 有很多方法, 可以用spring aop, 可以用拦截器, 可以用静态代理, 也可以用动态代理, 在这里用的是动态代理。
*/
public class BaseConsumerProxy { public class BaseConsumerProxy {
private static final Logger logger = LoggerFactory.getLogger(BaseConsumerProxy.class); private static final Logger logger = LoggerFactory.getLogger(BaseConsumerProxy.class);
/** /**
...@@ -51,30 +44,14 @@ public class BaseConsumerProxy { ...@@ -51,30 +44,14 @@ public class BaseConsumerProxy {
public Object getProxy() { public Object getProxy() {
ClassLoader classLoader = target.getClass().getClassLoader(); ClassLoader classLoader = target.getClass().getClassLoader();
Class[] interfaces = target.getClass().getInterfaces(); Class[] interfaces = target.getClass().getInterfaces();
//Lambda表达式方式实现InvocationHandler接口
return Proxy.newProxyInstance(classLoader, interfaces, (proxy, method, args) -> { return Proxy.newProxyInstance(classLoader, interfaces, (proxy, method, args) -> {
Message message = (Message) args[0]; Message message = (Message) args[0];
Channel channel = (Channel) args[1]; Channel channel = (Channel) args[1];
//String correlationId = getCorrelationId(message);
// 消费幂等性, 防止消息被重复消费
// 重启服务器, 由于有一条未被ack的消息, 所以重启后监听到消息, 进行消费, 但是由于消费前会判断该消息的状态是否未被消费, 发现status=3, 即已消费,
// 所以, 直接return, 这样就保证了消费端的幂等性, 即使由于网络等原因投递成功而未触发回调, 从而多次投递, 也不会重复消费进而发生业务异常。
// if (isConsumed(correlationId)) {
// logger.info("重复消费, correlationId: {}", correlationId);
// return null;
// }
MessageProperties properties = message.getMessageProperties(); MessageProperties properties = message.getMessageProperties();
long tag = properties.getDeliveryTag(); long tag = properties.getDeliveryTag();
try { try {
// 真正消费的业务逻辑
Object result = method.invoke(target, args); Object result = method.invoke(target, args);
//traffPictureService.updateStatus(correlationId, QueueConstants.MessageLogStatus.CONSUMED_SUCCESS); // 手动ack
// 消费确认 虽然消息确实被消费了, 但是由于是手动确认模式, 而最后又没手动确认, 所以, 消息仍被rabbitmq保存。
// 所以, 手动ack能够保证消息一定被消费, 但一定要记得basicAck。
channel.basicAck(tag, false); channel.basicAck(tag, false);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
...@@ -94,7 +71,6 @@ public class BaseConsumerProxy { ...@@ -94,7 +71,6 @@ public class BaseConsumerProxy {
*/ */
private String getCorrelationId(Message message) { private String getCorrelationId(Message message) {
String correlationId = null; String correlationId = null;
MessageProperties properties = message.getMessageProperties(); MessageProperties properties = message.getMessageProperties();
Map<String, Object> headers = properties.getHeaders(); Map<String, Object> headers = properties.getHeaders();
for (Map.Entry entry : headers.entrySet()) { for (Map.Entry entry : headers.entrySet()) {
...@@ -103,22 +79,7 @@ public class BaseConsumerProxy { ...@@ -103,22 +79,7 @@ public class BaseConsumerProxy {
if (key.equals("spring_returned_message_correlation")) { if (key.equals("spring_returned_message_correlation")) {
correlationId = value; correlationId = value;
} }
} }
return correlationId; return correlationId;
} }
/**
* 消息是否已被消费
*
* @param correlationId
* @return
*/
private boolean isConsumed(String correlationId) {
//查看数据是否入表
return false;
// MessageLog msgLog = msgLogService.selectByMsgId(correlationId);
// return null == msgLog || msgLog.getStatus().equals(QueueConstants.MessageLogStatus.CONSUMED_SUCCESS);
}
} }
\ No newline at end of file
...@@ -35,14 +35,8 @@ public class EventProcessingConsumer implements BaseConsumer { ...@@ -35,14 +35,8 @@ public class EventProcessingConsumer implements BaseConsumer {
public void consume(Message message, Channel channel) throws IOException { public void consume(Message message, Channel channel) throws IOException {
logger.info("TaskConsumConsumer 收到消息: {}", message.toString()); logger.info("TaskConsumConsumer 收到消息: {}", message.toString());
Map result = MessageHelper.msgToObj(message, Map.class); Map result = MessageHelper.msgToObj(message, Map.class);
if (null !=result) {
resultService.processResult(result); resultService.processResult(result);
//if (null !=result) { }
// QuartzTaskInformations taskinfo = JsonUtil.strToObj( result.get("task").toString(),QuartzTaskInformations.class);
// if (null != result.get("result")) {
// Map objresult = JsonUtil.strToObj(result.get("result").toString(), Map.class);
//处理消息
// resultService.processResult(taskinfo, objresult);
// }
//}
} }
} }
...@@ -16,15 +16,17 @@ public class SnapShotConsumer implements BaseConsumer{ ...@@ -16,15 +16,17 @@ public class SnapShotConsumer implements BaseConsumer{
private static final Logger logger = LoggerFactory.getLogger(SnapShotConsumer.class); private static final Logger logger = LoggerFactory.getLogger(SnapShotConsumer.class);
@Autowired @Autowired
VideoRTSPorURLService videoRTSPorURLService; VideoRTSPorURLService videoRTSPorURLService;
@Override @Override
public void consume(Message message, Channel channel) { public void consume(Message message, Channel channel) {
logger.info("SnapShotConsumer 收到消息: {}", message.toString()); logger.info("SnapShotConsumer 收到消息: {}", message.toString());
Sbtdspsr result = MessageHelper.msgToObj(message, Sbtdspsr.class); Sbtdspsr result = MessageHelper.msgToObj(message, Sbtdspsr.class);
if (result.getTdlx()==1) { if (result.getTdlx()==1) {
//调用rtsp 的服务 //调用rtsp 的服务
String token=videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(result.getSbbh()); if(null!=result.getSbbh()&&(!result.getSbbh().startsWith("33") ||
videoRTSPorURLService.getRTSPByDeviceCode(token,result.getSbbh()); (result.getSbbh().startsWith("33") &&result.getSbbh().length()==18))) {
String token = videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(result.getSbbh());
videoRTSPorURLService.getRTSPByDeviceCode(token, result.getSbbh());
}
} }
else{ else{
//调用hls 的服务 //调用hls 的服务
......
package com.cx.cn.cxquartz.rabbitmq.comsumer;
import com.cx.cn.cxquartz.common.Constants;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.service.quartz.TraffAlarmRecordService;
import com.cx.cn.cxquartz.service.quartz.impl.EventWriteService;
import com.cx.cn.cxquartz.service.quartz.impl.TaskRecog;
import com.cx.cn.cxquartz.util.CommonUtil;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 消息处理并推送第三方
*/
@Component
public class TaskQSTConsumer{
private List<Map> list=new ArrayList<>();
private static final Logger logger = LoggerFactory.getLogger(TaskQSTConsumer.class);
@Autowired
TraffAlarmRecordService traffAlarmRecordService;
@Autowired
TaskRecog taskRecog;
@Value("${voice.unionId}")
private String unionId;
@Value("${voice.appKey}")
private String appKey;
@Value("${voice.corpId}")
private String corpId;
@Value("${voice.eventId}")
private Integer eventId;
/**
* 消息消费入口
*
* @param messageList
* @param channel
* @throws IOException
*/
public void consume(List<Message> messageList, Channel channel) {
list.clear();
for (Message message : messageList) {
Map result = MessageHelper.msgToObj(message, Map.class);
list.add(result);
}
LinkedHashMap<String, List<Map>> maplist = CommonUtil.queryList(list);
for (String key : maplist.keySet()) {
try {
taskRecog.sender(maplist.get(key));
} catch (Exception ex) {
logger.error(ex.toString());
}
}
}
}
...@@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* 任务消息监听接受器 * 告警信息结果分析
*/ */
@Component @Component
public class EventProcessingReceiver { public class EventProcessingReceiver {
...@@ -25,17 +25,16 @@ public class EventProcessingReceiver { ...@@ -25,17 +25,16 @@ public class EventProcessingReceiver {
@Autowired @Autowired
private TraffPictureService traffPictureService; private TraffPictureService traffPictureService;
@RabbitListener(queues = QueueConstants.QueueEventProcessingConsumer.QUEUE,containerFactory="rabbitListenerContainerFactory") @RabbitListener(queues = QueueConstants.QueueEventProcessingConsumer.QUEUE)
public void process(Message message, Channel channel) { public void process(Message message, Channel channel) {
try { try {
logger.info("consumer->OrderCancelReceiver消费者收到消息 : " + message.toString());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(eventProcessingConsumer, traffPictureService); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(eventProcessingConsumer, traffPictureService);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy(); BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) { if (null != proxy) {
proxy.consume(message, channel); proxy.consume(message, channel);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error("告警信息结果分析 error:{}",e);
} }
} }
} }
...@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* 任务消息监听接受器 * rtsp与hls超时过期更新
*/ */
@Component @Component
public class RTSPorHLSReceiver { public class RTSPorHLSReceiver {
...@@ -21,17 +21,16 @@ public class RTSPorHLSReceiver { ...@@ -21,17 +21,16 @@ public class RTSPorHLSReceiver {
@Autowired @Autowired
private SnapShotConsumer snapShotConsumer; private SnapShotConsumer snapShotConsumer;
@RabbitListener(queues = QueueConstants.QueueRTSPConsumer.QUEUE,containerFactory="rabbitListenerContainerFactory") @RabbitListener(queues = QueueConstants.QueueRTSPConsumer.QUEUE)
public void process(Message message, Channel channel) { public void process(Message message, Channel channel) {
try { try {
logger.info("consumer->RTSPorHLSReceiver消费者收到消息 : " + message.toString());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapShotConsumer); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapShotConsumer);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy(); BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) { if (null != proxy) {
proxy.consume(message, channel); proxy.consume(message, channel);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error("rtsp与hls超时过期更新 error:{}",e);
} }
} }
} }
package com.cx.cn.cxquartz.rabbitmq.comsumer.listener; package com.cx.cn.cxquartz.rabbitmq.comsumer.listener;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumer;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumerProxy;
import com.cx.cn.cxquartz.rabbitmq.comsumer.SendToDXConsumer; import com.cx.cn.cxquartz.rabbitmq.comsumer.SendToDXConsumer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.rabbitmq.client.Channel;
import java.io.IOException; import java.io.IOException;
import org.springframework.amqp.core.Message;
/** /**
* 推送给第三方队列的监听 * 推送告警给第三方
*/ */
@Component @Component
public class SendtoDXReceiver { public class SendtoDXReceiver {
...@@ -24,13 +29,13 @@ public class SendtoDXReceiver { ...@@ -24,13 +29,13 @@ public class SendtoDXReceiver {
* @param channel * @param channel
* @throws IOException * @throws IOException
*/ */
// @RabbitListener(queues = QueueConstants.QueueSendToDXConsumer.QUEUE,containerFactory="rabbitListenerContainerFactory") @RabbitListener(queues = QueueConstants.QueueSendToDXConsumer.QUEUE,containerFactory="rabbitListenerContainerFactory")
// public void consume(Message message, Channel channel) throws IOException { public void consume(Message message, Channel channel) throws IOException {
// logger.info("consumer->QueueSendToDXConsumer 消费者收到消息 : " + message.toString()); logger.info("consumer->推送告警给第三方 消费者收到消息 : " + message.toString());
// BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToDXConsumer); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToDXConsumer);
// BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy(); BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
// if (null != proxy) { if (null != proxy) {
// proxy.consume(message, channel); proxy.consume(message, channel);
// } }
// } }
} }
package com.cx.cn.cxquartz.rabbitmq.comsumer.listener; package com.cx.cn.cxquartz.rabbitmq.comsumer.listener;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumer; import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumer;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumerProxy; import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumerProxy;
import com.cx.cn.cxquartz.rabbitmq.comsumer.SendToVoiceConsumer; import com.cx.cn.cxquartz.rabbitmq.comsumer.SendToVoiceConsumer;
import com.cx.cn.cxquartz.service.quartz.impl.ResultService;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -28,7 +25,7 @@ public class SendtoVoiceAlarmReceiver { ...@@ -28,7 +25,7 @@ public class SendtoVoiceAlarmReceiver {
* @param channel * @param channel
* @throws IOException * @throws IOException
*/ */
@RabbitListener(queues = QueueConstants.QueueSendToVoiceConsumer.QUEUE,containerFactory="rabbitListenerContainerFactory") // @RabbitListener(queues = QueueConstants.QueueSendToVoiceConsumer.QUEUE)
public void consume(Message message, Channel channel) throws IOException { public void consume(Message message, Channel channel) throws IOException {
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToVoiceConsumer); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToVoiceConsumer);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy(); BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
......
package com.cx.cn.cxquartz.rabbitmq.comsumer.listener; package com.cx.cn.cxquartz.rabbitmq.comsumer.listener;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants; import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumer; import com.cx.cn.cxquartz.rabbitmq.comsumer.TaskQSTConsumer;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumerProxy;
import com.cx.cn.cxquartz.rabbitmq.comsumer.SnapShotConsumer;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.BatchMessageListener;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
/** /**
* 任务消息监听接受器 * 批量分析图片
*/ */
@Component @Component
public class SnapShotReceiver { public class TaskQSTReceiver implements BatchMessageListener {
private static final Logger logger = LoggerFactory.getLogger(SnapShotReceiver.class); private static final Logger logger = LoggerFactory.getLogger(TaskQSTReceiver.class);
@Autowired @Autowired
private SnapShotConsumer snapShotConsumer; private TaskQSTConsumer taskQSTConsumer;
@Autowired
private TraffPictureService traffPictureService;
@RabbitListener(queues = QueueConstants.QueueRTSPConsumer.QUEUE) @RabbitListener(queues = QueueConstants.QueueTaskConsumer.QUEUE+"_QST",containerFactory = "batchQueueRabbitListenerContainerFactory")
public void process(Message message, Channel channel) { @Override
public void onMessageBatch(List<Message> messages) {
try { try {
logger.info("consumer->OrderCancelReceiver消费者收到消息 : " + message.toString()); if(messages.size()>0){
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapShotConsumer, traffPictureService); taskQSTConsumer.consume(messages,null);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
proxy.consume(message, channel);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error("批量分析图片 error:{}",e);
} }
} }
} }
...@@ -4,8 +4,8 @@ import com.cx.cn.cxquartz.controller.ExtController; ...@@ -4,8 +4,8 @@ import com.cx.cn.cxquartz.controller.ExtController;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -14,9 +14,6 @@ import java.nio.charset.StandardCharsets; ...@@ -14,9 +14,6 @@ import java.nio.charset.StandardCharsets;
/** /**
* 消息发送确认的回调 * 消息发送确认的回调
* 实现接口:implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback
* ConfirmCallback:只确认消息是否正确到达交换机中,不管是否到达交换机,该回调都会执行;
* ReturnCallback:如果消息从交换机未正确到达队列中将会执行,正确到达则不执行;
*/ */
@Component @Component
public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback { public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
...@@ -37,14 +34,11 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC ...@@ -37,14 +34,11 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC
} }
/** /**
* 消息从交换机成功到达队列,则returnedMessage方法不会执行; * 消息从交换机成功到达队列,spring.rabbitmq.publisher-returns=true
* 消息从交换机未能成功到达队列,则returnedMessage方法会执行;
* 需要开启 return 确认机制
* spring.rabbitmq.publisher-returns=true
*/ */
@Override @Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) { public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
logger.info("returnedMessage回调方法->" + new String(message.getBody(), StandardCharsets.UTF_8) + ",\n replyCode:" + replyCode logger.info(" info->" + new String(message.getBody(), StandardCharsets.UTF_8) + ",\n replyCode:" + replyCode
+ "\n replyText:" + replyText + "\n exchange:" + exchange + ",\\n routingKey:" + routingKey); + "\n replyText:" + replyText + "\n exchange:" + exchange + ",\\n routingKey:" + routingKey);
} }
...@@ -58,11 +52,9 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC ...@@ -58,11 +52,9 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC
@Override @Override
public void confirm(CorrelationData correlationData, boolean isSendSuccess, String error) { public void confirm(CorrelationData correlationData, boolean isSendSuccess, String error) {
if (correlationData != null) { if (correlationData != null) {
// logger.info("confirm回调方法->回调消息ID为: " + correlationData.getId());
if (isSendSuccess) { if (isSendSuccess) {
logger.info("confirm回调方法->消息成功发送到交换机!"); logger.info("confirm回调方法->消息成功发送到交换机!");
} else { } else {
logger.info("confirm回调方法->消息[{}]发送到交换机失败!,原因 : [{}]", correlationData, error); logger.info("confirm回调方法->消息[{}]发送到交换机失败!,原因 : [{}]", correlationData, error);
} }
} }
......
package com.cx.cn.cxquartz.redis; package com.cx.cn.cxquartz.redis;
import com.alibaba.druid.util.HttpClientUtils;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations; import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.helper.MessageHelper; import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants; import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService; import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.service.quartz.impl.VideoRTSPorURLService; import com.cx.cn.cxquartz.service.quartz.impl.VideoRTSPorURLService;
import com.cx.cn.cxquartz.util.DateUtils;
import com.cx.cn.cxquartz.util.JsonUtil; import com.cx.cn.cxquartz.util.JsonUtil;
import com.cx.cn.cxquartz.vo.ResultObj;
import com.rabbitmq.tools.json.JSONUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.support.CorrelationData; import org.springframework.amqp.rabbit.core.BatchingRabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.File;
import java.util.*; import java.util.*;
@Component @Component
...@@ -28,27 +39,34 @@ public class OrderConsumer implements Consumer { ...@@ -28,27 +39,34 @@ public class OrderConsumer implements Consumer {
private String recogurl; private String recogurl;
@Value("${file.model}") @Value("${file.model}")
private String model; private String model;
@Autowired
private RabbitTemplate rabbitTemplate; @Value("${local.czrooturl}")
private String czrooturl;
@Autowired @Autowired
private VideoRTSPorURLService videoRTSPorURLService; private VideoRTSPorURLService videoRTSPorURLService;
@Autowired @Autowired
private SbtdspsrService sbtdspsrService; private SbtdspsrService sbtdspsrService;
@Autowired
BatchingRabbitTemplate batchQueueRabbitTemplate;
private static OrderConsumer orderConsumer; private static OrderConsumer orderConsumer;
@Autowired
private RestTemplate restTemplate;
@PostConstruct @PostConstruct
public void init() { public void init() {
orderConsumer = this; orderConsumer = this;
orderConsumer.rabbitTemplate = this.rabbitTemplate; orderConsumer.batchQueueRabbitTemplate = this.batchQueueRabbitTemplate;
orderConsumer.czurl=this.czurl; orderConsumer.czurl=this.czurl;
orderConsumer.fxurl=this.fxurl; orderConsumer.fxurl=this.fxurl;
orderConsumer.recogurl=this.recogurl; orderConsumer.recogurl=this.recogurl;
orderConsumer.model=this.model; orderConsumer.model=this.model;
orderConsumer.videoRTSPorURLService=this.videoRTSPorURLService; orderConsumer.videoRTSPorURLService=this.videoRTSPorURLService;
orderConsumer.sbtdspsrService=this.sbtdspsrService; orderConsumer.sbtdspsrService=this.sbtdspsrService;
orderConsumer.restTemplate=this.restTemplate;
} }
public OrderConsumer(){ public OrderConsumer(){
} }
...@@ -60,37 +78,71 @@ public class OrderConsumer implements Consumer { ...@@ -60,37 +78,71 @@ public class OrderConsumer implements Consumer {
try { try {
//调用抽帧服务 //调用抽帧服务
String devicecode=msg.getExecuteparamter(); String devicecode=msg.getExecuteparamter();
String rtsporhls="";
log.info("开始消费消息{}", msg.getId()); log.info("开始消费消息{}", msg.getId());
//如果设备编号是用一次废一次的,此刻需要现场取得rtsp //如果设备编号是用一次废一次的,此刻需要现场取得rtsp
if(null!=devicecode&&devicecode.startsWith("33") && devicecode.length()==18){ if(null!=devicecode&&devicecode.startsWith("33") && devicecode.length()!=18){
//调用抽帧服务 //调用抽帧服务
String token= orderConsumer.videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(devicecode); String token= orderConsumer.videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(devicecode);
orderConsumer.videoRTSPorURLService.getRTSPByDeviceCode(token,devicecode); rtsporhls=orderConsumer.videoRTSPorURLService.getRTSPByDeviceCode(token,devicecode);
} }
else{ else{
//取表里最新的rtsp 或者hls 的值 //取表里最新的rtsp 或者hls 的值
orderConsumer.sbtdspsrService.getRtspOrHLSByDeviceCode(devicecode); rtsporhls=orderConsumer.sbtdspsrService.getRtspOrHLSByDeviceCode(devicecode);
}
if(rtsporhls.equals("")){
//尝试重新抽帧一遍
String token= orderConsumer.videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(devicecode);
rtsporhls=orderConsumer.videoRTSPorURLService.getRTSPByDeviceCode(token,devicecode);
if(rtsporhls.equals("")) {
log.error(devicecode + "rtsp 、hls 地址为空");
return;
}
} }
//将rtsp 作为参数调用抽帧服务 //将rtsp 作为参数调用抽帧服务
String result="{\n" +
" \"ret\": 0,\n" +
" \"desc\": \"succ!\",\n" + // String result="{\n" +
" \"url\": \"http://zjh189.ncpoi.cc:7080/download/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" + // " \"ret\": 0,\n" +
" \"localuri\": \"/home/ubuntu/pictures/slice/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" + // " \"desc\": \"succ!\",\n" +
" \"timestamp\": \"2021-09-08 13:41:31.031\",\n" + // " \"resourcePath\": \"http://zjh189.ncpoi.cc:7080/download/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" +
" \"devicecode\": \"33050300001327599605\"\n" + // " \"localuri\": \"/home/ubuntu/pictures/slice/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" +
"}"; // " \"timestamp\": \"2021-09-08 13:41:31.031\",\n" +
// " \"devicecode\": \"33050300001327599605\"\n" +
// "}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
Map map=new HashMap();
map.put("resourcePath",orderConsumer.czrooturl+"/"+ DateUtils.formatCurrDateYYMM()+"/"+devicecode+"/"+devicecode+"_"+DateUtils.formatCurrDayNoSign()+"_"+DateUtils.formatCurrDateHHmmss()+".jpg");
map.put("deviceID",devicecode);
map.put("resourceParam",rtsporhls);
HttpEntity<Map> requestEntity = new HttpEntity<>(map, headers);
String response= orderConsumer.restTemplate.postForObject(orderConsumer.czurl,requestEntity, String.class);
Map resultmap =JsonUtil.strToObj(response,Map.class);
if(null!=resultmap.get("ret")) {
if (resultmap.get("ret").toString().equals("0")
&& null!=resultmap.get("resourcePath")
&& !resultmap.get("resourcePath").toString().equals("")) {
//抽帧结果放到rabbttmq 中,根据msg 的检测metatype ,分别派发到不同的queue中,方便以后10条10条的去皮皮昂分析 //抽帧结果放到rabbttmq 中,根据msg 的检测metatype ,分别派发到不同的queue中,方便以后10条10条的去皮皮昂分析
Map m = new HashMap(); Map m = new HashMap();
m.put("taskparam", JsonUtil.objToStr(msg)); m.put("task", JsonUtil.objToStr(msg));
m.put("result", result); m.put("result", response);
String msgId = UUID.randomUUID().toString(); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
CorrelationData correlationData = new CorrelationData(msgId); orderConsumer.batchQueueRabbitTemplate.send(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange(),
orderConsumer.rabbitTemplate.convertAndSend(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange(), QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey() + "_QST",
QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey()+"_"+msg.getObjectType(),
MessageHelper.objToMsg(m), MessageHelper.objToMsg(m),
correlationData); correlationData);
}
else{
log.error("抽帧失败",JsonUtil.objToStr(resultmap));
}
}
else{
log.error("返回状态码为null");
}
// String roistr= URLEncoder.encode("[")+msg.getObjectx()+","+msg.getObjecty()+","+msg.getObjectw()+","+msg.getObjecth()+URLEncoder.encode("]"); // String roistr= URLEncoder.encode("[")+msg.getObjectx()+","+msg.getObjecty()+","+msg.getObjectw()+","+msg.getObjecth()+URLEncoder.encode("]");
// String result= CompletableFuture.supplyAsync(() -> HttpClientUtil.doGet(orderConsumer.recogurl + "?deviceCode="+msg.getExecuteparamter()+"&model="+orderConsumer.model+"&roi="+roistr)).get(2, TimeUnit.SECONDS); // String result= CompletableFuture.supplyAsync(() -> HttpClientUtil.doGet(orderConsumer.recogurl + "?deviceCode="+msg.getExecuteparamter()+"&model="+orderConsumer.model+"&roi="+roistr)).get(2, TimeUnit.SECONDS);
......
...@@ -27,7 +27,6 @@ public class QueueListener implements Runnable { ...@@ -27,7 +27,6 @@ public class QueueListener implements Runnable {
/** /**
* 使用队列右出获取消息 * 使用队列右出获取消息
* 没获取到消息则线程 sleep 一秒,减少资源浪费 * 没获取到消息则线程 sleep 一秒,减少资源浪费
* 实现了 Runnable 接口,可以作为线程任务执行
*/ */
@Override @Override
public void run() { public void run() {
...@@ -39,11 +38,9 @@ public class QueueListener implements Runnable { ...@@ -39,11 +38,9 @@ public class QueueListener implements Runnable {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("RedisMQConsumer:{}",e.toString());
} }
} }
} }
} }
} }
\ No newline at end of file
...@@ -30,13 +30,9 @@ public class RedisMQConsumerContainer { ...@@ -30,13 +30,9 @@ public class RedisMQConsumerContainer {
} }
public void addConsumer(QueueConfiguration configuration) { public void addConsumer(QueueConfiguration configuration) {
// if (consumerMap.containsKey(configuration.getQueue())) {
// log.warn("Key:{} this key already exists, and it will be replaced", configuration.getQueue());
// }
if (configuration.getConsumer() == null) { if (configuration.getConsumer() == null) {
log.warn("Key:{} consumer cannot be null, this configuration will be skipped", configuration.getQueue()); log.warn("Key:{} consumer cannot be null, this configuration will be skipped", configuration.getQueue());
} }
// consumerMap.put(configuration.getQueue(), configuration);
executor.submit(new QueueListener(redisTemplate,configuration.getQueue(),configuration.getConsumer())); executor.submit(new QueueListener(redisTemplate,configuration.getQueue(),configuration.getConsumer()));
log.info("队列 {} 提交消息任务",configuration.getQueue()); log.info("队列 {} 提交消息任务",configuration.getQueue());
...@@ -56,9 +52,10 @@ public class RedisMQConsumerContainer { ...@@ -56,9 +52,10 @@ public class RedisMQConsumerContainer {
public void init() { public void init() {
log.info("消息队列线程池初始化"); log.info("消息队列线程池初始化");
RUNNING = true; RUNNING = true;
this.executor = Executors.newCachedThreadPool(r -> { this.executor= Executors.newCachedThreadPool();
final AtomicInteger threadNumber = new AtomicInteger(6); // this.executor = Executors.newCachedThreadPool(r -> {
return new Thread(r, "RedisMQListener-" + threadNumber.getAndIncrement()); // final AtomicInteger threadNumber = new AtomicInteger(10);
}); // return new Thread(r, "RedisMQListener-" + threadNumber.getAndIncrement());
// });
} }
} }
\ No newline at end of file
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Autosnaptaskinfo;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
import java.util.List;
import java.util.Map;
public interface AutoSnapService {
int insert(Autosnaptaskinfo taskinfo);
List<Autosnaptaskinfo> query(Autosnaptaskinfo taskinfo);
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.util.RedisEnum;
import com.cx.cn.cxquartz.vo.Ftp;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class FtpService {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final Logger logger = LoggerFactory.getLogger(FtpService.class);
@Autowired
private StringRedisTemplate stringRedisTemplate;
private List<Ftp> ftpList;
@Autowired
CacheLoadService cacheLoadService;
@Autowired
public FtpService(StringRedisTemplate stringRedisTemplate) {
// try {
// this.ftpList = getFtpList(stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue()));
// }catch (Exception e){
// logger.error("ftpList error:"+e.toString());
// }
}
public Ftp reloadFtp() {
try {
// cacheLoadService.loadFtpCache();
if(null==stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue())){
cacheLoadService.loadFtpCache();
}
ftpList = getFtpList(stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue()));
}catch (Exception e){
logger.error("ftpListerror:"+e.toString());
}
Long count = null;
try {
count = stringRedisTemplate.opsForValue().increment(RedisEnum.FTPLIST_INDEX.getValue(), 1L);
} catch (Exception e) {
logger.error("redis error" + e.toString());
}
if (count == null) {
count = 0L;
}
long index = count % ftpList.size();
return ftpList.get((int) index);
}
private List<Ftp> getFtpList(String ftpJson) {
try {
JavaType javaType =OBJECT_MAPPER.getTypeFactory().constructParametricType(ArrayList.class, Map.class);
List<Map> jsonArr = OBJECT_MAPPER.readValue(ftpJson, javaType);
List<Ftp> ftpList = new ArrayList<>();
for (int i = 0; i < jsonArr.size(); i++) {
Ftp ftp = new Ftp();
Map jsonObject = jsonArr.get(i);
ftp.setFtpIp(jsonObject.get("serveip").toString());
ftp.setFtpPort(Integer.parseInt(jsonObject.get("serverport")==null?"21":jsonObject.get("serverport").toString()));
ftp.setFtpUsername(jsonObject.get("serveruser").toString());
ftp.setFtpPassword(jsonObject.get("serverpassword").toString());
ftpList.add(ftp);
}
}catch (Exception ex){
logger.error("ftpListerror:"+ex.toString());
}
return ftpList;
}
}
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.AutoSanpMapper;
import com.cx.cn.cxquartz.dao.CodeMapper;
import com.cx.cn.cxquartz.rabbitmq.comsumer.AutoSnapConsumer;
import com.cx.cn.cxquartz.service.quartz.AutoSnapService;
import com.cx.cn.cxquartz.service.quartz.CodeService;
import com.cx.cn.cxquartz.vo.Autosnaptaskinfo;
import com.cx.cn.cxquartz.vo.Code;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class AutoSnapServiceImpl implements AutoSnapService {
@Autowired
AutoSanpMapper autoSanpMapper;
@Override
public int insert(Autosnaptaskinfo taskinfo) {
return autoSanpMapper.insert(taskinfo);
}
@Override
public List<Autosnaptaskinfo> query(Autosnaptaskinfo taskinfo) {
return autoSanpMapper.query(taskinfo);
}
}
package com.cx.cn.cxquartz.service.quartz.impl; package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.TraffPictureMapper; import com.cx.cn.cxquartz.dao.TraffPictureMapper;
import com.cx.cn.cxquartz.service.quartz.FtpService;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService; import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import com.cx.cn.cxquartz.util.*; import com.cx.cn.cxquartz.util.*;
import com.cx.cn.cxquartz.vo.*; import com.cx.cn.cxquartz.vo.*;
...@@ -62,8 +61,6 @@ public class EventWriteService { ...@@ -62,8 +61,6 @@ public class EventWriteService {
@Autowired @Autowired
TokenCacheService tokensertvice; TokenCacheService tokensertvice;
@Autowired
FtpService ftpService;
@Value("${local.czurl}") @Value("${local.czurl}")
private String czurl; private String czurl;
@Value("${local.fxurl}") @Value("${local.fxurl}")
...@@ -76,12 +73,12 @@ public class EventWriteService { ...@@ -76,12 +73,12 @@ public class EventWriteService {
@Value("${file.uploadurl}") @Value("${file.uploadurl}")
private String uploadurl; private String uploadurl;
private static CompletionService<Boolean> completionService = new ExecutorCompletionService<Boolean>(ThreadPoolUtil.getPool());
public void sendEvent(TraffpictureParam traffpictureParamresult, TraffrecordData sendtozhiui) { public void sendEvent(TraffpictureParam traffpictureParamresult, TraffrecordData sendtozhiui) {
sendtozhiui.setAlarmnum(traffpictureParamresult.getTargetnum()); if (traffpictureParamresult.getTargetnum().contains("/")) {
sendtozhiui.setAlarmnum(Integer.parseInt(traffpictureParamresult.getTargetnum().split("/")[1]));
} else {
sendtozhiui.setAlarmnum(Integer.parseInt(traffpictureParamresult.getTargetnum()));
}
sendtozhiui.setFdid(traffpictureParamresult.getFdid()); sendtozhiui.setFdid(traffpictureParamresult.getFdid());
sendtozhiui.setRecordtype(traffpictureParamresult.getRecordtype()); sendtozhiui.setRecordtype(traffpictureParamresult.getRecordtype());
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -97,8 +94,6 @@ public class EventWriteService { ...@@ -97,8 +94,6 @@ public class EventWriteService {
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult); traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
return; return;
} }
/* 其他失败 */
} catch (TimeoutException e) { } catch (TimeoutException e) {
traffpictureParamresult.setPushdesc("请求超时"); traffpictureParamresult.setPushdesc("请求超时");
log.error("eventwrite - sendEvent 请求超时:" + e.toString()); log.error("eventwrite - sendEvent 请求超时:" + e.toString());
...@@ -116,7 +111,6 @@ public class EventWriteService { ...@@ -116,7 +111,6 @@ public class EventWriteService {
VoiceResultObj result; VoiceResultObj result;
try { try {
result = sendVoioceMessage(voice); result = sendVoioceMessage(voice);
/* 成功 */
if (result.getCode() == 1) { if (result.getCode() == 1) {
log.info(" push to voice success"); log.info(" push to voice success");
} else { } else {
...@@ -131,7 +125,7 @@ public class EventWriteService { ...@@ -131,7 +125,7 @@ public class EventWriteService {
private ResultObj sendMessage(TraffrecordData traffalarmrecord) throws InterruptedException, ExecutionException, TimeoutException { private ResultObj sendMessage(TraffrecordData traffalarmrecord) throws InterruptedException, ExecutionException, TimeoutException {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON);
String token = stringRedisTemplate.opsForValue().get(qztoken); String token = stringRedisTemplate.opsForValue().get(qztoken);
if (null == token) { if (null == token) {
token = tokensertvice.keepAlive(); token = tokensertvice.keepAlive();
...@@ -143,13 +137,14 @@ public class EventWriteService { ...@@ -143,13 +137,14 @@ public class EventWriteService {
private ResultObj sendToCalluri(JobTjParam jobTjParam, String callbackurl) throws InterruptedException, ExecutionException, TimeoutException { private ResultObj sendToCalluri(JobTjParam jobTjParam, String callbackurl) throws InterruptedException, ExecutionException, TimeoutException {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<JobTjParam> requestEntity = new HttpEntity<>(jobTjParam, headers); HttpEntity<JobTjParam> requestEntity = new HttpEntity<>(jobTjParam, headers);
return CompletableFuture.supplyAsync(() -> restTemplate.postForObject(callbackurl, requestEntity, ResultObj.class)).get(timeout, TimeUnit.SECONDS); return CompletableFuture.supplyAsync(() -> restTemplate.postForObject(callbackurl, requestEntity, ResultObj.class)).get(timeout, TimeUnit.SECONDS);
} }
private ResultObj sendToCalluriSync(JobTjParam jobTjParam, String callbackurl) throws InterruptedException, ExecutionException, TimeoutException { private ResultObj sendToCalluriSync(JobTjParam jobTjParam, String callbackurl) throws InterruptedException, ExecutionException, TimeoutException {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<JobTjParam> requestEntity = new HttpEntity<>(jobTjParam, headers); HttpEntity<JobTjParam> requestEntity = new HttpEntity<>(jobTjParam, headers);
return restTemplate.postForObject(callbackurl, requestEntity, ResultObj.class); return restTemplate.postForObject(callbackurl, requestEntity, ResultObj.class);
} }
...@@ -158,17 +153,12 @@ public class EventWriteService { ...@@ -158,17 +153,12 @@ public class EventWriteService {
ResultObj resultObj; ResultObj resultObj;
try { try {
resultObj = sendToCalluri(jobTjParam, callbackurl); resultObj = sendToCalluri(jobTjParam, callbackurl);
// boolean successFlag = resultObj.getCode() == ResponseEnum.SUCCESS.getCode();
traffpictureParamresult.setPushdesc(resultObj.getMsg()); traffpictureParamresult.setPushdesc(resultObj.getMsg());
/* 成功 */
if ("0".equals(resultObj.getCode())) { if ("0".equals(resultObj.getCode())) {
traffpictureParamresult.setPushstatus(0); traffpictureParamresult.setPushstatus(0);
//traffpictureParamresult.setPushdesc("推送第三方成功");
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult); traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
return; return;
} }
/* 其他失败 */
} catch (Exception e) { } catch (Exception e) {
traffpictureParamresult.setProcessstatus("-2"); traffpictureParamresult.setProcessstatus("-2");
traffpictureParamresult.setPushdesc("推送第三方失败"); traffpictureParamresult.setPushdesc("推送第三方失败");
...@@ -178,27 +168,23 @@ public class EventWriteService { ...@@ -178,27 +168,23 @@ public class EventWriteService {
traffpictureParamresult.setPushstatus(-1); traffpictureParamresult.setPushstatus(-1);
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult); traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
} }
public void sendEventByCallUrl(Long id, JobTjParam jobTjParam, String callbackurl) { public void sendEventByCallUrl(Long id, JobTjParam jobTjParam, String callbackurl) {
ResultObj resultObj; ResultObj resultObj;
TraffpictureParam traffpictureParamresult=new TraffpictureParam(); TraffpictureParam traffpictureParamresult = new TraffpictureParam();
traffpictureParamresult.setId(id); traffpictureParamresult.setId(id);
try { try {
resultObj = sendToCalluriSync(jobTjParam, callbackurl); resultObj = sendToCalluriSync(jobTjParam, callbackurl);
traffpictureParamresult.setPushdesc(resultObj.getMsg()); traffpictureParamresult.setPushdesc(resultObj.getMsg());
/* 成功 */
if ("0".equals(resultObj.getCode())) { if ("0".equals(resultObj.getCode())) {
traffpictureParamresult.setPushstatus(0); traffpictureParamresult.setPushstatus(0);
//traffpictureParamresult.setPushdesc("推送第三方成功");
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult); traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
return; return;
} }
/* 其他失败 */
} catch (Exception e) { } catch (Exception e) {
traffpictureParamresult.setProcessstatus("-2"); traffpictureParamresult.setProcessstatus("-2");
traffpictureParamresult.setPushdesc("推送第三方失败"); traffpictureParamresult.setPushdesc("推送第三方失败");
log.error("eventwrite - sendEventByCallUrl 异常:" + e.toString()); log.error("eventwrite - sendEventByCallUrl 异常:" + e.toString());
//return ResultObj.error(ResponseEnum.E_9999.getCode(), e.toString());
} }
traffpictureParamresult.setPushstatus(-1); traffpictureParamresult.setPushstatus(-1);
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult); traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
...@@ -211,66 +197,66 @@ public class EventWriteService { ...@@ -211,66 +197,66 @@ public class EventWriteService {
} }
public TraffpictureParam getResult(TraffpictureParam traffpictureParamresult,int tarnum, Long[] roiarray, String imgurl, public TraffpictureParam getResult(TraffpictureParam traffpictureParamresult, int tarnum, Long[] roiarray, String imgurl,
List<Map> objectList, List<Map> objectList,
JobTjParam jobTjParam, List<Map> detectObjects) { JobTjParam jobTjParam, List<Map> detectObjects) {
Map obj = new HashMap(); Map obj = new HashMap();
String recordtype = jobTjParam.getDetectType(); String recordtype = jobTjParam.getDetectType();
//判断是否统计结构化数据 //判断是否统计结构化数据
traffpictureParamresult.setImagedata(imgurl); traffpictureParamresult.setImagedata(imgurl);
//人群统计 //人群统计
if ("10".equals(recordtype)) { if ("10".equals(recordtype)) {
int larmnum = getManNumber(objectList); int larmnum = getManNumber(objectList);
//获得所有对象的坐标 //获得所有对象的坐标
if (tarnum < larmnum) { if (tarnum < larmnum) {
traffpictureParamresult.setTargetnum(larmnum); traffpictureParamresult.setTargetnum(String.valueOf(larmnum));
obj.put("objectCount", larmnum); obj.put("objectCount", larmnum);
} else { } else {
return null; return null;
} }
traffpictureParamresult.setTargetnum(String.valueOf(larmnum)+"/"+tarnum);
} }
//人群总数和戴口罩统计 //人群总数和戴口罩统计
else if("60".equals(recordtype)){ else if ("60".equals(recordtype)) {
int larmnum = getManNumber(objectList); int larmnum = getManNumber(objectList);
int masknum = 0;
obj.put("alarmNum", tarnum); obj.put("alarmNum", tarnum);
if (tarnum < larmnum) {
obj.put("objectCount", larmnum);
traffpictureParamresult.setTargetnum(larmnum);
//判断戴口罩多少人 //判断戴口罩多少人
for (Map traffpictureParam : objectList) {
if (null != traffpictureParam) {
} else { Map metadata = (Map) traffpictureParam.get("Metadata");
return null; if (null != metadata.get("HasMask") && metadata.get("HasMask").toString().equals("1")) {
masknum++;
} }
}
}
//获得所有对象的坐标
obj.put("objectCount", masknum + "/" + larmnum+"/"+tarnum);
traffpictureParamresult.setTargetnum(masknum + "/" + larmnum);
} else if ("12".equals(recordtype)) {//单独的结构化统计
obj.put("alarmNum", objectList.size());
traffpictureParamresult.setTargetnum(String.valueOf(objectList.size()));
} }
//获得所有对象的坐标 //获得所有对象的坐标
for (Map traffpictureParam : objectList) { for (Map traffpictureParam : objectList) {
//根据imageid 获得 base64图片 //根据imageid 获得 base64图片
Map metadata = (Map) traffpictureParam.get("Metadata"); Map metadata = (Map) traffpictureParam.get("Metadata");
// String metatype = String.valueOf(metadata.get("Type")); if (metadata.size() > 0) {
//获得点位坐标
Map objlocation = getObjectPoint(metadata, roiarray, traffpictureParamresult, recordtype); Map objlocation = getObjectPoint(metadata, roiarray, traffpictureParamresult, recordtype);
if (null == objlocation) { if (null == objlocation) {
log.info("点位未空"); log.info("点位未空");
continue; continue;
} }
//获得特征属性 //获得特征属性
getDetectInfo(recordtype, metadata, objlocation); getDetectInfo(recordtype, metadata, objlocation);
//根据对应的解析结果获得相应的数据,存放到对应的表中
List<Location> list = new ArrayList<>();
//getMetaData( roiarray, traffpictureParamresult,list,traffpictureParam,metadata);
detectObjects.add(objlocation); detectObjects.add(objlocation);
} }
}
if (detectObjects.size() == 0) { if (detectObjects.size() == 0) {
log.info(" 特征对象为空 "); log.info(" 特征对象为空 ");
return null; return null;
} }
//获得其他告警事件的返回结果
//超过则预警
obj.put("detectObjects", detectObjects); obj.put("detectObjects", detectObjects);
jobTjParam.setDetectInfo(obj); jobTjParam.setDetectInfo(obj);
jobTjParam.setTimestamp(new Date().getTime()); jobTjParam.setTimestamp(new Date().getTime());
...@@ -279,33 +265,21 @@ public class EventWriteService { ...@@ -279,33 +265,21 @@ public class EventWriteService {
public void setTraffpictureParam(String recordtype, String sbbh, String createtime, public void setTraffpictureParam(String recordtype, String sbbh, String createtime,
TraffpictureParam traffpictureParam) { TraffpictureParam traffpictureParam) {
traffpictureParam.setAreaid(Long.parseLong("-1")); // traffpictureParam.setAreaid(Long.parseLong("-1"));
traffpictureParam.setFdid(sbbh); traffpictureParam.setFdid(sbbh);
//traffpictureParam.setRecordid(transferRecord.getRecordid());
traffpictureParam.setChannelid(0); traffpictureParam.setChannelid(0);
if (createtime.contains(".")) { if (createtime.contains(".")) {
traffpictureParam.setCreatetime(createtime.split("\\.")[0]); traffpictureParam.setCreatetime(createtime.split("\\.")[0]);
} else { } else {
traffpictureParam.setCreatetime(createtime); traffpictureParam.setCreatetime(createtime);
} }
//默认推送成功,如果异常则更新状态为异常,该条记录会在30s 轮询中查出来,重新推送 //默认未处理
traffpictureParam.setProcessstatus("-1"); traffpictureParam.setProcessstatus("0");
traffpictureParam.setRecordtype(recordtype); traffpictureParam.setRecordtype(recordtype);
//新增到picture //判断是否自动推送,如果是自动推送则设置推送状态为推送成功
traffPictureService.inserTraffpicture(traffpictureParam);
}
public List<Map> getLocation(List<Map> objectList, String recordtype, Long[] roiarray) { traffpictureParam.setCheckstatus(0);
for (Map traffpictureParam : objectList) { traffPictureService.inserTraffpicture(traffpictureParam);
//根据imageid 获得 base64图片
Map metadata = (Map) traffpictureParam.get("Metadata");
Map objectBoundingBox = (Map) metadata.get("ObjectBoundingBox");
String metatype = String.valueOf(metadata.get("Type"));
Map objlocation = new HashMap();
//获得物体特征值,只能有一个框框
}
return null;
} }
public int getManNumber(List<Map> objectList) { public int getManNumber(List<Map> objectList) {
...@@ -313,6 +287,7 @@ public class EventWriteService { ...@@ -313,6 +287,7 @@ public class EventWriteService {
for (Map traffpictureParam : objectList) { for (Map traffpictureParam : objectList) {
//根据imageid 获得 base64图片 //根据imageid 获得 base64图片
Map metadata = (Map) traffpictureParam.get("Metadata"); Map metadata = (Map) traffpictureParam.get("Metadata");
if (metadata.size() == 0) continue;
String metadatatyp = metadata.get("Type").toString(); String metadatatyp = metadata.get("Type").toString();
if ("1".equals(metadatatyp) || "4".equals(metadatatyp) if ("1".equals(metadatatyp) || "4".equals(metadatatyp)
|| "3".equals(metadatatyp)) { || "3".equals(metadatatyp)) {
...@@ -324,17 +299,9 @@ public class EventWriteService { ...@@ -324,17 +299,9 @@ public class EventWriteService {
} }
public Map getObjectPoint(Map metadata, Long[] roiarray, TraffpictureParam traff, String recordtype) { public Map getObjectPoint(Map metadata, Long[] roiarray, TraffpictureParam traff, String recordtype) {
String metatype = metadata.get("Type").toString();
Map objlocation = new HashMap(); Map objlocation = new HashMap();
Location lo = null; Location lo = null;
if (
("41".equals(recordtype) && "2".equals(metatype))
|| ("42".equals(recordtype) && "4".equals(metatype))
|| ("43".equals(recordtype) && "4".equals(metatype))
|| ("50".equals(recordtype) && ("1".equals(metatype) || "3".equals(metatype) || "4".equals(metatype))
) || ("20".equals(recordtype))) {
Map objectBoundingBox = (Map) metadata.get("ObjectBoundingBox"); Map objectBoundingBox = (Map) metadata.get("ObjectBoundingBox");
if (null != metadata.get("LeftTopX") && if (null != metadata.get("LeftTopX") &&
!"".equals(metadata.get("LeftTopX").toString()) !"".equals(metadata.get("LeftTopX").toString())
&& null != metadata.get("LeftTopY") && null != metadata.get("LeftTopY")
...@@ -395,7 +362,6 @@ public class EventWriteService { ...@@ -395,7 +362,6 @@ public class EventWriteService {
} }
} }
} }
}
if (null != lo) { if (null != lo) {
objlocation.put("location", lo); objlocation.put("location", lo);
traff.setObjx(lo.getX1() < lo.getX2() ? lo.getX1() : lo.getX2()); traff.setObjx(lo.getX1() < lo.getX2() ? lo.getX1() : lo.getX2());
...@@ -436,9 +402,6 @@ public class EventWriteService { ...@@ -436,9 +402,6 @@ public class EventWriteService {
int mask = Integer.parseInt(metadata.get("HasMask").toString()); int mask = Integer.parseInt(metadata.get("HasMask").toString());
//佩戴口罩识别 //佩戴口罩识别
objlocation.put("mask", mask); objlocation.put("mask", mask);
// if (mask == 0) {
// objlocation.put("mask", mask);
// }
} }
} }
} }
...@@ -450,70 +413,13 @@ public class EventWriteService { ...@@ -450,70 +413,13 @@ public class EventWriteService {
ByteArrayOutputStream bos = PointUtil.drawByPoints(streanm, points); ByteArrayOutputStream bos = PointUtil.drawByPoints(streanm, points);
if (null == bos) { if (null == bos) {
log.error("picture is null"); log.error("picture is null");
// return false;
} }
File file = FileUtil.uploadToLocal(filerootpath + File.separator + File file = FileUtil.uploadToLocal(filerootpath + File.separator +
outpath + File.separator + outpath + File.separator +
basepath, bos, filename); basepath, bos, filename);
if (null == file) {
log.error("picture upload error");
// HttpHeaders headers = new HttpHeaders(); }
// headers.add("Accept", MediaType.ALL_VALUE);
// // headers.setContentType(MediaType.parseMediaType("multipart/form-data"));
// MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
//
// org.springframework.core.io.Resource resource = new ByteArrayResource(bos.toByteArray()){
// @Override
// public String getFilename () {
// return filename;
// }
// } ;
//
// ByteArrayResource arrayResource = new ByteArrayResource(bos.toByteArray()) {
// @Override
// public String getFilename() throws IllegalStateException {
// return filename;
// }
// @Override
// public long contentLength() {
// int estimate = bos.size();
// return estimate == 0 ? 1 : estimate;
// }
//
// };
// parts.add(basepath+File.separator+filename, resource);
// parts.add("name", basepath);
// parts.add("filename", filename);
// parts.add("folder", "1");
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
// HttpEntity<MultiValueMap<String, Object>> files = new HttpEntity<>(parts, headers);
// if(null!=file){
// parts.add("file", new FileSystemResource(file));
// }
//traffpictureParam.setImagedata(basepath+File.separator+filename);
// traffPictureService.updateTraffpicture(traffpictureParam);
// FileUploadResultVo resultVo=new FileUploadResultVo();
//resultVo = restTemplate.postForObject(uploadurl, files, FileUploadResultVo.class);
//restTemplate.put(uploadurl, files);
//删除
// if (file.delete()) {
// log.info("delete file success");
// }
// if(resultVo.getCode()==200){
// //更新地址
// if(resultVo.getData().size()>0) {
// traffpictureParam.setImagedata(resultVo.getData().get(0).getLocaluri());
// traffPictureService.updateTraffpicture(traffpictureParam);
// }
// return true;
// }
// return true;
// }).get(timeout, TimeUnit.SECONDS);
} catch (Exception ex) { } catch (Exception ex) {
log.error(" uplaod file:{}", ex.toString()); log.error(" uplaod file:{}", ex.toString());
} }
......
...@@ -11,8 +11,8 @@ import com.cx.cn.cxquartz.bean.QuartzTaskInformations; ...@@ -11,8 +11,8 @@ import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.vo.TraffpictureParam; import com.cx.cn.cxquartz.vo.TraffpictureParam;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -61,18 +61,18 @@ public class ResultService { ...@@ -61,18 +61,18 @@ public class ResultService {
public static final Logger logger = LoggerFactory.getLogger(ResultService.class); public static final Logger logger = LoggerFactory.getLogger(ResultService.class);
public void processResult( Map result) { public void processResult( Map result) {
if(null==result.get("param"))return;
Map taskinfo= (Map) result.get("param"); Map taskinfo= (Map) result.get("param");
String devicecode=(String) taskinfo.get("devicecode"); String devicecode=(String) taskinfo.get("devicecode");
String recordtype =(String) taskinfo.get("recordtype"); String recordtype =(String) taskinfo.get("recordtype");
String threshold=(String) taskinfo.get("threshold"); String threshold=(String) taskinfo.get("threshold");
String timestamp=taskinfo.get("timestamp").toString().substring(0,taskinfo.get("timestamp").toString().indexOf(".")); String timestamp=taskinfo.get("timestamp").toString().substring(0,taskinfo.get("timestamp").toString().indexOf("."));
JobTjParam jobTjParam = new JobTjParam(); JobTjParam jobTjParam = new JobTjParam();
jobTjParam.setDeviceId(devicecode); jobTjParam.setDeviceId(devicecode);
jobTjParam.setDetectType(recordtype); jobTjParam.setDetectType(recordtype);
String imageurl = taskinfo.get("url").toString(); String imageurl = taskinfo.get("url").toString();
TraffpictureParam traffpictureParamresult=new TraffpictureParam(); TraffpictureParam traffpictureParamresult=new TraffpictureParam();
try {
// Map maprecogdata = JsonUtil.strToObj(objectList.get("recogdata").toString(), Map.class); // Map maprecogdata = JsonUtil.strToObj(objectList.get("recogdata").toString(), Map.class);
List<Map> points = new ArrayList<>(); List<Map> points = new ArrayList<>();
//分析结果数据 //分析结果数据
...@@ -82,51 +82,78 @@ public class ResultService { ...@@ -82,51 +82,78 @@ public class ResultService {
logger.info(" objectresult is empty"); logger.info(" objectresult is empty");
} else { } else {
Long[] roiarray = new Long[4]; Long[] roiarray = new Long[4];
roiarray[0] = new Long(taskinfo.get("x").toString());
roiarray[1] = new Long(taskinfo.get("y").toString()); getPoi(taskinfo, roiarray);
roiarray[2] = new Long(taskinfo.get("w").toString());
roiarray[3] = new Long(taskinfo.get("h").toString());
//图片划线并上传 //图片划线并上传
String basepath = DateUtils.formatCurrDayYM() + File.separator + DateUtils.formatCurrDayDD() + File.separator + devicecode; String basepath = DateUtils.formatCurrDayYM() + File.separator + DateUtils.formatCurrDayDD() + File.separator + devicecode;
String filename = devicecode + "_" + DateUtils.parseDateToStrNoSign(timestamp) + "_result.jpg"; String filename = devicecode + "_" + DateUtils.parseDateToStrNoSign(timestamp) + "_result.jpg";
String filenameurl = File.separator + outpath + File.separator + basepath + File.separator + filename; String filenameurl = File.separator + outpath + File.separator + basepath + File.separator + filename;
jobTjParam.setImageUrl(weburl + filenameurl); jobTjParam.setImageUrl(weburl + filenameurl);
traffpictureParamresult.setImagedata(filenameurl); //获得点位 traffpictureParamresult.setImagedata(filenameurl); //获得点位
logger.info("1");
traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult, Integer.parseInt(threshold) traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult, Integer.parseInt(threshold)
, roiarray, imageurl, objectresult, jobTjParam, points); , roiarray, imageurl, objectresult, jobTjParam, points);
if (null == traffpictureParamresult) { if (null == traffpictureParamresult) {
logger.info("人群密度未超或目标未出现"); logger.info("未检测到结果");
} else { } else {
logger.info("2");
//同步上传文件 //同步上传文件
eventWriteService.uploadPicture(traffpictureParamresult, imageurl, points, basepath, filename); eventWriteService.uploadPicture(traffpictureParamresult, imageurl, points, basepath, filename);
//判断是否需要自动推送
if(null!=taskinfo.get("sendtype") &&taskinfo.get("sendtype").toString().equals("1"))
{
traffpictureParamresult.setPushstatus(9);
}
else if(null!=taskinfo.get("sendtype") &&taskinfo.get("sendtype").toString().equals("0"))
{
traffpictureParamresult.setPushstatus(1);//手动推送
}
//新增 //新增
eventWriteService.setTraffpictureParam(recordtype, devicecode, eventWriteService.setTraffpictureParam(recordtype, devicecode,
timestamp, timestamp,
traffpictureParamresult); traffpictureParamresult);
if(null!=traffpictureParamresult.getPushstatus() && traffpictureParamresult.getPushstatus()==9) {
Map sendtodxmap = new HashMap(); Map sendtodxmap = new HashMap();
sendtodxmap.put("id", traffpictureParamresult.getId()); sendtodxmap.put("id", traffpictureParamresult.getId());
sendtodxmap.put("traff", JsonUtil.objToStr(jobTjParam)); sendtodxmap.put("traff", JsonUtil.objToStr(jobTjParam));
sendtodxmap.put("callback", taskinfo.get("url").equals("") ? callbackurl : taskinfo.get("url").toString()); sendtodxmap.put("callback", taskinfo.get("url").equals("") ? callbackurl : taskinfo.get("url").toString());
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
// rabbitTemplate.convertAndSend(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getExchange(), rabbitTemplate.convertAndSend(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getExchange(),
// QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getRouteKey(), QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getRouteKey(),
// MessageHelper.objToMsg(sendtodxmap), MessageHelper.objToMsg(sendtodxmap),
// correlationData); correlationData);
// rabbitTemplate.convertAndSend(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getExchange(),
// rabbitTemplate.convertAndSend(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getExchange(), QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getRouteKey(),
// QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getRouteKey(), MessageHelper.objToMsg(sendtodxmap),
// MessageHelper.objToMsg(sendtodxmap), correlationData);
// correlationData); //回调第三方接口
// //回调第三方接口 // logger.info("send to dianxin data:{}",JSONObject.toJSONString(jobTjParam));
//// logger.info("send to dianxin data:{}",JSONObject.toJSONString(jobTjParam));
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl()); // eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl());
}
}
} }
} }
// } catch(Exception ex){
// logger.error(" processResult error:{}", ex.toString());
// }
} }
} catch(Exception ex){ private void getPoi(Map taskinfo, Long[] roiarray) {
logger.error(" processResult error:{}", ex.toString()); roiarray[0]=0L;roiarray[1]=0L;roiarray[2]=0L;roiarray[3]=0L;
if(null!=taskinfo.get("x") && !taskinfo.get("x").toString().equals("null"))
{
roiarray[0] = new Long(taskinfo.get("x").toString());
}
if(null!=taskinfo.get("y") &&!taskinfo.get("y").toString().equals("null")) {
roiarray[1] = new Long(taskinfo.get("y").toString());
}
if(null!=taskinfo.get("w") && !taskinfo.get("w").toString().equals("null")) {
roiarray[2] = new Long(taskinfo.get("w").toString());
}
if(null!=taskinfo.get("h") && !taskinfo.get("h").toString().equals("null"))
{
roiarray[3] = new Long(taskinfo.get("h").toString());
} }
} }
......
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.bean.GoalStructureParam;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.bean.TaskResult;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.util.JsonUtil;
import com.cx.cn.cxquartz.vo.ImageList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.*;
@Service
@Configuration
public class TaskRecog implements InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(TaskRecog.class);
@Value("${file.recogurl}")
String recogurl;
@Value("${file.recogqsturl}")
String recogqsturl;
RestTemplate restTemplate=new RestTemplate();
@Autowired
private RabbitTemplate rabbitTemplate;
public void sender(List<Map> list) throws Exception {
String result="{\n" +
" \"ret\": 0,\n" +
" \"desc\": \"succ!\",\n" +
" \"url\": \"http://zjh189.ncpoi.cc:7080/download/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" +
" \"resourcePath\": \"/home/ubuntu/pictures/slice/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\n" +
" \"timestamp\": \"2021-09-08 13:41:31.031\",\n" +
" \"devicecode\": \"33050300001327599605\"\n" +
"}";
//调用服务,10个一组批量调用分析服务
int i=0;
GoalStructureParam goalSparam=new GoalStructureParam();
List<ImageList> imglist=new ArrayList<>();
int model=1;
Map<Integer, TaskResult> recordtypeMap=new HashMap();
for(Map m:list) {
if (null != m.get("task")) {
QuartzTaskInformations param = JsonUtil.strToObj(m.get("task").toString(), QuartzTaskInformations.class);
Map picture = JsonUtil.strToObj(m.get("result").toString(), Map.class);
//获得roi
ImageList img = new ImageList();
img.setImageID(String.valueOf(i));
img.setFormat(2);
if (null != param.getObjectType()) {
model = Integer.parseInt(param.getObjectType());
}
//判断是否有感兴趣区域
if (null != param.getObjectx() && null != param.getObjecty()
&& null != param.getObjectw() && null != param.getObjecth()) {
img.setRoi(new Long[]{param.getObjectx(),
param.getObjecty(),
param.getObjectw(),
param.getObjecth()
});
}
img.setData(picture.get("resourcePath").toString());
imglist.add(img);
recordtypeMap.put(i,new TaskResult(param.getVideoid(),
param.getRecordtype(),picture.get("timestamp").toString(),param.getObjectx(),param.getObjecty(), param.getObjectw() , param.getObjecth(),
picture.get("resourcePath").toString(), param.getMetatype(), param.getSendtype())
);
i++;
}
}
goalSparam.setImageList(imglist);
goalSparam.setModel(model);
String resultstr = restTemplate.postForObject(recogqsturl, goalSparam, String.class);
// try {
Map resulMap = JsonUtil.strToObj(resultstr, Map.class);
if (null != resulMap.get("ret") && resulMap.get("ret").equals("200")) {
List<Map> resultList = (List<Map>) resulMap.get("ObjectList");
if (resultList.size() < 1) {
logger.info(" objectresult is empty");
return ;
}
for (Integer key : recordtypeMap.keySet()) {
List<Map> senderresult = new ArrayList<>();
//遍历所有返回结果
for (Map resultMap : resultList) {
//放到消息处理 队列中
//根据返回的图片id 获得告警类型
if (null != resultMap.get("ImageID") && resultMap.get("ImageID").toString().equals(String.valueOf(key))) {
senderresult.add(resultMap);
}
}
Map map = new HashMap();
map.put("ObjectList",senderresult);
map.put("param", recordtypeMap.get(key));
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(QueueConstants.QueueEventProcessingEnum.QUEUE_EVENT_PROCESSING_ENUM.getExchange(),
QueueConstants.QueueEventProcessingEnum.QUEUE_EVENT_PROCESSING_ENUM.getRouteKey(),
MessageHelper.objToMsg(map),
correlationData);
}
}
// } catch (Exception ex) {
// logger.error(ex.toString());
// }
}
@Override
public void afterPropertiesSet() throws Exception {
// init();
}
}
\ No newline at end of file
...@@ -159,9 +159,10 @@ public class VideoRTSPorURLService { ...@@ -159,9 +159,10 @@ public class VideoRTSPorURLService {
return null; return null;
} }
public void getRTSPByDeviceCode(String token,String deviceCode) { public String getRTSPByDeviceCode(String token,String deviceCode) {
String timestamp = String.valueOf(new Date().getTime()); String timestamp = String.valueOf(new Date().getTime());
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
String rtsp ="";
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("accessToken", token); headers.add("accessToken", token);
headers.add("timestamp", timestamp); headers.add("timestamp", timestamp);
...@@ -173,9 +174,7 @@ public class VideoRTSPorURLService { ...@@ -173,9 +174,7 @@ public class VideoRTSPorURLService {
try { try {
Map result = new ObjectMapper().readValue(body, Map.class); Map result = new ObjectMapper().readValue(body, Map.class);
if (null != result.get("errorCode") && "0".equals(result.get("errorCode").toString())) { if (null != result.get("errorCode") && "0".equals(result.get("errorCode").toString())) {
sbtdspsr.setSbbh(deviceCode); sbtdspsr.setSbbh(deviceCode);
//获得token 成功,更新表数据 //获得token 成功,更新表数据
Map data = (Map) result.get("data"); Map data = (Map) result.get("data");
// { // {
...@@ -187,19 +186,18 @@ public class VideoRTSPorURLService { ...@@ -187,19 +186,18 @@ public class VideoRTSPorURLService {
// "errorCode": "0", // "errorCode": "0",
// "errorMsg": "success" // "errorMsg": "success"
// } // }
String rtsp = String.valueOf(data.get("rtspUri")); rtsp = String.valueOf(data.get("rtspUri"));
//省内设备 = 地址只能用一次 ,33开头的18位 //省内设备 = 地址只能用一次 ,33开头的
// //集团设备 = 地址可以用20分钟,15位 // //集团设备 = 地址可以用20分钟,15位
sbtdspsr.setSqurllj(rtsp); sbtdspsr.setSqurllj(rtsp);
} }
if (deviceCode.length() == 15) { // if (deviceCode.length() == 18) {
String serverHlsNextTime = DateUtils.addMin(new Date(), 20); String serverHlsNextTime = DateUtils.addMin(new Date(), 20);
sbtdspsr.setUrlnexttime(serverHlsNextTime); sbtdspsr.setUrlnexttime(serverHlsNextTime);
} else if (deviceCode.startsWith("33") && deviceCode.length() == 18) { // } else if (deviceCode.startsWith("330") && sbtdspsr.getSqurllj().indexOf("token=")>-1 &&deviceCode.length()!=18) {
//无需更新,抽帧的时候再去调用,将设备的rtsp 地址换成null // //无需更新,抽帧的时候再去调用,将设备的rtsp 地址换成null
sbtdspsr.setUrlnexttime(null); // sbtdspsr.setUrlnexttime(null);
} // }
//更新表里的数据 //更新表里的数据
if(null!=sbtdspsr.getSbbh() && !"".equals(sbtdspsr.getSbbh())) if(null!=sbtdspsr.getSbbh() && !"".equals(sbtdspsr.getSbbh()))
sbtdspsrService.updateRTSPorHLSParam(sbtdspsr); sbtdspsrService.updateRTSPorHLSParam(sbtdspsr);
...@@ -209,6 +207,7 @@ public class VideoRTSPorURLService { ...@@ -209,6 +207,7 @@ public class VideoRTSPorURLService {
logger.error("getRTSPByDeviceCode" + ex.toString()); logger.error("getRTSPByDeviceCode" + ex.toString());
} }
return rtsp;
} }
/*** /***
* 根据rtsp 或者hls 去抽帧 * 根据rtsp 或者hls 去抽帧
......
...@@ -3,6 +3,10 @@ package com.cx.cn.cxquartz.util; ...@@ -3,6 +3,10 @@ package com.cx.cn.cxquartz.util;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class CommonUtil { public class CommonUtil {
...@@ -22,4 +26,24 @@ public class CommonUtil { ...@@ -22,4 +26,24 @@ public class CommonUtil {
pw.close(); pw.close();
} }
} }
public static LinkedHashMap<String, List<Map>> queryList(List<Map> list) {
LinkedHashMap<String, List<Map>> map = new LinkedHashMap<>();
for (Map li : list) {
//将需要归类的属性与map中的key进行比较,如果map中有该key则添加bean如果没有则新增key
Map mapresult = JsonUtil.strToObj(li.get("task").toString(), Map.class);
if (map.size() > 0 && null != mapresult.get("objectType") && map.containsKey(mapresult.get("objectType").toString())) {
//取出map中key对应的list并将遍历出的bean放入该key对应的list中
ArrayList<Map> templist = (ArrayList<Map>) map.get(mapresult.get("objectType"));
templist.add(li);
} else {
//创建新的list
ArrayList<Map> temlist = new ArrayList<Map>();
temlist.add(li);
map.put(mapresult.get("objectType").toString(), temlist);
}
}
return map;
}
} }
package com.cx.cn.cxquartz.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 下午6:01:40
* @desc
*/
public class DateDomConvert implements DomConvert {
@Override
public Date convert(Object object) {
String date = null;
if (object instanceof String) {
date = (String) object;
}
if (date == null) {
return null;
}
if (date.contains("T") || date.contains(".")) {
date = date.replace("T", " ");
int index = date.indexOf(".");
date = date.substring(0, index);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return sdf.parse(date);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public static void main(String[] args) {
System.out.println(new DateDomConvert().convert("2014-10-20 15:15:15.024"));
}
}
...@@ -6,7 +6,11 @@ import org.joda.time.Months; ...@@ -6,7 +6,11 @@ import org.joda.time.Months;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
public class DateUtils { public class DateUtils {
private static final DateTimeFormatter YMD_HMS = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); private static final DateTimeFormatter YMD_HMS = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
...@@ -15,6 +19,9 @@ public class DateUtils { ...@@ -15,6 +19,9 @@ public class DateUtils {
private static final DateTimeFormatter Y_M_D = DateTimeFormat.forPattern("yyyy-MM-dd"); private static final DateTimeFormatter Y_M_D = DateTimeFormat.forPattern("yyyy-MM-dd");
private static final DateTimeFormatter YM= DateTimeFormat.forPattern("yyyyMM"); private static final DateTimeFormatter YM= DateTimeFormat.forPattern("yyyyMM");
private static final DateTimeFormatter DD= DateTimeFormat.forPattern("dd"); private static final DateTimeFormatter DD= DateTimeFormat.forPattern("dd");
private static final DateTimeFormatter YYMM= DateTimeFormat.forPattern("yyyy/MM");
private static final DateTimeFormatter HHmmss= DateTimeFormat.forPattern("HHmmssSSS");
public static String formatCurrDate(){ public static String formatCurrDate(){
return formatCurrDateByType(YMD_HMS); return formatCurrDateByType(YMD_HMS);
} }
...@@ -22,11 +29,17 @@ public class DateUtils { ...@@ -22,11 +29,17 @@ public class DateUtils {
public static String formatCurrDateNoSign(){ public static String formatCurrDateNoSign(){
return formatCurrDateByType(YMDHMS); return formatCurrDateByType(YMDHMS);
} }
public static String formatCurrDateHHmmss(){
return formatCurrDateByType(HHmmss);
}
public static String formatCurrDateYMD(){ public static String formatCurrDateYMD(){
return formatCurrDateByType(Y_M_D); return formatCurrDateByType(Y_M_D);
} }
public static String formatCurrDateYYMM(){
return formatCurrDateByType(YYMM);
}
public static String formatCurrDayNoSign(){ public static String formatCurrDayNoSign(){
return formatCurrDateByType(YMD); return formatCurrDateByType(YMD);
...@@ -134,4 +147,40 @@ public class DateUtils { ...@@ -134,4 +147,40 @@ public class DateUtils {
public static String addMin(Date date,int min){ public static String addMin(Date date,int min){
return new DateTime(date).plusMinutes(min).toString(YMD_HMS); return new DateTime(date).plusMinutes(min).toString(YMD_HMS);
} }
public static String dealDateFormat(String oldDateStr) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); //yyyy-MM-dd'T'HH:mm:ss.SSSZ
Date date = null;
try {
date = df.parse(oldDateStr);
} catch (ParseException e) {
return null;
}
SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
Date date1 = null;
try {
date1 = df1.parse(date.toString());
} catch (ParseException e) {
return null;
}
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df2.format(date1);
}
/**
* 日期格式转换 yyyy-MM-dd HH:mm:ss TO yyyy-MM-dd'T'HH:mm:ss.SSSXXX (yyyy-MM-dd'T'HH:mm:ss.SSSZ)
* 2020-04-09 23:00:00 TO 2020-04-09T23:00:00.000+08:00
* @throws ParseException
*/
public static String dealDateFormatReverse(String oldDateStr){
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date1 = null;
try {
date1 = df2.parse(oldDateStr);
} catch (ParseException e) {
e.printStackTrace();
}
return df.format(date1);
}
} }
package com.cx.cn.cxquartz.util;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 下午5:36:34
* @desc 转换器
*/
public interface DomConvert
{
public Object convert(Object object);
}
package com.cx.cn.cxquartz.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 上午11:46:46
* @desc 此注解用来控制属性别名 和 转换别名使用,用于xml2bean和bean2xml里的<对应别名>值的转换
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DomField
{
String value() default "";
}
package com.cx.cn.cxquartz.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 下午5:29:21
* @desc
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DomFieldConvert
{
Class<? extends DomConvert> value();
}
package com.cx.cn.cxquartz.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 下午5:25:09
* @desc 此注解用来忽略序列化属性
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DomFieldIngore
{
}
package com.cx.cn.cxquartz.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 上午11:46:23
* @desc 此注解用来控制Root别名 或者 解析类中引用自定义类使用,主要用于xml2bean使用,解析xml中代表这个自定义类的属性转换赋值
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DomFieldRoot
{
Class<?> value();
}
package com.cx.cn.cxquartz.util;
/**
* @author aiheng@jd.com
* @date 2014年11月3日 上午10:18:34
* @desc Dom解析异常
*/
public class DomParseException extends RuntimeException
{
/**
* serialVersionUID
* long
*/
private static final long serialVersionUID = 4964045225307295010L;
public DomParseException()
{
super();
}
public DomParseException(String message)
{
super(message);
}
public DomParseException(String message, Throwable e)
{
super(message, e);
}
}
package com.cx.cn.cxquartz.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 上午11:46:23
* @desc 此注解用来控制Root别名
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface DomRoot
{
String value();
}
package com.cx.cn.cxquartz.util; package com.cx.cn.cxquartz.util;
import com.cx.cn.cxquartz.controller.IndexController;
import com.cx.cn.cxquartz.vo.Location; import com.cx.cn.cxquartz.vo.Location;
import com.cx.cn.cxquartz.vo.Point; import com.cx.cn.cxquartz.vo.Point;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -16,7 +14,7 @@ import java.util.*; ...@@ -16,7 +14,7 @@ import java.util.*;
import java.util.List; import java.util.List;
public class PointUtil { public class PointUtil {
private static final Logger logger = LoggerFactory.getLogger(IndexController.class); private static final Logger logger = LoggerFactory.getLogger(PointUtil.class);
public static void getXYWH(List<Point> points, Long[] roiarray){ public static void getXYWH(List<Point> points, Long[] roiarray){
Map<Integer, Integer> map=new HashMap(); Map<Integer, Integer> map=new HashMap();
......
package com.cx.cn.cxquartz.util;
import com.cx.cn.cxquartz.vo.Capture;
import com.thoughtworks.xstream.XStream;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.text.SimpleDateFormat;
import java.util.*;
public class XmlUtils {
private static final Logger logger = LoggerFactory.getLogger(XmlUtils.class);
private static final String UTF_8 = "UTF-8";
private static final String XML_HEAD = "<?xml version=\"1.0\" encoding=\"%s\"?>";
private static final String SPACE = "";
private static final String LEFT_ANGLE = "<";
private static final String RIGHT_ANGLE = ">";
private static final String LEFT_SLASH_ANGLE = "</";
private static final String SET = "set";
private static final String GET = "get";
private static final String DATE_PATTERN = "yyyy-MM-dd HH:mm:ss";
private static final String POINT_JAVA = "java.";
private static final String DATE = "java.util.Date";
private static final String LONG = "java.lang.Long";
private static final String INTEGER = "java.lang.Integer";
private static final String DOUBLE = "java.lang.Double";
private static final String FLOAT = "java.lang.Float";
private static final String LIST = "java.util.List";
private XmlUtils() {
}
/**
* 序列化XML
*
* @param obj
* @return
*/
public static <T> String toXML(Object obj) {
XStream stream = getXStream();
stream.processAnnotations(obj.getClass());
return new StringBuffer(XML_HEAD).append(stream.toXML(obj)).toString();
}
/**
* 反序列化XML
*
* @param xmlStr
* @param clazz
* @return
*/
public static <T> T fromXML(String xmlStr, Class<T> clazz) {
XStream stream = getXStream();
stream.processAnnotations(clazz);
Object obj = stream.fromXML(xmlStr);
try {
return clazz.cast(obj);
} catch (ClassCastException e) {
return null;
}
}
/**
* 获取指定节点的值
*
* @param xpath
* @param dataStr
* @return
*/
public static String getNodeValue(String xpath, String dataStr) {
try {
// 将字符串转为xml
Document document = DocumentHelper.parseText(dataStr);
// 查找节点
Element element = (Element) document.selectSingleNode(xpath);
if (element != null) {
return element.getStringValue();
}
} catch (org.dom4j.DocumentException e) {
e.printStackTrace();
}
return "";
}
/**
* 获取Xstream实例
*
* @return
*/
public static XStream getXStream() {
return new XStream();
}
public static Capture parseDocument(Capture obj, Document doc)
{ Element rootElement = doc.getRootElement();
for (Iterator<Element> iters = rootElement.elementIterator(); iters.hasNext(); ) {
Element element = iters.next();
String elementName = element.getName();
if(elementName.equalsIgnoreCase("deviceId")){
obj.setDeviceId(element.getStringValue());
}
for (Iterator<Element> iter = element.elementIterator(); iter.hasNext(); ) {
Element elementiter = iter.next();
for (Iterator<Element> iterchilsthree = elementiter.elementIterator(); iterchilsthree.hasNext(); ) {
Element elementchilsthree = iterchilsthree.next();
if(elementchilsthree.getName().equalsIgnoreCase("datetime"))
{
obj.setDateTime(elementchilsthree.getStringValue());
}
}
}
}
return obj;
}
private static Map<String, Field> buildDataMapper(Field[] fields){
Map<String, Field> mappers = new HashMap<String, Field>(16);
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers())){
if (field.isAnnotationPresent(DomFieldIngore.class)) {
continue;
}
String fieldName = null;
if (field.isAnnotationPresent(DomField.class)) {
DomField domField = field.getAnnotation(DomField.class);
if (!SPACE.equals(domField.value())) {
fieldName = domField.value();
}
}
if (fieldName == null) {
fieldName = field.getName();
}
mappers.put(fieldName, field);
}
}
return mappers;
}
/**
* 获取根名称
*
* @param clazz clazz
* @return String
*/
private static <T> String getRootName(Class<T> clazz) {
String rootName = null;
if (clazz.isAnnotationPresent(DomRoot.class)) {
DomRoot domRoot = clazz.getAnnotation(DomRoot.class);
if (!SPACE.equals(domRoot.value())) {
rootName = domRoot.value();
}
} else {
rootName = clazz.getSimpleName();
}
return rootName;
}
/**
* 将对象转成xml
*
* @param t t
* @param encoding 编码
* @return String
*/
public static <T> String beanToXml(T t, String encoding, boolean xmlHead, boolean xmlRoot, boolean xmlField) {
StringBuffer sb = new StringBuffer();
try {
if (xmlHead) {
sb.append(String.format(XML_HEAD,encoding));
}
Class<?> clazz = t.getClass();
String rootName = getRootName(clazz);
if (xmlRoot) {
sb.append(LEFT_ANGLE);
sb.append(rootName);
sb.append(RIGHT_ANGLE);
}
// 获取所有属性
Field[] fields = clazz.getDeclaredFields();
buildXmlUseFields(t, sb, clazz, fields, xmlField);
if (xmlRoot) {
sb.append(LEFT_SLASH_ANGLE);
sb.append(rootName);
sb.append(RIGHT_ANGLE);
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return sb.toString();
}
private static <T> void buildXmlUseFields(T t, StringBuffer sb, Class<?> clazz, Field[] fields, boolean xmlFullField)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Map<String, Field> mappers = buildDataMapper(fields);
for (Map.Entry<String, Field> entry : mappers.entrySet()) {
String key = entry.getKey();
Field field = entry.getValue();
String getMethodName = GET + field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method getMethod = clazz.getMethod(getMethodName);
Object value = getMethod.invoke(t);
if (xmlFullField) {
sb.append(LEFT_ANGLE);
sb.append(key);
sb.append(RIGHT_ANGLE);
} else {
if (value != null && value != "") {
sb.append(LEFT_ANGLE);
sb.append(key);
sb.append(RIGHT_ANGLE);
}
}
if (field.getType().getName().startsWith(POINT_JAVA) && !LIST.equals(field.getType().getName())) {
if (field.getType().getName().equals(DATE) && value != null) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN);
sb.append(sdf.format(value));
} else if (value != null) {
sb.append(value);
}
} else if (LIST.equals(field.getType().getName())) {
List list = (List) value;
for (Object obj : list) {
Class<?> objClass = obj.getClass();
String rootName = getRootName(objClass);
sb.append(LEFT_ANGLE);
sb.append(rootName);
sb.append(RIGHT_ANGLE);
buildXmlUseFields(obj, sb, objClass, objClass.getDeclaredFields(), xmlFullField);
sb.append(LEFT_SLASH_ANGLE);
sb.append(rootName);
sb.append(RIGHT_ANGLE);
}
} else {
Class<?> type = field.getType();
buildXmlUseFields(value, sb, type, type.getDeclaredFields(), xmlFullField);
}
if (xmlFullField) {
sb.append(LEFT_SLASH_ANGLE);
sb.append(key);
sb.append(RIGHT_ANGLE);
} else {
if (value != null && value != SPACE) {
sb.append(LEFT_SLASH_ANGLE);
sb.append(key);
sb.append(RIGHT_ANGLE);
}
}
}
}
public static <T> String beanToXml(T t, boolean xmlHead, boolean xmlRoot, boolean xmlFullField) {
return beanToXml(t, UTF_8, xmlHead, xmlRoot, xmlFullField);
}
public static Document readDocument (MultipartFile multipartFile) {
InputStream inputStream= null;
try {
inputStream = multipartFile.getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
File file= new File(multipartFile.getOriginalFilename());
try {
inputStreamTofile(inputStream,file);
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
SAXReader reader = new SAXReader();
Document document = null;
try {
document = reader.read(file);
} catch (DocumentException e) {
e.printStackTrace();
}
return document;
}
public static void inputStreamTofile(InputStream inputStream,File file) throws IOException {
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
int byteread = 0;
byte[] buffer = new byte[1024];
while ((byteread = inputStream.read(buffer, 0, buffer.length)) != -1) {
try {
outputStream.write(buffer, 0, byteread);
} catch (IOException e) {
e.printStackTrace();
}
}
try {
outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
public class Autosnaptaskinfo {
private String taskid ;
private String taskname;
private String devicenum;
private String starthour;
private String endhour;
private String recordtype;
private String region;
private String spId;
private String status;
private String cjrq;
private String xgrq;
private String objectType;
private String sendurl;
private String threshold;
private String algorithmfrom;
private String sendtype;
public String getSendtype() {
return sendtype;
}
public void setSendtype(String sendtype) {
this.sendtype = sendtype;
}
public Autosnaptaskinfo(String taskid, String taskname, String devicenum, String starthour, String endhour, String recordtype, String region, String spId, String status, String objectType, String sendurl, String threshold, String algorithmfrom,String sendtype) {
this.taskid = taskid;
this.taskname = taskname;
this.devicenum = devicenum;
this.starthour = starthour;
this.endhour = endhour;
this.recordtype = recordtype;
this.region = region;
this.spId = spId;
this.status = status;
this.objectType = objectType;
this.sendurl = sendurl;
this.threshold = threshold;
this.algorithmfrom = algorithmfrom;
this.sendtype=sendtype;
}
public String getTaskid() {
return taskid;
}
public void setTaskid(String taskid) {
this.taskid = taskid;
}
public String getTaskname() {
return taskname;
}
public void setTaskname(String taskname) {
this.taskname = taskname;
}
public String getDevicenum() {
return devicenum;
}
public void setDevicenum(String devicenum) {
this.devicenum = devicenum;
}
public String getStarthour() {
return starthour;
}
public void setStarthour(String starthour) {
this.starthour = starthour;
}
public String getEndhour() {
return endhour;
}
public void setEndhour(String endhour) {
this.endhour = endhour;
}
public String getRecordtype() {
return recordtype;
}
public void setRecordtype(String recordtype) {
this.recordtype = recordtype;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getSpId() {
return spId;
}
public void setSpId(String spId) {
this.spId = spId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCjrq() {
return cjrq;
}
public void setCjrq(String cjrq) {
this.cjrq = cjrq;
}
public String getXgrq() {
return xgrq;
}
public void setXgrq(String xgrq) {
this.xgrq = xgrq;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getSendurl() {
return sendurl;
}
public void setSendurl(String sendurl) {
this.sendurl = sendurl;
}
public String getThreshold() {
return threshold;
}
public void setThreshold(String threshold) {
this.threshold = threshold;
}
public String getAlgorithmfrom() {
return algorithmfrom;
}
public void setAlgorithmfrom(String algorithmfrom) {
this.algorithmfrom = algorithmfrom;
}
public Autosnaptaskinfo(String devicenum) {
this.devicenum = devicenum;
}
}
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Capture {
private String deviceId;
private String dateTime;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
}
...@@ -57,7 +57,7 @@ public class Traffpicture{ ...@@ -57,7 +57,7 @@ public class Traffpicture{
private String index; private String index;
private Integer targetnum; private String targetnum;
private String creattime; private String creattime;
...@@ -69,11 +69,11 @@ public class Traffpicture{ ...@@ -69,11 +69,11 @@ public class Traffpicture{
this.creattime = creattime; this.creattime = creattime;
} }
public Integer getTargetnum() { public String getTargetnum() {
return targetnum; return targetnum;
} }
public void setTargetnum(Integer targetnum) { public void setTargetnum(String targetnum) {
this.targetnum = targetnum; this.targetnum = targetnum;
} }
......
...@@ -63,7 +63,8 @@ spring: ...@@ -63,7 +63,8 @@ spring:
# info # info
local: local:
job: 0 job: 0
czurl: http://localhost:8089/ext/getRTSP/1 czurl: http://zjh189.ncpoi.cc:7780/getDeviceSnapshot
czrooturl: /home/ubuntu/pictures/slice
fxurl: http://localhost:8089/ext/getDeviceSnapshotAndRecognize fxurl: http://localhost:8089/ext/getDeviceSnapshotAndRecognize
file: file:
...@@ -71,6 +72,9 @@ file: ...@@ -71,6 +72,9 @@ file:
recogurl: http://zjh189.ncpoi.cc:7080/getDeviceSnapshotAndRecognize recogurl: http://zjh189.ncpoi.cc:7080/getDeviceSnapshotAndRecognize
uploadurl: http://home2.ncpoi.cc:7080/uploadResultFile uploadurl: http://home2.ncpoi.cc:7080/uploadResultFile
model: 1 model: 1
recogqsturl: http://zjh189.ncpoi.cc:9098/images/recog
rootpath: D://home/ubuntu/pictures/slice/
outpath: result
countryside: countryside:
callbackurl: http://kvideo.51iwifi.com/hesc-mq/hesc callbackurl: http://kvideo.51iwifi.com/hesc-mq/hesc
...@@ -83,7 +87,7 @@ rtspurl: ...@@ -83,7 +87,7 @@ rtspurl:
url: http://kvideo.51iwifi.com/home_gw/heschome_api/api/hesc/open/getRtsp url: http://kvideo.51iwifi.com/home_gw/heschome_api/api/hesc/open/getRtsp
appid: 8e9c7ff0fc6c11eac5efb5371726daaf appid: 8e9c7ff0fc6c11eac5efb5371726daaf
appsecret: 8e9ca700fc6c11eac5efb5371726daaf appsecret: 8e9ca700fc6c11eac5efb5371726daaf
params: account18888888888deviceCode params: deviceCode
logging: logging:
level: level:
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cx.cn.cxquartz.dao.AutoSanpMapper">
<resultMap id="resultMap" type="com.cx.cn.cxquartz.vo.Autosnaptaskinfo">
<id column="taskid" property="taskid"/>
<result column="taskname" property="taskname"/>
<result column="devicenum" property="devicenum"/>
<result column="starthour" property="starthour"/>
<result column="endhour" property="endhour"/>
<result column="recordtype" property="recordtype"/>
<result column="region" property="region"/>
<result column="spId" property="spId"/>
<result column="status" property="status"/>
<result column="objectType" property="objectType"/>
<result column="sendurl" property="sendurl"/>
<result column="threshold" property="threshold"/>
<result column="algorithmfrom" property="algorithmfrom"/>
<result column="sendtype" property="sendtype"/>
</resultMap>
<select id="query" parameterType="com.cx.cn.cxquartz.vo.Autosnaptaskinfo" resultMap="resultMap">
select taskid, taskname, devicenum, starthour, endhour, recordtype, region, spId, status, objectType, sendurl, threshold, algorithmfrom,sendtype from autosnaptaskinfo t where devicenum=#{devicenum} and status!=2
</select>
</mapper>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.cx.cn.cxquartz.dao.CodeMapper"> <mapper namespace="com.cx.cn.cxquartz.dao.CodeMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Code"> <resultMap id="CodeBaseResultMap" type="com.cx.cn.cxquartz.vo.Code">
<result column="key" jdbcType="VARCHAR" property="key" /> <result column="key" jdbcType="VARCHAR" property="key" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="CHAR" property="type" /> <result column="type" jdbcType="CHAR" property="type" />
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<result column="maxnumvalue" jdbcType="INTEGER" property="maxnum" /> <result column="maxnumvalue" jdbcType="INTEGER" property="maxnum" />
<result column="alarmnum" jdbcType="INTEGER" property="alarmnum" /> <result column="alarmnum" jdbcType="INTEGER" property="alarmnum" />
</resultMap> </resultMap>
<select id="selectalarmNum" resultMap="BaseResultMap"> <select id="selectalarmNum" resultMap="CodeBaseResultMap">
select * from t_code t where t.type=2 and t.key=#{key,jdbcType=VARCHAR} select * from t_code t where t.type=2 and t.key=#{key,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Face"> <resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Face">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="facex" property="facex"/> <result column="facex" property="facex" />
<result column="facey" property="facey"/> <result column="facey" property="facey"/>
<result column="facew" property="facew"/> <result column="facew" property="facew"/>
<result column="faceh" property="faceh"/> <result column="faceh" property="faceh"/>
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cx.cn.cxquartz.dao.SbtdspsrMapper"> <mapper namespace="com.cx.cn.cxquartz.dao.SbtdspsrMapper">
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Sbtdspsr"> <resultMap id="SbtdspsrBaseResultMap" type="com.cx.cn.cxquartz.vo.Sbtdspsr">
<result column="sbbh" jdbcType="VARCHAR" property="sbbh"/> <result column="sbbh" jdbcType="VARCHAR" property="sbbh"/>
<result column="tdbh" jdbcType="INTEGER" property="tdbh"/> <result column="tdbh" jdbcType="INTEGER" property="tdbh"/>
<result column="xzbh" jdbcType="VARCHAR" property="xzbh"/> <result column="xzbh" jdbcType="VARCHAR" property="xzbh"/>
......
...@@ -67,6 +67,8 @@ ...@@ -67,6 +67,8 @@
<if test="imagedata != null">imagedata,</if> <if test="imagedata != null">imagedata,</if>
<if test="processstatus != null">processstatus,</if> <if test="processstatus != null">processstatus,</if>
<if test="createtime !=null">createtime ,</if> <if test="createtime !=null">createtime ,</if>
<if test="targetnum !=null">targetnum ,</if>
<if test="checkstatus !=null">checkstatus ,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordid != null">#{recordid},</if> <if test="recordid != null">#{recordid},</if>
...@@ -92,6 +94,8 @@ ...@@ -92,6 +94,8 @@
<if test="imagedata != null">#{imagedata},</if> <if test="imagedata != null">#{imagedata},</if>
<if test="processstatus != null">#{processstatus},</if> <if test="processstatus != null">#{processstatus},</if>
<if test="createtime !=null">str_to_date(#{createtime},'%Y-%m-%d %H:%i:%s') ,</if> <if test="createtime !=null">str_to_date(#{createtime},'%Y-%m-%d %H:%i:%s') ,</if>
<if test="targetnum !=null">#{targetnum} ,</if>
<if test="checkstatus !=null">#{checkstatus} ,</if>
</trim> </trim>
</insert> </insert>
......
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