Commit a53e0467 authored by wangjinjing's avatar wangjinjing

修改同步

parent 44400cdd
......@@ -69,12 +69,6 @@
<version>2.9.6</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<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;
import org.springframework.context.annotation.Configuration;
/***
* 自动抓拍队列
* 自动抓拍队列
*/
@Configuration
public class AutoSnapConfig {
/**
* 创建交换机
* 创建交换机
*
* @return
*/
......@@ -25,7 +25,7 @@ public class AutoSnapConfig {
}
/**
* 创建队列 true表示是否持久
* 创建队列 true表示是否持久
*
* @return
*/
......@@ -35,7 +35,7 @@ public class AutoSnapConfig {
}
/**
* 将队列和交换机绑定,并设置用于匹配路由键
* 将队列和交换机绑定,并设置用于匹配路由键
*
* @return
*/
......
......@@ -22,17 +22,30 @@ public class RabbitConfig {
TaskScheduler taskScheduler=new ThreadPoolTaskScheduler();
return taskScheduler;
}
//批量处理rabbitTemplate
/***
* 批量处理rabbitTemplate
* @param connectionFactory
* @param taskScheduler
* @return
*/
@Bean("batchQueueRabbitTemplate")
public BatchingRabbitTemplate batchQueueRabbitTemplate(ConnectionFactory connectionFactory,
@Qualifier("batchQueueTaskScheduler") TaskScheduler taskScheduler){
int batchSize=1;
int bufferLimit=1024; //1 K
//1024M
int bufferLimit=1024;
//超时时间ms
long timeout=10000;
BatchingStrategy batchingStrategy=new SimpleBatchingStrategy(batchSize,bufferLimit,timeout);
return new BatchingRabbitTemplate(connectionFactory,batchingStrategy,taskScheduler);
}
/***
* 批量监听
* @param connectionFactory
* @return
*/
@Bean("batchQueueRabbitListenerContainerFactory")
public SimpleRabbitListenerContainerFactory batchQueueRabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
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.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;
import com.cx.cn.cxquartz.helper.MessageHelper;
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.vo.*;
import org.dom4j.Document;
......@@ -28,31 +29,40 @@ public class AutoSnapController {
@Value("${snapnote.note1}")
String note1;
@Autowired
AutoSnapService autoSnapService;
@RequestMapping(value = "/autoSnap", method = RequestMethod.POST)
@ResponseBody
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 filejpg:{}",filejpg.getName());
// /*如果文件不为空,保存文件*/
// /*如果文件不为空,保存文件*/
if (filexml != null && filejpg!= null) {
//获得xml文件里信息,获得图片地址,将信息与地址整合成rabbitmq 中的格式进行消费
//获得xml文件里信息,获得图片地址,将信息与地址整合成rabbitmq 中的格式进行消费
try {
Document doc= XmlUtils.readDocument(filexml);
Capture vCACapture=new Capture();
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()));
//获得jpg 文件,将文件存放到某个路径下面
//获得jpg 文件,将文件存放到某个路径下面
String filepath = DateUtils.formatCurrDatefileYMD() + File.separator + vCACapture.getDeviceId() + File.separator + vCACapture.getDeviceId() + "_" + DateUtils.formatDateToNoSign(vCACapture.getDateTime()) + ".jpg";
logger.info(filepath);
//将文件copy到该路径下
//将文件copy到该路径下
File desfile = new File(note1 +File.separator + filepath);
if (!desfile.getParentFile().exists()) {
desfile.getParentFile().mkdirs();
}
filejpg.transferTo(desfile);
Map map=new HashMap<>();
map.put("resourcePath",filepath);//不加节点的resourcePath,方便哪个节点的消费者抢到消息直接添加节点信息
map.put("resourcePath",filepath);//不加节点的resourcePath,方便哪个节点的消费者抢到消息直接添加节点信息
map.put("timestamp", vCACapture.getDateTime());
map.put("devicecode", vCACapture.getDeviceId());
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
......@@ -61,7 +71,7 @@ public class AutoSnapController {
MessageHelper.objToMsg(map),
correlationData);
return "success";
//拼接数据为如下格式
//拼接数据为如下格式
// String result="{\n" +
// " \"ret\": 0,\n" +
// " \"desc\": \"succ!\",\n" +
......@@ -76,7 +86,7 @@ public class AutoSnapController {
return "IO error";
}
}else{
logger.error("参数为null");
logger.error("参数为null");
return "null";
}
}
......
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;
import com.cx.cn.cxquartz.bean.TaskResult;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.rabbitmq.QueueConstants;
import com.cx.cn.cxquartz.redis.Consumer;
import com.cx.cn.cxquartz.service.quartz.AutoSnapService;
import com.cx.cn.cxquartz.service.quartz.impl.TaskRecog;
import com.cx.cn.cxquartz.util.JsonUtil;
......@@ -31,9 +30,6 @@ import java.util.*;
@Component
public class AutoSnapConsumer implements BaseConsumer{
private List<Map> list=new ArrayList<>();
private static final Logger logger = LoggerFactory.getLogger(AutoSnapConsumer.class);
@Autowired
AutoSnapService autoSnapService;
......@@ -41,19 +37,6 @@ public class AutoSnapConsumer implements BaseConsumer{
@Autowired
TaskRecog taskRecog;
@Value("${voice.unionId}")
private String unionId;
@Value("${voice.appKey}")
private String appKey;
@Value("${voice.corpId}")
private String corpId;
@Value("${voice.eventId}")
private Integer eventId;
@Autowired
private RestTemplate restTemplate;
......
......@@ -3,15 +3,12 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import java.io.IOException;
public interface BaseConsumer {
/**
* 消息消费入口
*
* @param message
* @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;
import com.cx.cn.cxquartz.service.quartz.TraffPictureService;
import com.cx.cn.cxquartz.service.quartz.impl.ResultService;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -26,9 +25,6 @@ public class BaseConsumerProxy {
@Autowired
TraffPictureService traffPictureService;
@Autowired
ResultService resultService;
public BaseConsumerProxy(Object target, TraffPictureService traffPictureService) {
this.target = target;
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 {
* @throws IOException
*/
@Override
public void consume(Message message, Channel channel) throws IOException {
logger.info("SendToDXConsumer 收到消息: {}", message.toString());
public void consume(Message message, Channel channel) {
Map result = MessageHelper.msgToObj(message, Map.class);
if (null != result.get("id") && null!=result.get("traff") && null!=result.get("callback")) {
JobTjParam jobTjParam=JsonUtil.strToObj(result.get("traff").toString(),JobTjParam.class);
if(null!=jobTjParam) {
logger.info("callbackurl={}",result.get("callback").toString());
eventWriteService.sendEventByCallUrl(Long.parseLong(result.get("id").toString())
, jobTjParam, result.get("callback").toString());
}
......
......@@ -7,6 +7,7 @@ import com.cx.cn.cxquartz.util.JsonUtil;
import com.cx.cn.cxquartz.vo.JobTjParam;
import com.cx.cn.cxquartz.vo.Voice;
import com.cx.cn.cxquartz.vo.VoiceData;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -42,18 +43,17 @@ public class SendToVoiceConsumer implements BaseConsumer {
@Value("${voice.eventId}")
private Integer eventId;
@Value("${voice.url}")
private String url;
/**
* 消息消费入口
*
* @param message
* @param channel
* @throws IOException
*/
@Override
public void consume(Message message, Channel channel) {
logger.info("SendToVoiceConsumer 收到消息: {}", message.toString());
Map result = MessageHelper.msgToObj(message, Map.class);
if (null != result.get("id") && null!=result.get("traff") && null!=result.get("callback")) {
JobTjParam jobTjParam=JsonUtil.strToObj(result.get("traff").toString(), JobTjParam.class);
......@@ -63,9 +63,9 @@ public class SendToVoiceConsumer implements BaseConsumer {
voicedata.setAppKey(appKey);
voicedata.setCorpId(corpId);
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));
......
......@@ -3,10 +3,7 @@ package com.cx.cn.cxquartz.rabbitmq.comsumer;
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.redis.OrderConsumer;
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.util.DateUtils;
import com.cx.cn.cxquartz.util.JsonUtil;
......@@ -36,9 +33,6 @@ import java.util.UUID;
public class SnapTaskConsumer implements BaseConsumer {
private static final Logger logger = LoggerFactory.getLogger(SnapTaskConsumer.class);
@Autowired
ResultService resultService;
@Value("${local.czurl}")
private String czurl;
@Value("${local.fxurl}")
......@@ -66,15 +60,13 @@ public class SnapTaskConsumer implements BaseConsumer {
* @throws IOException
*/
@Override
public void consume(Message message, Channel channel) throws IOException {
logger.info("SnapTaskConsumer 收到消息: {}", message.toString());
public void consume(Message message, Channel channel){
QuartzTaskInformations msg = MessageHelper.msgToObj(message, QuartzTaskInformations.class);
if (null != msg) {
try {
//调用抽帧服务
String devicecode = msg.getExecuteparamter();
String rtsporhls = "";
logger.info("开始消费消息{}", msg.getId());
//如果设备编号是用一次废一次的,此刻需要现场取得rtsp
if (null != devicecode && devicecode.startsWith("33") && devicecode.length() != 18) {
//调用抽帧服务
......@@ -112,7 +104,7 @@ public class SnapTaskConsumer implements BaseConsumer {
map.put("deviceID", devicecode);
map.put("resourceParam", rtsporhls);
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);
if (null != resultmap.get("ret")) {
if (resultmap.get("ret").toString().equals("0")
......@@ -128,13 +120,13 @@ public class SnapTaskConsumer implements BaseConsumer {
MessageHelper.objToMsg(m),
correlationData);
} else {
logger.error("抽帧失败:{}", JsonUtil.objToStr(resultmap));
logger.error("VideoRTSPorURLService error:{}", JsonUtil.objToStr(resultmap));
}
} else {
logger.error("返回状态码为null");
logger.error("VideoRTSPorURLService ->czurl> resultmap is null");
}
} 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;
import java.util.Map;
/**
* 消息处理并推送第三方
* 消息处理并推送第三方
*/
@Component
public class TaskQSTConsumer{
......@@ -33,21 +33,8 @@ public class TaskQSTConsumer{
@Autowired
TaskRecog taskRecog;
@Value("${voice.unionId}")
private String unionId;
@Value("${voice.appKey}")
private String appKey;
@Value("${voice.corpId}")
private String corpId;
@Value("${voice.eventId}")
private Integer eventId;
/**
* 消息消费入口
* 消息消费入口
*
* @param messageList
* @param channel
......
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.BaseConsumer;
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.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -22,16 +18,17 @@ public class AutoSnapReceiver {
private static final Logger logger = LoggerFactory.getLogger(AutoSnapReceiver.class);
@Autowired
private AutoSnapConsumer autoSnapConsumer;
@RabbitListener(queues = QueueConstants.QueueAutoSnapConsumer.QUEUE)
// @RabbitListener(queues = QueueConstants.QueueAutoSnapConsumer.QUEUE)
public void process(Message message, Channel channel) {
try {
// logger.info("AutoSnapReceiver body:{}",message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(autoSnapConsumer);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
proxy.consume(message, channel);
}
} 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 {
@RabbitListener(queues = QueueConstants.QueueRTSPConsumer.QUEUE)
public void process(Message message, Channel channel) {
try {
// logger.info("RTSPorHLSReceiver body:{}",message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapShotConsumer);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
proxy.consume(message, channel);
}
} catch (Exception e) {
logger.error("rtsp与hls超时过期更新 error:{}",e);
logger.error("RTSPorHLSReceiver error:{}",e);
}
}
}
......@@ -30,12 +30,16 @@ public class SendtoDXReceiver {
* @throws IOException
*/
@RabbitListener(queues = QueueConstants.QueueSendToDXConsumer.QUEUE,containerFactory="rabbitListenerContainerFactory")
public void consume(Message message, Channel channel) throws IOException {
logger.info("consumer->推送告警给第三方 消费者收到消息 : " + message.toString());
public void consume(Message message, Channel channel) {
try {
// logger.info("SendtoDXReceiver body:{}", message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(sendToDXConsumer);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
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;
import com.cx.cn.cxquartz.rabbitmq.comsumer.BaseConsumerProxy;
import com.cx.cn.cxquartz.rabbitmq.comsumer.SendToVoiceConsumer;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -17,7 +19,7 @@ import java.io.IOException;
*/
@Component
public class SendtoVoiceAlarmReceiver {
private static final Logger logger = LoggerFactory.getLogger(SendtoVoiceAlarmReceiver.class);
@Autowired
private SendToVoiceConsumer sendToVoiceConsumer;
/**
......@@ -28,11 +30,16 @@ public class SendtoVoiceAlarmReceiver {
* @throws IOException
*/
@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);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
proxy.consume(message, channel);
}
}catch (Exception ex){
logger.error("SendtoVoiceReceiver error:{}", ex.toString());
}
}
}
......@@ -28,13 +28,14 @@ public class SnapTaskReceiver {
@RabbitListener(queues = QueueConstants.QueueSnapTaskConsumer.QUEUE)
public void process(Message message, Channel channel) {
try {
// logger.info("SnapTaskReceiver body:{}",message.getBody());
BaseConsumerProxy baseConsumerProxy = new BaseConsumerProxy(snapTaskConsumer, traffPictureService);
BaseConsumer proxy = (BaseConsumer) baseConsumerProxy.getProxy();
if (null != proxy) {
proxy.consume(message, channel);
}
} catch (Exception e) {
logger.error("告警信息结果分析 error:{}",e);
logger.error("SnapTaskReceiver error:{}",e);
}
}
}
......@@ -30,7 +30,7 @@ public class TaskQSTReceiver implements BatchMessageListener {
taskQSTConsumer.consume(messages,null);
}
} catch (Exception e) {
logger.error("批量分析图片 error:{}",e.toString());
logger.error("TaskQSTReceiver error:{}",e.toString());
}
}
}
......@@ -13,7 +13,7 @@ import javax.annotation.PostConstruct;
import java.nio.charset.StandardCharsets;
/**
* 消息发送确认的回调
* 消息发送确认的回调
*/
@Component
public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
......@@ -23,18 +23,18 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC
private RabbitTemplate rabbitTemplate;
/**
* PostConstruct: 用于在依赖关系注入完成之后需要执行的方法上,以执行任何初始化.
* PostConstruct: 用于在依赖关系注入完成之后需要执行的方法上,以执行任何初始化.
*/
@PostConstruct
public void init() {
//指定 ConfirmCallback
//指定 ConfirmCallback
rabbitTemplate.setConfirmCallback(this);
//指定 ReturnCallback
//指定 ReturnCallback
rabbitTemplate.setReturnCallback(this);
}
/**
* 消息从交换机成功到达队列,spring.rabbitmq.publisher-returns=true
* 消息从交换机成功到达队列,spring.rabbitmq.publisher-returns=true
*/
@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
......@@ -43,19 +43,17 @@ public class ConsumerConfirmAndReturnCallback implements RabbitTemplate.ConfirmC
}
/**
* 消息找不到对应的Exchange会先触发此方法
* 如果消息没有到达交换机,则该方法中isSendSuccess = false,error为错误信息;
* 如果消息正确到达交换机,则该方法中isSendSuccess = true;
* 需要开启 confirm 确认机制
* 消息找不到对应的Exchange会先触发此方法
* 如果消息没有到达交换机,则该方法中isSendSuccess = false,error为错误信息;
* 如果消息正确到达交换机,则该方法中isSendSuccess = true;
* 需要开启 confirm 确认机制
* spring.rabbitmq.publisher-confirms=true
*/
@Override
public void confirm(CorrelationData correlationData, boolean isSendSuccess, String error) {
if (correlationData != null) {
if (isSendSuccess) {
logger.info("confirm回调方法->消息成功发送到交换机!");
} else {
logger.info("confirm回调方法->消息[{}]发送到交换机失败!,原因 : [{}]", correlationData, error);
if (!isSendSuccess) {
logger.info("confirm callback->[{}],error : [{}]", 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;
import com.cx.cn.cxquartz.dao.AutoSanpMapper;
import com.cx.cn.cxquartz.dao.CodeMapper;
import com.cx.cn.cxquartz.rabbitmq.comsumer.AutoSnapConsumer;
import com.cx.cn.cxquartz.service.quartz.AutoSnapService;
import com.cx.cn.cxquartz.service.quartz.CodeService;
import com.cx.cn.cxquartz.vo.Autosnaptaskinfo;
import com.cx.cn.cxquartz.vo.Code;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
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;
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.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
......@@ -18,7 +17,6 @@ import org.springframework.web.client.RestTemplate;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
......@@ -39,27 +37,10 @@ public class EventWriteService {
@Autowired
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
TraffPictureService traffPictureService;
@Autowired
TokenCacheService tokensertvice;
@Value("${local.czurl}")
private String czurl;
......@@ -70,39 +51,6 @@ public class EventWriteService {
@Value("${file.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 ) {
VoiceResultObj result;
......@@ -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 {
HttpHeaders headers = new HttpHeaders();
......@@ -146,26 +76,6 @@ public class EventWriteService {
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) {
ResultObj resultObj;
TraffpictureParam traffpictureParamresult = new TraffpictureParam();
......@@ -181,7 +91,7 @@ public class EventWriteService {
} catch (Exception e) {
traffpictureParamresult.setProcessstatus("-2");
traffpictureParamresult.setPushdesc("推送第三方失败");
log.error("eventwrite - sendEventByCallUrl 异常:" + e.toString());
log.error("eventwrite - sendEventByCallUrl error:" + e.toString());
}
traffpictureParamresult.setPushstatus(-1);
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 {
}
img.setData(picture.get("resourcePath").toString());
imglist.add(img);
recordtypeMap.put(i,new TaskResult(param.getVideoid(),
param.getRecordtype(),
picture.get("timestamp").toString(),
param.getObjectx(),param.getObjecty(),
param.getObjectw() , param.getObjecth(),
picture.get("resourcePath").toString(),
param.getMetatype(), param.getSendtype(),
param.getUrl()
recordtypeMap.put(i,new TaskResult(param.getVideoid(),param.getRecordtype(),
picture.get("timestamp").toString(), param.getObjectx(),param.getObjecty(),
param.getObjectw() , param.getObjecth(), picture.get("resourcePath").toString(),
param.getMetatype(), param.getSendtype(), param.getUrl()
)
);
i++;
......@@ -89,9 +85,9 @@ public class TaskRecog implements InitializingBean {
}
goalSparam.setImageList(imglist);
goalSparam.setModel(model);
logger.info("参数:{}",JsonUtil.objToStr(goalSparam));
logger.info("goalSparam:{}",JsonUtil.objToStr(goalSparam));
String resultstr = restTemplate.postForObject(recogqsturl, goalSparam, String.class);
logger.info("分析结果:{}",resultstr);
logger.info("resultstr:{}",resultstr);
// try {
Map resulMap = JsonUtil.strToObj(resultstr, Map.class);
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;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 上午11:46:46
* @desc 此注解用来控制属性别名 和 转换别名使用,用于xml2bean和bean2xml里的<对应别名>值的转换
*/
@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;
import java.lang.annotation.Target;
/**
* @author aiheng@jd.com
* @date 2014年10月31日 下午5:25:09
* @desc 此注解用来忽略序列化属性
*/
@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;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -22,63 +21,6 @@ public class RestUtil {
@Autowired
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 ) {
HttpHeaders headers = new HttpHeaders();
......@@ -99,27 +41,6 @@ public class RestUtil {
}
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>
/// 读取远程文件的内容
......
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;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Capture {
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
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,6 @@ package com.cx.cn.cxquartz.vo;
import java.util.Date;
public class TraffAlarmRecord {
private static final long serialVersionUID = 1L;
private Long recordid ;// ��¼��� ��������
private Integer algotype ;//--�㷨���� Ĭ���� 0:��˾ 1:��������˾
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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