Commit 884f56a0 by xmh

<refactor> 提出 FeignClient 到公共模块

<feat> 按磁盘空间删除数据
<feat> 添加运维服务的注册接口
<feat> 添加运维服务的相关操作
<feat> 磁盘使用情况接口
<feat> 添加数据统计接口
<feat> 导出任务添加打断功能
<feat> 查询任务时添加视频源状态
<feat> 检测视频分析服务时统计帧率和视频源状态
<fix> 检索过车数据时排除违法数据
<fix> 暂停任务时任务状态改为未部署
1 parent e610b5b0
Showing 45 changed files with 533 additions and 173 deletions
......@@ -17,6 +17,11 @@
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.16</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
......@@ -42,7 +47,7 @@
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-23</artifactId>
<version>3.16.4</version>
<version>3.16.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......
package com.viontech.fanxing.forward;
package com.viontech.fanxing.commons.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
......
package com.viontech.fanxing.query.feign;
package com.viontech.fanxing.commons.feign;
import com.viontech.fanxing.commons.model.*;
import com.viontech.fanxing.commons.model.main.ImageKeepConfig;
import com.viontech.fanxing.commons.vo.LogVo;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -20,25 +21,64 @@ import java.util.List;
@FeignClient(value = "fanxing-ops")
public interface OpsClient {
/**
* 获取存储配置
*/
@GetMapping("/storeConfigs/{id}")
JsonMessageUtil.JsonMessage<StoreConfig> getStoreConfigById(@PathVariable("id") Long storeConfigId);
/**
* 获取文本内容
*/
@GetMapping("/contents")
JsonMessageUtil.JsonMessage<List<Content>> getContentByName(@RequestParam("name") String name);
/**
* 根据 channelUnid 获取对应视频设备信息
*/
@GetMapping("/channels")
JsonMessageUtil.JsonMessage<List<Channel>> getChannelByChannelUnid(@RequestParam("channelUnid") String channelUnid);
/**
* 通过 unid 获取字典
*/
@GetMapping("/dictCodes")
JsonMessageUtil.JsonMessage<List<DictCode>> getDictCodeByUnid(@RequestParam("unid") String unid);
/**
* 获取所有字典编码
*/
@GetMapping("/dictCodes")
JsonMessageUtil.JsonMessage<List<DictCode>> getDictCodes();
/**
* 获取所有字典
*/
@GetMapping("/dictCates")
JsonMessageUtil.JsonMessage<List<DictCate>> getDictCates();
/**
* 添加日志
*/
@PostMapping("/logs")
JsonMessageUtil.JsonMessage<Log> addLog(@RequestBody LogVo logVo);
/**
* 获取所有转发列表
*/
@GetMapping("/forwards")
JsonMessageUtil.JsonMessage<List<Forward>> getForwards();
/**
* 通过id修改转发列表
*/
@PostMapping("/forwards/{id}")
JsonMessageUtil.JsonMessage<Forward> updateForwardById(@PathVariable("id") Long id, @RequestBody Forward forward);
/**
* 获取存储方案配置
*/
@GetMapping("/contents/imageKeepConfig")
JsonMessageUtil.JsonMessage<ImageKeepConfig> getImageKeepConfig();
}
package com.viontech.fanxing.ops.feign;
package com.viontech.fanxing.commons.feign;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.vo.TaskVo;
......
package com.viontech.fanxing.commons.model.main;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* .
*
* @author 谢明辉
* @date 2021/12/4
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class StreamInfo {
private String taskUnid;
private String channelUnid;
private Float sourceStreamFrameRate;
private Float analyseStreamFrameRate;
}
package com.viontech.fanxing.commons.vo;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.model.main.StreamInfo;
import com.viontech.fanxing.commons.vobase.TaskVoBase;
public class TaskVo extends TaskVoBase {
private StreamInfo streamInfo;
public TaskVo() {
super();
}
public TaskVo(Task task) {
super(task);
}
public StreamInfo getStreamInfo() {
return streamInfo;
}
public TaskVo setStreamInfo(StreamInfo streamInfo) {
this.streamInfo = streamInfo;
return this;
}
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableDiscoveryClient
@EnableScheduling
@EnableFeignClients
@EnableFeignClients(basePackages = "com.viontech.fanxing")
@EnableTransactionManagement
@EnableBatchProcessing
@Slf4j
......
package com.viontech.fanxing.forward.feign;
import com.viontech.fanxing.commons.model.Forward;
import com.viontech.fanxing.commons.model.main.ImageKeepConfig;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/7/16
*/
@FeignClient(value = "fanxing-ops")
@Service
public interface OpsFeignClient {
@GetMapping("/forwards")
JsonMessageUtil.JsonMessage<List<Forward>> getForwards();
@PostMapping("/forwards/{id}")
JsonMessageUtil.JsonMessage<Forward> updateById(@PathVariable("id") Long id, @RequestBody Forward forward);
@GetMapping("/contents/imageKeepConfig")
JsonMessageUtil.JsonMessage<ImageKeepConfig> getImageKeepConfig();
}
package com.viontech.fanxing.forward.feign;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/7/16
*/
@FeignClient(value = "fanxing-task")
@Service
public interface TaskFeignClient {
@GetMapping("/tasks")
JsonMessageUtil.JsonMessage<List<Task>> getAllTask();
}
package com.viontech.fanxing.forward.runner;
import com.viontech.fanxing.commons.feign.OpsClient;
import com.viontech.fanxing.commons.model.Forward;
import com.viontech.fanxing.forward.feign.OpsFeignClient;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RKeys;
......@@ -30,7 +30,7 @@ public class ForwardResultPersistenceRunner {
@Resource
private RedissonClient redissonClient;
@Resource
private OpsFeignClient opsFeignClient;
private OpsClient opsClient;
@Scheduled(cron = "1 0/5 * * * ?")
public void forwardResultPersistenceRunner() {
......@@ -52,7 +52,7 @@ public class ForwardResultPersistenceRunner {
Object failed = map.get("failed");
forward.setFailed((Long) failed);
Long id = (Long) map.get("id");
JsonMessageUtil.JsonMessage<Forward> forwardJsonMessage = opsFeignClient.updateById(id, forward);
JsonMessageUtil.JsonMessage<Forward> forwardJsonMessage = opsClient.updateForwardById(id, forward);
}
} catch (Exception e) {
log.error("ForwardResultPersistenceRunner failed", e);
......
package com.viontech.fanxing.forward.runner;
import cn.hutool.core.util.RuntimeUtil;
import com.viontech.fanxing.commons.config.VionConfig;
import com.viontech.fanxing.commons.feign.OpsClient;
import com.viontech.fanxing.commons.model.main.ImageKeepConfig;
import com.viontech.fanxing.forward.feign.OpsFeignClient;
import com.viontech.keliu.util.DateUtil;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -14,10 +14,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
/**
* .
......@@ -31,32 +28,86 @@ import java.util.Set;
public class PicKeepRunner {
@Resource
private OpsFeignClient opsFeignClient;
private OpsClient opsClient;
@Resource
private JdbcTemplate jdbcTemplate;
@Resource
private VionConfig vionConfig;
@Scheduled(cron = "13 05 01 * * ?")
/**
* 按天保留数据
*/
@Scheduled(cron = "13 01 02 * * ?")
public void run() {
JsonMessageUtil.JsonMessage<ImageKeepConfig> imageKeepConfigData = opsFeignClient.getImageKeepConfig();
JsonMessageUtil.JsonMessage<ImageKeepConfig> imageKeepConfigData = opsClient.getImageKeepConfig();
ImageKeepConfig config = imageKeepConfigData.getData();
// type 为 1, 按天数保留
if (config.getType() == 1) {
keep1(config.getKeep());
log.info("按保留日期进行删除,日期数为:[{}]", config.getKeep());
// 因为删分区是小于等于,所以这里要多往前推一天
Date date = DateUtil.addDays(new Date(), -config.getKeep() - 1);
keep1(date);
}
// type 为 2, 按磁盘空间比例保留
else if (config.getType() == 2) {
}
/**
* 按磁盘空间保留数据,也是删一整天
*/
@Scheduled(fixedDelay = 1000 * 60 * 60, initialDelay = 60 * 1000)
public void run2() {
try {
JsonMessageUtil.JsonMessage<ImageKeepConfig> imageKeepConfigData = opsClient.getImageKeepConfig();
ImageKeepConfig config = imageKeepConfigData.getData();
if (config.getType() == 2) {
log.info("按磁盘容量的阈值删除,阈值为:[{}]", config.getRate());
boolean needCheck = true;
while (needCheck) {
List<String> strings = RuntimeUtil.execForLines("df -h " + vionConfig.getImage().getPath());
String[] split = strings.get(1).split("\\s+");
int diskUsage = Integer.parseInt(split[4].replace("%", ""));
if (diskUsage > config.getRate()) {
// 删除最早一天的
Date minDate = jdbcTemplate.queryForObject("select min(date)\n" +
"from (\n" +
" select min(CAST(FROM_UNIXTIME(partition_description) as date)) as date\n" +
" from information_schema.partitions\n" +
" where table_name = 'd_traffic'\n" +
" union\n" +
" select min(CAST(FROM_UNIXTIME(partition_description) as date)) as date\n" +
" from information_schema.partitions\n" +
" where table_name = 'd_traffic_face'\n" +
" union\n" +
" select min(CAST(FROM_UNIXTIME(partition_description) as date)) as date\n" +
" from information_schema.partitions\n" +
" where table_name = 'd_flow_data'\n" +
" union\n" +
" select min(CAST(FROM_UNIXTIME(partition_description) as date)) as date\n" +
" from information_schema.partitions\n" +
" where table_name = 'd_flow_event'\n" +
" union\n" +
" select min(CAST(FROM_UNIXTIME(partition_description) as date)) as date\n" +
" from information_schema.partitions\n" +
" where table_name = 'd_behavior'\n" +
" ) as ttt", Date.class);
keep1(minDate);
log.info("磁盘空间使用达到阈值,需要删除:[{}]数据", DateUtil.format(DateUtil.FORMAT_LONG, minDate));
} else {
needCheck = false;
}
}
}
} catch (Exception e) {
log.error("按磁盘空间保留数据执行失败:", e);
}
}
private void keep1(int day) {
// 删除 传入日期及之前 的数据
private void keep1(Date date) {
Date date = DateUtil.addDays(new Date(), -day);
String yyyyMMdd = DateUtil.format("yyyyMMdd", date);
String sql = "select partition_name,CAST(FROM_UNIXTIME(partition_description) as date) as date from information_schema.partitions where table_name = ? and partition_name< ?";
String sql = "select partition_name,CAST(FROM_UNIXTIME(partition_description) as date) as date from information_schema.partitions where table_name = ? and partition_name<= ?";
Set<String> yyyyMMddSet = new HashSet<>();
// 五张表都要处理
for (String tableName : new String[]{"d_traffic", "d_flow_event", "d_behavior", "d_flow_data", "d_traffic_face"}) {
......@@ -89,7 +140,8 @@ public class PicKeepRunner {
for (File file : files) {
String name = file.getName();
if (dirName.equals(name)) {
FileUtils.deleteDirectory(file);
// FileUtils.deleteDirectory(file);
RuntimeUtil.execForStr("rm -rf " + file.getPath());
log.info("删除文件夹:{}", name);
}
}
......
package com.viontech.fanxing.forward.util;
import com.viontech.fanxing.commons.base.LocalCache;
import com.viontech.fanxing.commons.feign.OpsClient;
import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.fanxing.commons.model.Forward;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.forward.feign.OpsFeignClient;
import com.viontech.fanxing.forward.feign.TaskFeignClient;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......@@ -29,7 +29,7 @@ public class CacheUtils {
@Resource
private TaskFeignClient taskFeignClient;
@Resource
private OpsFeignClient opsFeignClient;
private OpsClient opsClient;
@LocalCache(value = "task_map", duration = 1)
public synchronized Map<String, Task> getTaskMap() {
......@@ -51,7 +51,7 @@ public class CacheUtils {
public synchronized List<Forward> getAllForward() {
JsonMessageUtil.JsonMessage<List<Forward>> response = null;
try {
response = opsFeignClient.getForwards();
response = opsClient.getForwards();
} catch (Exception e) {
log.info("获取 forward_list 失败:", e);
}
......
......@@ -46,6 +46,10 @@ spring:
batch:
job:
enabled: false
task:
scheduling:
pool:
size: 10
logging:
config: classpath:logback-${spring.profiles.active}.xml
mybatis:
......
......@@ -3,8 +3,8 @@ package com.viontech.fanxing.forward;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.forward.feign.TaskFeignClient;
import com.viontech.fanxing.forward.runner.PicKeepRunner;
import com.viontech.keliu.util.JsonMessageUtil;
import org.junit.Test;
......
......@@ -3,6 +3,7 @@ package com.viontech.fanxing.forward;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.config.VionConfig;
import com.viontech.fanxing.commons.feign.AuthClient;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
......
......@@ -34,7 +34,7 @@ import java.util.List;
})
@EnableDiscoveryClient
@EnableScheduling
@EnableFeignClients
@EnableFeignClients(basePackages = "com.viontech.fanxing")
@Slf4j
public class GatewayApp {
......
......@@ -17,7 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@EnableFeignClients(basePackages = "com.viontech.fanxing")
@MapperScan(basePackages = "com.viontech.fanxing.ops.mapper")
@Slf4j
public class OpsApp {
......
package com.viontech.fanxing.ops.controller.main;
import com.viontech.fanxing.commons.base.BaseController;
import com.viontech.fanxing.ops.model.OpsServer;
import com.viontech.fanxing.ops.service.main.OpsServerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* .
*
* @author 谢明辉
* @date 2021/12/6
*/
@RestController
@RequestMapping("/opsSerer")
public class OpsController {
@Resource
private OpsServerService opsServerService;
@PostMapping("register")
public Object register(@RequestBody OpsServer opsServer) {
opsServerService.register(opsServer);
return BaseController.success();
}
}
package com.viontech.fanxing.ops.controller.main;
import cn.hutool.core.util.RuntimeUtil;
import com.viontech.fanxing.commons.base.BaseController;
import com.viontech.fanxing.commons.config.VionConfig;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/12/4
*/
@RestController
@RequestMapping("other")
@Slf4j
public class OtherController {
@Resource
private VionConfig vionConfig;
@GetMapping("/diskUsage")
public JsonMessageUtil.JsonMessage<HashMap<String, String>> diskUsage() {
List<String> strings = RuntimeUtil.execForLines("df -h " + vionConfig.getImage().getPath());
String[] split = strings.get(1).split("\\s+");
System.out.println(Arrays.toString(split));
HashMap<String, String> result = new HashMap<>(4);
result.put("size", split[1]);
result.put("used", split[2]);
result.put("use", split[4]);
result.put("mounted", split[5]);
return BaseController.success(result);
}
}
......@@ -4,11 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.constant.ChannelType;
import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.fanxing.commons.model.*;
import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.commons.vo.DictCodeVo;
import com.viontech.fanxing.ops.controller.base.ChannelBaseController;
import com.viontech.fanxing.ops.feign.TaskFeignClient;
import com.viontech.fanxing.ops.service.adapter.ChannelTagService;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
......@@ -83,7 +83,7 @@ public class ChannelController extends ChannelBaseController {
public Object page(ChannelVo channelVo,
@RequestParam(value = "page", defaultValue = "-1") int page,
@RequestParam(value = "pageSize", defaultValue = "100") int pageSize,
String sortName, String sortOrder) {
@RequestParam(required = false, defaultValue = "create_time") String sortName, @RequestParam(required = false, defaultValue = "desc") String sortOrder) {
final Set<String> channelUnidSet = new HashSet<>();
......@@ -118,7 +118,7 @@ public class ChannelController extends ChannelBaseController {
}
response = channels;
} else {
PageInfo<Channel> pageInfo = (PageInfo<Channel>) getService().pagedQuery(baseExample, page, pageSize);
PageInfo<Channel> pageInfo = (PageInfo<Channel>) channelService.pagedQuery(baseExample, page, pageSize);
channels = pageInfo.getList();
response = pageInfo;
}
......
......@@ -39,7 +39,7 @@ public class ContentController extends ContentBaseController {
List result = contentService.selectByExampleWithBlob(baseExample);
return getSuccessJsonMsg(MESSAGE_SELECT_SUCCESS, result);
} else {
PageInfo pageInfo = getService().pagedQuery(baseExample, page, pageSize);
PageInfo pageInfo = contentService.pagedQuery(baseExample, page, pageSize);
return getSuccessJsonMsg(MESSAGE_PAGE_SUCCESS, pageInfo);
}
}
......
package com.viontech.fanxing.ops.model;
import lombok.Getter;
import lombok.Setter;
/**
* .
*
* @author 谢明辉
* @date 2021/12/6
*/
@Getter
@Setter
public class OpsServer {
private String ip;
private Integer port;
private String name;
private Long lastHeartBeat;
}
......@@ -9,11 +9,11 @@ import com.viontech.fanxing.commons.config.VionConfig;
import com.viontech.fanxing.commons.constant.ChannelType;
import com.viontech.fanxing.commons.constant.LogType;
import com.viontech.fanxing.commons.exception.FanXingException;
import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.fanxing.commons.model.*;
import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.commons.vo.DictCodeVo;
import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.fanxing.ops.feign.TaskFeignClient;
import com.viontech.fanxing.ops.mapper.ChannelMapper;
import com.viontech.fanxing.ops.service.adapter.*;
import com.viontech.keliu.util.JsonMessageUtil;
......
package com.viontech.fanxing.ops.service.main;
import com.viontech.fanxing.ops.model.OpsServer;
import org.redisson.api.RBucket;
import org.redisson.api.RKeys;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/12/6
*/
@Service
public class OpsServerService {
@Resource
private RedissonClient redissonClient;
public void register(OpsServer opsServer) {
opsServer.setLastHeartBeat(System.currentTimeMillis());
addOrUpdateOpsServer(opsServer);
}
private List<OpsServer> listAll() {
ArrayList<OpsServer> opsServers = new ArrayList<>();
RKeys keys = redissonClient.getKeys();
Iterable<String> pattern = keys.getKeysByPattern("ops:server:*");
for (String key : pattern) {
opsServers.add(redissonClient.<OpsServer>getBucket(key).get());
}
return opsServers;
}
private OpsServer getOpsServerFromRedisByIp(String ip) {
RBucket<OpsServer> bucket = redissonClient.getBucket("ops:server:" + ip);
if (bucket.isExists()) {
OpsServer opsServer = bucket.get();
if (System.currentTimeMillis() - opsServer.getLastHeartBeat() > Duration.ofMinutes(1).toMillis()) {
bucket.delete();
return null;
} else {
return opsServer;
}
} else {
return null;
}
}
private void addOrUpdateOpsServer(OpsServer opsServer) {
RBucket<OpsServer> bucket = redissonClient.getBucket("ops:server:" + opsServer.getIp());
bucket.set(opsServer);
}
}
......@@ -43,6 +43,10 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
task:
scheduling:
pool:
size: 10
logging:
config: classpath:logback-${spring.profiles.active}.xml
mybatis:
......
package com.viontech.fanxing.ops;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.ops.feign.TaskFeignClient;
import com.viontech.fanxing.ops.service.adapter.ChannelService;
import com.viontech.fanxing.ops.service.adapter.DictCodeService;
import com.viontech.keliu.util.JsonMessageUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
......
......@@ -30,11 +30,6 @@
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-poi</artifactId>
<version>5.7.16</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.1.0</version>
......
......@@ -17,15 +17,15 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@EnableFeignClients(basePackages = "com.viontech.fanxing")
@MapperScan(basePackages = "com.viontech.fanxing.query.mapper")
@Slf4j
public class QueryApp {
public static void main(String[] args) {
try{
try {
SpringApplication.run(QueryApp.class, args);
}catch(Exception e){
} catch (Exception e) {
log.error("query app start error", e);
}
}
......
......@@ -47,9 +47,6 @@ public class TrafficController extends TrafficBaseController {
@RequestMapping(value = "", method = RequestMethod.GET)
public Object page(TrafficVo trafficVo, @RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "pageSize", defaultValue = "30") int pageSize,
@RequestParam(defaultValue = "event_time") String sortName, @RequestParam(defaultValue = "desc") String sortOrder) {
if (trafficVo.getIllegalState() == null) {
trafficVo.setIllegalState(0);
}
Assert.notNull(trafficVo.getEventTime_gte(), "起始时间不能为空");
Assert.notNull(trafficVo.getEventTime_lte(), "结束时间不能为空");
Assert.isTrue(pageSize > 0, "页面大小不正确");
......@@ -61,10 +58,11 @@ public class TrafficController extends TrafficBaseController {
dataType = "非机动车";
} else if ("pedestrian".equals(eventType)) {
dataType = "行人";
} else if (trafficVo.getIllegalState() == 1) {
} else if (trafficVo.getIllegalState() != null && trafficVo.getIllegalState() == 1) {
dataType = "违法";
} else if ("vehicle".equals(eventType)) {
dataType = "过车";
trafficVo.setIllegalState(0);
} else {
throw new FanXingException("参数有误");
}
......@@ -95,16 +93,9 @@ public class TrafficController extends TrafficBaseController {
@GetMapping("/export")
public Object export(TrafficVo trafficVo, @RequestParam String name, @RequestParam Integer withPic, @RequestParam Integer withVideo) {
if (trafficVo.getIllegalState() == null) {
trafficVo.setIllegalState(0);
}
SimplePropertyPreFilter simplePropertyPreFilter = new SimplePropertyPreFilter();
simplePropertyPreFilter.getExcludes().add("model");
String param = JSON.toJSONString(trafficVo, SerializeConfig.globalInstance, new SerializeFilter[]{simplePropertyPreFilter}, "yyyy-MM-dd HH:mm:ss", JSON.DEFAULT_GENERATE_FEATURE);
String eventType = trafficVo.getEventType();
// 违法以外的数据需要带 eventType
if (trafficVo.getIllegalState() == 0) {
if (trafficVo.getIllegalState() == null || trafficVo.getIllegalState() == 0) {
Assert.hasLength(eventType, "eventType不能为空");
}
int type;
......@@ -112,14 +103,19 @@ public class TrafficController extends TrafficBaseController {
type = ExportDataTypeEnum.XCYCLE.type;
} else if ("pedestrian".equals(eventType)) {
type = ExportDataTypeEnum.PEDESTRIAN.type;
} else if (trafficVo.getIllegalState() == 1) {
} else if (trafficVo.getIllegalState() != null && trafficVo.getIllegalState() == 1) {
type = ExportDataTypeEnum.ILLEGAL.type;
} else if ("vehicle".equals(eventType)) {
type = ExportDataTypeEnum.TRAFFIC.type;
trafficVo.setIllegalState(0);
} else {
throw new FanXingException("参数有误");
}
SimplePropertyPreFilter simplePropertyPreFilter = new SimplePropertyPreFilter();
simplePropertyPreFilter.getExcludes().add("model");
String param = JSON.toJSONString(trafficVo, SerializeConfig.globalInstance, new SerializeFilter[]{simplePropertyPreFilter}, "yyyy-MM-dd HH:mm:ss", JSON.DEFAULT_GENERATE_FEATURE);
int i = trafficService.countByExample(getExample(trafficVo));
if (i == 0) {
throw new FanXingException("数据为空");
......@@ -150,6 +146,9 @@ public class TrafficController extends TrafficBaseController {
return JsonMessageUtil.getSuccessJsonMsg(result);
}
/**
* 数据概览详情,某个任务某天每小时的数据量
*/
@GetMapping("overview/detail")
@ResponseBody
public JsonMessageUtil.JsonMessage<Collection<DataOverViewModel>> overviewDetail(@RequestParam(required = false) Date date, @RequestParam Long taskId) {
......@@ -160,6 +159,16 @@ public class TrafficController extends TrafficBaseController {
return JsonMessageUtil.getSuccessJsonMsg(dataOverViewModels);
}
/**
* 数据量统计,某类数据的总数和保存的最大最小日期
*/
@GetMapping("statistics")
@ResponseBody
public JsonMessageUtil.JsonMessage<Object> statistics() {
JSONArray statistics = trafficService.statistics();
return success(statistics);
}
public TrafficExample getExample(TrafficVo trafficVo) {
return (TrafficExample) super.getExample(trafficVo, EXAMPLE_TYPE_PAGE);
......
......@@ -18,5 +18,8 @@ public class DataOverViewModel {
private Long flow;
private Long behavior;
private Integer hour;
private String taskName;
private Integer effectiveAnalysisTime;
private Integer exceptionNum;
}
......@@ -3,7 +3,6 @@ package com.viontech.fanxing.query.runner;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.StyleSet;
import cn.hutool.poi.excel.cell.CellSetter;
import cn.hutool.poi.excel.cell.FormulaCellValue;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
......@@ -279,8 +278,16 @@ public class ExportDataJob {
BehaviorVo behaviorVo = JSON.parseObject(param, BehaviorVo.class);
BehaviorExample example = behaviorController.getExample(behaviorVo);
int nextPage = 1;
boolean interrupted = false;
List<String> pathList = new ArrayList<>();
while (nextPage != 0) {
// 如果被删除了则需要打断
if (needInterrupt(item.getId())) {
log.info("任务已被删除,打断任务");
interrupted = true;
break;
}
PageInfo<BehaviorVo> jsonData = behaviorService.getJsonData(example, nextPage, pageSize);
log.info("数据总量:{}", jsonData.getTotal());
item.setCount(jsonData.getTotal());
......@@ -341,10 +348,29 @@ public class ExportDataJob {
}
nextPage = jsonData.getNextPage();
}
item.setPath(JSON.toJSONString(pathList));
exportDataService.updateByPrimaryKeySelective(item);
if (interrupted) {
new Thread(() -> {
try {
File file = new File(vionConfig.getImage().getPath() + "/export/" + item.getId());
while (file.exists()) {
FileUtils.deleteDirectory(file);
Thread.sleep(10L);
log.info("删除目录:{}", file.getPath());
}
} catch (Exception e) {
log.error("中断了,删除失败", e);
}
}).start();
} else {
item.setPath(JSON.toJSONString(pathList));
exportDataService.updateByPrimaryKeySelective(item);
}
}
private boolean needInterrupt(Long id) {
ExportData exportData = exportDataService.selectByPrimaryKey(id);
return exportData == null;
}
private List<ExportData> getExportDataNeedFinished() {
ExportDataExample exportDataExample = new ExportDataExample();
......
package com.viontech.fanxing.query.service.adapter;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.viontech.fanxing.commons.base.BaseExample;
......@@ -17,4 +18,6 @@ public interface TrafficService extends BaseService<Traffic> {
JSONObject dataOverview(Date date, Long taskId, Integer page, Integer pageSize);
Collection<DataOverViewModel> overviewDetail(Date date, Long taskId);
JSONArray statistics();
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.viontech.fanxing.query.service.impl;
import cn.hutool.core.collection.ListUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
......@@ -9,6 +10,7 @@ import com.github.pagehelper.PageInfo;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseServiceImpl;
import com.viontech.fanxing.commons.base.LocalCache;
import com.viontech.fanxing.commons.model.*;
import com.viontech.fanxing.commons.vo.TrafficVo;
import com.viontech.fanxing.query.mapper.TrafficMapper;
......@@ -16,7 +18,9 @@ import com.viontech.fanxing.query.model.DataOverViewModel;
import com.viontech.fanxing.query.service.adapter.BehaviorService;
import com.viontech.fanxing.query.service.adapter.FlowEventService;
import com.viontech.fanxing.query.service.adapter.TrafficService;
import com.viontech.fanxing.query.service.main.TaskClientService;
import com.viontech.keliu.util.DateUtil;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -31,6 +35,10 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
private FlowEventService flowEventService;
@Resource
private BehaviorService behaviorService;
@Resource
private TaskClientService taskClientService;
@Resource
private JdbcTemplate jdbcTemplate;
@Override
public BaseMapper<Traffic> getMapper() {
......@@ -61,7 +69,11 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
}
@Override
@LocalCache(value = "dataOverview", duration = 1)
public JSONObject dataOverview(Date date, Long taskId, Integer page, Integer pageSize) {
// todo 还需要加有效分析时长(effectiveAnalysisTime) 和 异常次数(exceptionNum)
Map<Long, Task> taskMap = taskClientService.taskMap();
Date min = DateUtil.setDayMinTime(date);
Date max = DateUtil.setDayMaxTime(date);
HashMap<Long, DataOverViewModel> resultMap = new HashMap<>();
......@@ -79,6 +91,7 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
DataOverViewModel dov = resultMap.computeIfAbsent(t.getTaskId(), x -> {
DataOverViewModel temp = new DataOverViewModel();
temp.setTaskId(x);
temp.setTaskName(taskMap.get(x).getName());
return temp;
});
dov.setTraffic(t.getCount());
......@@ -97,6 +110,7 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
DataOverViewModel dov = resultMap.computeIfAbsent(f.getTaskId(), x -> {
DataOverViewModel temp = new DataOverViewModel();
temp.setTaskId(x);
temp.setTaskName(taskMap.get(x).getName());
return temp;
});
dov.setFlow(f.getCount());
......@@ -115,6 +129,7 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
DataOverViewModel dov = resultMap.computeIfAbsent(b.getTaskId(), x -> {
DataOverViewModel temp = new DataOverViewModel();
temp.setTaskId(x);
temp.setTaskName(taskMap.get(x).getName());
return temp;
});
dov.setBehavior(b.getCount());
......@@ -193,4 +208,28 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
}
return resultMap.values();
}
@Override
@LocalCache(value = "traffic_statics_123fds4", duration = 1)
public JSONArray statistics() {
JSONArray jsonArray = new JSONArray();
jdbcTemplate.query("select '过车数据' as dataType ,max(event_time) maxTime,min(event_time) minTime,count(pics) as picCount,count(video_name) as videoCount from d_traffic where event_type='vehicle' and illegal_state=0\n" +
"union\n" +
"select '违法数据' as dataType ,max(event_time) maxTime,min(event_time) minTime,count(pics) as picCount,count(video_name) as videoCount from d_traffic where event_type='vehicle' and illegal_state=1\n" +
"union\n" +
"select '非机动车数据' as dataType ,max(event_time) maxTime,min(event_time) minTime,count(pics) as picCount,count(video_name) as videoCount from d_traffic where event_type='xcycle'\n" +
"union\n" +
"select '行人数据' as dataType ,max(event_time) maxTime,min(event_time) minTime,count(pics) as picCount,count(video_name) as videoCount from d_traffic where event_type='pedestrian'\n" +
"union\n" +
"select '事件数据' as dataType ,max(event_time) maxTime,min(event_time) minTime,count(pics) as picCount,count(video) as videoCount from d_behavior", rs -> {
JSONObject jsonObject = new JSONObject();
jsonObject.put("dataType", rs.getString("dataType"));
jsonObject.put("maxTime", rs.getDate("maxTime"));
jsonObject.put("minTime", rs.getDate("minTime"));
jsonObject.put("picCount", rs.getLong("picCount"));
jsonObject.put("videoCount", rs.getLong("videoCount"));
jsonArray.add(jsonObject);
});
return jsonArray;
}
}
\ No newline at end of file
......@@ -3,9 +3,9 @@ package com.viontech.fanxing.query.service.main;
import com.viontech.fanxing.commons.base.LocalCache;
import com.viontech.fanxing.commons.constant.LogType;
import com.viontech.fanxing.commons.exception.FanXingException;
import com.viontech.fanxing.commons.feign.OpsClient;
import com.viontech.fanxing.commons.model.*;
import com.viontech.fanxing.commons.vo.LogVo;
import com.viontech.fanxing.query.feign.OpsClient;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......
package com.viontech.fanxing.query.service.main;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* .
*
* @author 谢明辉
* @date 2021/12/6
*/
@Service
@Slf4j
public class TaskClientService {
@Resource
private TaskFeignClient taskFeignClient;
public Map<Long, Task> taskMap() {
JsonMessageUtil.JsonMessage<List<Task>> allTask = taskFeignClient.getAllTask();
return allTask.getData().stream().collect(Collectors.toMap(Task::getId, x -> x, (a, b) -> a));
}
}
......@@ -43,6 +43,10 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
task:
scheduling:
pool:
size: 10
logging:
config: classpath:logback-${spring.profiles.active}.xml
mybatis:
......
......@@ -17,7 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@EnableFeignClients(basePackages = "com.viontech.fanxing")
@Slf4j
@MapperScan(basePackages = "com.viontech.fanxing.task.mapper")
public class TaskApp {
......
......@@ -16,6 +16,7 @@ import com.viontech.fanxing.commons.model.TaskExample;
import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.fanxing.task.controller.base.TaskBaseController;
import com.viontech.fanxing.task.model.ConfigBuilder;
import com.viontech.fanxing.task.runner.VaServerCheckRunner;
import com.viontech.fanxing.task.service.OpsClientService;
import com.viontech.fanxing.task.utils.SceneUtils;
import com.viontech.keliu.util.JsonMessageUtil;
......@@ -66,7 +67,10 @@ public class TaskController extends TaskBaseController {
List result = taskService.selectByExample(baseExample);
return getSuccessJsonMsg(MESSAGE_SELECT_SUCCESS, result);
} else {
PageInfo pageInfo = getService().pagedQuery(baseExample, page, pageSize);
PageInfo<TaskVo> pageInfo = taskService.pageVo(baseExample, page, pageSize);
for (TaskVo vo : pageInfo.getList()) {
vo.setStreamInfo(VaServerCheckRunner.STREAM_INFO_MAP.get(vo.getUnid()));
}
return getSuccessJsonMsg(MESSAGE_PAGE_SUCCESS, pageInfo);
}
}
......@@ -268,7 +272,7 @@ public class TaskController extends TaskBaseController {
}
if (error) {
JsonMessageUtil.JsonMessage message = JsonMessageUtil.getErrorJsonMsg("有任务操作失败");
message.setData(build);
message.setData(build.asMap());
return message;
} else {
return JsonMessageUtil.getSuccessJsonMsg("成功");
......
package com.viontech.fanxing.task.feign;
import com.viontech.fanxing.commons.model.*;
import com.viontech.fanxing.commons.vo.LogVo;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/7/20
*/
@Component
@FeignClient(value = "fanxing-ops")
public interface OpsClient {
@GetMapping("/storeConfigs/{id}")
JsonMessageUtil.JsonMessage<StoreConfig> getStoreConfigById(@PathVariable("id") Long storeConfigId);
@GetMapping("/contents")
JsonMessageUtil.JsonMessage<List<Content>> getContentByName(@RequestParam("name") String name);
@GetMapping("/channels")
JsonMessageUtil.JsonMessage<List<Channel>> getChannelByChannelUnid(@RequestParam("channelUnid") String channelUnid);
@GetMapping("/dictCodes")
JsonMessageUtil.JsonMessage<List<DictCode>> getDictCodeByUnid(@RequestParam("unid") String unid);
@PostMapping("/logs")
JsonMessageUtil.JsonMessage<Log> addLog(@RequestBody LogVo logVo);
}
......@@ -3,7 +3,6 @@ package com.viontech.fanxing.task.runner;
import com.viontech.fanxing.commons.constant.TaskStatus;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.service.RedisService;
import com.viontech.fanxing.task.feign.OpsClient;
import com.viontech.fanxing.task.model.TaskData;
import com.viontech.fanxing.task.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.service.TaskDataService;
......@@ -40,8 +39,6 @@ public class TaskRunner {
@Resource
private TaskDataService taskDataService;
@Resource
private OpsClient opsClient;
@Resource
private TaskService taskService;
@Scheduled(fixedDelay = 5000)
......
package com.viontech.fanxing.task.runner;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.model.main.StreamInfo;
import com.viontech.fanxing.task.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.service.VAServerService;
import lombok.extern.slf4j.Slf4j;
......@@ -13,6 +15,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* .
......@@ -25,6 +28,7 @@ import java.util.Set;
@Slf4j
@Profile("!test")
public class VaServerCheckRunner {
public static final ConcurrentHashMap<String, StreamInfo> STREAM_INFO_MAP = new ConcurrentHashMap<>();
@Resource
private VAServerService vaServerService;
......@@ -48,8 +52,23 @@ public class VaServerCheckRunner {
float availableResource = brief.getFloatValue("video_free");
vaServerInfo.setAvailableResources(availableResource);
vaServerInfo.setVideoResource(videoResource);
vaServerService.getVaServerRedisRepository().addOrUpdate(devId, vaServerInfo);
// 统计帧率和视频源状态
if (!status.containsKey("tasks")) {
continue;
}
JSONArray tasks = status.getJSONArray("tasks");
for (int i = 0; i < tasks.size(); i++) {
JSONObject jsonObject = tasks.getJSONObject(i);
String taskUnid = jsonObject.getString("task_unid");
Float sourceStreamFrameRate = jsonObject.getFloat("source_stream_frame_rate");
Float analyseStreamFrameRate = jsonObject.getFloat("analyse_stream_frame_rate");
String channelUnid = jsonObject.getString("channel_unid");
StreamInfo streamInfo = new StreamInfo(taskUnid, channelUnid, sourceStreamFrameRate, analyseStreamFrameRate);
STREAM_INFO_MAP.put(taskUnid, streamInfo);
}
} else {
log.info("设备处于离线状态:{}", devId);
}
......
......@@ -2,12 +2,12 @@ package com.viontech.fanxing.task.service;
import com.viontech.fanxing.commons.constant.LogType;
import com.viontech.fanxing.commons.exception.FanXingException;
import com.viontech.fanxing.commons.feign.OpsClient;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.vo.LogVo;
import com.viontech.fanxing.task.feign.OpsClient;
import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......
package com.viontech.fanxing.task.service.adapter;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseService;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.vo.TaskVo;
public interface TaskService extends BaseService<Task> {
PageInfo<TaskVo> pageVo(BaseExample example, int pageNum, int pageSize);
TaskVo addTask(Task task);
TaskVo updateTask(Task task);
......
......@@ -37,6 +37,7 @@ import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskService {
......@@ -78,6 +79,18 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic
}
}
@Override
public PageInfo<TaskVo> pageVo(BaseExample example, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
Page<Task> result = (Page<Task>) taskMapper.selectByExampleWithBLOBs((TaskExample) example);
Page<TaskVo> page = new Page<>(pageNum, pageSize, true);
page.setTotal(result.getTotal());
List<TaskVo> collect = result.stream().map(TaskVo::new).collect(Collectors.toList());
page.addAll(collect);
return new PageInfo<>(page);
}
@Transactional(rollbackFor = Exception.class)
@Override
public TaskVo addTask(Task task) {
......@@ -236,7 +249,7 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic
RLock taskLock = taskDataService.getRepository().getTaskLock(task.getUnid());
try {
taskDataService.deleteTask(task.getUnid());
updateStatus(id, TaskStatus.PAUSE.val);
updateStatus(id, TaskStatus.AWAIT.val);
opsClientService.addLog("停止任务:" + task.getName());
} finally {
taskLock.forceUnlock();
......
......@@ -43,6 +43,10 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
task:
scheduling:
pool:
size: 10
mybatis:
type-aliases-package: com.viontech.fanxing.commons.model
mapper-locations: classpath:com/viontech/fanxing/task/mapping/*.xml
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!