Commit 9e616c66 authored by wangjinjing's avatar wangjinjing

发布版本

parent 148ad6dc
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!--mybatis--> <!--mybatis-->
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
...@@ -45,6 +48,7 @@ ...@@ -45,6 +48,7 @@
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.27</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -114,7 +118,11 @@ ...@@ -114,7 +118,11 @@
<version>1.7.25</version> <version>1.7.25</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.0</version>
</dependency>
</dependencies> </dependencies>
......
package com.cx.cn.cxquartz; package com.cx.cn.cxquartz;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
@SpringBootApplication @SpringBootApplication
public class TaskDispatchApplication extends SpringBootServletInitializer { public class TaskDispatchApplication extends SpringBootServletInitializer {
...@@ -16,5 +19,11 @@ public class TaskDispatchApplication extends SpringBootServletInitializer { ...@@ -16,5 +19,11 @@ public class TaskDispatchApplication extends SpringBootServletInitializer {
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(TaskDispatchApplication.class); return builder.sources(TaskDispatchApplication.class);
} }
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
return rabbitTemplate;
}
} }
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 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;
/***
* 自动抓拍队列
*/
@Configuration
public class SnapTaskConfig {
/**
* 创建交换机
*
* @return
*/
@Bean
public DirectExchange SnapTaskDirectExchange() {
return new DirectExchange(QueueConstants.QueueSnapTaskEnum.QUEUE_SNAP_TASK_ENUM.getExchange());
}
/**
* 创建队列 true表示是否持久
*
* @return
*/
@Bean
public Queue SnapTaskDirectQueue() {
return new Queue(QueueConstants.QueueSnapTaskEnum.QUEUE_SNAP_TASK_ENUM.getQueue(), true);
}
/**
* 将队列和交换机绑定,并设置用于匹配路由键
*
* @return
*/
@Bean
public Binding BindingSnapTaskDirect() {
return BindingBuilder.bind(SnapTaskDirectQueue()).to(SnapTaskDirectExchange()).with(QueueConstants.QueueSnapTaskEnum.QUEUE_SNAP_TASK_ENUM.getRouteKey());
}
}
\ No newline at end of file
...@@ -142,20 +142,56 @@ public class QuartzController { ...@@ -142,20 +142,56 @@ public class QuartzController {
@PostMapping("/task") @PostMapping("/task")
@ResponseBody @ResponseBody
public TaskResultObj scheduleJob(@RequestBody JobParam jobParam) { public TaskResultObj scheduleJob(@RequestBody JobParam jobParam) {
String objstr="0";
String cztaskno="cz_" + jobParam.getDeviceId() + "_" + jobParam.getDetectType(); if(null!=jobParam.getParams().get("objectType")){
objstr=jobParam.getParams().get("objectType").toString();
}
String taskno="fx_" + jobParam.getDeviceId() + "_" + jobParam.getDetectType()+"_"+objstr;
if(null!=jobParam.getParams().get("taskno")) {
taskno = jobParam.getParams().get("taskno").toString();
}
QuartzTaskInformations taskInformations = new QuartzTaskInformations(); QuartzTaskInformations taskInformations = new QuartzTaskInformations();
taskInformations.setExecuteparamter(jobParam.getDeviceId()); taskInformations.setExecuteparamter(jobParam.getDeviceId());
taskInformations.setMetatype(jobParam.getDetectType()); taskInformations.setMetatype(jobParam.getDetectType());
//查询是否有抽帧服务
List<QuartzTaskInformations> tasks = quartzService.getTaskSByDeviceCode(jobParam.getDeviceId());
Map<String, Integer> map = getTaskCzAndFxNumer(tasks);
Integer cznum = map.get("cznum");
Long[] roiarray=new Long[4]; Long[] roiarray=new Long[4];
if ("0".equals(jobParam.getType())) {//0新增 1开启 2停止 3删除 if ("0".equals(jobParam.getType())) {//0新增 1开启 2停止 3删除
//判断是否存在抽帧任务,存在则直接新增分析任务,不存在则新增 //判断是否存在抽帧任务,存在则直接新增分析任务,不存在则新增
taskInformations.setFrozenstatus("UNFROZEN"); taskInformations.setFrozenstatus("UNFROZEN");
taskInformations.setSchedulerrule("*/" + jobParam.getParams().get("schedulerRule").toString() + " * * * * ?"); //判断是否是全天的检测
if(null!=jobParam.getParams().get("schedulerRule") && jobParam.getParams().get("schedulerRule").toString().indexOf(",")>-1) {
String[] schedulerRules=jobParam.getParams().get("schedulerRule").toString().split(",");
if(schedulerRules.length==3){
if(schedulerRules[0].equals("") && schedulerRules[1].equals("")) {
if(Integer.parseInt(schedulerRules[2])/60>0)
{ //分
taskInformations.setSchedulerrule("0 */" + Integer.parseInt(schedulerRules[2])/60 + " * * * ?");
}
else{
taskInformations.setSchedulerrule("*/" + schedulerRules[2]+ " * * * * ?");
}
}else if(!schedulerRules[0].equals("") && !schedulerRules[1].equals(""))
{
//有开始时间结束时间的执行方式
if(Integer.parseInt(schedulerRules[2])/60>0)
{ //分 0 */2 8-9 * * *
taskInformations.setSchedulerrule("0 */" + Integer.parseInt(schedulerRules[2])/60 + " "+ schedulerRules[0]+"-"+schedulerRules[1]+" * * ?");
}
else{
//秒 0/15 * 6-19 * * ?
taskInformations.setSchedulerrule("0/" + schedulerRules[2] + " * "+ schedulerRules[0]+"-"+schedulerRules[1]+" * * ?");
}
}
}else{
return TaskResultObj.error("-1","时间格式错误");
}
}
else{
return TaskResultObj.error("-1","执行时间不能为空");
}
taskInformations.setObjectType(jobParam.getParams().get("objectType")==null?"1":jobParam.getParams().get("objectType").toString());
List<Point> listpoint=jobParam.getArea(); List<Point> listpoint=jobParam.getArea();
PointUtil.getXYWH(listpoint,roiarray); PointUtil.getXYWH(listpoint,roiarray);
taskInformations.setObjectx(roiarray[0]); taskInformations.setObjectx(roiarray[0]);
...@@ -164,61 +200,53 @@ public TaskResultObj scheduleJob(@RequestBody JobParam jobParam) { ...@@ -164,61 +200,53 @@ public TaskResultObj scheduleJob(@RequestBody JobParam jobParam) {
taskInformations.setObjecth(roiarray[3]); taskInformations.setObjecth(roiarray[3]);
taskInformations.setMetatype( jobParam.getParams().get("thresholdValue").toString()); taskInformations.setMetatype( jobParam.getParams().get("thresholdValue").toString());
taskInformations.setUrl(jobParam.getCallBackUrl()); taskInformations.setUrl(jobParam.getCallBackUrl());
taskInformations.setExecutorno(cztaskno); taskInformations.setExecutorno(taskno);
taskInformations.setTaskno(taskInformations.getExecutorno()); taskInformations.setTaskno(taskno);
taskInformations.setTaskname(jobParam.getName()); taskInformations.setTaskname(jobParam.getName());
taskInformations.setVideoid(jobParam.getDeviceId() ); taskInformations.setVideoid(jobParam.getDeviceId() );
taskInformations.setRecordtype(jobParam.getDetectType()); taskInformations.setRecordtype(jobParam.getDetectType());
taskInformations.setSendtype(jobParam.getParams().get("sendType")==null?"1":jobParam.getParams().get("sendType").toString());
String result = quartzService.addTask(taskInformations); String result = quartzService.addTask(taskInformations);
Map mapresult=JsonUtil.strToObj(result,Map.class);
if(null!=mapresult.get("code")&&mapresult.get("code").toString().equals("200")) {
try { try {
quartzService.startJob(cztaskno, "UNFROZEN"); quartzService.startJob(taskInformations.getTaskno(), "UNFROZEN");
}catch (Exception ex){
logger.error(cztaskno+" fx startJob error:"+ex.toString());
}
} catch (Exception ex) {
logger.error(taskInformations.getTaskno() + " fx startJob error:" + ex.toString());
return TaskResultObj.error("-1", "error");
}
}else{
return TaskResultObj.error(mapresult.get("code").toString(),mapresult.get("message").toString());
}
} else if ("1".equals(jobParam.getType()))//开启 } else if ("1".equals(jobParam.getType()))//开启
{ {
try { try {
quartzService.startOrStopJob(cztaskno,"UNFROZEN"); quartzService.startOrStopJob(taskno,"UNFROZEN");
} catch (Exception ex) { } catch (Exception ex) {
logger.error(ex.toString()); logger.error(ex.toString());
return TaskResultObj.error("-1","error");
} }
} else if ("2".equals(jobParam.getType()) ) {//停止 } else if ("2".equals(jobParam.getType()) ) {//停止
//一抽帧多分析,停止不停抽帧服务 //一抽帧多分析,停止不停抽帧服务
try { try {
quartzService.startOrStopJob(cztaskno, "FROZEN"); quartzService.startOrStopJob(taskno, "FROZEN");
} catch (Exception ex) { } catch (Exception ex) {
logger.error(ex.toString()); logger.error(ex.toString());
return TaskResultObj.error("-1","error");
} }
} else if ("3".equals(jobParam.getType())) {//删除 } else if ("3".equals(jobParam.getType())) {//删除
try { try {
quartzService.startOrStopJob(cztaskno, "FROZEN"); quartzService.startOrStopJob(taskno, "FROZEN");
quartzService.deletetask(cztaskno); quartzService.deletetask(taskno);
} catch (Exception ex) { } catch (Exception ex) {
logger.error(ex.toString()); logger.error(ex.toString());
return TaskResultObj.error("-1","error");
} }
} }
return TaskResultObj.ok(); return TaskResultObj.ok();
} }
public Map getTaskCzAndFxNumer(List<QuartzTaskInformations> tasks) {
Map<String, Integer> map = new HashMap();
int cznum = 0, fxnum = 0;
if (tasks.size() > 0) {
//一抽多分析
for (QuartzTaskInformations item : tasks) {
if (item.getTaskno().contains("cz")) {
cznum++;
} else if (item.getTaskno().contains("fx")) {
fxnum++;
}
}
}
map.put("cznum", cznum);
map.put("fxnum", fxnum);
return map;
}
// //
// @RequestMapping(value = "/edit/taskpage", method = RequestMethod.GET) // @RequestMapping(value = "/edit/taskpage", method = RequestMethod.GET)
// public String editTaskpage(Model model, String id) { // public String editTaskpage(Model model, String id) {
......
package com.cx.cn.cxquartz.job; package com.cx.cn.cxquartz.job;
import com.cx.cn.cxquartz.config.QueueConstants;
import com.cx.cn.cxquartz.helper.MessageHelper;
import com.cx.cn.cxquartz.redis.QueueSender; import com.cx.cn.cxquartz.redis.QueueSender;
import com.cx.cn.cxquartz.util.ApplicationContextHolder; import com.cx.cn.cxquartz.util.ApplicationContextHolder;
import org.quartz.*; import org.quartz.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import java.util.Date;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@DisallowConcurrentExecution @DisallowConcurrentExecution
...@@ -14,71 +21,27 @@ public class QuartzMainJobFactory implements Job { ...@@ -14,71 +21,27 @@ public class QuartzMainJobFactory implements Job {
private static Logger logger = LoggerFactory.getLogger(QuartzMainJobFactory.class); private static Logger logger = LoggerFactory.getLogger(QuartzMainJobFactory.class);
private AtomicInteger atomicInteger;
@Value("${local.czurl}")
private String czurl;
@Value("${local.fxurl}")
private String fxurl;
// @Autowired
// private QueueSender queueSender;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
atomicInteger = new AtomicInteger(0); // logger.info(new Date().toLocaleString());
JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap(); JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
QueueSender qeueSender = (QueueSender) ApplicationContextHolder.getBean("queueSender"); RabbitTemplate rabbitTemplate = (RabbitTemplate) ApplicationContextHolder.getBean("rabbitTemplate");
try { try {
//根据事件类型进行通道分配 //根据事件类型进行redis通道分配
qeueSender.sendMsg("taskinfo", jobDataMap.get("taskinfo")); // qeueSender.sendMsg("taskinfo", jobDataMap.get("taskinfo"));
//根据事件类型进行rabbitmq分配
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(QueueConstants.QueueSnapTaskEnum.QUEUE_SNAP_TASK_ENUM.getExchange(),
QueueConstants.QueueSnapTaskEnum.QUEUE_SNAP_TASK_ENUM.getRouteKey(),
MessageHelper.objToMsg(jobDataMap.get("taskinfo")),
correlationData);
}catch (Exception ex){ }catch (Exception ex){
logger.error("Scheduler executing error:{}",ex); logger.error("Scheduler executing error:{}",ex);
} }
// String taskNo = jobDataMap.getString("taskNo"); String executorNo = jobDataMap.getString("executorNo");
// String url = jobDataMap.getString("url");
// String executeParameter = jobDataMap.getString("executeParameter");
// logger.info("定时任务被执行:taskNo={},executorNo={},url={},executeParameter={}", taskNo, executorNo, url, executeParameter);
// QuartzService quartzService = (QuartzServiceImpl) ApplicationContextHolder.getBean("quartzServiceImpl");
// QuartzTaskRecords records = null;
// try {
// //保存定时任务的执行记录
// records = quartzService.addTaskRecords(taskNo);
// if (null == records || !ResultEnum.INIT.name().equals(records.getTaskstatus())) {
// logger.info("taskNo={}保存执行记录失败", taskNo);
// return;
// }
//
// //if (ResultEnum.HTTP.getMessage().equals(sendType)) {
// try {
// String result = HttpClientUtil.doPost(taskNo.contains("cz_") ? czurl : fxurl, "text/json", executeParameter);
// logger.info("taskNo={},执行结果result{}", taskNo, result);
// if (StringUtils.isEmpty(result)) {
// throw new RuntimeException("taskNo=" + taskNo + "http方式返回null");
// }
// } catch (Exception ex) {
// logger.error("");
// throw ex;
// }
//// } else if (ResultEnum.KAFKA.getMessage().equals(sendType)) {
//// try {
//// String message = new StringBuffer(taskNo).append(":").append(id).append(":").append(executeParameter).toString();
//// quartzService.sendMessage(message);
//// logger.info("taskNo={},sendtype={}推送至kafka成功", taskNo, sendType);
//// } catch (Exception ex) {
//// logger.error("");
//// throw ex;
//// }
//// }
// } catch (Exception ex) {
// String exception=CommonUtil.getExceptionDetail(ex);
// logger.error(exception);
// atomicInteger.incrementAndGet();
// quartzService.addTaskErrorRecord(records.getId().toString(), taskNo + ":" + ex.getMessage(), exception);
// }
// quartzService.updateRecordById(atomicInteger.get(), records.getId());
//QuartzTaskInformations quartzTaskInformation = new QuartzTaskInformations();
//quartzTaskInformation.setId(Long.parseLong(id));
//quartzTaskInformation.setLastmodifytime(System.currentTimeMillis());
//quartzService.updateTask(quartzTaskInformation);
} }
} }
...@@ -108,30 +108,22 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean { ...@@ -108,30 +108,22 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
QuartzTaskInformations task = new QuartzTaskInformations(); QuartzTaskInformations task = new QuartzTaskInformations();
task.setId(quartzTaskInformation.getId()); task.setId(quartzTaskInformation.getId());
task.setVersion(quartzTaskInformation.getVersion()); task.setVersion(quartzTaskInformation.getVersion());
//说明要暂停
if (ResultEnum.FROZEN.name().equals(status)) { if (ResultEnum.FROZEN.name().equals(status)) {
//删除
//暂停
scheduler.pauseTrigger(new TriggerKey(taskNo)); scheduler.pauseTrigger(new TriggerKey(taskNo));
// 移除触发器中的任务
scheduler.unscheduleJob(new TriggerKey(taskNo)); scheduler.unscheduleJob(new TriggerKey(taskNo));
scheduler.deleteJob(new JobKey(taskNo)); scheduler.deleteJob(new JobKey(taskNo));
task.setFrozentime(currentTimeMillis); task.setFrozentime(currentTimeMillis);
task.setFrozenstatus(ResultEnum.FROZEN.name()); task.setFrozenstatus(ResultEnum.FROZEN.name());
} else if (ResultEnum.UNFROZEN.name().equals(status)) { } else if (ResultEnum.UNFROZEN.name().equals(status)) {
//删除后启动
//暂停
scheduler.pauseTrigger(new TriggerKey(taskNo)); scheduler.pauseTrigger(new TriggerKey(taskNo));
// 移除触发器中的任务
scheduler.unscheduleJob(new TriggerKey(taskNo)); scheduler.unscheduleJob(new TriggerKey(taskNo));
scheduler.deleteJob(new JobKey(taskNo)); scheduler.deleteJob(new JobKey(taskNo));
this.schedule(quartzTaskInformation, scheduler); this.schedule(quartzTaskInformation, scheduler);
task.setUnfrozentime(currentTimeMillis); task.setUnfrozentime(currentTimeMillis);
task.setFrozenstatus(ResultEnum.UNFROZEN.name()); task.setFrozenstatus(ResultEnum.UNFROZEN.name());
} }
// task.setLastmodifytime(currentTimeMillis); logger.info("taskNo={},taskName={},scheduleRule={},任务{}成功", quartzTaskInformation.getTaskno(), quartzTaskInformation.getTaskname(), quartzTaskInformation.getSchedulerrule(), ResultEnum.FROZEN.name().equals(status) ? "启动" : "暂停");
//quartzTaskInformationsService.updateStatusById(task);
// logger.info("taskNo={},taskName={},scheduleRule={},任务{}成功", quartzTaskInformation.getTaskno(), quartzTaskInformation.getTaskname(), quartzTaskInformation.getSchedulerrule(), ResultEnum.FROZEN.name().equals(status) ? "启动" : "暂停");
return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage()); return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage());
} }
...@@ -275,7 +267,7 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean { ...@@ -275,7 +267,7 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(quartzTaskInfo.getSchedulerrule()); CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(quartzTaskInfo.getSchedulerrule());
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withDescription(quartzTaskInfo.getTaskname()).withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build(); CronTrigger cronTrigger = TriggerBuilder.newTrigger().withDescription(quartzTaskInfo.getTaskname()).withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
scheduler.scheduleJob(jobDetail, cronTrigger); scheduler.scheduleJob(jobDetail, cronTrigger);
// logger.info("taskNo={},taskName={},scheduleRule={} load to quartz success!", quartzTaskInfo.getTaskno(), quartzTaskInfo.getTaskname(), quartzTaskInfo.getSchedulerrule()); logger.info("taskNo={},taskName={},scheduleRule={} load to quartz success!", quartzTaskInfo.getTaskno(), quartzTaskInfo.getTaskname(), quartzTaskInfo.getSchedulerrule());
} }
/** /**
......
...@@ -2,10 +2,10 @@ server: ...@@ -2,10 +2,10 @@ server:
port: 4082 port: 4082
spring: spring:
datasource: datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: 123456 password: 123456
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
filters: stat filters: stat
maxActive: 1000 maxActive: 1000
......
...@@ -2,10 +2,10 @@ server: ...@@ -2,10 +2,10 @@ server:
port: 4085 port: 4085
spring: spring:
datasource: datasource:
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: 123456 password: 123456
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
filters: stat filters: stat
maxActive: 1000 maxActive: 1000
......
server: server:
port: 8088 port: 8089
spring: spring:
datasource: datasource:
url: jdbc:mysql://localhost:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true url: jdbc:mysql://192.168.78.31:3307/hzdxtest?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
username: root username: hzdxtest
password: root password: 1qaz@wsx
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
filters: stat maxActive: 20
maxActive: 1000 initialSize: 1
initialSize: 100
maxWait: 60000 maxWait: 60000
minIdle: 500 minIdle: 1
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000 minEvictableIdleTimeMillis: 300000
testWhileIdle: true testWhileIdle: true
testOnBorrow: false testOnBorrow: false
testOnReturn: false testOnReturn: false
poolPreparedStatements: true poolPreparedStatements: true
maxOpenPreparedStatements: 20 maxPoolPreparedStatementPerConnectionSize: 20
rabbitmq: rabbitmq:
host: 192.168.168.110 host: 192.168.78.31
port: 5672 port: 5672
username: admin username: admin
password: admin password: admin
...@@ -38,7 +37,7 @@ spring: ...@@ -38,7 +37,7 @@ spring:
acknowledge-mode: manual acknowledge-mode: manual
concurrency: 5 concurrency: 5
max-concurrency: 10 max-concurrency: 10
prefetch: 5 prefetch: 10
#开启消费者重试 #开启消费者重试
retry: retry:
enabled: true enabled: true
...@@ -46,25 +45,16 @@ spring: ...@@ -46,25 +45,16 @@ spring:
initial-interval: 3000 initial-interval: 3000
#最大重试次数 #最大重试次数
max-attempts: 3 max-attempts: 3
# redis:
redis: # database: 0
database: 0 # host: 192.168.78.31
host: 192.168.168.110 # port: 6379
port: 6379 # pool:
pool: # max-active: 20
max-active: 100 #连接池最大连接数(负值表示没有限制) # max-wait: 3000
max-wait: 3000 #连接池最大阻塞等待时间(负值表示没有限制) # max-idle: 1
max-idle: 200 #连接池最大空闭连接数 # min-idle: 1
min-idle: 50 #连接汉最小空闲连接数 # timeout: 60000
timeout: 600 #连接超时时间(毫秒)
#logging:W
# level:
# root:
# info
local:
czurl: http://localhost:8089/ext/getRTSP/1
fxurl: http://localhost:8089/ext/getDeviceSnapshotAndRecognize
logging: logging:
level: level:
......
server:
port: 8089
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/hzdxtest?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: hzdxtest
password: 1qaz@wsx
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
maxActive: 1000
initialSize: 100
maxWait: 60000
minIdle: 500
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
local:
czurl: http://localhost:8089/ext/getRTSP/1
fxurl: http://localhost:8089/ext/getDeviceSnapshotAndRecognize
logging:
level:
com.cx.cn.cxquartz.dao:
debug
spring: spring:
profiles: profiles:
active: local active: devdispatch
mybatis: mybatis:
type-aliases-package: com.cx.cn.cxquartz.bean type-aliases-package: com.cx.cn.cxquartz.bean
...@@ -10,7 +10,7 @@ mybatis: ...@@ -10,7 +10,7 @@ mybatis:
default-statement-timeout: 3000 default-statement-timeout: 3000
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml
redis: redis:
database: 0 database: 0
host: 172.16.24.29 host: 172.16.24.29
port: 6379 port: 6379
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<configuration debug="false" scan="false"> <configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/> <springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<!--<property name="log.path" value="/home/ubuntu/tar/zjdxtest/logs/${spring.application.name}"/>--> <!--<property name="log.path" value="/home/ubuntu/tar/zjdxtest/logs/${spring.application.name}"/>-->
<property name="log.path" value="/home/prod/deploy/HZDXService/logs/${spring.application.name}"/> <property name="log.path" value="/home/ubuntu/tar/logs/taskdispatch/${spring.application.name}"/>
<!-- 彩色日志格式 --> <!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" <property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
......
...@@ -32,13 +32,12 @@ ...@@ -32,13 +32,12 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, version, taskNo, taskName, schedulerRule, frozenStatus, executorNo, frozenTime, id, taskNo, schedulerRule, frozenStatus, executorNo,sendType, url, executeParamter,
unfrozenTime, createTime, lastModifyTime, sendType, url, executeParamter, timeKey, objectx , objecty ,objectw,objecth,recordtype,metatype,videoid,objectType
objectx , objecty ,objectw,objecth,recordtype,metatype,videoid,objectType,imgsrc
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select select
<include refid="Base_Column_List"/> id,taskNo,schedulerRule,executorNo,sendType,url,executeParamter,objectx ,objecty ,objectw,objecth,recordtype,metatype,videoid,objectType
from quartz_task_informations from quartz_task_informations
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
......
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