Commit a53e0467 authored by wangjinjing's avatar wangjinjing

修改同步

parent 44400cdd
...@@ -69,12 +69,6 @@ ...@@ -69,12 +69,6 @@
<version>2.9.6</version> <version>2.9.6</version>
</dependency> </dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
......
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;
}
...@@ -10,12 +10,12 @@ import org.springframework.context.annotation.Bean; ...@@ -10,12 +10,12 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/*** /***
* 自动抓拍队列 * 自动抓拍队列
*/ */
@Configuration @Configuration
public class AutoSnapConfig { public class AutoSnapConfig {
/** /**
* 创建交换机 * 创建交换机
* *
* @return * @return
*/ */
...@@ -25,7 +25,7 @@ public class AutoSnapConfig { ...@@ -25,7 +25,7 @@ public class AutoSnapConfig {
} }
/** /**
* 创建队列 true表示是否持久 * 创建队列 true表示是否持久
* *
* @return * @return
*/ */
...@@ -35,7 +35,7 @@ public class AutoSnapConfig { ...@@ -35,7 +35,7 @@ public class AutoSnapConfig {
} }
/** /**
* 将队列和交换机绑定,并设置用于匹配路由键 * 将队列和交换机绑定,并设置用于匹配路由键
* *
* @return * @return
*/ */
......
...@@ -22,17 +22,30 @@ public class RabbitConfig { ...@@ -22,17 +22,30 @@ public class RabbitConfig {
TaskScheduler taskScheduler=new ThreadPoolTaskScheduler(); TaskScheduler taskScheduler=new ThreadPoolTaskScheduler();
return taskScheduler; return taskScheduler;
} }
//批量处理rabbitTemplate
/***
* 批量处理rabbitTemplate
* @param connectionFactory
* @param taskScheduler
* @return
*/
@Bean("batchQueueRabbitTemplate") @Bean("batchQueueRabbitTemplate")
public BatchingRabbitTemplate batchQueueRabbitTemplate(ConnectionFactory connectionFactory, public BatchingRabbitTemplate batchQueueRabbitTemplate(ConnectionFactory connectionFactory,
@Qualifier("batchQueueTaskScheduler") TaskScheduler taskScheduler){ @Qualifier("batchQueueTaskScheduler") TaskScheduler taskScheduler){
int batchSize=1; int batchSize=1;
int bufferLimit=1024; //1 K //1024M
int bufferLimit=1024;
//超时时间ms
long timeout=10000; long timeout=10000;
BatchingStrategy batchingStrategy=new SimpleBatchingStrategy(batchSize,bufferLimit,timeout); BatchingStrategy batchingStrategy=new SimpleBatchingStrategy(batchSize,bufferLimit,timeout);
return new BatchingRabbitTemplate(connectionFactory,batchingStrategy,taskScheduler); return new BatchingRabbitTemplate(connectionFactory,batchingStrategy,taskScheduler);
} }
/***
* 批量监听
* @param connectionFactory
* @return
*/
@Bean("batchQueueRabbitListenerContainerFactory") @Bean("batchQueueRabbitListenerContainerFactory")
public SimpleRabbitListenerContainerFactory batchQueueRabbitListenerContainerFactory(ConnectionFactory connectionFactory) { public SimpleRabbitListenerContainerFactory batchQueueRabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
......
package com.cx.cn.cxquartz.config;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
@Component
public class RabbitMqAdminConf {
@Bean
public RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory) {
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
// 只有设置为 true,spring 才会加载 RabbitAdmin 这个类
rabbitAdmin.setAutoStartup(true);
return rabbitAdmin;
}
}
package com.cx.cn.cxquartz.config;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.core.ChannelCallback;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class RabbitMqService {
@Resource
RabbitAdmin rabbitAdmin;
/**
* 获取对应队列的数量;
*
* @param queue
* @return
*/
public int getMessageCount(String queue) {
AMQP.Queue.DeclareOk declareOk = rabbitAdmin.getRabbitTemplate().execute(new ChannelCallback<AMQP.Queue.DeclareOk>() {
public AMQP.Queue.DeclareOk doInRabbit(Channel channel) throws Exception {
return channel.queueDeclarePassive(queue);
}
});
return declareOk.getMessageCount();
}
}
package com.cx.cn.cxquartz.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
@EnableCaching //开启注解
public class RedisConfig extends CachingConfigurerSupport {
/**
* retemplate相关配置
*
* @param factory
* @return
*/
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jacksonSeial.setObjectMapper(om);
template.setValueSerializer(jacksonSeial);
template.setKeySerializer(new StringRedisSerializer());
// 设置hash key 和value序列化模式
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(jacksonSeial);
template.afterPropertiesSet();
return template;
}
/**
* 对hash类型的数据操作
*
* @param redisTemplate
* @return
*/
@Bean
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForHash();
}
/**
* 对redis字符串类型数据操作
*
* @param redisTemplate
* @return
*/
@Bean
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForValue();
}
/**
* 对链表类型的数据操作
*
* @param redisTemplate
* @return
*/
@Bean
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForList();
}
/**
* 对无序集合类型的数据操作
*
* @param redisTemplate
* @return
*/
@Bean
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForSet();
}
/**
* 对有序集合类型的数据操作
*
* @param redisTemplate
* @return
*/
@Bean
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForZSet();
}
}
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* redis 消费者初始化
*/
//@Configuration
public class RedisPCQueueConfig {
@Autowired
RedisMQConsumerContainer mqContainer;
// 初始化完毕后调取 init
@Bean(initMethod = "init", destroyMethod = "destroy")
public RedisMQConsumerContainer redisQueueConsumerContainer() {
for(int i=0;i<2;i++) {
Consumer orderConsumer = new OrderConsumer();
mqContainer.addConsumer(
QueueConfiguration.builder().queue("taskinfo").consumer(orderConsumer).build()
);
}
return mqContainer;
}
}
package com.cx.cn.cxquartz.util; package com.cx.cn.cxquartz.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
......
package com.cx.cn.cxquartz.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration
@EnableScheduling
public class ScheduleTaskConfig {
private static final Logger logger = LoggerFactory.getLogger(ScheduleTaskConfig.class);
@Autowired
private RabbitMqService rRabbitMqService;
@Scheduled(cron = "*/45 * * * * ?")//每隔45s查询所有queue的消费数目,超过警戒值的
private void statistoday() {
try {
int count= rRabbitMqService.getMessageCount("RabbitMQ.DirectQueue.SendToVoiceConsumer");
logger.info("count:{}", count);
}
catch (Exception ex){
logger.error(ex.toString());
}
}
}
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");
}
}
...@@ -3,6 +3,7 @@ package com.cx.cn.cxquartz.controller; ...@@ -3,6 +3,7 @@ package com.cx.cn.cxquartz.controller;
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.AutoSnapService;
import com.cx.cn.cxquartz.util.*; import com.cx.cn.cxquartz.util.*;
import com.cx.cn.cxquartz.vo.*; import com.cx.cn.cxquartz.vo.*;
import org.dom4j.Document; import org.dom4j.Document;
...@@ -28,31 +29,40 @@ public class AutoSnapController { ...@@ -28,31 +29,40 @@ public class AutoSnapController {
@Value("${snapnote.note1}") @Value("${snapnote.note1}")
String note1; String note1;
@Autowired
AutoSnapService autoSnapService;
@RequestMapping(value = "/autoSnap", method = RequestMethod.POST) @RequestMapping(value = "/autoSnap", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public String AutoSnap(@RequestParam("imageinfo.xml_0") MultipartFile filexml,@RequestParam("vcaimage_0.jpg_1") MultipartFile filejpg ) { public String AutoSnap(@RequestParam("imageinfo.xml_0") MultipartFile filexml,@RequestParam("vcaimage_0.jpg_1") MultipartFile filejpg ) {
logger.info("autosnap xml:{}",filexml.getName()); logger.info("autosnap xml:{}",filexml.getName());
logger.info("autosnap filejpg:{}",filejpg.getName()); logger.info("autosnap filejpg:{}",filejpg.getName());
// /*如果文件不为空,保存文件*/ // /*如果文件不为空,保存文件*/
if (filexml != null && filejpg!= null) { if (filexml != null && filejpg!= null) {
//获得xml文件里信息,获得图片地址,将信息与地址整合成rabbitmq 中的格式进行消费 //获得xml文件里信息,获得图片地址,将信息与地址整合成rabbitmq 中的格式进行消费
try { try {
Document doc= XmlUtils.readDocument(filexml); Document doc= XmlUtils.readDocument(filexml);
Capture vCACapture=new Capture(); Capture vCACapture=new Capture();
XmlUtils.parseDocument(vCACapture,doc); XmlUtils.parseDocument(vCACapture,doc);
//判断时间是否在任务范围内
List<Autosnaptaskinfo> taskinfolist = autoSnapService.query(new Autosnaptaskinfo(vCACapture.getDeviceId() ));
if(taskinfolist.size()==0){
logger.info("自动抓拍任务不存在!");
return "success";
}
vCACapture.setDateTime(vCACapture.getDateTime()==null?null:DateUtils.dealDateFormat(vCACapture.getDateTime())); vCACapture.setDateTime(vCACapture.getDateTime()==null?null:DateUtils.dealDateFormat(vCACapture.getDateTime()));
//获得jpg 文件,将文件存放到某个路径下面 //获得jpg 文件,将文件存放到某个路径下面
String filepath = DateUtils.formatCurrDatefileYMD() + File.separator + vCACapture.getDeviceId() + File.separator + vCACapture.getDeviceId() + "_" + DateUtils.formatDateToNoSign(vCACapture.getDateTime()) + ".jpg"; String filepath = DateUtils.formatCurrDatefileYMD() + File.separator + vCACapture.getDeviceId() + File.separator + vCACapture.getDeviceId() + "_" + DateUtils.formatDateToNoSign(vCACapture.getDateTime()) + ".jpg";
logger.info(filepath); logger.info(filepath);
//将文件copy到该路径下 //将文件copy到该路径下
File desfile = new File(note1 +File.separator + filepath); File desfile = new File(note1 +File.separator + filepath);
if (!desfile.getParentFile().exists()) { if (!desfile.getParentFile().exists()) {
desfile.getParentFile().mkdirs(); desfile.getParentFile().mkdirs();
} }
filejpg.transferTo(desfile); filejpg.transferTo(desfile);
Map map=new HashMap<>(); Map map=new HashMap<>();
map.put("resourcePath",filepath);//不加节点的resourcePath,方便哪个节点的消费者抢到消息直接添加节点信息 map.put("resourcePath",filepath);//不加节点的resourcePath,方便哪个节点的消费者抢到消息直接添加节点信息
map.put("timestamp", vCACapture.getDateTime()); map.put("timestamp", vCACapture.getDateTime());
map.put("devicecode", vCACapture.getDeviceId()); map.put("devicecode", vCACapture.getDeviceId());
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
...@@ -61,7 +71,7 @@ public class AutoSnapController { ...@@ -61,7 +71,7 @@ public class AutoSnapController {
MessageHelper.objToMsg(map), MessageHelper.objToMsg(map),
correlationData); correlationData);
return "success"; return "success";
//拼接数据为如下格式 //拼接数据为如下格式
// String result="{\n" + // String result="{\n" +
// " \"ret\": 0,\n" + // " \"ret\": 0,\n" +
// " \"desc\": \"succ!\",\n" + // " \"desc\": \"succ!\",\n" +
...@@ -76,7 +86,7 @@ public class AutoSnapController { ...@@ -76,7 +86,7 @@ public class AutoSnapController {
return "IO error"; return "IO error";
} }
}else{ }else{
logger.error("参数为null"); logger.error("参数为null");
return "null"; return "null";
} }
} }
......
package com.cx.cn.cxquartz.controller; package com.cx.cn.cxquartz.controller;
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.VideoRTSPorURLService;
import com.cx.cn.cxquartz.util.DateUtils; 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.util.RestUtil;
import com.cx.cn.cxquartz.util.ResultUtil;
import com.cx.cn.cxquartz.vo.JobTjParam; import com.cx.cn.cxquartz.vo.JobTjParam;
import com.cx.cn.cxquartz.vo.ResultObj; import com.cx.cn.cxquartz.vo.ResultObj;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
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.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
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 java.util.HashMap;
import java.util.ArrayList; import java.util.Map;
import java.util.List;
@RestController @RestController
@RequestMapping("/ext") @RequestMapping("/ext")
@PropertySource("classpath:file.properties")
public class ExtController { public class ExtController {
private static final Logger logger = LoggerFactory.getLogger(AutoSnapController.class); private static final Logger logger = LoggerFactory.getLogger(ExtController.class);
@Value("${file.rtspurl}")
private String rtspurl;
@Value("${file.getrtspbyurl}")
private String getrtspbyurl;
@Value("${file.publicpictureurl}")
private String publicpictureurl;
@Value("${voice.appKey}")
private String appKey;
@Value("${voice.corpId}")
private String corpId;
@Value("${voice.eventId}")
private Integer eventId;
@Value("${voice.unionId}")
private String unionId;
@Value("${web.url}")
private String weburl;
@Autowired
TraffAlarmRecordService traffAlarmRecordService;
@Autowired
TraffPictureService traffPictureService;
@Autowired @Autowired
PedestrianService pedestrianService; VideoRTSPorURLService videoRTSPorURLService;
@Autowired @Autowired
TrafficService trafficService; SbtdspsrService sbtdspsrService;
@Autowired @Autowired
FaceService faceService; RestTemplate restTemplate;
@Value("${file.ftppath}")
private String ftppath;
@Autowired
PeopleridebicycService peopleridebicycService;
@Autowired
WebSocket webSocket;
@Autowired
CodeService codeservice;
@Autowired
EventWriteService eventWriteService;
RestUtil restutil = new RestUtil();
@Resource @Value("${local.czurl}")
public void setRestTemplate(RestTemplate restTemplate) { private String czurl;
restutil.restTemplate = restTemplate;
}
@Resource @Value("${file.rootpath}")
public void setSbtdspsrService(SbtdspsrService sbtdspsrService) { private String czrooturl;
restutil.sbtdspsrService = sbtdspsrService;
} @RequestMapping(value = "/callback", method = RequestMethod.POST)
@ResponseBody
public ResultObj sendcallback(JobTjParam jobTjParam){
logger.info(JsonUtil.objToStr(jobTjParam));
return ResultObj.ok();
@RequestMapping(value = "/getRTSP/{photonum}", method = RequestMethod.POST)
public String getrtsp(@RequestBody String videoid,
@PathVariable("photonum") Integer photonum) {
//尝试抽取第一张图片
List<String> imgUrls = new ArrayList<>();
TraffAlarmRecord traffAlarmRecord = new TraffAlarmRecord();
try {
logger.info("rtspurl" + rtspurl);
String timestamp = restutil.getPicture(imgUrls, videoid, rtspurl,traffAlarmRecord);
logger.info("timestamp" + timestamp);
if(null==timestamp){
logger.info("getRTSP/1 no snapshot");
return ResultUtil.success();
} }
if (timestamp.contains(".")) {
traffAlarmRecord.setCreatetime(timestamp.split("\\.")[0]); @RequestMapping(value = "/getRTSP/{devicecode}", method = RequestMethod.GET)
@ResponseBody
public String getsnapPicUrl(@PathVariable(value = "devicecode") String devicecode) {
String rtsporhls = "";
//如果设备编号是用一次废一次的,此刻需要现场取得rtsp
if (null != devicecode && devicecode.startsWith("33") && devicecode.length() != 18) {
//调用抽帧服务
String token = videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(devicecode);
rtsporhls = videoRTSPorURLService.getRTSPByDeviceCode(token, devicecode);
} else { } else {
traffAlarmRecord.setCreatetime(timestamp); //取表里最新的rtsp 或者hls 的值
rtsporhls = sbtdspsrService.getRtspOrHLSByDeviceCode(devicecode);
} }
} catch (Exception ex) { if (rtsporhls.equals("")) {
logger.info("getRTSP/1 error:{}", ex.toString()); //尝试重新抽帧一遍
traffAlarmRecord.setCreatetime(DateUtils.formatCurrDate()); String token = videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(devicecode);
rtsporhls = videoRTSPorURLService.getRTSPByDeviceCode(token, devicecode);
if (rtsporhls.equals("")) {
logger.error(devicecode + "rtsp 、hls 地址为空");
return "";
} }
try {
if (imgUrls.size() == 0) {
restutil.getPicture(imgUrls, videoid, rtspurl,traffAlarmRecord);
} }
//将rtsp 作为参数调用抽帧服务
traffAlarmRecord.setFdid(videoid); HttpHeaders headers = new HttpHeaders();
traffAlarmRecord.setChannelid(0); headers.setContentType(MediaType.APPLICATION_JSON);
traffAlarmRecord.setAreaid(Long.parseLong("-1")); Map map = new HashMap();
traffAlarmRecord.setPushstatus(9); map.put("resourcePath", czrooturl + "/" + DateUtils.formatCurrDatefileYMD() + "/" + devicecode + "/" + devicecode + "_" + DateUtils.formatCurrDayNoSign() + "_" + DateUtils.formatCurrDateHHmmss() + ".jpg");
//免审 map.put("deviceID", devicecode);
traffAlarmRecord.setCheckstatus(9); map.put("resourceParam", rtsporhls);
//未提取特征 HttpEntity<Map> requestEntity = new HttpEntity<>(map, headers);
traffAlarmRecord.setProcessstatus("-2"); logger.info("VideoRTSPorURL param:{}", JsonUtil.objToStr(map));
traffAlarmRecord.setImg1urlfrom(imgUrls.get(0)); Map resultmap = restTemplate.postForObject(czurl, requestEntity, Map.class);
//异步新增五条数据 if (null != resultmap.get("ret")) {
traffAlarmRecordService.inserTraffAlarmRecord(traffAlarmRecord); if (resultmap.get("ret").toString().equals("0")
return ResultUtil.success(); && null != resultmap.get("resourcePath")
} catch (Exception e) { && !resultmap.get("resourcePath").toString().equals("")) {
logger.error("ext/getRTSPr-->error:{}" + e.toString()); //抽帧结果放到rabbttmq 中,根据msg 的检测metatype ,分别派发到不同的queue中,方便以后10条10条的去皮皮昂分析
return resultmap.get("resourcePath").toString();
} else {
logger.error("VideoRTSPorURLService error:{}", JsonUtil.objToStr(resultmap));
} }
return ResultUtil.success(); } else {
logger.error("VideoRTSPorURLService ->czurl> resultmap is null");
}
return "";
} }
//
// @RequestMapping(value = "/getDeviceSnapshotAndRecognize", method = RequestMethod.POST)
// public String getDeviceSnapshotAndRecognize(@RequestBody String taskno) {
// //根据判断监控是否存在,该监控检测的事件是什么
// List<QuartzTaskInformations> mapList = sbtdspsrService.selectRecogByRtsp(taskno);
// String model = "1";
// //图片框选出来的范围
// Long[] roiarray;
// HttpEntity<GoalStructureParam> requestEntity = null;
// if (null != mapList && !mapList.equals("") && mapList.size() > 0) {
//
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
// Map<String, Object> mapparam = new HashMap<>();
// roiarray = new Long[4];
//
// //获得该监控的检测业务与检测范围
// for (QuartzTaskInformations taskinfo : mapList) {
// roiarray[0] = new Long(taskinfo.getObjectx());
// roiarray[1] = new Long(taskinfo.getObjecty());
// roiarray[2] = new Long(taskinfo.getObjectw());
// roiarray[3] = new Long(taskinfo.getObjecth());
// String devicecode=taskinfo.getExecuteparamter();
// //查询该监控下面还没有经过分析的数据
// Map<String, Object> map = new HashMap<>();
// map.put("sbbh", devicecode);
// map.put("recordtype", taskinfo.getRecordtype());
//
// List<TraffAlarmRecord> traffalarmrecordlist=traffAlarmRecordService.getTraffAlarmRecordByProgress(map);
// if(traffalarmrecordlist.size()<1) {
// return ResultUtil.success();
// }
// for (TraffAlarmRecord transferRecord : traffalarmrecordlist) {
// GoalStructureParam param = FileTransferManager.getGoalStructureParam(roiarray,
// Integer.parseInt(model == null ? "1" : "".equals(model) ? "1" : model),2, transferRecord);
// if (param.getImageList().size() < 1) {
// logger.info(" no imagelist ");
// continue;
// }
// String maprecogdata = restTemplate.postForObject(recogurl, param, String.class);
// try {
// Map result = new ObjectMapper().readValue(maprecogdata, Map.class);
// if (null != result.get("ret") && result.get("ret").equals("200")) {
// //变成为已分析
// transferRecord.setProcessstatus("-1");
// traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord);
// String recordtype = taskinfo.getRecordtype();
// JobTjParam jobTjParam = new JobTjParam();
// jobTjParam.setDeviceId(devicecode);
// jobTjParam.setDetectType(recordtype);
// String imageurl = transferRecord.getImg1path();
// List<Map> points = new ArrayList<>();
// //分析结果数据
// List<Map> objectresult = (List<Map>) result.get("ObjectList");
// if (objectresult.size() < 1) {
// logger.info(" objectresult is empty");
// continue;
// }
// //获得点位
// logger.info("获得点位");
// TraffpictureParam traffpictureParamresult = new TraffpictureParam();
// traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult,Integer.parseInt(taskinfo.getMetatype())
// , roiarray, imageurl, objectresult, jobTjParam, points);
// if(null==traffpictureParamresult){
// logger.info("人群密度未超或目标未出现");
// continue;
// }
// eventWriteService.setTraffpictureParam(recordtype, devicecode,
// transferRecord.getCreatetime(),
// traffpictureParamresult);
// //图片划线并上传
// logger.info("图片划线并上传");
// String basepath = DateUtils.formatCurrDayYM() +
// File.separator + DateUtils.formatCurrDayDD() + File.separator +
// devicecode;
// String filename = devicecode + "_" + DateUtils.parseDateToStrNoSign(transferRecord.getRecordtime()) +"_"+ recordtype+"_result.jpg";
// eventWriteService.uploadPicture(traffpictureParamresult, transferRecord.getImg1urlfrom(), points, basepath, filename);
// String filenameurl = File.separator + outpath + File.separator + basepath + File.separator + filename;
// jobTjParam.setImageUrl(weburl + filenameurl);
// logger.info("file path:{}",filenameurl);
// traffpictureParamresult.setImagedata(filenameurl);
// traffpictureParamresult.setProcessstatus("-1");
// traffPictureService.updateTraffpicture(traffpictureParamresult);
//
// //回调
// logger.info("send to dianxin data:{}",jobTjParam.toString());
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl());
//
// if (unionId.contains(devicecode)) {
// VoiceData voicedata = new VoiceData();
// voicedata.setAppKey(appKey);
// voicedata.setCorpId(corpId);
// Voice voice = new Voice();
// voice.setEventId(eventId);
// voice.setUnionId(unionId);
// voicedata.setRequestData(voice);
// // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata));
// eventWriteService.sendVoice(voicedata);
// }
// //推送告警到前端
// webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult));
// }
// } catch (Exception ex) {
// logger.error(ex.toString());
// }
// //其他数据如表
// //getMetaData( objectresult );
// }
// }
// return ResultUtil.success();
// } else {
// logger.info("监控不属于该范围");
// }
// //更新record 表Progress 字段,0为 未检测,-2 为检测失败,将检测
// //结果进行额外封装入表
// return ResultUtil.success();
// }
// @RequestMapping(value = "/getDeviceSnapshotAndRecognize", method = RequestMethod.POST)
// public String getDeviceSnapshotAndRecognize(@RequestBody String taskno) {
// //根据判断监控是否存在,该监控检测的事件是什么
// List<QuartzTaskInformations> mapList = sbtdspsrService.selectRecogByRtsp(taskno);
// String model = "1";
// //图片框选出来的范围
// Long[] roiarray;
// String devicecode="";
// if (null != mapList && !mapList.equals("") && mapList.size() > 0) {
// //查询该监控下面还没有经过分析的数据
// //Map<String, Object> map = new HashMap<>();
// //map.put("sbbh", devicecode);
//
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
// Map<String, Object> mapparam = new HashMap<>();
// roiarray = new Long[4];
// //获得该监控的检测业务与检测范围
// for (QuartzTaskInformations taskinfo : mapList) {
// roiarray[0] = new Long(taskinfo.getObjectx());
// roiarray[1] = new Long(taskinfo.getObjecty());
// roiarray[2] = new Long(taskinfo.getObjectw());
// roiarray[3] = new Long(taskinfo.getObjecth());
// devicecode=taskinfo.getExecuteparamter();
//// roiarray[0] = new Long(0);
//// roiarray[1] = new Long(0);
//// roiarray[2] = new Long(0);
//// roiarray[3] = new Long(0);
// // for (TraffAlarmRecord transferRecord : traffalarmrecordlist) {
// mapparam.put("deviceCode", devicecode);
// mapparam.put("model", model);
// mapparam.put("roi", roiarray);
//// logger.info("recogurl="+recogurl);
// Map objectList = restTemplate.getForObject(recogurl + "?deviceCode={deviceCode}&model={model}&roi={roi}", Map.class, mapparam);
//
// if (String.valueOf(objectList.get("ret")).equals("0")) {
// //变成为已分析
// // transferRecord.setProcessstatus("-1");
// // traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord);
// String recordtype=taskinfo.getRecordtype();
// JobTjParam jobTjParam = new JobTjParam();
// jobTjParam.setDeviceId(devicecode);
// jobTjParam.setDetectType(recordtype);
// String imageurl=objectList.get("url").toString();
// try {
// Map maprecogdata =new ObjectMapper().readValue(objectList.get("recogdata").toString(),Map.class);
// List<Map> points = new ArrayList<>();
// //分析结果数据
// List<Map> objectresult = (List<Map>) maprecogdata.get("ObjectList");
// if(objectresult.size()<1){
// logger.info(" objectresult is empty");
// continue;
// }
// //获得点位
// TraffpictureParam traffpictureParamresult = eventWriteService.getResult(Integer.parseInt(taskinfo.getMetatype())
// , roiarray,imageurl , objectresult, jobTjParam, points);
//
// eventWriteService.setTraffpictureParam(recordtype,devicecode,
// objectList.get("timestamp").toString(),
// traffpictureParamresult);
// //图片划线并上传
// String basepath = DateUtils.formatCurrDayYM()+
// File.separator+DateUtils.formatCurrDayDD()+ File.separator+
// devicecode ;
// String filename = devicecode+"_"+ DateUtils.formatCurrDateNoSign()+ "_result.jpg";
// eventWriteService.uploadPicture(traffpictureParamresult,imageurl, points, basepath, filename);
// String filenameurl=File.separator+outpath+File.separator+basepath+File.separator+filename;
// jobTjParam.setImageUrl(weburl+filenameurl);
//// logger.info("file path:{}",filenameurl);
// traffpictureParamresult.setImagedata(filenameurl);
// traffpictureParamresult.setProcessstatus("-1");
// traffPictureService.updateTraffpicture(traffpictureParamresult);
//
// //回调
//// logger.info("send to dianxin data:{}",JSONObject.toJSONString(jobTjParam));
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("")?callbackurl:taskinfo.getUrl());
//
// if (unionId.contains(devicecode)) {
// VoiceData voicedata = new VoiceData();
// voicedata.setAppKey(appKey);
// voicedata.setCorpId(corpId);
// Voice voice = new Voice();
// voice.setEventId(eventId);
// voice.setUnionId(unionId);
// voicedata.setRequestData(voice);
// // logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata));
// eventWriteService.sendVoice(voicedata);
// }
// //推送告警到前端
// webSocket.GroupSending(new ObjectMapper().writeValueAsString(traffpictureParamresult));
// } catch (Exception ex) {
//
// }
// //其他数据如表
// //getMetaData( objectresult );
// }
//
// }
// //}
// return ResultUtil.success();
// } else {
// logger.info("监控不属于该范围");
// }
// //更新record 表Progress 字段,0为 未检测,-2 为检测失败,将检测
// //结果进行额外封装入表
// return ResultUtil.success();
// }
// private void getMetaData( List<Map> objectresult ) {
// if (null != metadata) {
// traffpictureParamresult.setMetatype(String.valueOf(metadata.get("Type")));
// if ("1".equals(metadata.get("Type"))) {
// //规定范围内检测到人
// Pedestrian meta = new ObjectMapper().convertValue(metadata, Pedestrian.class);
// meta.setId(traffpictureParamresult.getId());
// pedestrianService.insertpedestrian(meta);
// if (null != meta.getFaceBoundingBox()) {
// list.add(new ObjectBoundingBox(meta.getFaceBoundingBox().getX() + roiarray[0].intValue(),
// meta.getFaceBoundingBox().getY() + roiarray[1].intValue(),
// meta.getFaceBoundingBox().getW(),
// meta.getFaceBoundingBox().getH()
// ));
// }
// if (null != meta.getObjectBoundingBox()) {
//
// list.add(new ObjectBoundingBox(meta.getObjectBoundingBox().getX() + roiarray[0].intValue(),
// meta.getObjectBoundingBox().getY() + roiarray[1].intValue(),
// meta.getObjectBoundingBox().getW(),
// meta.getObjectBoundingBox().getH()
// ));
// }
//
// if (null != meta.getHeadBoundingBox()) {
//
// list.add(new ObjectBoundingBox(meta.getHeadBoundingBox().getX() + roiarray[0].intValue(),
// meta.getHeadBoundingBox().getY() + roiarray[1].intValue(),
// meta.getHeadBoundingBox().getW(),
// meta.getHeadBoundingBox().getH()
// ));
// }
//
// if (null != meta.getUpperBoundingBox()) {
// list.add(new ObjectBoundingBox(meta.getUpperBoundingBox().getX() + roiarray[0].intValue(),
// meta.getUpperBoundingBox().getY() + roiarray[1].intValue(),
// meta.getUpperBoundingBox().getW(),
// meta.getUpperBoundingBox().getH()
// ));
// }
// if (null != meta.getLowerBoundingBox()) {
// list.add(new ObjectBoundingBox(meta.getLowerBoundingBox().getX() + roiarray[0].intValue(),
// meta.getLowerBoundingBox().getY() + roiarray[1].intValue(),
// meta.getLowerBoundingBox().getW(),
// meta.getLowerBoundingBox().getH()
// ));
// }
//
// } else if (null != metadata && "2".equals(metadata.get("Type"))) {
// //车辆
// Traffic meta = new ObjectMapper().convertValue(metadata, Traffic.class);
// meta.setId(traffpictureParamresult.getId());
// //新增到车辆详情表
// trafficService.insertTraffic(meta);
// if (null != meta.getObjectBoundingBox()) {
//
// list.add(new ObjectBoundingBox(meta.getObjectBoundingBox().getX() + roiarray[0].intValue(),
// meta.getObjectBoundingBox().getY() + roiarray[1].intValue(),
// meta.getObjectBoundingBox().getW(),
// meta.getObjectBoundingBox().getH()
// ));
// }
// } else if (null != metadata && "3".equals(metadata.get("Type"))) {
// Face meta = new ObjectMapper().convertValue(metadata, Face.class);
// meta.setId(traffpictureParamresult.getId());
// faceService.insertFace(meta);
// if (null != meta.getFaceBoundingBox()) {
// traffpictureParam.setObjx(meta.getFaceBoundingBox().getX() + roiarray[0].intValue());
// traffpictureParam.setObjy(meta.getFaceBoundingBox().getY() + roiarray[1].intValue());
// traffpictureParam.setObjw(meta.getFaceBoundingBox().getW());
// traffpictureParam.setObjh(meta.getFaceBoundingBox().getH());
// }
//
// if (null != meta.getFaceBoundingBox()) {
// list.add(new ObjectBoundingBox(meta.getFaceBoundingBox().getX() + roiarray[0].intValue(),
// meta.getFaceBoundingBox().getY() + roiarray[1].intValue(),
// meta.getFaceBoundingBox().getW(),
// meta.getFaceBoundingBox().getH()
// ));
// }
// if (null != meta.getHeadBoundingBox()) {
//
// list.add(new ObjectBoundingBox(meta.getHeadBoundingBox().getX() + roiarray[0].intValue(),
// meta.getHeadBoundingBox().getY() + roiarray[1].intValue(),
// meta.getHeadBoundingBox().getW(),
// meta.getHeadBoundingBox().getH()
// ));
// }
// //人骑车
// } else if (null != metadata && "4".equals(metadata.get("Type"))) {
// PeopleRideBicyc meta = new ObjectMapper().convertValue(metadata, PeopleRideBicyc.class);
// meta.setId(traffpictureParamresult.getId());
// peopleridebicycService.insertPeopleRideBicyc(meta);
// if (null != meta.getFaceBoundingBox()) {
// list.add(new ObjectBoundingBox(meta.getFaceBoundingBox().getX() + roiarray[0].intValue(),
// meta.getFaceBoundingBox().getY() + roiarray[1].intValue(),
// meta.getFaceBoundingBox().getW(),
// meta.getFaceBoundingBox().getH()
// ));
// }
// if (null != meta.getObjectBoundingBox()) {
//
// list.add(new ObjectBoundingBox(meta.getObjectBoundingBox().getX() + roiarray[0].intValue(),
// meta.getObjectBoundingBox().getY() + roiarray[1].intValue(),
// meta.getObjectBoundingBox().getW(),
// meta.getObjectBoundingBox().getH()
// ));
// }
// }
//
// }
// }
@RequestMapping(value = "/callback", method = RequestMethod.POST)
@ResponseBody
public ResultObj sendcallback(JobTjParam jobTjParam){
logger.info(JsonUtil.objToStr(jobTjParam));
return ResultObj.ok();
} }
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.Face;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Mapper
public interface FaceMapper {
int insertFace(Face face);
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.Pedestrian;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Mapper
public interface PedestrianMapper {
int insertpedestrian(Pedestrian pedestrian);
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.PeopleRideBicyc;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Mapper
public interface PeopleridebicycMapper {
int insertPeopleRideBicyc( PeopleRideBicyc peopleridebicyc);
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.Storageserver;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface StorageServerMapper {
List<Storageserver> queryStorageServerAll(Storageserver storageServer);
}
\ No newline at end of file
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.Traffic;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wjj
* @since 2021-04-29
*/@Mapper
public interface TrafficMapper {
int insertTraffic(Traffic traffic);
}
...@@ -4,7 +4,6 @@ import com.cx.cn.cxquartz.bean.GoalStructureParam; ...@@ -4,7 +4,6 @@ import com.cx.cn.cxquartz.bean.GoalStructureParam;
import com.cx.cn.cxquartz.bean.TaskResult; import com.cx.cn.cxquartz.bean.TaskResult;
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.redis.Consumer;
import com.cx.cn.cxquartz.service.quartz.AutoSnapService; import com.cx.cn.cxquartz.service.quartz.AutoSnapService;
import com.cx.cn.cxquartz.service.quartz.impl.TaskRecog; import com.cx.cn.cxquartz.service.quartz.impl.TaskRecog;
import com.cx.cn.cxquartz.util.JsonUtil; import com.cx.cn.cxquartz.util.JsonUtil;
...@@ -31,9 +30,6 @@ import java.util.*; ...@@ -31,9 +30,6 @@ import java.util.*;
@Component @Component
public class AutoSnapConsumer implements BaseConsumer{ public class AutoSnapConsumer implements BaseConsumer{
private List<Map> list=new ArrayList<>();
private static final Logger logger = LoggerFactory.getLogger(AutoSnapConsumer.class); private static final Logger logger = LoggerFactory.getLogger(AutoSnapConsumer.class);
@Autowired @Autowired
AutoSnapService autoSnapService; AutoSnapService autoSnapService;
...@@ -41,19 +37,6 @@ public class AutoSnapConsumer implements BaseConsumer{ ...@@ -41,19 +37,6 @@ public class AutoSnapConsumer implements BaseConsumer{
@Autowired @Autowired
TaskRecog taskRecog; 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;
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
......
...@@ -3,15 +3,12 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer; ...@@ -3,15 +3,12 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import java.io.IOException;
public interface BaseConsumer { public interface BaseConsumer {
/** /**
* 消息消费入口 * 消息消费入口
* *
* @param message * @param message
* @param channel * @param channel
* @throws IOException
*/ */
void consume(Message message, Channel channel) throws IOException; void consume(Message message, Channel channel);
} }
\ No newline at end of file
...@@ -2,7 +2,6 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer; ...@@ -2,7 +2,6 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService; import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import com.cx.cn.cxquartz.service.quartz.impl.ResultService;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -26,9 +25,6 @@ public class BaseConsumerProxy { ...@@ -26,9 +25,6 @@ public class BaseConsumerProxy {
@Autowired @Autowired
TraffPictureService traffPictureService; TraffPictureService traffPictureService;
@Autowired
ResultService resultService;
public BaseConsumerProxy(Object target, TraffPictureService traffPictureService) { public BaseConsumerProxy(Object target, TraffPictureService traffPictureService) {
this.target = target; this.target = target;
this.traffPictureService = traffPictureService; this.traffPictureService = traffPictureService;
......
package com.cx.cn.cxquartz.rabbitmq.comsumer;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.service.quartz.TraffAlarmRecordService;
import com.cx.cn.cxquartz.service.quartz.impl.ResultService;
import com.cx.cn.cxquartz.util.JsonUtil;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Map;
/**
* 消息处理并推送第三方
*/
@Component
public class EventProcessingConsumer implements BaseConsumer {
private static final Logger logger = LoggerFactory.getLogger(EventProcessingConsumer.class);
@Autowired
TraffAlarmRecordService traffAlarmRecordService;
@Autowired
ResultService resultService;
/**
* 消息消费入口
*
* @param message
* @param channel
* @throws IOException
*/
@Override
public void consume(Message message, Channel channel) throws IOException {
logger.info("TaskConsumConsumer 收到消息: {}", message.toString());
Map result = MessageHelper.msgToObj(message, Map.class);
if (null !=result) {
resultService.processResult(result);
}
}
}
package com.cx.cn.cxquartz.rabbitmq.comsumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
//@Component
public class ResendMessage {
private static final Logger logger = LoggerFactory.getLogger(ResendMessage.class);
@Autowired
private RabbitTemplate rabbitTemplate;
// 最大投递次数
private static final int MAX_TRY_COUNT = 3;
/**
* 每30s拉取投递失败的消息, 保证消息100%投递成功并被消费.
* 实际应用场景中, 可能由于网络原因, 或者消息未被持久化MQ就宕机了, 使得投递确认的回调方法ConfirmCallback没有被执行,
* 从而导致数据库该消息状态一直是投递中的状态, 此时就需要进行消息重投, 即使也许消息已经被消费了。
* 定时任务只是保证消息100%投递成功, 而多次投递的消费幂等性需要消费端自己保证。
* 我们可以将回调和消费成功后更新消息状态的代码注释掉, 开启定时任务, 查看是否重投。
*/
@Scheduled(cron = "0/30 * * * * ?")
public void resend() {
logger.info("开始执行定时任务(重新投递消息)");
// List<MessageLog> msgLogs = msgLogService.selectTimeoutMsg();
// //查询推送给失败的数据,重新投递,投递最大次数为三次
// msgLogs.forEach(msgLog -> {
// String msgId = msgLog.getMsgId();
// if (msgLog.getTryCount() >= MAX_TRY_COUNT) {
// msgLogService.updateStatus(msgId, QueueConstants.MessageLogStatus.DELIVER_FAIL);
// logger.info("超过最大重试次数, 消息投递失败, msgId: {}", msgId);
// } else {
// // 投递次数+1
// msgLogService.updateTryCount(msgId, msgLog.getNextTryTime());
//
// CorrelationData correlationData = new CorrelationData(msgId);
// // 重新投递
// rabbitTemplate.convertAndSend(msgLog.getExchange(), msgLog.getRoutingKey(),
// MessageHelper.objToMsg(msgLog.getMsg()), correlationData);
//
// logger.info("第 " + (msgLog.getTryCount() + 1) + " 次重新投递 MsgID:" + msgId + "的消息!");
// }
// });
logger.info("定时任务执行结束(重新投递消息)");
}
}
...@@ -34,12 +34,12 @@ public class SendToDXConsumer implements BaseConsumer { ...@@ -34,12 +34,12 @@ public class SendToDXConsumer implements BaseConsumer {
* @throws IOException * @throws IOException
*/ */
@Override @Override
public void consume(Message message, Channel channel) throws IOException { public void consume(Message message, Channel channel) {
logger.info("SendToDXConsumer 收到消息: {}", message.toString());
Map result = MessageHelper.msgToObj(message, Map.class); Map result = MessageHelper.msgToObj(message, Map.class);
if (null != result.get("id") && null!=result.get("traff") && null!=result.get("callback")) { if (null != result.get("id") && null!=result.get("traff") && null!=result.get("callback")) {
JobTjParam jobTjParam=JsonUtil.strToObj(result.get("traff").toString(),JobTjParam.class); JobTjParam jobTjParam=JsonUtil.strToObj(result.get("traff").toString(),JobTjParam.class);
if(null!=jobTjParam) { if(null!=jobTjParam) {
logger.info("callbackurl={}",result.get("callback").toString());
eventWriteService.sendEventByCallUrl(Long.parseLong(result.get("id").toString()) eventWriteService.sendEventByCallUrl(Long.parseLong(result.get("id").toString())
, jobTjParam, result.get("callback").toString()); , jobTjParam, result.get("callback").toString());
} }
......
...@@ -7,6 +7,7 @@ import com.cx.cn.cxquartz.util.JsonUtil; ...@@ -7,6 +7,7 @@ import com.cx.cn.cxquartz.util.JsonUtil;
import com.cx.cn.cxquartz.vo.JobTjParam; import com.cx.cn.cxquartz.vo.JobTjParam;
import com.cx.cn.cxquartz.vo.Voice; import com.cx.cn.cxquartz.vo.Voice;
import com.cx.cn.cxquartz.vo.VoiceData; import com.cx.cn.cxquartz.vo.VoiceData;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,18 +43,17 @@ public class SendToVoiceConsumer implements BaseConsumer { ...@@ -42,18 +43,17 @@ public class SendToVoiceConsumer implements BaseConsumer {
@Value("${voice.eventId}") @Value("${voice.eventId}")
private Integer eventId; private Integer eventId;
@Value("${voice.url}")
private String url;
/** /**
* 消息消费入口 * 消息消费入口
* *
* @param message * @param message
* @param channel * @param channel
* @throws IOException
*/ */
@Override @Override
public void consume(Message message, Channel channel) { public void consume(Message message, Channel channel) {
logger.info("SendToVoiceConsumer 收到消息: {}", message.toString());
Map result = MessageHelper.msgToObj(message, Map.class); Map result = MessageHelper.msgToObj(message, Map.class);
if (null != result.get("id") && null!=result.get("traff") && null!=result.get("callback")) { if (null != result.get("id") && null!=result.get("traff") && null!=result.get("callback")) {
JobTjParam jobTjParam=JsonUtil.strToObj(result.get("traff").toString(), JobTjParam.class); JobTjParam jobTjParam=JsonUtil.strToObj(result.get("traff").toString(), JobTjParam.class);
...@@ -63,9 +63,9 @@ public class SendToVoiceConsumer implements BaseConsumer { ...@@ -63,9 +63,9 @@ public class SendToVoiceConsumer implements BaseConsumer {
voicedata.setAppKey(appKey); voicedata.setAppKey(appKey);
voicedata.setCorpId(corpId); voicedata.setCorpId(corpId);
voicedata.setRequestData(new Voice(eventId,unionId)); voicedata.setRequestData(new Voice(eventId,unionId));
// logger.info(" send to voice: {}", new ObjectMapper().writeValueAsString(voicedata)); logger.info(" send to voice:{}",voicedata.toString());
//同步推送 //同步推送
eventWriteService.sendVoice(voicedata,result.get("callback").toString()); eventWriteService.sendVoice(voicedata,url);
} }
//推送告警到前端 //推送告警到前端
// webSocket.GroupSending(JsonUtil.objToStr(traffpictureParamresult)); // webSocket.GroupSending(JsonUtil.objToStr(traffpictureParamresult));
......
...@@ -3,10 +3,7 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer; ...@@ -3,10 +3,7 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer;
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.redis.OrderConsumer;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService; import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.service.quartz.TraffAlarmRecordService;
import com.cx.cn.cxquartz.service.quartz.impl.ResultService;
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.DateUtils;
import com.cx.cn.cxquartz.util.JsonUtil; import com.cx.cn.cxquartz.util.JsonUtil;
...@@ -36,9 +33,6 @@ import java.util.UUID; ...@@ -36,9 +33,6 @@ import java.util.UUID;
public class SnapTaskConsumer implements BaseConsumer { public class SnapTaskConsumer implements BaseConsumer {
private static final Logger logger = LoggerFactory.getLogger(SnapTaskConsumer.class); private static final Logger logger = LoggerFactory.getLogger(SnapTaskConsumer.class);
@Autowired
ResultService resultService;
@Value("${local.czurl}") @Value("${local.czurl}")
private String czurl; private String czurl;
@Value("${local.fxurl}") @Value("${local.fxurl}")
...@@ -66,15 +60,13 @@ public class SnapTaskConsumer implements BaseConsumer { ...@@ -66,15 +60,13 @@ public class SnapTaskConsumer implements BaseConsumer {
* @throws IOException * @throws IOException
*/ */
@Override @Override
public void consume(Message message, Channel channel) throws IOException { public void consume(Message message, Channel channel){
logger.info("SnapTaskConsumer 收到消息: {}", message.toString());
QuartzTaskInformations msg = MessageHelper.msgToObj(message, QuartzTaskInformations.class); QuartzTaskInformations msg = MessageHelper.msgToObj(message, QuartzTaskInformations.class);
if (null != msg) { if (null != msg) {
try { try {
//调用抽帧服务 //调用抽帧服务
String devicecode = msg.getExecuteparamter(); String devicecode = msg.getExecuteparamter();
String rtsporhls = ""; String rtsporhls = "";
logger.info("开始消费消息{}", msg.getId());
//如果设备编号是用一次废一次的,此刻需要现场取得rtsp //如果设备编号是用一次废一次的,此刻需要现场取得rtsp
if (null != devicecode && devicecode.startsWith("33") && devicecode.length() != 18) { if (null != devicecode && devicecode.startsWith("33") && devicecode.length() != 18) {
//调用抽帧服务 //调用抽帧服务
...@@ -112,7 +104,7 @@ public class SnapTaskConsumer implements BaseConsumer { ...@@ -112,7 +104,7 @@ public class SnapTaskConsumer implements BaseConsumer {
map.put("deviceID", devicecode); map.put("deviceID", devicecode);
map.put("resourceParam", rtsporhls); map.put("resourceParam", rtsporhls);
HttpEntity<Map> requestEntity = new HttpEntity<>(map, headers); HttpEntity<Map> requestEntity = new HttpEntity<>(map, headers);
logger.info("抽帧参数:{}", JsonUtil.objToStr(map)); logger.info("VideoRTSPorURL param:{}", JsonUtil.objToStr(map));
Map resultmap = restTemplate.postForObject(czurl, requestEntity, Map.class); Map resultmap = restTemplate.postForObject(czurl, requestEntity, Map.class);
if (null != resultmap.get("ret")) { if (null != resultmap.get("ret")) {
if (resultmap.get("ret").toString().equals("0") if (resultmap.get("ret").toString().equals("0")
...@@ -128,13 +120,13 @@ public class SnapTaskConsumer implements BaseConsumer { ...@@ -128,13 +120,13 @@ public class SnapTaskConsumer implements BaseConsumer {
MessageHelper.objToMsg(m), MessageHelper.objToMsg(m),
correlationData); correlationData);
} else { } else {
logger.error("抽帧失败:{}", JsonUtil.objToStr(resultmap)); logger.error("VideoRTSPorURLService error:{}", JsonUtil.objToStr(resultmap));
} }
} else { } else {
logger.error("返回状态码为null"); logger.error("VideoRTSPorURLService ->czurl> resultmap is null");
} }
} catch (Exception ex) { } catch (Exception ex) {
logger.error("消费消息{}error:{}", msg.getId(), ex.toString()); logger.error("VideoRTSPorURLService {}error:{}", msg.getId(), ex.toString());
} }
} }
} }
......
...@@ -19,7 +19,7 @@ import java.util.List; ...@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 消息处理并推送第三方 * 消息处理并推送第三方
*/ */
@Component @Component
public class TaskQSTConsumer{ public class TaskQSTConsumer{
...@@ -33,21 +33,8 @@ public class TaskQSTConsumer{ ...@@ -33,21 +33,8 @@ public class TaskQSTConsumer{
@Autowired @Autowired
TaskRecog taskRecog; 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 messageList
* @param channel * @param 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.AutoSnapConsumer; import com.cx.cn.cxquartz.rabbitmq.comsumer.AutoSnapConsumer;
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.service.quartz.TraffPictureService;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Consumer;
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.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;
...@@ -22,16 +18,17 @@ public class AutoSnapReceiver { ...@@ -22,16 +18,17 @@ public class AutoSnapReceiver {
private static final Logger logger = LoggerFactory.getLogger(AutoSnapReceiver.class); private static final Logger logger = LoggerFactory.getLogger(AutoSnapReceiver.class);
@Autowired @Autowired
private AutoSnapConsumer autoSnapConsumer; private AutoSnapConsumer autoSnapConsumer;
@RabbitListener(queues = QueueConstants.QueueAutoSnapConsumer.QUEUE) // @RabbitListener(queues = QueueConstants.QueueAutoSnapConsumer.QUEUE)
public void process(Message message, Channel channel) { public void process(Message message, Channel channel) {
try { try {
// logger.info("AutoSnapReceiver body:{}",message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(autoSnapConsumer); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(autoSnapConsumer);
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) {
logger.error("告警信息结果分析 error:{}",e); logger.error("AutoSnapReceiver error:{}",e);
} }
} }
} }
package com.cx.cn.cxquartz.rabbitmq.comsumer.listener;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumer;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumerProxy;
import com.cx.cn.cxquartz.rabbitmq.comsumer.EventProcessingConsumer;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 告警信息结果分析
*/
@Component
public class EventProcessingReceiver {
private static final Logger logger = LoggerFactory.getLogger(EventProcessingReceiver.class);
@Autowired
private EventProcessingConsumer eventProcessingConsumer;
@Autowired
private TraffPictureService traffPictureService;
// @RabbitListener(queues = QueueConstants.QueueEventProcessingConsumer.QUEUE)
public void process(Message message, Channel channel) {
try {
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(eventProcessingConsumer, traffPictureService);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
proxy.consume(message, channel);
}
} catch (Exception e) {
logger.error("告警信息结果分析 error:{}",e);
}
}
}
...@@ -24,13 +24,14 @@ public class RTSPorHLSReceiver { ...@@ -24,13 +24,14 @@ public class RTSPorHLSReceiver {
@RabbitListener(queues = QueueConstants.QueueRTSPConsumer.QUEUE) @RabbitListener(queues = QueueConstants.QueueRTSPConsumer.QUEUE)
public void process(Message message, Channel channel) { public void process(Message message, Channel channel) {
try { try {
// logger.info("RTSPorHLSReceiver body:{}",message.getBody());
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) {
logger.error("rtsp与hls超时过期更新 error:{}",e); logger.error("RTSPorHLSReceiver error:{}",e);
} }
} }
} }
...@@ -30,12 +30,16 @@ public class SendtoDXReceiver { ...@@ -30,12 +30,16 @@ public class SendtoDXReceiver {
* @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) {
logger.info("consumer->推送告警给第三方 消费者收到消息 : " + message.toString()); try {
// logger.info("SendtoDXReceiver body:{}", message.getBody());
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);
} }
}catch (Exception ex){
logger.error("SendtoDXReceiver error:{}", ex.toString());
}
} }
} }
...@@ -5,6 +5,8 @@ import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumer; ...@@ -5,6 +5,8 @@ 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.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
...@@ -17,7 +19,7 @@ import java.io.IOException; ...@@ -17,7 +19,7 @@ import java.io.IOException;
*/ */
@Component @Component
public class SendtoVoiceAlarmReceiver { public class SendtoVoiceAlarmReceiver {
private static final Logger logger = LoggerFactory.getLogger(SendtoVoiceAlarmReceiver.class);
@Autowired @Autowired
private SendToVoiceConsumer sendToVoiceConsumer; private SendToVoiceConsumer sendToVoiceConsumer;
/** /**
...@@ -28,11 +30,16 @@ public class SendtoVoiceAlarmReceiver { ...@@ -28,11 +30,16 @@ public class SendtoVoiceAlarmReceiver {
* @throws IOException * @throws IOException
*/ */
@RabbitListener(queues = QueueConstants.QueueSendToVoiceConsumer.QUEUE) @RabbitListener(queues = QueueConstants.QueueSendToVoiceConsumer.QUEUE)
public void consume(Message message, Channel channel) throws IOException { public void consume(Message message, Channel channel){
try {
// logger.info("SendtoVoiceAlarmReceiver body:{}", message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToVoiceConsumer); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToVoiceConsumer);
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 ex){
logger.error("SendtoVoiceReceiver error:{}", ex.toString());
}
} }
} }
...@@ -28,13 +28,14 @@ public class SnapTaskReceiver { ...@@ -28,13 +28,14 @@ public class SnapTaskReceiver {
@RabbitListener(queues = QueueConstants.QueueSnapTaskConsumer.QUEUE) @RabbitListener(queues = QueueConstants.QueueSnapTaskConsumer.QUEUE)
public void process(Message message, Channel channel) { public void process(Message message, Channel channel) {
try { try {
// logger.info("SnapTaskReceiver body:{}",message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapTaskConsumer, traffPictureService); BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapTaskConsumer, 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) {
logger.error("告警信息结果分析 error:{}",e); logger.error("SnapTaskReceiver error:{}",e);
} }
} }
} }
...@@ -30,7 +30,7 @@ public class TaskQSTReceiver implements BatchMessageListener { ...@@ -30,7 +30,7 @@ public class TaskQSTReceiver implements BatchMessageListener {
taskQSTConsumer.consume(messages,null); taskQSTConsumer.consume(messages,null);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("批量分析图片 error:{}",e.toString()); logger.error("TaskQSTReceiver error:{}",e.toString());
} }
} }
} }
...@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct; ...@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
/** /**
* 消息发送确认的回调 * 消息发送确认的回调
*/ */
@Component @Component
public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback { public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
...@@ -23,18 +23,18 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC ...@@ -23,18 +23,18 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC
private RabbitTemplate rabbitTemplate; private RabbitTemplate rabbitTemplate;
/** /**
* PostConstruct: 用于在依赖关系注入完成之后需要执行的方法上,以执行任何初始化. * PostConstruct: 用于在依赖关系注入完成之后需要执行的方法上,以执行任何初始化.
*/ */
@PostConstruct @PostConstruct
public void init() { public void init() {
//指定 ConfirmCallback //指定 ConfirmCallback
rabbitTemplate.setConfirmCallback(this); rabbitTemplate.setConfirmCallback(this);
//指定 ReturnCallback //指定 ReturnCallback
rabbitTemplate.setReturnCallback(this); rabbitTemplate.setReturnCallback(this);
} }
/** /**
* 消息从交换机成功到达队列,spring.rabbitmq.publisher-returns=true * 消息从交换机成功到达队列,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) {
...@@ -43,19 +43,17 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC ...@@ -43,19 +43,17 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC
} }
/** /**
* 消息找不到对应的Exchange会先触发此方法 * 消息找不到对应的Exchange会先触发此方法
* 如果消息没有到达交换机,则该方法中isSendSuccess = false,error为错误信息; * 如果消息没有到达交换机,则该方法中isSendSuccess = false,error为错误信息;
* 如果消息正确到达交换机,则该方法中isSendSuccess = true; * 如果消息正确到达交换机,则该方法中isSendSuccess = true;
* 需要开启 confirm 确认机制 * 需要开启 confirm 确认机制
* spring.rabbitmq.publisher-confirms=true * spring.rabbitmq.publisher-confirms=true
*/ */
@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) {
if (isSendSuccess) { if (!isSendSuccess) {
logger.info("confirm回调方法->消息成功发送到交换机!"); logger.info("confirm callback->[{}],error : [{}]", correlationData, error);
} else {
logger.info("confirm回调方法->消息[{}]发送到交换机失败!,原因 : [{}]", correlationData, error);
} }
} }
} }
......
package com.cx.cn.cxquartz.redis;
public interface Consumer {
void consume(Object message);
}
package com.cx.cn.cxquartz.redis;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.service.quartz.impl.VideoRTSPorURLService;
import com.cx.cn.cxquartz.util.DateUtils;
import com.cx.cn.cxquartz.util.JsonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.BatchingRabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
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.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.*;
@Component
public class OrderConsumer implements Consumer {
public static final Logger log = LoggerFactory.getLogger(OrderConsumer.class);
@Value("${local.czurl}")
private String czurl;
@Value("${local.fxurl}")
private String fxurl;
@Value("${file.rootpath}")
private String czrooturl;
@Autowired
private VideoRTSPorURLService videoRTSPorURLService;
@Autowired
private SbtdspsrService sbtdspsrService;
@Autowired
BatchingRabbitTemplate batchQueueRabbitTemplate;
private static OrderConsumer orderConsumer;
@Autowired
private RestTemplate restTemplate;
@PostConstruct
public void init() {
orderConsumer = this;
orderConsumer.batchQueueRabbitTemplate = this.batchQueueRabbitTemplate;
orderConsumer.czurl=this.czurl;
orderConsumer.fxurl=this.fxurl;
orderConsumer.videoRTSPorURLService=this.videoRTSPorURLService;
orderConsumer.sbtdspsrService=this.sbtdspsrService;
orderConsumer.restTemplate=this.restTemplate;
}
public OrderConsumer(){
}
@Override
public void consume(Object message) {
if(message instanceof QuartzTaskInformations){
QuartzTaskInformations msg =(QuartzTaskInformations) message;
try {
//调用抽帧服务
String devicecode=msg.getExecuteparamter();
String rtsporhls="";
log.info("开始消费消息{}", msg.getId());
//如果设备编号是用一次废一次的,此刻需要现场取得rtsp
if(null!=devicecode&&devicecode.startsWith("33") && devicecode.length()!=18){
//调用抽帧服务
String token= orderConsumer.videoRTSPorURLService.getRTSPAccessToekenByDeviceCode(devicecode);
rtsporhls=orderConsumer.videoRTSPorURLService.getRTSPByDeviceCode(token,devicecode);
}
else{
//取表里最新的rtsp 或者hls 的值
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 作为参数调用抽帧服务
// String result="{\n" +
// " \"ret\": 0,\n" +
// " \"desc\": \"succ!\",\n" +
// " \"resourcePath\": \"http://zjh189.ncpoi.cc:7080/download/202109/08/33050300001327599605/33050300001327599605_20210908_134131031.jpg\",\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.formatCurrDatefileYMD()+"/"+devicecode+"/"+devicecode+"_"+DateUtils.formatCurrDayNoSign()+"_"+DateUtils.formatCurrDateHHmmss()+".jpg");
map.put("deviceID",devicecode);
map.put("resourceParam",rtsporhls);
HttpEntity<Map> requestEntity = new HttpEntity<>(map, headers);
log.info("抽帧参数:{}",JsonUtil.objToStr(map));
Map resultmap= orderConsumer.restTemplate.postForObject(orderConsumer.czurl,requestEntity, 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条的去皮皮昂分析
Map m = new HashMap();
m.put("task", JsonUtil.objToStr(msg));
m.put("result", JsonUtil.objToStr(resultmap));
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
orderConsumer.batchQueueRabbitTemplate.send(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange(),
QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey() + "_QST",
MessageHelper.objToMsg(m),
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 result= CompletableFuture.supplyAsync(() -> HttpClientUtil.doGet(orderConsumer.recogurl + "?deviceCode="+msg.getExecuteparamter()+"&model="+orderConsumer.model+"&roi="+roistr)).get(2, TimeUnit.SECONDS);
// 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="+roiarray)).get(2, TimeUnit.SECONDS);
// log.info(" deviceCode:{} ",msg.getExecuteparamter());
// String result = HttpClientUtil.doGet(orderConsumer.recogurl + "?deviceCode=" + msg.getExecuteparamter() + "&model=" + orderConsumer.model + "&roi=" + roistr);
// log.info(" picture result:{} ",result);
// if (null != result && result.contains("ret"))//放入rabbitmq.数据由消费者去处理
// {
// Map objresult = JsonUtil.strToObj(result, Map.class);
// //处理消息
// if (null != objresult.get("ret") && objresult.get("ret").toString().equals("0")
// && null != objresult.get("desc")
// && objresult.get("desc").toString().contains("succ")) {
// Map m = new HashMap();
// m.put("task", JsonUtil.objToStr(msg));
// m.put("result", result);
// String msgId = UUID.randomUUID().toString();
// CorrelationData correlationData = new CorrelationData(msgId);
// //根绝不同的检测事件对象metatype分发到不同的通道
//
// orderConsumer.rabbitTemplate.convertAndSend(QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getExchange(),
// QueueConstants.QueueTaskEnum.QUEUE_TASK_ENUM.getRouteKey(),
// MessageHelper.objToMsg(m),
// correlationData);
// }
// }
//添加具体的消费逻辑,修改数据库什么的
}catch (Exception ex){
log.error("消费消息{}error:{}", msg.getId(), ex.toString());
}
}
}
}
package com.cx.cn.cxquartz.redis;
public class QueueConfiguration {
private String queue;
private Consumer consumer;
public static Builder builder(){
return new Builder();
}
public static class Builder{
private QueueConfiguration configuration = new QueueConfiguration();
public Builder queue(String queue) {
configuration.queue = queue;
return this;
}
public Builder consumer(Consumer consumer) {
configuration.consumer = consumer;
return this;
}
public QueueConfiguration build() {
if (configuration.queue == null || configuration.queue.length() == 0) {
if (configuration.consumer != null) {
configuration.queue = configuration.getClass().getSimpleName();
}
}
return configuration;
}
}
public void setQueue(String queue) {
this.queue = queue;
}
public void setConsumer(Consumer consumer) {
this.consumer = consumer;
}
public String getQueue() {
return queue;
}
public Consumer getConsumer() {
return consumer;
}
}
package com.cx.cn.cxquartz.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@Service
public class QueueSender {
@Autowired
private RedisTemplate redisTemplate;
public QueueSender(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
public void sendMsg(String queue, Object msg) {
redisTemplate.opsForList().leftPush(queue, msg);
}
}
package com.cx.cn.cxquartz.redis.container;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.redis.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.concurrent.TimeUnit;
public class QueueListener implements Runnable {
public static final Logger log = LoggerFactory.getLogger(QueueListener.class);
private RedisTemplate redisTemplate;
private String queue;
private Consumer consumer;
public QueueListener(RedisTemplate redisTemplate, String queue, Consumer consumer) {
this.redisTemplate = redisTemplate;
this.queue = queue;
this.consumer = consumer;
}
/**
* 使用队列右出获取消息
* 没获取到消息则线程 sleep 一秒,减少资源浪费
*/
@Override
public void run() {
try {
while (true) {
Object message = redisTemplate.opsForList().rightPop(queue);
if (message instanceof QuartzTaskInformations) {
consumer.consume(message);
} else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
log.error("RedisMQConsumer error:{}", e.toString());
}
}
}
} catch (Exception e) {
log.error("RedisMQConsumer error:{}", e.toString());
}
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.redis.container;
import com.cx.cn.cxquartz.redis.QueueConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
//@Component
public class RedisMQConsumerContainer {
public static final Logger log = LoggerFactory.getLogger(RedisMQConsumerContainer.class);
public static boolean RUNNING;
@Autowired
private RedisTemplate redisTemplate;
private Map<String,QueueConfiguration> consumerMap= new HashMap<>();
private ExecutorService executor;
public RedisMQConsumerContainer() {
init();
}
public void addConsumer(QueueConfiguration configuration) {
if (configuration.getConsumer() == null) {
log.warn("Key:{} consumer cannot be null, this configuration will be skipped", configuration.getQueue());
}
executor.submit(new QueueListener(redisTemplate,configuration.getQueue(),configuration.getConsumer()));
log.info("队列 {} 提交消息任务",configuration.getQueue());
}
public void destroy() {
log.info("Redis消息队列线程池关闭中");
RUNNING = false;
this.executor.shutdown();
log.info("QueueListener exiting.");
while (!this.executor.isTerminated()) {
log.error("this.executor.isTerminated()");
}
log.info("QueueListener exited.");
}
public void init() {
log.info("消息队列线程池初始化");
RUNNING = true;
this.executor= Executors.newCachedThreadPool();
// this.executor = Executors.newCachedThreadPool(r -> {
// 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.dao.StorageServerMapper;
import com.cx.cn.cxquartz.vo.Storageserver;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Service
public class CacheLoadService {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Value("${redis.cachekey.ftplist}")
private String ftplistkey;
@Autowired
private StorageServerMapper storageServerMapper;
public boolean loadFtpCache() {
try {
Storageserver server = new Storageserver();
server.setServerstatus(0);//�����õ�
server.setServertype("ftp");
List<Storageserver> storageServers = storageServerMapper.queryStorageServerAll(server);
if (!storageServers.isEmpty() && storageServers.size() > 0) {
stringRedisTemplate.opsForValue().set(ftplistkey, new Gson().toJson(storageServers),60, TimeUnit.SECONDS);
} else {
System.out.println("storageServers.isEmpty");
}
return true;
} catch (Exception e) {
System.out.println(e.toString());
return false;
}
}
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Code;
/**
* <p>
* 服务类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public interface CodeService {
Code selectalarmNum(String keyid);
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Face;
/**
* <p>
* 服务类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public interface FaceService {
int insertFace(Face face);
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Pedestrian;
/**
* <p>
* 服务类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public interface PedestrianService {
int insertpedestrian(Pedestrian pedestrian);
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.PeopleRideBicyc;
/**
* <p>
* 服务类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public interface PeopleridebicycService {
int insertPeopleRideBicyc( PeopleRideBicyc peopleridebicyc);
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Traffic;
/**
* <p>
* 服务类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public interface TrafficService {
int insertTraffic(Traffic traffic);
}
package com.cx.cn.cxquartz.service.quartz.impl; package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.AutoSanpMapper; 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.AutoSnapService;
import com.cx.cn.cxquartz.service.quartz.CodeService;
import com.cx.cn.cxquartz.vo.Autosnaptaskinfo; import com.cx.cn.cxquartz.vo.Autosnaptaskinfo;
import com.cx.cn.cxquartz.vo.Code;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.CodeMapper;
import com.cx.cn.cxquartz.service.quartz.CodeService;
import com.cx.cn.cxquartz.vo.Code;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class CodeServiceImpl implements CodeService {
@Autowired
private CodeMapper codeMapper;
@Override
public Code selectalarmNum(String keyid) {
return codeMapper.selectalarmNum(keyid);
}
}
...@@ -8,7 +8,6 @@ import org.slf4j.Logger; ...@@ -8,7 +8,6 @@ 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.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -18,7 +17,6 @@ import org.springframework.web.client.RestTemplate; ...@@ -18,7 +17,6 @@ import org.springframework.web.client.RestTemplate;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
...@@ -39,27 +37,10 @@ public class EventWriteService { ...@@ -39,27 +37,10 @@ public class EventWriteService {
@Autowired @Autowired
private TraffPictureMapper traffPictureMapper; private TraffPictureMapper traffPictureMapper;
@Value("${countryside.eventwrite.url}")
private String url;
@Value("${voice.url}")
private String voiceurl;
@Value("${countryside.eventwrite.timeout}")
private Integer timeout;
@Value("${countryside.eventwrite.token}")
private String qztoken;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired @Autowired
TraffPictureService traffPictureService; TraffPictureService traffPictureService;
@Autowired
TokenCacheService tokensertvice;
@Value("${local.czurl}") @Value("${local.czurl}")
private String czurl; private String czurl;
...@@ -70,39 +51,6 @@ public class EventWriteService { ...@@ -70,39 +51,6 @@ public class EventWriteService {
@Value("${file.outpath}") @Value("${file.outpath}")
private String outpath; private String outpath;
public void sendEvent(TraffpictureParam traffpictureParamresult, TraffrecordData sendtozhiui) {
if (traffpictureParamresult.getTargetnum().contains("/")) {
sendtozhiui.setAlarmnum(Integer.parseInt(traffpictureParamresult.getTargetnum().split("/")[1]));
} else {
sendtozhiui.setAlarmnum(Integer.parseInt(traffpictureParamresult.getTargetnum()));
}
sendtozhiui.setFdid(traffpictureParamresult.getFdid());
sendtozhiui.setRecordtype(traffpictureParamresult.getRecordtype());
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sendtozhiui.setRecordtime(traffpictureParamresult.getCreatetime() == null ? "" : format.format(traffpictureParamresult.getCreatetime()));
ResultObj resultObj;
try {
resultObj = sendMessage(sendtozhiui);
traffpictureParamresult.setPushdesc(resultObj.getMsg());
/* 成功 */
if ("0".equals(resultObj.getCode())) {
traffpictureParamresult.setPushstatus(0);
traffpictureParamresult.setPushdesc("推送成功");
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
return;
}
} catch (TimeoutException e) {
traffpictureParamresult.setPushdesc("请求超时");
log.error("eventwrite - sendEvent 请求超时:" + e.toString());
//return ResultObj.error(ResponseEnum.E_1008.getCode(), ResponseEnum.E_1008.getMsg());
} catch (Exception e) {
traffpictureParamresult.setPushdesc("请求失败");
log.error("eventwrite - sendEvent 异常:" + e.toString());
//return ResultObj.error(ResponseEnum.E_9999.getCode(), e.toString());
}
traffpictureParamresult.setPushstatus(-1);
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
}
public void sendVoice(VoiceData voice,String url ) { public void sendVoice(VoiceData voice,String url ) {
VoiceResultObj result; VoiceResultObj result;
...@@ -120,24 +68,6 @@ public class EventWriteService { ...@@ -120,24 +68,6 @@ public class EventWriteService {
} }
} }
private ResultObj sendMessage(TraffrecordData traffalarmrecord) throws InterruptedException, ExecutionException, TimeoutException {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
String token = stringRedisTemplate.opsForValue().get(qztoken);
if (null == token) {
token = tokensertvice.keepAlive();
}
headers.add("accessToken", token);
HttpEntity<TraffrecordData> requestEntity = new HttpEntity<>(traffalarmrecord, headers);
return CompletableFuture.supplyAsync(() -> restTemplate.postForObject(url, requestEntity, ResultObj.class)).get(timeout, TimeUnit.SECONDS);
}
private ResultObj sendToCalluri(JobTjParam jobTjParam, String callbackurl) throws InterruptedException, ExecutionException, TimeoutException {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<JobTjParam> requestEntity = new HttpEntity<>(jobTjParam, headers);
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();
...@@ -146,26 +76,6 @@ public class EventWriteService { ...@@ -146,26 +76,6 @@ public class EventWriteService {
return restTemplate.postForObject(callbackurl, requestEntity, ResultObj.class); return restTemplate.postForObject(callbackurl, requestEntity, ResultObj.class);
} }
public void sendEventByCallUrl(TraffpictureParam traffpictureParamresult, JobTjParam jobTjParam, String callbackurl) {
ResultObj resultObj;
try {
resultObj = sendToCalluri(jobTjParam, callbackurl);
traffpictureParamresult.setPushdesc(resultObj.getMsg());
if ("0".equals(resultObj.getCode())) {
traffpictureParamresult.setPushstatus(0);
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
return;
}
} catch (Exception e) {
traffpictureParamresult.setProcessstatus("-2");
traffpictureParamresult.setPushdesc("推送第三方失败");
log.error("eventwrite - sendEventByCallUrl 异常:" + e.toString());
//return ResultObj.error(ResponseEnum.E_9999.getCode(), e.toString());
}
traffpictureParamresult.setPushstatus(-1);
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();
...@@ -181,7 +91,7 @@ public class EventWriteService { ...@@ -181,7 +91,7 @@ public class EventWriteService {
} 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 error:" + e.toString());
} }
traffpictureParamresult.setPushstatus(-1); traffpictureParamresult.setPushstatus(-1);
traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult); traffPictureMapper.updateTraffpicturePushStatus(traffpictureParamresult);
......
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.FaceMapper;
import com.cx.cn.cxquartz.service.quartz.FaceService;
import com.cx.cn.cxquartz.vo.Face;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class FaceServiceImpl implements FaceService {
@Autowired
private FaceMapper faceMapper;
@Override
public int insertFace(Face face) {
return faceMapper.insertFace(face);
}
}
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.PedestrianMapper;
import com.cx.cn.cxquartz.service.quartz.PedestrianService;
import com.cx.cn.cxquartz.vo.Pedestrian;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class PedestrianServiceImpl implements PedestrianService {
@Autowired
private PedestrianMapper pedestrianMapper;
@Override
public int insertpedestrian(Pedestrian pedestrian) {
return pedestrianMapper.insertpedestrian(pedestrian);
}
}
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.PeopleridebicycMapper;
import com.cx.cn.cxquartz.service.quartz.PeopleridebicycService;
import com.cx.cn.cxquartz.vo.PeopleRideBicyc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class PeopleridebicycServiceImpl implements PeopleridebicycService {
@Autowired
private PeopleridebicycMapper peopleridebicycMapper;
@Override
public int insertPeopleRideBicyc(PeopleRideBicyc peopleridebicyc) {
return peopleridebicycMapper.insertPeopleRideBicyc( peopleridebicyc);
}
}
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.job.WebSocket;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import com.cx.cn.cxquartz.util.DateUtils;
import com.cx.cn.cxquartz.util.JsonUtil;
import com.cx.cn.cxquartz.vo.JobTjParam;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.vo.TraffpictureParam;
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.stereotype.Service;
import java.io.File;
import java.util.*;
@Service
public class ResultService {
@Autowired
EventWriteService eventWriteService;
@Autowired
TraffPictureService traffPictureService;
@Value("${file.outpath}")
private String outpath;
@Value("${voice.unionId}")
private String unionId;
@Value("${countryside.callbackurl}")
private String callbackurl;
@Value("${web.url}")
private String weburl;
@Value("${file.publicpictureurl}")
private String publicpictureurl;
@Value("${voice.appKey}")
private String appKey;
@Value("${voice.corpId}")
private String corpId;
@Value("${voice.eventId}")
private Integer eventId;
@Value("${file.rootpath}")
private String filerootpath;
@Autowired
WebSocket webSocket;
@Autowired
RabbitTemplate rabbitTemplate;
public static final Logger logger = LoggerFactory.getLogger(ResultService.class);
public void processResult( Map result) {
if(null==result.get("param"))return;
Map taskinfo= (Map) result.get("param");
String devicecode=(String) taskinfo.get("devicecode");
String recordtype =(String) taskinfo.get("recordtype");
String threshold=(String) taskinfo.get("threshold");
String timestamp=taskinfo.get("timestamp").toString().substring(0,taskinfo.get("timestamp").toString().indexOf("."));
JobTjParam jobTjParam = new JobTjParam();
jobTjParam.setDeviceId(devicecode);
jobTjParam.setDetectType(recordtype);
String imageurl = taskinfo.get("url").toString();
TraffpictureParam traffpictureParamresult=new TraffpictureParam();
// Map maprecogdata = JsonUtil.strToObj(objectList.get("recogdata").toString(), Map.class);
List<Map> points = new ArrayList<>();
//分析结果数据
if (null != result) {
List<Map> objectresult = (List<Map>) result.get("ObjectList");
if (objectresult.size() < 1) {
logger.info(" objectresult is empty");
} else {
Long[] roiarray = new Long[4];
getPoi(taskinfo, roiarray);
//图片划线并上传
String basepath = DateUtils.formatCurrDayYM() + File.separator + DateUtils.formatCurrDayDD() + File.separator + devicecode;
String filename = devicecode + "_" + DateUtils.parseDateToStrNoSign(timestamp) + "_"+ recordtype + "_result.jpg";
String filenameurl = File.separator + outpath + File.separator + basepath + File.separator + filename;
jobTjParam.setImageUrl(weburl + filenameurl);
traffpictureParamresult.setImagedata(filenameurl); //获得点位
logger.info("1");
traffpictureParamresult = eventWriteService.getResult(traffpictureParamresult, Integer.parseInt(threshold)
, roiarray, imageurl, objectresult, jobTjParam, points);
if (null == traffpictureParamresult) {
logger.info("未检测到结果");
} else {
logger.info("2");
//同步上传文件
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,
timestamp,
traffpictureParamresult);
if(null!=traffpictureParamresult.getPushstatus() && traffpictureParamresult.getPushstatus()==9) {
Map sendtodxmap = new HashMap();
sendtodxmap.put("id", traffpictureParamresult.getId());
sendtodxmap.put("traff", JsonUtil.objToStr(jobTjParam));
sendtodxmap.put("callback", taskinfo.get("url").equals("") ? callbackurl : taskinfo.get("url").toString());
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getExchange(),
QueueConstants.QueueSendToDXEnum.QUEUE_SEND_TO_DX_ENUM.getRouteKey(),
MessageHelper.objToMsg(sendtodxmap),
correlationData);
rabbitTemplate.convertAndSend(QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getExchange(),
QueueConstants.QueueSendToVoiceEnum.QUEUE_SEND_TO_VOICE_ENUM.getRouteKey(),
MessageHelper.objToMsg(sendtodxmap),
correlationData);
//回调第三方接口
// logger.info("send to dianxin data:{}",JSONObject.toJSONString(jobTjParam));
// eventWriteService.sendEventByCallUrl(traffpictureParamresult, jobTjParam, taskinfo.getUrl().equals("") ? callbackurl : taskinfo.getUrl());
}
}
}
}
// } catch(Exception ex){
// logger.error(" processResult error:{}", ex.toString());
// }
}
private void getPoi(Map taskinfo, Long[] roiarray) {
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());
}
}
}
...@@ -74,14 +74,10 @@ public class TaskRecog implements InitializingBean { ...@@ -74,14 +74,10 @@ public class TaskRecog implements InitializingBean {
} }
img.setData(picture.get("resourcePath").toString()); img.setData(picture.get("resourcePath").toString());
imglist.add(img); imglist.add(img);
recordtypeMap.put(i,new TaskResult(param.getVideoid(), recordtypeMap.put(i,new TaskResult(param.getVideoid(),param.getRecordtype(),
param.getRecordtype(), picture.get("timestamp").toString(), param.getObjectx(),param.getObjecty(),
picture.get("timestamp").toString(), param.getObjectw() , param.getObjecth(), picture.get("resourcePath").toString(),
param.getObjectx(),param.getObjecty(), param.getMetatype(), param.getSendtype(), param.getUrl()
param.getObjectw() , param.getObjecth(),
picture.get("resourcePath").toString(),
param.getMetatype(), param.getSendtype(),
param.getUrl()
) )
); );
i++; i++;
...@@ -89,9 +85,9 @@ public class TaskRecog implements InitializingBean { ...@@ -89,9 +85,9 @@ public class TaskRecog implements InitializingBean {
} }
goalSparam.setImageList(imglist); goalSparam.setImageList(imglist);
goalSparam.setModel(model); goalSparam.setModel(model);
logger.info("参数:{}",JsonUtil.objToStr(goalSparam)); logger.info("goalSparam:{}",JsonUtil.objToStr(goalSparam));
String resultstr = restTemplate.postForObject(recogqsturl, goalSparam, String.class); String resultstr = restTemplate.postForObject(recogqsturl, goalSparam, String.class);
logger.info("分析结果:{}",resultstr); logger.info("resultstr:{}",resultstr);
// try { // try {
Map resulMap = JsonUtil.strToObj(resultstr, Map.class); Map resulMap = JsonUtil.strToObj(resultstr, Map.class);
if (null != resulMap.get("ret") && resulMap.get("ret").equals("200")) { if (null != resulMap.get("ret") && resulMap.get("ret").equals("200")) {
......
package com.cx.cn.cxquartz.service.quartz.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
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.data.redis.core.StringRedisTemplate;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service
public class TokenCacheService {
private static final Logger log = LoggerFactory.getLogger(TokenCacheService.class);
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Value("${countryside.eventwrite.token}")
private String qztoken;
@Value("${countryside.eventwrite.expiretoken}")
private String expiretoken;
@Value("${countryside.appid}")
private String appid;
@Value("${countryside.appsecret}")
private String appsecret;
@Value("${countryside.tokenurl}")
private String tokenurl;
public String keepAlive() {
try {
String tokencache = stringRedisTemplate.opsForValue().get(qztoken);
if (tokencache != null) {
//判断是否过期
String datetime=stringRedisTemplate.opsForValue().get(expiretoken);
if( null!=datetime){
//预留1分钟过期时间
Long expireminiseconds =Long.parseLong(datetime);
if(new Date().getTime()<expireminiseconds)
{
return tokencache;
}
}
return loginServer();
} else {
return loginServer();
}
} catch (Exception e) {
System.out.println(e.toString());
}
return null;
}
private String loginServer() {
HttpHeaders headers = getHttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
RestTemplate client = new RestTemplate();
ResponseEntity<String> response = client.getForEntity((tokenurl+"?appid="+appid+"&appsecret="+appsecret),String.class);
return getTokenData(response);
}
private HttpHeaders getHttpHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
return headers;
}
private String getTokenData(ResponseEntity<String> response){
try {
if (response != null && response.getBody() != null && response.getBody().contains("code")) {
String ret = response.getBody();
Map map= new ObjectMapper().readValue(ret,Map.class);
if ( null !=map && null!=map.get("obj") &&("0").equals(map.get("code"))) {
Map object= new ObjectMapper().readValue(map.get("obj").toString(),Map.class);
if(null!=object && null!=object.get("accessToken")) {
Long time=Long.parseLong(object.get("expire").toString())-new Date().getTime();
stringRedisTemplate.opsForValue().set(expiretoken,time.toString(),time,TimeUnit.MILLISECONDS);
stringRedisTemplate.opsForValue().set(qztoken, String.valueOf(object.get("accessToken")), time,TimeUnit.MILLISECONDS);
return String.valueOf(object.get("accessToken"));
}
} else {
log.error("getTokenData error :" + response.getBody());
}
} else {
log.error("getTokenData empty...");
}
}catch (Exception e){
System.out.println(e.toString());
log.error(e.getMessage());
}
return null;
}
}
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.TrafficMapper;
import com.cx.cn.cxquartz.service.quartz.TrafficService;
import com.cx.cn.cxquartz.vo.Traffic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class TrafficServiceImpl implements TrafficService {
@Autowired
TrafficMapper trafficMapper;
@Override
public int insertTraffic(Traffic traffic) {
return trafficMapper.insertTraffic(traffic);
}
}
package com.cx.cn.cxquartz.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class AdminInterceptor implements HandlerInterceptor {
/**
* 在请求处理之前进行调用(Controller方法调用之前)
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
// System.out.println("执行了TestInterceptor的preHandle方法");
try {
//
// //统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session)
// String token = (String) request.getSession().getAttribute("token");
// RestTemplate restTemplate = new RestTemplate();
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// ResponseEntity<String> result = null;
// if (null == token) {
// //登录
//// String jsontoken= dologin(restTemplate,headers);
//// request.getSession().setAttribute("token",jsontoken);
// }
// else{//验证权限
// headers.add("access-token", request.getSession().getAttribute("token").toString());
// ResponseEntity<Map> response_result = restTemplate.exchange(
// "http://www.zjwwzf.cn/xzzfSpv/ext/auth/verify.do",
// HttpMethod.GET,
// new HttpEntity<String>(headers),
// Map.class,
// new HashMap<>());
// Map<Object,Object> bodyresult = response_result.getBody();
// if(null!=bodyresult.get("status") && !String.valueOf(bodyresult.get("status")).equals("0")){
// String jsontoken= dologin(restTemplate,headers);
// request.getSession().setAttribute("token",jsontoken);
// }
// }
} catch (Exception e) {
e.printStackTrace();
}
return true;//如果设置为false时,被请求时,拦截器执行到此处将不会继续操作
//如果设置为true时,请求将会继续执行后面的操作
}
/**
* 请求处理之后进行调用,但是在视图被渲染之前(Controller方法调用之后)
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
// System.out.println("执行了TestInterceptor的postHandle方法");
}
/**
* 在整个请求结束之后被调用,也就是在DispatcherServlet 渲染了对应的视图之后执行(主要是用于进行资源清理工作)
*/
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
// System.out.println("执行了TestInterceptor的afterCompletion方法");
}
}
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"));
}
}
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);
}
...@@ -6,8 +6,6 @@ import java.lang.annotation.RetentionPolicy; ...@@ -6,8 +6,6 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* @author aiheng@jd.com
* @date 2014年10月31日 上午11:46:46
* @desc 此注解用来控制属性别名 和 转换别名使用,用于xml2bean和bean2xml里的<对应别名>值的转换 * @desc 此注解用来控制属性别名 和 转换别名使用,用于xml2bean和bean2xml里的<对应别名>值的转换
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
......
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();
}
...@@ -6,8 +6,6 @@ import java.lang.annotation.RetentionPolicy; ...@@ -6,8 +6,6 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* @author aiheng@jd.com
* @date 2014年10月31日 下午5:25:09
* @desc 此注解用来忽略序列化属性 * @desc 此注解用来忽略序列化属性
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
......
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 org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class LoginConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
//注册TestInterceptor拦截器
InterceptorRegistration registration = registry.addInterceptor(new AdminInterceptor());
registration.addPathPatterns("/**"); //所有路径都被拦截
registration.excludePathPatterns( //添加不拦截路径
"/**/*.html", //html静态资源
"/**/*.js", //js静态资源
"/**/*.css", //css静态资源
"/**/*.woff",
"/**/*.ttf"
);
}
}
package com.cx.cn.cxquartz.util;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
public class RecursiveGetJsonData {
private static List<Object> list = new ArrayList<Object>(); //公共的的数据池
private String rootDir;//根目录
private List<File> jsonFileList = new ArrayList<File>();//公共的数据区域 找到的文件数据
public List<File> getJsonFileList() {
return jsonFileList;
}
public void setJsonFileList(List<File> jsonFileList) {
this.jsonFileList = jsonFileList;
}
public RecursiveGetJsonData(String rootDir) {
this.setRootDir(rootDir);
}
public RecursiveGetJsonData() { // 空构造方法
}
/**
* rootDir 根目录
* fileNameEndFlag 问价结尾标识
*
* @param rootDir
*/
public void getDataFromFile(String rootDir, final String fileNameEndFlag) {
File rootFile = new File(rootDir);
FileFilter filter = new FileFilter() { //文件后缀过滤
@Override
public boolean accept(File file) {
String fileName = file.getName();
if (fileName != null && fileName != "" && fileName.endsWith(fileNameEndFlag)) {
return true;
}
return false;
}
};
if (rootFile.isDirectory()) { //如果是目录
File[] listFiles = rootFile.listFiles(filter); // 满足条件的文件装入公共数据区
if (null != listFiles && listFiles.length > 0) {
jsonFileList.addAll(Arrays.asList(listFiles)); //Arrays 将数组转化为List集合
}
File[] list = rootFile.listFiles();
if (null != list && list.length > 0) {
for (int i = 0; i < list.length; i++) {
if (list[i].isDirectory()) {
getDataFromFile(list[i].getAbsolutePath(), fileNameEndFlag); //递归调用方法
}
}
}
}
}
public String ImageToBase64ByLocal(File file) {
InputStream in = null;
byte[] data = null;
// 读取图片字节数组
try {
//获取图片路径
in = new FileInputStream(file.getPath());
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
return null;
}
return Base64.getEncoder().encodeToString(data);
}
public String getRootDir() {
return rootDir;
}
public void setRootDir(String rootDir) {
this.rootDir = rootDir;
}
public static List<Object> getList() {
return list;
}
public static void setList(List<Object> list) {
RecursiveGetJsonData.list = list;
}
}
package com.cx.cn.cxquartz.util;
/**
* 通用序列枚举类
* @author cp
*/
public enum RedisEnum {
/**
* 支队心跳
*/
DETACHMENT_HEART_BEATS("gs:traff:detachment:heartbeats"),
/**
* FTP List
*/
FTPLIST("gs:traff:global:cache:ftplist"),
/**
* ftp index
*/
FTPLIST_INDEX("gs:traff:global:cache:ftplistindex");
private String value;
RedisEnum(String value){
this.value =value;
}
public String getValue() {
return value;
}
}
package com.cx.cn.cxquartz.util; package com.cx.cn.cxquartz.util;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord; import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -22,63 +21,6 @@ public class RestUtil { ...@@ -22,63 +21,6 @@ public class RestUtil {
@Autowired @Autowired
public RestTemplate restTemplate; public RestTemplate restTemplate;
@Autowired
public SbtdspsrService sbtdspsrService;
//
// public String getnewRtspVlue(String devicecode,String getrtspbyurl ){
// String rtspnewvalue="";
// Map<String, String> map = new HashMap<>();
// map.put("deviceCode", devicecode);
// ResponseEntity<String> responseEntity = restTemplate.getForEntity(getrtspbyurl+"?deviceCode={deviceCode}", String.class, map);
// JSONObject json = JSONObject.parseObject(responseEntity.getBody());
// if (null != json.getString("errorCode") && json.getString("errorCode").equals("0")) {
// //返回rtsp 地址
// json = JSONObject.parseObject(json.getString("data"));
// if (null != json.get("rtspUri") && !"".equals(json.get("rtspUri"))) {
// rtspnewvalue = String.valueOf(json.get("rtspUri"));
// if(rtspnewvalue.contains("rtsp")) {
// //更新sbtdspsr 地址
// int result = sbtdspsrService.updateRecogByRtsp(rtspnewvalue, devicecode);
// if (result > 0) {
// logger.info("更新rtsp success");
// } else {
// logger.info("设备" + devicecode + "不存在");
// }
// }
// else {
// logger.info("获取失败");
// }
// }
// }
// return rtspnewvalue;
// }
// public void rtspChangeVlue(String devicecode,String oldrtsp,String getrtspbyurl ){
// String rtspnewvalue="";
// Map<String, String> map = new HashMap<>();
// map.put("deviceCode", devicecode);
// ResponseEntity<String> responseEntity = restTemplate.getForEntity(getrtspbyurl+"?deviceCode={deviceCode}", String.class, map);
// JSONObject json = JSONObject.parseObject(responseEntity.getBody());
// if (null != json.getString("errorCode") && json.getString("errorCode").equals("0")) {
// //返回rtsp 地址
// json = JSONObject.parseObject(json.getString("data"));
// if (null != json.get("rtspUri") && !"".equals(json.get("rtspUri"))) {
// rtspnewvalue = String.valueOf(json.get("rtspUri"));
// //与新获得的rtsp 比较,如果一样则不更新,否则更新
// if(oldrtsp.contains("rtsp") && !oldrtsp.equals(rtspnewvalue)) {
// //更新sbtdspsr 地址
// int result = sbtdspsrService.updateRecogByRtsp(rtspnewvalue, devicecode);
// if (result > 0) {
// logger.info("更新rtsp success");
// } else {
// logger.info("设备" + devicecode + "不存在");
// }
// }
// else {
// logger.info("获取失败");
// }
// }
// }
// }
public String getPicture(List<String> imgUrls, String deviceCode, String rtspurl, TraffAlarmRecord record ) { public String getPicture(List<String> imgUrls, String deviceCode, String rtspurl, TraffAlarmRecord record ) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
...@@ -99,27 +41,6 @@ public class RestUtil { ...@@ -99,27 +41,6 @@ public class RestUtil {
} }
return null; return null;
} }
//
// public String getSnapshot(List<String> imgUrls, String deviceCode, String rtspurl, TraffAlarmRecord record ) {
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
// Map<String, Object> maps = new HashMap<>();
// maps.put("deviceCode", deviceCode);
// logger.info("rtspurl:{}",rtspurl);
// HttpEntity<String> formEntity = new HttpEntity<>(null, headers);
// ResponseEntity<String> exchange = restTemplate.exchange(rtspurl + "?deviceCode={deviceCode}",
// HttpMethod.GET, formEntity, String.class, maps);
// if(null!=exchange.getBody()) {
// JSONObject json = JSONObject.parseObject(exchange.getBody());
// if (null != json.getString("ret") && json.getString("ret").equals("0")) {
// //获得图片地址
// imgUrls.add(json.getString("url"));
// record.setImg1path(json.getString("url"));
// }
// return json.getString("timestamp");
// }
// return null;
// }
/// <summary> /// <summary>
/// 读取远程文件的内容 /// 读取远程文件的内容
......
package com.cx.cn.cxquartz.util;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
/**
* TraffAlarmRecord4��������ͼƬXԴ��ַ
* @author cp
*/
public enum TraffAlarmRecordFromImgEnum implements TraffAlarmRecordImg {
/**
* ����ͼƬ���õ�ַ
*/
IMG0 {
@Override
public void setImg(TraffAlarmRecord traffAlarmRecord, String img) {
traffAlarmRecord.setImg1urlfrom(img);
}
}
}
package com.cx.cn.cxquartz.util;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
/**
* TraffAlarmRecordͼƬӿ
* @author cp
*/
public interface TraffAlarmRecordImg {
void setImg(TraffAlarmRecord traffAlarmRecord, String img);
}
package com.cx.cn.cxquartz.util;
import java.util.UUID;
public class UUIDUtils {
/**
* UUID
* @return String32λUUID
*/
public static String createuuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
}
package com.cx.cn.cxquartz.vo; package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Capture { public class Capture {
private String deviceId; private String deviceId;
......
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class Face {
@JsonIgnore
private Long id;
private String Type;
private FaceBoundingBox FaceBoundingBox;
private HeadBoundingBox HeadBoundingBox;
private String Gender;
private String Age;
private String HasGlasses;
private String HasHat;
private String HasMask;
private String HairStyle;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setType(String Type) {
this.Type = Type;
}
public String getType() {
return Type;
}
public void setFaceBoundingBox(FaceBoundingBox FaceBoundingBox) {
this.FaceBoundingBox = FaceBoundingBox;
}
public FaceBoundingBox getFaceBoundingBox() {
return FaceBoundingBox;
}
public void setHeadBoundingBox(HeadBoundingBox HeadBoundingBox) {
this.HeadBoundingBox = HeadBoundingBox;
}
public HeadBoundingBox getHeadBoundingBox() {
return HeadBoundingBox;
}
public void setGender(String Gender) {
this.Gender = Gender;
}
public String getGender() {
return Gender;
}
public void setAge(String Age) {
this.Age = Age;
}
public String getAge() {
return Age;
}
public void setHasGlasses(String HasGlasses) {
this.HasGlasses = HasGlasses;
}
public String getHasGlasses() {
return HasGlasses;
}
public void setHasHat(String HasHat) {
this.HasHat = HasHat;
}
public String getHasHat() {
return HasHat;
}
public void setHasMask(String HasMask) {
this.HasMask = HasMask;
}
public String getHasMask() {
return HasMask;
}
public void setHairStyle(String HairStyle) {
this.HairStyle = HairStyle;
}
public String getHairStyle() {
return HairStyle;
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class FaceBoundingBox {
private int x;
private int y;
private int w;
private int h;
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
public void setW(int w) {
this.w = w;
}
public int getW() {
return w;
}
public void setH(int h) {
this.h = h;
}
public int getH() {
return h;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
import java.util.Date;
public class FileUploadResult {
private String filename;
private String url;
private String localuri;
private long length;
private Date timestamp;
public void setFilename(String filename) {
this.filename = filename;
}
public String getFilename() {
return filename;
}
public void setUrl(String url) {
this.url = url;
}
public String getUrl() {
return url;
}
public void setLocaluri(String localuri) {
this.localuri = localuri;
}
public String getLocaluri() {
return localuri;
}
public void setLength(long length) {
this.length = length;
}
public long getLength() {
return length;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public Date getTimestamp() {
return timestamp;
}
}
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import java.util.List;
public class FileUploadResultVo {
@JsonProperty("Url")
private String Url;
@JsonProperty("Error")
private String Error;
@JsonProperty("Code")
private int Code;
@JsonProperty("StackTrace")
private String StackTrace;
@JsonProperty("Data")
private List<FileUploadResult> Data;
@JsonProperty("ID")
private String ID;
public void setUrl(String Url) {
this.Url = Url;
}
public String getUrl() {
return Url;
}
public void setError(String Error) {
this.Error = Error;
}
public String getError() {
return Error;
}
public void setCode(int Code) {
this.Code = Code;
}
public int getCode() {
return Code;
}
public void setStackTrace(String StackTrace) {
this.StackTrace = StackTrace;
}
public String getStackTrace() {
return StackTrace;
}
public List<FileUploadResult> getData() {
return Data;
}
public void setData(List<FileUploadResult> data) {
Data = data;
}
public void setID(String ID) {
this.ID = ID;
}
public String getID() {
return ID;
}
}
package com.cx.cn.cxquartz.vo;
public class Ftp {
private String ftpIp;
private Integer ftpPort;
private String ftpUsername;
private String ftpPassword;
public Ftp() {
}
public Ftp(String ftpIp, Integer ftpPort, String ftpUsername, String ftpPassword) {
this.ftpIp = ftpIp;
this.ftpPort = ftpPort;
this.ftpUsername = ftpUsername;
this.ftpPassword = ftpPassword;
}
public String getFtpIp() {
return ftpIp;
}
public void setFtpIp(String ftpIp) {
this.ftpIp = ftpIp;
}
public Integer getFtpPort() {
return ftpPort;
}
public void setFtpPort(Integer ftpPort) {
this.ftpPort = ftpPort;
}
public String getFtpUsername() {
return ftpUsername;
}
public void setFtpUsername(String ftpUsername) {
this.ftpUsername = ftpUsername;
}
public String getFtpPassword() {
return ftpPassword;
}
public void setFtpPassword(String ftpPassword) {
this.ftpPassword = ftpPassword;
}
@Override
public String toString() {
return "Ftp{" +
"ftpIp='" + ftpIp + '\'' +
", ftpPort=" + ftpPort +
", ftpUsername='" + ftpUsername + '\'' +
", ftpPassword='" + ftpPassword + '\'' +
'}';
}
}
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
@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<Map> 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<Map> getImageList() {
return ImageList;
}
public void setImageList(List<Map> imageList) {
ImageList = imageList;
}
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class HeadBoundingBox {
private int x;
private int y;
private int w;
private int h;
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
public void setW(int w) {
this.w = w;
}
public int getW() {
return w;
}
public void setH(int h) {
this.h = h;
}
public int getH() {
return h;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
public class JobLJTParam {
private String taskid;
private String taskname;
private String devicenum;
private Integer starthour;
private Integer endhour;
private Integer intervals;
private String interfaceCode;
private String region;
private String spId;
private Integer status;
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 Integer getStarthour() {
return starthour;
}
public void setStarthour(Integer starthour) {
this.starthour = starthour;
}
public Integer getEndhour() {
return endhour;
}
public void setEndhour(Integer endhour) {
this.endhour = endhour;
}
public Integer getIntervals() {
return intervals;
}
public void setIntervals(Integer intervals) {
this.intervals = intervals;
}
public String getInterfaceCode() {
return interfaceCode;
}
public void setInterfaceCode(String interfaceCode) {
this.interfaceCode = interfaceCode;
}
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 Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
package com.cx.cn.cxquartz.vo;
import java.util.List;
import java.util.Map;
public class JobParam {
private String detectType;
private String deviceId;
private String type;
private String name;
private Map params;
private String callBackUrl;
private List<Point> area;
public String getDetectType() {
return detectType;
}
public void setDetectType(String detectType) {
this.detectType = detectType;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map getParams() {
return params;
}
public void setParams(Map params) {
this.params = params;
}
public String getCallBackUrl() {
return callBackUrl;
}
public void setCallBackUrl(String callBackUrl) {
this.callBackUrl = callBackUrl;
}
public List<Point> getArea() {
return area;
}
public void setArea(List<Point> area) {
this.area = area;
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class LowerBoundingBox {
private int x;
private int y;
private int w;
private int h;
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
public void setW(int w) {
this.w = w;
}
public int getW() {
return w;
}
public void setH(int h) {
this.h = h;
}
public int getH() {
return h;
}
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
import java.util.List;
public class Metadata {
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class ObjectBoundingBox {
private int x;
private int y;
private int w;
private int h;
public ObjectBoundingBox(int x, int y, int w, int h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
}
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
public void setW(int w) {
this.w = w;
}
public int getW() {
return w;
}
public void setH(int h) {
this.h = h;
}
public int getH() {
return h;
}
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
import java.util.List;
public class ObjectList {
private String ImageID;
private int ObjectID;
private Metadata Metadata;
private String Feature;
private int BucketID;
private List<Integer> BucketIDList;
private String FaceFeature;
private int FaceBucketID;
private List<Integer> FaceBucketIDList;
private String FaceQuality;
private String FaceYaw;
private String FacePitch;
private String FaceRoll;
private String FaceBlurry;
private String ObjectImageData;
private String FaceImageData;
private int Index;
public void setImageID(String ImageID) {
this.ImageID = ImageID;
}
public String getImageID() {
return ImageID;
}
public void setObjectID(int ObjectID) {
this.ObjectID = ObjectID;
}
public int getObjectID() {
return ObjectID;
}
public void setMetadata(Metadata Metadata) {
this.Metadata = Metadata;
}
public Metadata getMetadata() {
return Metadata;
}
public void setFeature(String Feature) {
this.Feature = Feature;
}
public String getFeature() {
return Feature;
}
public void setBucketID(int BucketID) {
this.BucketID = BucketID;
}
public int getBucketID() {
return BucketID;
}
public void setBucketIDList(List<Integer> BucketIDList) {
this.BucketIDList = BucketIDList;
}
public List<Integer> getBucketIDList() {
return BucketIDList;
}
public void setFaceFeature(String FaceFeature) {
this.FaceFeature = FaceFeature;
}
public String getFaceFeature() {
return FaceFeature;
}
public void setFaceBucketID(int FaceBucketID) {
this.FaceBucketID = FaceBucketID;
}
public int getFaceBucketID() {
return FaceBucketID;
}
public void setFaceBucketIDList(List<Integer> FaceBucketIDList) {
this.FaceBucketIDList = FaceBucketIDList;
}
public List<Integer> getFaceBucketIDList() {
return FaceBucketIDList;
}
public void setFaceQuality(String FaceQuality) {
this.FaceQuality = FaceQuality;
}
public String getFaceQuality() {
return FaceQuality;
}
public void setFaceYaw(String FaceYaw) {
this.FaceYaw = FaceYaw;
}
public String getFaceYaw() {
return FaceYaw;
}
public void setFacePitch(String FacePitch) {
this.FacePitch = FacePitch;
}
public String getFacePitch() {
return FacePitch;
}
public void setFaceRoll(String FaceRoll) {
this.FaceRoll = FaceRoll;
}
public String getFaceRoll() {
return FaceRoll;
}
public void setFaceBlurry(String FaceBlurry) {
this.FaceBlurry = FaceBlurry;
}
public String getFaceBlurry() {
return FaceBlurry;
}
public void setObjectImageData(String ObjectImageData) {
this.ObjectImageData = ObjectImageData;
}
public String getObjectImageData() {
return ObjectImageData;
}
public void setFaceImageData(String FaceImageData) {
this.FaceImageData = FaceImageData;
}
public String getFaceImageData() {
return FaceImageData;
}
public void setIndex(int Index) {
this.Index = Index;
}
public int getIndex() {
return Index;
}
public ObjectList() {
}
public ObjectList(String imageID, int objectID, com.cx.cn.cxquartz.vo.Metadata metadata, String feature, int bucketID, List<Integer> bucketIDList, String faceFeature, int faceBucketID, List<Integer> faceBucketIDList, String faceQuality, String faceYaw, String facePitch, String faceRoll, String faceBlurry, String objectImageData, String faceImageData, int index) {
ImageID = imageID;
ObjectID = objectID;
Metadata = metadata;
Feature = feature;
BucketID = bucketID;
BucketIDList = bucketIDList;
FaceFeature = faceFeature;
FaceBucketID = faceBucketID;
FaceBucketIDList = faceBucketIDList;
FaceQuality = faceQuality;
FaceYaw = faceYaw;
FacePitch = facePitch;
FaceRoll = faceRoll;
FaceBlurry = faceBlurry;
ObjectImageData = objectImageData;
FaceImageData = faceImageData;
Index = index;
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class ObjectListResult {
private ObjectResult recogdata;
private int ret;
private String desc;
private String url;
private String localuri;
private String timestamp;
public int getRet() {
return ret;
}
public void setRet(int ret) {
this.ret = ret;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLocaluri() {
return localuri;
}
public void setLocaluri(String localuri) {
this.localuri = localuri;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public ObjectResult getRecogdata() {
return recogdata;
}
public void setRecogdata(ObjectResult recogdata) {
this.recogdata = recogdata;
}
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
import java.util.List;
public class ObjectResult {
private List<ObjectList> ObjectList;
private String ret;
private String error_msg;
public ObjectResult() {
}
public ObjectResult(List<com.cx.cn.cxquartz.vo.ObjectList> objectList, String ret, String error_msg) {
ObjectList = objectList;
this.ret = ret;
this.error_msg = error_msg;
}
public List<com.cx.cn.cxquartz.vo.ObjectList> getObjectList() {
return ObjectList;
}
public void setObjectList(List<com.cx.cn.cxquartz.vo.ObjectList> objectList) {
ObjectList = objectList;
}
public String getRet() {
return ret;
}
public void setRet(String ret) {
this.ret = ret;
}
public String getError_msg() {
return error_msg;
}
public void setError_msg(String error_msg) {
this.error_msg = error_msg;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Output {
private int SubClass;
// //最大行人细类输出个数为1
// @JsonIgnore
// private int MaxHumanSubClassNum;
//
// //最大车辆细类输出个数为输出全部
// @JsonIgnore
// private int MaxVehicleSubClassNum;
// //最大骑行细类输出个数为3
// @JsonIgnore
// private int MaxBikeSubClassNum;
public Output(int subClass) {
SubClass = subClass;
// MaxHumanSubClassNum = maxHumanSubClassNum;
// MaxVehicleSubClassNum = maxVehicleSubClassNum;
// MaxBikeSubClassNum = maxBikeSubClassNum;
}
public Output() {
}
public void setSubClass(int SubClass) {
this.SubClass = SubClass;
}
@JsonProperty("SubClass")
public int getSubClass() {
return this.SubClass;
}
//
// public void setMaxHumanSubClassNum(int MaxHumanSubClassNum) {
// this.MaxHumanSubClassNum = MaxHumanSubClassNum;
// }
//
// @JSONField(name = "MaxHumanSubClassNum")
// public int getMaxHumanSubClassNum() {
// return this.MaxHumanSubClassNum;
// }
//
// public void setMaxVehicleSubClassNum(int MaxVehicleSubClassNum) {
// this.MaxVehicleSubClassNum = MaxVehicleSubClassNum;
// }
//
// @JSONField(name = "MaxVehicleSubClassNum")
// public int getMaxVehicleSubClassNum() {
// return this.MaxVehicleSubClassNum;
// }
//
// public void setMaxBikeSubClassNum(int MaxBikeSubClassNum) {
// this.MaxBikeSubClassNum = MaxBikeSubClassNum;
// }
//
// @JSONField(name = "MaxBikeSubClassNum")
// public int getMaxBikeSubClassNum() {
// return this.MaxBikeSubClassNum;
// }
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
/***
* 行人
*/
public class Pedestrian {
private Long id;
private String Type;
private ObjectBoundingBox ObjectBoundingBox;
private String Gender;
private String Age;
private String Angle;
private String HasBackpack;
private String HasGlasses;
private String HasCarrybag;
private String HasUmbrella;
private String CoatLength;
private String CoatColorNums;
private String CoatColor;
private String TrousersLength;
private String TrousersColorNums;
private String TrousersColor;
private HeadBoundingBox HeadBoundingBox;
private UpperBoundingBox UpperBoundingBox;
private LowerBoundingBox LowerBoundingBox;
private FaceBoundingBox FaceBoundingBox;
private String HasHat;
private String HasMask;
private String HairStyle;
private String CoatTexture;
private String TrousersTexture;
private String HasTrolley;
private String HasLuggage;
private String LuggageColorNums;
private String LuggageColor;
private int HasKnife;
public void setType(String Type) {
this.Type = Type;
}
@JsonProperty("Type")
public String getType() {
return Type;
}
public void setObjectBoundingBox(ObjectBoundingBox ObjectBoundingBox) {
this.ObjectBoundingBox = ObjectBoundingBox;
}
@JsonProperty("ObjectBoundingBox")
public ObjectBoundingBox getObjectBoundingBox() {
return ObjectBoundingBox;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setGender(String Gender) {
this.Gender = Gender;
}
@JsonProperty("Gender")
public String getGender() {
return Gender;
}
public void setAge(String Age) {
this.Age = Age;
}
@JsonProperty("Age")
public String getAge() {
return Age;
}
public void setAngle(String Angle) {
this.Angle = Angle;
}
@JsonProperty("Angle")
public String getAngle() {
return Angle;
}
public void setHasBackpack(String HasBackpack) {
this.HasBackpack = HasBackpack;
}
@JsonProperty("HasBackpack")
public String getHasBackpack() {
return HasBackpack;
}
public void setHasGlasses(String HasGlasses) {
this.HasGlasses = HasGlasses;
}
@JsonProperty("HasGlasses")
public String getHasGlasses() {
return HasGlasses;
}
public void setHasCarrybag(String HasCarrybag) {
this.HasCarrybag = HasCarrybag;
}
@JsonProperty("HasCarrybag")
public String getHasCarrybag() {
return HasCarrybag;
}
public void setHasUmbrella(String HasUmbrella) {
this.HasUmbrella = HasUmbrella;
}
@JsonProperty("HasUmbrella")
public String getHasUmbrella() {
return HasUmbrella;
}
public void setCoatLength(String CoatLength) {
this.CoatLength = CoatLength;
}
@JsonProperty("CoatLength")
public String getCoatLength() {
return CoatLength;
}
public void setCoatColorNums(String CoatColorNums) {
this.CoatColorNums = CoatColorNums;
}
@JsonProperty("CoatColorNums")
public String getCoatColorNums() {
return CoatColorNums;
}
public void setTrousersLength(String TrousersLength) {
this.TrousersLength = TrousersLength;
}
@JsonProperty( "TrousersLength")
public String getTrousersLength() {
return TrousersLength;
}
public void setTrousersColorNums(String TrousersColorNums) {
this.TrousersColorNums = TrousersColorNums;
}
@JsonProperty( "TrousersColorNums")
public String getTrousersColorNums() {
return TrousersColorNums;
}
public void setHeadBoundingBox(HeadBoundingBox HeadBoundingBox) {
this.HeadBoundingBox = HeadBoundingBox;
}
@JsonProperty("HeadBoundingBox")
public HeadBoundingBox getHeadBoundingBox() {
return HeadBoundingBox;
}
public void setUpperBoundingBox(UpperBoundingBox UpperBoundingBox) {
this.UpperBoundingBox = UpperBoundingBox;
}
@JsonProperty("UpperBoundingBox")
public UpperBoundingBox getUpperBoundingBox() {
return UpperBoundingBox;
}
public void setLowerBoundingBox(LowerBoundingBox LowerBoundingBox) {
this.LowerBoundingBox = LowerBoundingBox;
}
@JsonProperty("LowerBoundingBox")
public LowerBoundingBox getLowerBoundingBox() {
return LowerBoundingBox;
}
public void setFaceBoundingBox(FaceBoundingBox FaceBoundingBox) {
this.FaceBoundingBox = FaceBoundingBox;
}
@JsonProperty("FaceBoundingBox")
public FaceBoundingBox getFaceBoundingBox() {
return FaceBoundingBox;
}
public void setHasHat(String HasHat) {
this.HasHat = HasHat;
}
@JsonProperty("HasHat")
public String getHasHat() {
return HasHat;
}
public void setHasMask(String HasMask) {
this.HasMask = HasMask;
}
@JsonProperty("HasMask")
public String getHasMask() {
return HasMask;
}
public void setHairStyle(String HairStyle) {
this.HairStyle = HairStyle;
}
@JsonProperty( "HairStyle")
public String getHairStyle() {
return HairStyle;
}
public void setCoatTexture(String CoatTexture) {
this.CoatTexture = CoatTexture;
}
@JsonProperty("CoatTexture")
public String getCoatTexture() {
return CoatTexture;
}
public void setTrousersTexture(String TrousersTexture) {
this.TrousersTexture = TrousersTexture;
}
@JsonProperty("TrousersTexture")
public String getTrousersTexture() {
return TrousersTexture;
}
public void setHasTrolley(String HasTrolley) {
this.HasTrolley = HasTrolley;
}
@JsonProperty("HasTrolley")
public String getHasTrolley() {
return HasTrolley;
}
public void setHasLuggage(String HasLuggage) {
this.HasLuggage = HasLuggage;
}
@JsonProperty("HasLuggage")
public String getHasLuggage() {
return HasLuggage;
}
public void setLuggageColorNums(String LuggageColorNums) {
this.LuggageColorNums = LuggageColorNums;
}
@JsonProperty("LuggageColorNums")
public String getLuggageColorNums() {
return LuggageColorNums;
}
public void setHasKnife(int HasKnife) {
this.HasKnife = HasKnife;
}
@JsonProperty("HasKnife")
public int getHasKnife() {
return HasKnife;
}
@JsonProperty("CoatColor")
public String getCoatColor() {
return CoatColor;
}
public void setCoatColor(String coatColor) {
CoatColor = coatColor;
}
@JsonProperty("TrousersColor")
public String getTrousersColor() {
return TrousersColor;
}
public void setTrousersColor(String trousersColor) {
TrousersColor = trousersColor;
}
@JsonProperty("LuggageColor")
public String getLuggageColor() {
return LuggageColor;
}
public void setLuggageColor(String luggageColor) {
LuggageColor = luggageColor;
}
}
package com.cx.cn.cxquartz.vo;
import java.util.List;
public class PeopleRideBicyc {
private Long id;
private String Type;
private ObjectBoundingBox ObjectBoundingBox;
private String BikeClass;
private String Gender;
private String Age;
private String Angle;
private String HasBackpack;
private String HasGlasses;
private String HasMask;
private String HasCarrybag;
private String HasUmbrella;
private String CoatLength;
private String HasPlate;
private String PlateNo;
private String HasHelmet;
private String HelmetColor;
private String CoatColorNums;
private String CoatColor;
private String CoatTexture;
private FaceBoundingBox FaceBoundingBox;
private String SocialAttribute;
private String Enterprise;
private String HasPassenger;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setType(String Type) {
this.Type = Type;
}
public String getType() {
return Type;
}
public void setObjectBoundingBox(ObjectBoundingBox ObjectBoundingBox) {
this.ObjectBoundingBox = ObjectBoundingBox;
}
public ObjectBoundingBox getObjectBoundingBox() {
return ObjectBoundingBox;
}
public void setBikeClass(String BikeClass) {
this.BikeClass = BikeClass;
}
public String getBikeClass() {
return BikeClass;
}
public void setGender(String Gender) {
this.Gender = Gender;
}
public String getGender() {
return Gender;
}
public void setAge(String Age) {
this.Age = Age;
}
public String getAge() {
return Age;
}
public void setAngle(String Angle) {
this.Angle = Angle;
}
public String getAngle() {
return Angle;
}
public void setHasBackpack(String HasBackpack) {
this.HasBackpack = HasBackpack;
}
public String getHasBackpack() {
return HasBackpack;
}
public void setHasGlasses(String HasGlasses) {
this.HasGlasses = HasGlasses;
}
public String getHasGlasses() {
return HasGlasses;
}
public void setHasMask(String HasMask) {
this.HasMask = HasMask;
}
public String getHasMask() {
return HasMask;
}
public void setHasCarrybag(String HasCarrybag) {
this.HasCarrybag = HasCarrybag;
}
public String getHasCarrybag() {
return HasCarrybag;
}
public void setHasUmbrella(String HasUmbrella) {
this.HasUmbrella = HasUmbrella;
}
public String getHasUmbrella() {
return HasUmbrella;
}
public void setCoatLength(String CoatLength) {
this.CoatLength = CoatLength;
}
public String getCoatLength() {
return CoatLength;
}
public void setHasPlate(String HasPlate) {
this.HasPlate = HasPlate;
}
public String getHasPlate() {
return HasPlate;
}
public void setPlateNo(String PlateNo) {
this.PlateNo = PlateNo;
}
public String getPlateNo() {
return PlateNo;
}
public void setHasHelmet(String HasHelmet) {
this.HasHelmet = HasHelmet;
}
public String getHasHelmet() {
return HasHelmet;
}
public void setHelmetColor(String HelmetColor) {
this.HelmetColor = HelmetColor;
}
public String getHelmetColor() {
return HelmetColor;
}
public void setCoatColorNums(String CoatColorNums) {
this.CoatColorNums = CoatColorNums;
}
public String getCoatColorNums() {
return CoatColorNums;
}
public String getCoatColor() {
return CoatColor;
}
public void setCoatColor(String coatColor) {
CoatColor = coatColor;
}
public void setCoatTexture(String CoatTexture) {
this.CoatTexture = CoatTexture;
}
public String getCoatTexture() {
return CoatTexture;
}
public void setFaceBoundingBox(FaceBoundingBox FaceBoundingBox) {
this.FaceBoundingBox = FaceBoundingBox;
}
public FaceBoundingBox getFaceBoundingBox() {
return FaceBoundingBox;
}
public void setSocialAttribute(String SocialAttribute) {
this.SocialAttribute = SocialAttribute;
}
public String getSocialAttribute() {
return SocialAttribute;
}
public void setEnterprise(String Enterprise) {
this.Enterprise = Enterprise;
}
public String getEnterprise() {
return Enterprise;
}
public void setHasPassenger(String HasPassenger) {
this.HasPassenger = HasPassenger;
}
public String getHasPassenger() {
return HasPassenger;
}
}
package com.cx.cn.cxquartz.vo;
public class PictureResult {
Long recordid;
String key;
String result;
public PictureResult(Long recordid, String key, String result) {
this.recordid = recordid;
this.key = key;
this.result = result;
}
public Long getRecordid() {
return recordid;
}
public void setRecordid(Long recordid) {
this.recordid = recordid;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
public class QuartzTaskRecordsVo
{
private Long id;
private String taskno;
private String timekeyvalue;
private Long executetime;
private String taskstatus;
private Integer failcount;
private String failreason;
private Long createtime;
private Long lastmodifytime;
private Long time;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTaskno() {
return taskno;
}
public void setTaskno(String taskno) {
this.taskno = taskno;
}
public String getTimekeyvalue() {
return timekeyvalue;
}
public void setTimekeyvalue(String timekeyvalue) {
this.timekeyvalue = timekeyvalue;
}
public Long getExecutetime() {
return executetime;
}
public void setExecutetime(Long executetime) {
this.executetime = executetime;
}
public String getTaskstatus() {
return taskstatus;
}
public void setTaskstatus(String taskstatus) {
this.taskstatus = taskstatus;
}
public Integer getFailcount() {
return failcount;
}
public void setFailcount(Integer failcount) {
this.failcount = failcount;
}
public String getFailreason() {
return failreason;
}
public void setFailreason(String failreason) {
this.failreason = failreason;
}
public Long getCreatetime() {
return createtime;
}
public void setCreatetime(Long createtime) {
this.createtime = createtime;
}
public Long getLastmodifytime() {
return lastmodifytime;
}
public void setLastmodifytime(Long lastmodifytime) {
this.lastmodifytime = lastmodifytime;
}
public Long getTime() {
return time;
}
public void setTime(Long time) {
this.time = time;
}
}
package com.cx.cn.cxquartz.vo;
public enum ResponseEnum {
/* 错误信息 */
E_1000(1000, "返回值必须为PageResult"),
E_1001(1001, "必须传递分页参数"),
E_1002(1002, "参数值异常"),
E_1003(1003, "参数值转换异常"),
E_1004(1004, "参数值为空"),
/* 保存 更新 重置 删除 等 */
E_1005(1005,"更新失败"),
E_1006(1006,"无结果"),
E_1007(1007,"未登录"),
E_1008(1008,"请求超时"),
E_1009(1009,"请求下游服务异常"),
E_1010(1010,"数据保存失败"),
E_1011(1011,"数据重复"),
E_9999(9999,"系统异常"),
SUCCESS(0,"请求成功");
private int code;
private String msg;
ResponseEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class SafetyBelt {
private String MainDriver;
private String CoDriver;
public void setMainDriver(String MainDriver) {
this.MainDriver = MainDriver;
}
public String getMainDriver() {
return MainDriver;
}
public void setCoDriver(String CoDriver) {
this.CoDriver = CoDriver;
}
public String getCoDriver() {
return CoDriver;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
import java.io.Serializable;
import java.util.Date;
public class Storageserver{
private static final long serialVersionUID = 1L;
private Integer serverid;
private String servername;
private String servergroup;
private String servertype ;
private Integer serverstatus;
private String serveurl ;
private String serveip;
private String serverport;
private String serveruser;
private String serverpassword;
private String creator;
private Date createtime;
private String remark;
public Integer getServerid() {
return serverid;
}
public void setServerid(Integer serverid) {
this.serverid = serverid;
}
public String getServername() {
return servername;
}
public void setServername(String servername) {
this.servername = servername;
}
public String getServergroup() {
return servergroup;
}
public void setServergroup(String servergroup) {
this.servergroup = servergroup;
}
public String getServertype() {
return servertype;
}
public void setServertype(String servertype) {
this.servertype = servertype;
}
public Integer getServerstatus() {
return serverstatus;
}
public void setServerstatus(Integer serverstatus) {
this.serverstatus = serverstatus;
}
public String getServeurl() {
return serveurl;
}
public void setServeurl(String serveurl) {
this.serveurl = serveurl;
}
public String getServeip() {
return serveip;
}
public void setServeip(String serveip) {
this.serveip = serveip;
}
public String getServerport() {
return serverport;
}
public void setServerport(String serverport) {
this.serverport = serverport;
}
public String getServeruser() {
return serveruser;
}
public void setServeruser(String serveruser) {
this.serveruser = serveruser;
}
public String getServerpassword() {
return serverpassword;
}
public void setServerpassword(String serverpassword) {
this.serverpassword = serverpassword;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
public class TaskResultObj {
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 响应业务状态
* 200 成功
* 201 错误
* 400 参数错误
*/
private String errorCode;
/**
* 响应消息
*/
private String errorMsg;
/**
* 响应中的数据
*/
private Object data;
public static TaskResultObj error(String status, String msg, Object data) {
return new TaskResultObj(status, msg, data);
}
public static TaskResultObj ok(Object data) {
return new TaskResultObj(data);
}
public static TaskResultObj ok() {
return ok(null);
}
private TaskResultObj() {
}
public static TaskResultObj error(String status, String msg) {
return new TaskResultObj(status, msg, null);
}
private TaskResultObj(String status, String msg, Object data) {
this.errorCode = status;
this.errorMsg = msg;
this.data = data;
}
private TaskResultObj(Object data) {
this.errorCode = "0";
this.errorMsg = "success";
this.data = data;
}
/**
* 将json结果集转化为SysResult对象
*
* @param jsonData json数据
* @param clazz SysResult中的object类型
* @return SysResult对象
*/
public static TaskResultObj formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, TaskResultObj.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
return error(jsonNode.get("errorCode").toString(), jsonNode.get("errorMsg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 没有object对象的转化
*
* @param json 字符串
* @return SysResult对象
*/
public static TaskResultObj format(String json) {
try {
return MAPPER.readValue(json, TaskResultObj.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return SysResult对象
*/
public static TaskResultObj formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return error(jsonNode.get("errorCode").toString(), jsonNode.get("errorMsg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
\ No newline at end of file
...@@ -3,7 +3,6 @@ package com.cx.cn.cxquartz.vo; ...@@ -3,7 +3,6 @@ package com.cx.cn.cxquartz.vo;
import java.util.Date; import java.util.Date;
public class TraffAlarmRecord { public class TraffAlarmRecord {
private static final long serialVersionUID = 1L;
private Long recordid ;// ��¼��� �������� private Long recordid ;// ��¼��� ��������
private Integer algotype ;//--�㷨���� Ĭ���� 0:��˾ 1:��������˾ private Integer algotype ;//--�㷨���� Ĭ���� 0:��˾ 1:��������˾
......
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Date;
import java.util.List;
public class Traffic {
@JsonIgnore
private Long id;
private String Type;
private ObjectBoundingBox ObjectBoundingBox;
private String VehicleClass;
private String VehicleColorNums;
private String VehicleColor;
private String VehicleBrand;
private String mainBrandName;
private String subBrandName;
private String yearName;
private String HasPlate;
private String PlateClass;
private String PlateColor;
private String PlateNo;
private String PlateNeatness;
private String Angle;
private String Sunvisor;
private String Paper;
private String Decoration;
private String Drop;
private String Tag;
private SafetyBelt SafetyBelt;
private String HasCall;
private String HasCrash;
private String HasDanger;
private String HasSkylight;
private String HasBaggage;
private String HasAerial;
private String creattime;
public String getCreattime() {
return creattime;
}
public void setCreattime(String creattime) {
this.creattime = creattime;
}
public void setType(String Type) {
this.Type = Type;
}
public String getType() {
return Type;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setObjectBoundingBox(ObjectBoundingBox ObjectBoundingBox) {
this.ObjectBoundingBox = ObjectBoundingBox;
}
public ObjectBoundingBox getObjectBoundingBox() {
return ObjectBoundingBox;
}
public void setVehicleClass(String VehicleClass) {
this.VehicleClass = VehicleClass;
}
public String getVehicleClass() {
return VehicleClass;
}
public void setVehicleColorNums(String VehicleColorNums) {
this.VehicleColorNums = VehicleColorNums;
}
public String getVehicleColorNums() {
return VehicleColorNums;
}
public void setMainBrandName(String mainBrandName) {
this.mainBrandName = mainBrandName;
}
public String getMainBrandName() {
return mainBrandName;
}
public void setSubBrandName(String subBrandName) {
this.subBrandName = subBrandName;
}
public String getSubBrandName() {
return subBrandName;
}
public void setYearName(String yearName) {
this.yearName = yearName;
}
public String getYearName() {
return yearName;
}
public void setHasPlate(String HasPlate) {
this.HasPlate = HasPlate;
}
public String getHasPlate() {
return HasPlate;
}
public void setPlateClass(String PlateClass) {
this.PlateClass = PlateClass;
}
public String getPlateClass() {
return PlateClass;
}
public void setPlateColor(String PlateColor) {
this.PlateColor = PlateColor;
}
public String getPlateColor() {
return PlateColor;
}
public void setPlateNo(String PlateNo) {
this.PlateNo = PlateNo;
}
public String getPlateNo() {
return PlateNo;
}
public void setPlateNeatness(String PlateNeatness) {
this.PlateNeatness = PlateNeatness;
}
public String getPlateNeatness() {
return PlateNeatness;
}
public void setAngle(String Angle) {
this.Angle = Angle;
}
public String getAngle() {
return Angle;
}
public void setSunvisor(String Sunvisor) {
this.Sunvisor = Sunvisor;
}
public String getSunvisor() {
return Sunvisor;
}
public void setPaper(String Paper) {
this.Paper = Paper;
}
public String getPaper() {
return Paper;
}
public void setDecoration(String Decoration) {
this.Decoration = Decoration;
}
public String getDecoration() {
return Decoration;
}
public void setDrop(String Drop) {
this.Drop = Drop;
}
public String getDrop() {
return Drop;
}
public void setTag(String Tag) {
this.Tag = Tag;
}
public String getTag() {
return Tag;
}
public void setSafetyBelt(SafetyBelt SafetyBelt) {
this.SafetyBelt = SafetyBelt;
}
public SafetyBelt getSafetyBelt() {
return SafetyBelt;
}
public void setHasCall(String HasCall) {
this.HasCall = HasCall;
}
public String getHasCall() {
return HasCall;
}
public void setHasCrash(String HasCrash) {
this.HasCrash = HasCrash;
}
public String getHasCrash() {
return HasCrash;
}
public void setHasDanger(String HasDanger) {
this.HasDanger = HasDanger;
}
public String getHasDanger() {
return HasDanger;
}
public void setHasSkylight(String HasSkylight) {
this.HasSkylight = HasSkylight;
}
public String getHasSkylight() {
return HasSkylight;
}
public void setHasBaggage(String HasBaggage) {
this.HasBaggage = HasBaggage;
}
public String getHasBaggage() {
return HasBaggage;
}
public void setHasAerial(String HasAerial) {
this.HasAerial = HasAerial;
}
public String getHasAerial() {
return HasAerial;
}
public String getVehicleColor() {
return VehicleColor;
}
public void setVehicleColor(String vehicleColor) {
VehicleColor = vehicleColor;
}
public String getVehicleBrand() {
return VehicleBrand;
}
public void setVehicleBrand(String vehicleBrand) {
VehicleBrand = vehicleBrand;
}
}
package com.cx.cn.cxquartz.vo;
public class TransferResult {
Long recordid;
String pathvalue;
String urlfrom;
String imgpath;
Boolean result;
public TransferResult(Long recordid, String pathvalue, String urlfrom, String imgpath, Boolean result) {
this.recordid = recordid;
this.pathvalue = pathvalue;
this.urlfrom = urlfrom;
this.imgpath = imgpath;
this.result = result;
}
public Long getRecordid() {
return recordid;
}
public void setRecordid(Long recordid) {
this.recordid = recordid;
}
public String getPathvalue() {
return pathvalue;
}
public void setPathvalue(String pathvalue) {
this.pathvalue = pathvalue;
}
public String getUrlfrom() {
return urlfrom;
}
public void setUrlfrom(String urlfrom) {
this.urlfrom = urlfrom;
}
public String getImgpath() {
return imgpath;
}
public void setImgpath(String imgpath) {
this.imgpath = imgpath;
}
public Boolean getResult() {
return result;
}
public void setResult(Boolean result) {
this.result = result;
}
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
/**
* Auto-generated: 2021-04-28 19:16:46
*
* @author json.cn (i@json.cn)
* @website http://www.json.cn/java2pojo/
*/
public class UpperBoundingBox {
private int x;
private int y;
private int w;
private int h;
public void setX(int x) {
this.x = x;
}
public int getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public int getY() {
return y;
}
public void setW(int w) {
this.w = w;
}
public int getW() {
return w;
}
public void setH(int h) {
this.h = h;
}
public int getH() {
return h;
}
}
\ No newline at end of file
...@@ -37,4 +37,13 @@ public class VoiceData { ...@@ -37,4 +37,13 @@ public class VoiceData {
public void setRequestData(Voice requestData) { public void setRequestData(Voice requestData) {
this.requestData = requestData; this.requestData = requestData;
} }
@Override
public String toString() {
return "VoiceData{" +
"corpId='" + corpId + '\'' +
", appKey='" + appKey + '\'' +
", requestData=" + requestData +
'}';
}
} }
server:
port: 4082
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
local:
job: 0
czurl: http://localhost:4082/ext/getRTSP/1
fxurl: http://localhost:4082/ext/getDeviceSnapshotAndRecognize
server:
port: 4085
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
local:
job: 0
czurl: http://localhost:4085/ext/getRTSP/1
fxurl: http://localhost:4085/ext/getDeviceSnapshotAndRecognize
\ No newline at end of file
server: server:
port: 8083 port: 7083
spring: spring:
datasource: datasource:
url: jdbc:mysql://192.168.78.31:3307/hzdxtest?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 url: jdbc:mysql://192.168.78.31:3306/imagepro?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
username: hzdxtest username: root
password: 1qaz@wsx password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
maxActive: 20 maxActive: 20
...@@ -45,24 +45,16 @@ spring: ...@@ -45,24 +45,16 @@ spring:
initial-interval: 30000 initial-interval: 30000
#最大重试次数 #最大重试次数
max-attempts: 3 max-attempts: 3
redis:
database: 0
host: 192.168.78.31
port: 6379
pool:
max-active: 5 #连接池最大连接数(负值表示没有限制)
max-wait: 60000 #连接池最大阻塞等待时间(负值表示没有限制)
max-idle: 1 #连接池最大空闭连接数
min-idle: 1 #连接汉最小空闲连接数
timeout: 60000 #连接超时时间(毫秒)
countryside: countryside:
callbackurl: http://kvideo.51iwifi.com # callbackurl: http://kvideo.51iwifi.com
callbackurl: http://localhost:7083/ext/callback
file: file:
# rootpath: /home/ubuntu/pictures # rootpath: /home/ubuntu/pictures
rtspurl: http://172.16.24.29:7180/getDeviceSnapshot #旧版抽帧服务地址 rtspurl: http://172.16.24.29:7180/getDeviceSnapshot #旧版抽帧服务地址
uploadurl: http://172.16.24.29:7080/uploadResultFile uploadurl: http://172.16.24.29:7080/uploadResultFile
recogqsturl: http://172.16.24.29:9098/images/recog #分析 recogqsturl: http://172.16.24.29:9098/images/recog #分析
rootpath: /home/ubuntu/pictures/slice #测试环境抽帧地址 rootpath: /home/ubuntu/pic/slice #测试环境抽帧地址
local: local:
czurl: http://172.16.24.29:7780/getDeviceSnapshot #新版抽帧服务地址 czurl: http://172.16.24.29:7780/getDeviceSnapshot #新版抽帧服务地址
...@@ -78,7 +70,12 @@ rtspurl: ...@@ -78,7 +70,12 @@ rtspurl:
appid: 8e9c7ff0fc6c11eac5efb5371726daaf appid: 8e9c7ff0fc6c11eac5efb5371726daaf
appsecret: 8e9ca700fc6c11eac5efb5371726daaf appsecret: 8e9ca700fc6c11eac5efb5371726daaf
params: deviceCode params: deviceCode
voice:
url: http://106.13.41.128:9102/giant-sound/api/voice/1.0/play
appKey: 9555a51a08a2e1b1c9f02a5b3e9bea11
corpId: 587c9d56ee324c0186a86aea85fc7691
eventId: 5
unionId: 3YSCA450426N3XP
logging: logging:
level: level:
com.cx.cn.cxquartz.dao: com.cx.cn.cxquartz.dao:
......
server: server:
port: 8083 port: 7083
spring: spring:
datasource: datasource:
url: jdbc:mysql://192.168.78.31:3307/hzdxtest?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
username: hzdxtest username: root
password: 1qaz@wsx password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
maxActive: 20 maxActive: 20
...@@ -19,7 +19,7 @@ spring: ...@@ -19,7 +19,7 @@ spring:
poolPreparedStatements: true poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20 maxPoolPreparedStatementPerConnectionSize: 20
rabbitmq: rabbitmq:
host: 192.168.78.31 host: 172.16.24.29
port: 5672 port: 5672
username: admin username: admin
password: admin password: admin
...@@ -47,7 +47,7 @@ spring: ...@@ -47,7 +47,7 @@ spring:
max-attempts: 3 max-attempts: 3
redis: redis:
database: 0 database: 0
host: 192.168.78.31 host: 172.16.24.29
port: 6379 port: 6379
pool: pool:
max-active: 100 #连接池最大连接数(负值表示没有限制) max-active: 100 #连接池最大连接数(负值表示没有限制)
...@@ -65,7 +65,7 @@ file: ...@@ -65,7 +65,7 @@ file:
rootpath: /home/prod/pictures/snapshot #生产环境抽帧地址 rootpath: /home/prod/pictures/snapshot #生产环境抽帧地址
local: local:
czurl: http://172.16.24.29:7780/getDeviceSnapshot #新版抽帧服务地址 czurl: http://172.16.24.29:7781/getDeviceSnapshot #新版抽帧服务地址
fxurl: http://localhost:8083/ext/getDeviceSnapshotAndRecognize #抽帧分析一体服务 fxurl: http://localhost:8083/ext/getDeviceSnapshotAndRecognize #抽帧分析一体服务
hlsurl: hlsurl:
...@@ -78,7 +78,12 @@ rtspurl: ...@@ -78,7 +78,12 @@ rtspurl:
appid: 8e9c7ff0fc6c11eac5efb5371726daaf appid: 8e9c7ff0fc6c11eac5efb5371726daaf
appsecret: 8e9ca700fc6c11eac5efb5371726daaf appsecret: 8e9ca700fc6c11eac5efb5371726daaf
params: deviceCode params: deviceCode
voice:
url: http://106.13.41.128:9102/giant-sound/api/voice/1.0/play
appKey: 9555a51a08a2e1b1c9f02a5b3e9bea11
corpId: 587c9d56ee324c0186a86aea85fc7691
eventId: 5
unionId: 3YSCA450426N3XP
logging: logging:
level: level:
com.cx.cn.cxquartz.dao: com.cx.cn.cxquartz.dao:
......
server:
port: 4084
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
local:
job: 1
czurl: http://localhost:4082/ext/getRTSP/1
fxurl: http://localhost:4082/ext/getDeviceSnapshotAndRecognize
server:
port: 8083
spring:
datasource:
url: jdbc:mysql://localhost:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
rabbitmq:
host: 192.168.168.110
port: 5672
username: admin
password: admin
virtual-host: my_vhost
#消息发送到交换机确认机制,是否确认回调
publisher-confirms: true
##消息发送到交换机确认机制,是否返回回调
publisher-returns: true
#启用强制信息;默认false
template.mandatory: true
#设置为 true 后 消费者在消息没有被路由到合适队列情况下会被return监听,而不会自动删除
listener:
simple:
#设置手动确认(ack)
acknowledge-mode: manual
concurrency: 5
max-concurrency: 10
prefetch: 10
#开启消费者重试
retry:
enabled: true
#重试时间间隔
initial-interval: 3000
#最大重试次数
max-attempts: 3
redis:
database: 0
host: 192.168.168.110
port: 6379
pool:
max-active: 100 #连接池最大连接数(负值表示没有限制)
max-wait: 3000 #连接池最大阻塞等待时间(负值表示没有限制)
max-idle: 200 #连接池最大空闭连接数
min-idle: 50 #连接汉最小空闲连接数
timeout: 600 #连接超时时间(毫秒)
#logging:
# level:
# root:
# info
local:
job: 0
czurl: http://zjh189.ncpoi.cc:7780/getDeviceSnapshot
czrooturl: /home/ubuntu/pictures/slice
fxurl: http://localhost:8083/ext/getDeviceSnapshotAndRecognize
file:
rtspurl: http://zjh189.ncpoi.cc:7080/getDeviceSnapshot
recogurl: http://zjh189.ncpoi.cc:7080/getDeviceSnapshotAndRecognize
uploadurl: http://home2.ncpoi.cc:7080/uploadResultFile
model: 1
recogqsturl: http://zjh189.ncpoi.cc:9098/images/recog
rootpath: D://home/ubuntu/pictures/slice/
outpath: result
countryside:
callbackurl: http://kvideo.51iwifi.com/hesc-mq/hesc
hlsurl:
token: http://183.131.122.215:85/appApi/authenticate/getToken
url: http://183.131.122.215:85/appApi/forward/byCode/57240035916824
rtspurl:
token: http://kvideo.51iwifi.com/home_gw/getAccessToken
url: http://kvideo.51iwifi.com/home_gw/heschome_api/api/hesc/open/getRtsp
appid: 8e9c7ff0fc6c11eac5efb5371726daaf
appsecret: 8e9ca700fc6c11eac5efb5371726daaf
params: deviceCode
logging:
level:
com.cx.cn.cxquartz.dao:
debug
\ No newline at end of file
spring: spring:
profiles: profiles:
active: devconsum active: devconsumprod
Servlet: Servlet:
multipart: multipart:
...@@ -22,8 +22,6 @@ file: ...@@ -22,8 +22,6 @@ file:
outpath: result outpath: result
countryside: countryside:
callbackurl: http://kvideo.51iwifi.com/hesc-mq/hesc/mq/receive/aiCallback callbackurl: http://kvideo.51iwifi.com/hesc-mq/hesc/mq/receive/aiCallback
web: web:
......
#file.rtspurl=http://172.16.24.29:7080/getrealcamerasnapshot.php
#file.recogurl=http://172.16.24.29:9098/images/recog
redis.cachekey.ftplist=gs:traff:global:cache:ftplist
file.getrtspbyurl=http://212.129.142.17:8888/heschome_api/api/hesc/open/getRtsp
countryside.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraalarm
countryside.eventwrite.timeout=5
countryside.eventwrite.token=countrysidetoken
countryside.eventwrite.expiretoken=countrysideexpiretime
countryside.eventwrite.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraalarm
countryside.appid=05744e80b2c211ebe32a8e271066b19e
countryside.appsecret=a55a8870b2e911ebe32a8e271066b19e
countryside.tokenurl=http://countryside.51iwifi.com/gw/getAccessToken
file.publicpictureurl=http://zjh189.ncpoi.cc:10001/api/alg/files
file.ftppath=jiuling:9ling.cn@172.16.24.29:21
voice.url=http://106.13.41.128:9102/giant-sound/api/voice/1.0/play
voice.appKey=9555a51a08a2e1b1c9f02a5b3e9bea11
voice.corpId=587c9d56ee324c0186a86aea85fc7691
voice.eventId=5
voice.unionId=3YSCA450426N3XP
log4j2.formatMsgNoLookups=true
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<configuration debug="false" scan="false"> <configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/> <springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<!--<property name="log.path" value="/home/ubuntu/tar/zjdxtest/logs/${spring.application.name}"/>--> <!--<property name="log.path" value="/home/ubuntu/tar/zjdxtest/logs/${spring.application.name}"/>-->
<property name="log.path" value="/home/ubuntu/tar/logs/taskconsumption/${spring.application.name}"/> <property name="log.path" value="/home/prod/tar/log/taskconsumption/${spring.application.name}"/>
<!-- 彩色日志格式 --> <!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" <property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
......
<?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.CodeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="CodeBaseResultMap" type="com.cx.cn.cxquartz.vo.Code">
<result column="key" jdbcType="VARCHAR" property="key" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="CHAR" property="type" />
<result column="alarmlevel" jdbcType="VARCHAR" property="alarmlevel" />
<result column="rectifytime" jdbcType="INTEGER" property="rectifytime" />
<result column="manualchecktime" jdbcType="INTEGER" property="manualchecktime" />
<result column="pushchecktime" jdbcType="INTEGER" property="pushchecktime" />
<result column="maxnumvalue" jdbcType="INTEGER" property="maxnum" />
<result column="alarmnum" jdbcType="INTEGER" property="alarmnum" />
</resultMap>
<select id="selectalarmNum" resultMap="CodeBaseResultMap">
select * from t_code t where t.type=2 and t.key=#{key,jdbcType=VARCHAR}
</select>
</mapper>
<?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.FaceMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Face">
<id column="id" property="id"/>
<result column="facex" property="facex" />
<result column="facey" property="facey"/>
<result column="facew" property="facew"/>
<result column="faceh" property="faceh"/>
<result column="headx" property="headx"/>
<result column="heady" property="heady"/>
<result column="headw" property="headw"/>
<result column="headh" property="headh"/>
<result column="gender" property="gender"/>
<result column="age" property="age"/>
<result column="hasglasses" property="hasglasses"/>
<result column="hashat" property="hashat"/>
<result column="hasmask" property="hasmask"/>
<result column="hairstyle" property="hairstyle"/>
<result column="createtime" property="createtime"/>
<result column="updatetime" property="updatetime"/>
</resultMap>
<insert id="insertFace" parameterType="com.cx.cn.cxquartz.vo.Face">
insert into face
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id!= null">id,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.x!= null">facex,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.y!= null">facey,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.w!= null">facew,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.h!= null">faceh,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.x!= null">headx,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.y!= null">heady,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.w!= null">headw,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.h!= null">headh,</if>
<if test="Gender != null">gender ,</if>
<if test="Age != null">age ,</if>
<if test="HasGlasses != null">hasglasses ,</if>
<if test="HasHat != null">hashat ,</if>
<if test="HasMask!= null">hasmask ,</if>
<if test="HairStyle != null">hairstyle ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.x!= null">#{FaceBoundingBox.x},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.y!= null">#{FaceBoundingBox.y},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.w!= null">#{FaceBoundingBox.w},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.h!= null">#{FaceBoundingBox.h},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.x!= null">#{HeadBoundingBox.x},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.y!= null">#{HeadBoundingBox.y},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.w!= null">#{HeadBoundingBox.w},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.h!= null">#{HeadBoundingBox.h},</if>
<if test="Gender != null">#{Gender},</if>
<if test="Age!= null">#{Age},</if>
<if test="HasGlasses!= null">#{HasGlasses},</if>
<if test="HasHat!= null">#{HasHat},</if>
<if test="HasMask != null">#{HasMask},</if>
<if test="HairStyle!= null">#{HairStyle},</if>
</trim>
</insert>
</mapper>
<?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.PedestrianMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Pedestrian">
<result column="id" property="id"/>
<result column="type" property="Type"/>
<result column="gender" property="Gender"/>
<result column="age" property="Age"/>
<result column="angle" property="Angle"/>
<result column="hasbackpack" property="HasBackpack"/>
<result column="hasglasses" property="hasglasses"/>
<result column="hascarrybag" property="hascarrybag"/>
<result column="hasumbrella" property="hasumbrella"/>
<result column="coatlength" property="coatlength"/>
<result column="coatcolornums" property="coatcolornums"/>
<result column="coatcolor" property="coatcolor"/>
<result column="trouserslength" property="trouserslength"/>
<result column="trouserscolornums" property="trouserscolornums"/>
<result column="trouserscolor" property="trouserscolor"/>
<result column="headx" property="HeadBoundingBox.x"/>
<result column="heady" property="HeadBoundingBox.y"/>
<result column="headw" property="HeadBoundingBox.w"/>
<result column="headh" property="HeadBoundingBox.h"/>
<result column="upperx" property="UpperBoundingBox.x"/>
<result column="uppery" property="UpperBoundingBox.y"/>
<result column="upperw" property="UpperBoundingBox.w"/>
<result column="upperh" property="UpperBoundingBox.h"/>
<result column="lowerx" property="LowerBoundingBox.x"/>
<result column="lowery" property="LowerBoundingBox.y"/>
<result column="lowerw" property="LowerBoundingBox.w"/>
<result column="lowerh" property="LowerBoundingBox.h"/>
<result column="facex" property="FaceBoundingBox.x"/>
<result column="facey" property="FaceBoundingBox.y"/>
<result column="facew" property="FaceBoundingBox.w"/>
<result column="faceh" property="FaceBoundingBox.h"/>
<result column="hashat" property="hashat"/>
<result column="hasmask" property="hasmask"/>
<result column="hairstyle" property="hairstyle"/>
<result column="coattexture" property="coattexture"/>
<result column="trouserstexture" property="trouserstexture"/>
<result column="hastrolley" property="hastrolley"/>
<result column="hasluggage" property="hasluggage"/>
<result column="luggagecolornums" property="luggagecolornums"/>
<result column="luggagecolor" property="luggagecolor"/>
<result column="hasknife" property="hasknife"/>
<result column="objectx" property="objectx"/>
<result column="objecty" property="objecty"/>
<result column="objectw" property="objectw"/>
<result column="objecth" property="objecth"/>
</resultMap>
<insert id="insertpedestrian" parameterType="com.cx.cn.cxquartz.vo.Pedestrian">
insert into pedestrian
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id!= null">id ,</if>
<if test="Type!= null">type ,</if>
<if test="Gender!= null">gender ,</if>
<if test="Age!= null">age ,</if>
<if test="Angle!= null">Angle ,</if>
<if test="HasBackpack!= null">hasbackpack ,</if>
<if test="HasGlasses!= null">hasglasses ,</if>
<if test="HasCarrybag!= null">hascarrybag ,</if>
<if test="HasUmbrella!= null">hasumbrella ,</if>
<if test="CoatLength!= null">coatlength ,</if>
<if test="CoatColorNums!= null">coatcolornums ,</if>
<if test="CoatColor!= null">coatcolor ,</if>
<if test="TrousersLength!= null">trouserslength ,</if>
<if test="TrousersColorNums!= null">trouserscolornums ,</if>
<if test="TrousersColor!= null">trouserscolor ,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.x!= null">headx ,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.y!= null">heady ,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.w!= null">headw ,</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.h!= null">headh ,</if>
<if test="HeadBoundingBox!=null and UpperBoundingBox.x!= null">upperx ,</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.y!= null">uppery ,</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.w!= null">upperw ,</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.h!= null">upperh ,</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.x!= null">lowerx ,</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.y!= null">lowery ,</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.w!= null">lowerw ,</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.h!= null">lowerh ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.x!= null">facex ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.y!= null">facey ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.w!= null">facew ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.h!= null">faceh ,</if>
<if test="HasHat!= null">hashat ,</if>
<if test="HasMask!= null">hasmask ,</if>
<if test="HairStyle!= null">hairstyle ,</if>
<if test="CoatTexture!= null">coattexture ,</if>
<if test="TrousersTexture!= null">trouserstexture ,</if>
<if test="HasTrolley!= null">hastrolley ,</if>
<if test="HasLuggage!= null">hasluggage ,</if>
<if test="LuggageColorNums!= null">luggagecolornums ,</if>
<if test="LuggageColor!= null">luggagecolor ,</if>
<if test="HasKnife!= null">hasknife ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.x!= null">objectx ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.y!= null">objecty ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.w!= null">objectw ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.h!= null">objecth ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id!= null">#{id},</if>
<if test="Type!= null">#{Type},</if>
<if test="Gender!= null">#{Gender},</if>
<if test="Age!= null">#{Age},</if>
<if test="Angle!= null">#{Angle},</if>
<if test="HasBackpack!= null">#{HasBackpack},</if>
<if test="HasGlasses!= null">#{HasGlasses},</if>
<if test="HasCarrybag!= null">#{HasCarrybag},</if>
<if test="HasUmbrella!= null">#{HasUmbrella},</if>
<if test="CoatLength!= null">#{CoatLength},</if>
<if test="CoatColorNums!= null">#{CoatColorNums},</if>
<if test="CoatColor!= null">#{CoatColor},</if>
<if test="TrousersLength!= null">#{TrousersLength},</if>
<if test="TrousersColorNums!= null">#{TrousersColorNums},</if>
<if test="TrousersColor!= null">#{TrousersColor},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.x!= null">#{HeadBoundingBox.x},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.y!= null">#{HeadBoundingBox.y},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.w!= null">#{HeadBoundingBox.w},</if>
<if test="HeadBoundingBox!=null and HeadBoundingBox.h!= null">#{HeadBoundingBox.h},</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.x!= null">#{UpperBoundingBox.x},</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.y!= null">#{UpperBoundingBox.y},</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.w!= null">#{UpperBoundingBox.w},</if>
<if test="UpperBoundingBox!=null and UpperBoundingBox.h!= null">#{UpperBoundingBox.h},</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.x!= null">#{LowerBoundingBox.x},</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.y!= null">#{LowerBoundingBox.y},</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.w!= null">#{LowerBoundingBox.w},</if>
<if test="LowerBoundingBox!=null and LowerBoundingBox.h!= null">#{LowerBoundingBox.h},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.x!= null">#{FaceBoundingBox.x},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.y!= null">#{FaceBoundingBox.y},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.w!= null">#{FaceBoundingBox.w},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.h!= null">#{FaceBoundingBox.h},</if>
<if test="HasHat!= null">#{HasHat},</if>
<if test="HasMask!= null">#{HasMask},</if>
<if test="HairStyle!= null">#{HairStyle},</if>
<if test="CoatTexture!= null">#{CoatTexture},</if>
<if test="TrousersTexture!= null">#{TrousersTexture},</if>
<if test="HasTrolley!= null">#{HasTrolley},</if>
<if test="HasLuggage!= null">#{HasLuggage},</if>
<if test="LuggageColorNums!= null">#{LuggageColorNums},</if>
<if test="LuggageColor!= null">#{LuggageColor},</if>
<if test="HasKnife!= null">#{HasKnife},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.x!= null">#{ObjectBoundingBox.x},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.y!= null">#{ObjectBoundingBox.y},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.w!= null">#{ObjectBoundingBox.w},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.h!= null">#{ObjectBoundingBox.h},</if>
</trim>
</insert>
</mapper>
<?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.PeopleridebicycMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.PeopleRideBicyc">
<id column="id" property="id" />
<result column="type" property="type" />
<result column="objectx" property="objectx" />
<result column="objecty" property="objecty" />
<result column="obectw" property="obectw" />
<result column="objecth" property="objecth" />
<result column="bikeclass" property="bikeclass" />
<result column="gender" property="gender" />
<result column="age" property="age" />
<result column="angle" property="angle" />
<result column="hasbackpack" property="hasbackpack" />
<result column="hasglasses" property="hasglasses" />
<result column="hasmask" property="hasmask" />
<result column="hascarrybag" property="hascarrybag" />
<result column="hasumbrella" property="hasumbrella" />
<result column="coatlength" property="coatlength" />
<result column="hasplate" property="hasplate" />
<result column="plateno" property="plateno" />
<result column="hashelmet" property="hashelmet" />
<result column="helmetcolor" property="helmetcolor" />
<result column="coatcolornums" property="coatcolornums" />
<result column="coatcolor" property="coatcolor" />
<result column="coattexture" property="coattexture" />
<result column="facex" property="facex" />
<result column="facey" property="facey" />
<result column="facew" property="facew" />
<result column="faceh" property="faceh" />
<result column="socialattribute" property="socialattribute" />
<result column="enterprise" property="enterprise" />
<result column="haspassenger" property="haspassenger" />
<result column="createtime" property="createtime" />
<result column="updatetime" property="updatetime" />
</resultMap>
<insert id="insertPeopleRideBicyc" parameterType="com.cx.cn.cxquartz.vo.PeopleRideBicyc">
insert into peopleridebicyc
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id ,</if>
<if test="Type != null">type ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.x != null">objectx ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.y != null">objecty ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.w != null">obectw ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.h != null">objecth ,</if>
<if test="BikeClass != null">bikeclass ,</if>
<if test="Gender != null">gender ,</if>
<if test="Age != null">age ,</if>
<if test="Angle != null">angle ,</if>
<if test="HasBackpack != null">hasbackpack ,</if>
<if test="HasGlasses != null">hasglasses ,</if>
<if test="HasMask != null">hasmask ,</if>
<if test="HasCarrybag != null">hascarrybag ,</if>
<if test="HasUmbrella != null">hasumbrella ,</if>
<if test="CoatLength != null">coatlength ,</if>
<if test="HasPlate != null">hasplate ,</if>
<if test="PlateNo != null">plateno ,</if>
<if test="HasHelmet != null">hashelmet ,</if>
<if test="HelmetColor != null">helmetcolor ,</if>
<if test="CoatColorNums != null">coatcolornums ,</if>
<if test="CoatColor != null">coatcolor ,</if>
<if test="CoatTexture != null">coattexture ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.x != null">facex ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.y != null">facey ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.w != null">facew ,</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.h != null">faceh ,</if>
<if test="SocialAttribute != null">socialattribute ,</if>
<if test="Enterprise != null">enterprise ,</if>
<if test="HasPassenger != null">haspassenger ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="Type != null">#{Type},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.x != null">#{ObjectBoundingBox.x},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.y != null">#{ObjectBoundingBox.y},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.w != null">#{ObjectBoundingBox.w},</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.h != null">#{ObjectBoundingBox.h},</if>
<if test="BikeClass != null">#{BikeClass},</if>
<if test="Gender != null">#{Gender},</if>
<if test="Age != null">#{Age},</if>
<if test="Angle != null">#{Angle},</if>
<if test="HasBackpack != null">#{HasBackpack},</if>
<if test="HasGlasses != null">#{HasGlasses},</if>
<if test="HasMask != null">#{HasMask},</if>
<if test="HasCarrybag != null">#{HasCarrybag},</if>
<if test="HasUmbrella != null">#{HasUmbrella},</if>
<if test="CoatLength != null">#{CoatLength},</if>
<if test="HasPlate != null">#{HasPlate},</if>
<if test="PlateNo != null">#{PlateNo},</if>
<if test="HasHelmet != null">#{HasHelmet},</if>
<if test="HelmetColor != null">#{HelmetColor},</if>
<if test="CoatColorNums != null">#{CoatColorNums},</if>
<if test="CoatColor != null">#{CoatColor},</if>
<if test="CoatTexture != null">#{CoatTexture},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.x != null">#{FaceBoundingBox.x},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.y != null">#{FaceBoundingBox.y},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.w != null">#{FaceBoundingBox.w},</if>
<if test="FaceBoundingBox!=null and FaceBoundingBox.h != null">#{FaceBoundingBox.h},</if>
<if test="SocialAttribute != null">#{SocialAttribute},</if>
<if test="Enterprise != null">#{Enterprise},</if>
<if test="HasPassenger != null">#{HasPassenger},</if>
</trim>
</insert>
</mapper>
...@@ -62,4 +62,8 @@ ...@@ -62,4 +62,8 @@
where sbbh=#{sbbh} where sbbh=#{sbbh}
</update> </update>
<select id="getRtspOrHLSByDeviceCode" parameterType="java.lang.String" resultType="java.lang.String">
select squrllj from sbtdspsr where sbbh=#{deviceCode}
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="GBK"?>
<!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.StorageServerMapper">
<select id="queryStorageServerAll" resultType="com.cx.cn.cxquartz.vo.Storageserver">
select serverid
,servername ,servergroup ,servertype
,serverstatus ,serveurl ,serveip
,serverport ,serveruser ,serverpassword
from storageserver b
<where>
<if test="serverstatus != null">
and b.serverstatus = #{serverstatus}
</if>
<if test="servertype != null">
and b.servertype = #{servertype}
</if>
<if test="servergroup != null">
and b.servergroup = #{servergroup}
</if>
</where>
order by b.createtime desc
</select>
</mapper>
\ No newline at end of file
...@@ -5,25 +5,9 @@ ...@@ -5,25 +5,9 @@
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.TraffpictureParam"> <resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.TraffpictureParam">
<id column="recordid" property="recordid"/> <id column="recordid" property="recordid"/>
<result column="imageid" property="imageid"/> <result column="imageid" property="imageid"/>
<result column="areaid" property="areaid"/>
<result column="fdid" property="fdid"/> <result column="fdid" property="fdid"/>
<result column="channelid" property="channelid"/> <result column="channelid" property="channelid"/>
<result column="objectid" property="objectid"/>
<result column="recordtype" property="recordtype"/> <result column="recordtype" property="recordtype"/>
<result column="Feature" property="Feature"/>
<result column="bucketidlist" property="bucketidlist"/>
<result column="facefeature" property="facefeature"/>
<result column="facebucketid" property="facebucketid"/>
<result column="facebucketidlist" property="facebucketidlist"/>
<result column="facequality" property="facequality"/>
<result column="faceyaw" property="faceyaw"/>
<result column="facepitch" property="facepitch"/>
<result column="faceroll" property="faceroll"/>
<result column="faceblurry" property="faceblurry"/>
<result column="objectimagedata" property="objectimagedata"/>
<result column="faceimagedata" property="faceimagedata"/>
<result column="pindex" property="index"/>
<result column="metadataid" property="metadataid"/>
<result column="retrycount" property="retrycount"/> <result column="retrycount" property="retrycount"/>
<result column="recordlevel" property="recordlevel"/> <result column="recordlevel" property="recordlevel"/>
<result column="checkstatus" property="checkstatus"/> <result column="checkstatus" property="checkstatus"/>
...@@ -37,7 +21,6 @@ ...@@ -37,7 +21,6 @@
<result column="pushcount" property="pushcount"/> <result column="pushcount" property="pushcount"/>
<result column="pushdate" property="pushdate"/> <result column="pushdate" property="pushdate"/>
<result column="processstatus" property="processstatus"/> <result column="processstatus" property="processstatus"/>
<result column="manualstatus" property="manualstatus"/>
</resultMap> </resultMap>
...@@ -48,22 +31,6 @@ ...@@ -48,22 +31,6 @@
<if test="fdid != null">fdid,</if> <if test="fdid != null">fdid,</if>
<if test="channelid != null">channelid,</if> <if test="channelid != null">channelid,</if>
<if test="recordtype != null">recordtype,</if> <if test="recordtype != null">recordtype,</if>
<if test="areaid != null">areaid,</if>
<if test="imageid != null">imageid,</if>
<if test="objectid != null">objectid,</if>
<if test="feature != null">feature,</if>
<if test="bucketidlist != null">bucketidlist,</if>
<if test="facefeature != null">facefeature,</if>
<if test="facebucketid != null">facebucketid,</if>
<if test="facebucketidlist != null">facebucketidlist,</if>
<if test="facequality != null">facequality,</if>
<if test="faceyaw != null">faceyaw,</if>
<if test="faceroll != null">faceroll,</if>
<if test="facepitch != null">facepitch,</if>
<if test="faceblurry != null">faceblurry,</if>
<if test="objectimagedata != null">objectimagedata,</if>
<if test="faceimagedata != null">faceimagedata,</if>
<if test="index != null">pindex,</if>
<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>
...@@ -75,22 +42,6 @@ ...@@ -75,22 +42,6 @@
<if test="fdid != null">#{fdid},</if> <if test="fdid != null">#{fdid},</if>
<if test="channelid != null">#{channelid},</if> <if test="channelid != null">#{channelid},</if>
<if test="recordtype != null">#{recordtype},</if> <if test="recordtype != null">#{recordtype},</if>
<if test="areaid != null">#{areaid},</if>
<if test="imageid != null">#{imageid},</if>
<if test="objectid != null">#{objectid},</if>
<if test="feature != null">#{feature},</if>
<if test="bucketidlist != null">#{bucketidlist},</if>
<if test="facefeature != null">#{facefeature},</if>
<if test="facebucketid != null">#{facebucketid},</if>
<if test="facebucketidlist != null">#{facebucketidlist},</if>
<if test="facequality != null">#{facequality},</if>
<if test="faceyaw != null">#{faceyaw},</if>
<if test="faceroll != null">#{faceroll},</if>
<if test="facepitch != null">#{facepitch},</if>
<if test="faceblurry != null">#{faceblurry},</if>
<if test="objectimagedata != null">#{objectimagedata},</if>
<if test="faceimagedata != null">#{faceimagedata},</if>
<if test="index != null">#{index},</if>
<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>
...@@ -150,6 +101,5 @@ ...@@ -150,6 +101,5 @@
</update> </update>
<select id="queryimgdataByid" parameterType="java.lang.String" resultType="java.lang.String"> <select id="queryimgdataByid" parameterType="java.lang.String" resultType="java.lang.String">
select imagedata from traffpicture where id=#{id} select imagedata from traffpicture where id=#{id}
</select>
</select>
</mapper> </mapper>
\ No newline at end of file
<?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.TrafficMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Traffic">
<result column="id" property="id"/>
<result column="type" property="type"/>
<result column="objectx" property="objectx"/>
<result column="objecty" property="objecty"/>
<result column="objectw" property="objectw"/>
<result column="objecth" property="objecth"/>
<result column="vehicleclass" property="vehicleclass"/>
<result column="vehiclecolornums" property="vehiclecolornums"/>
<result column="vehiclecolor" property="vehiclecolor"/>
<result column="vehiclebrand" property="vehiclebrand"/>
<result column="mainbrandname" property="mainbrandname"/>
<result column="subbrandname" property="subbrandname"/>
<result column="yearname" property="yearname"/>
<result column="hasplate" property="hasplate"/>
<result column="plateclass" property="plateclass"/>
<result column="platecolor" property="platecolor"/>
<result column="plateno" property="plateno"/>
<result column="plateneatness" property="plateneatness"/>
<result column="angle" property="angle"/>
<result column="sunvisor" property="sunvisor"/>
<result column="paper" property="paper"/>
<result column="decoration" property="decoration"/>
<result column="drop" property="drop"/>
<result column="tag" property="tag"/>
<result column="maindriver" property="maindriver"/>
<result column="codriver" property="codriver"/>
<result column="hascall" property="hascall"/>
<result column="hascrash" property="hascrash"/>
<result column="hasdanger" property="hasdanger"/>
<result column="hasskylight" property="hasskylight"/>
<result column="hasbaggage" property="hasbaggage"/>
<result column="hasaerial" property="hasaerial"/>
</resultMap>
<insert id="insertTraffic" parameterType="com.cx.cn.cxquartz.vo.Traffic">
insert into traffic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id !=null">id,</if>
<if test="Type !=null"> type ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.x !=null"> objectx ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.y !=null"> objecty ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.w !=null"> objectw ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.h !=null"> objecth ,</if>
<if test="VehicleClass !=null"> vehicleclass ,</if>
<if test="VehicleColorNums !=null"> vehiclecolornums ,</if>
<if test="VehicleColor !=null"> vehiclecolor ,</if>
<if test="VehicleBrand !=null"> vehiclebrand ,</if>
<if test="mainBrandName !=null"> mainbrandname ,</if>
<if test="subBrandName !=null"> subbrandname ,</if>
<if test="yearName !=null"> yearname ,</if>
<if test="HasPlate !=null"> hasplate ,</if>
<if test="PlateClass !=null"> plateclass ,</if>
<if test="PlateColor !=null"> platecolor ,</if>
<if test="PlateNo !=null"> plateno ,</if>
<if test="PlateNeatness !=null"> plateneatness ,</if>
<if test="Angle !=null"> angle ,</if>
<if test="Sunvisor !=null"> sunvisor ,</if>
<if test="Paper !=null"> paper ,</if>
<if test="Decoration !=null"> decoration ,</if>
<if test="Drop !=null"> trafficdrop ,</if>
<if test="Tag !=null"> tag ,</if>
<if test="SafetyBelt.MainDriver !=null"> maindriver ,</if>
<if test="SafetyBelt.CoDriver !=null">codriver,</if>
<if test="HasCall !=null"> hascall ,</if>
<if test="HasCrash !=null"> hascrash ,</if>
<if test="HasDanger !=null"> hasdanger ,</if>
<if test="HasSkylight !=null"> hasskylight ,</if>
<if test="HasBaggage !=null"> hasbaggage ,</if>
<if test="HasAerial !=null"> hasaerial ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id !=null">#{id} ,</if>
<if test="Type !=null">#{Type} ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.x !=null">#{ObjectBoundingBox.x } ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.y !=null">#{ObjectBoundingBox.y} ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.w !=null">#{ObjectBoundingBox.w} ,</if>
<if test="ObjectBoundingBox!=null and ObjectBoundingBox.h !=null">#{ObjectBoundingBox.h} ,</if>
<if test="VehicleClass !=null">#{VehicleClass} ,</if>
<if test="VehicleColorNums !=null">#{VehicleColorNums} ,</if>
<if test="VehicleColor !=null">#{VehicleColor} ,</if>
<if test="VehicleBrand !=null">#{VehicleBrand} ,</if>
<if test="mainBrandName !=null">#{mainBrandName} ,</if>
<if test="subBrandName !=null">#{subBrandName} ,</if>
<if test="yearName !=null">#{yearName} ,</if>
<if test="HasPlate !=null">#{HasPlate} ,</if>
<if test="PlateClass !=null">#{PlateClass} ,</if>
<if test="PlateColor !=null">#{PlateColor} ,</if>
<if test="PlateNo !=null">#{PlateNo} ,</if>
<if test="PlateNeatness !=null">#{PlateNeatness} ,</if>
<if test="Angle !=null">#{Angle} ,</if>
<if test="Sunvisor !=null">#{Sunvisor} ,</if>
<if test="Paper !=null">#{Paper} ,</if>
<if test="Decoration !=null">#{Decoration} ,</if>
<if test="Drop !=null">#{Drop},</if>
<if test="Tag !=null">#{Tag},</if>
<if test="SafetyBelt!=null and SafetyBelt.MainDriver !=null">#{SafetyBelt.MainDriver} ,</if>
<if test="SafetyBelt!=null and SafetyBelt.CoDriver !=null">#{SafetyBelt.CoDriver},</if>
<if test="HasCall !=null">#{HasCall} ,</if>
<if test="HasCrash !=null">#{HasCrash} ,</if>
<if test="HasDanger !=null">#{HasDanger} ,</if>
<if test="HasSkylight !=null">#{HasSkylight} ,</if>
<if test="HasBaggage !=null">#{HasBaggage} ,</if>
<if test="HasAerial !=null">#{HasAerial} ,</if>
</trim>
</insert>
</mapper>
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