新增本地目录文件点位逻辑
This commit is contained in:
parent
88ee5540d9
commit
2f51438a5b
@ -85,7 +85,8 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
|
|||||||
String uuid = IdUtil.fastSimpleUUID();
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
algorithmClass.setId(uuid);
|
algorithmClass.setId(uuid);
|
||||||
}
|
}
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
// String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
String currentUsername = "admin";
|
||||||
this.saveOrUpdate(algorithmClass);
|
this.saveOrUpdate(algorithmClass);
|
||||||
List<AlgorithmParams> algorithmParamsList = algorithmParamsRequest.getAlgorithmParamsList();
|
List<AlgorithmParams> algorithmParamsList = algorithmParamsRequest.getAlgorithmParamsList();
|
||||||
algorithmParamsList.forEach(r -> {
|
algorithmParamsList.forEach(r -> {
|
||||||
|
@ -463,70 +463,19 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
config.getSnapFilePath() + fullfilename);
|
config.getSnapFilePath() + fullfilename);
|
||||||
}
|
}
|
||||||
} else if ("3".equals(config.getFilefromtype())) {
|
} else if ("3".equals(config.getFilefromtype())) {
|
||||||
typelist.clear();
|
|
||||||
String typeStr = "bj_bpmh,bj_bpps,bj_wkps,bjdsyc_zz,bjdsyc_ywj,bmwh," +
|
|
||||||
"hxq_gjbs,hxq_gjtps,hxq_yfps,jyz_pl,pzqcd,sly_dmyw,ws_ywyc," +
|
|
||||||
"xmbhyc,yljdq_flow,yljdq_stop,yw_gkxfw,ywzt_yfyc";
|
|
||||||
// String typeStr = "sly_dmyw";
|
|
||||||
typelist.addAll(StrUtil.split(typeStr, ","));
|
|
||||||
//检测系统指定文件目录
|
|
||||||
String sourceFilePath = config.getTestfilepath();
|
String sourceFilePath = config.getTestfilepath();
|
||||||
File directory = new File(sourceFilePath);
|
String deviceName = ObjectUtil.isNotEmpty(map.get("deviceName")) ?
|
||||||
if (directory.exists() && directory.isDirectory()) {
|
map.get("deviceName").toString() : "";
|
||||||
File[] files = directory.listFiles();
|
if (StrUtil.isNotBlank(deviceName)) {
|
||||||
if (files != null && files.length > 0) {
|
String formatfilePath = String.format("%s%s.jpg", sourceFilePath,
|
||||||
String taskTodoId = taskTodo.getTaskTodoId();
|
deviceName);
|
||||||
LambdaUpdateWrapper<TaskTodo> updateWrapper1 =
|
if (FileUtil.exist(formatfilePath)) {
|
||||||
new LambdaUpdateWrapper<>();
|
FileUtil.copy(formatfilePath,
|
||||||
updateWrapper1.eq(TaskTodo::getTaskTodoId, taskTodoId).set(TaskTodo::getDeviceSumnum, files.length);
|
config.getSnapFilePath() + fullfilename, true);
|
||||||
todoTaskService.update(updateWrapper1);
|
log.info("直接获取文件夹中文件" + fullfilename);
|
||||||
TaskResult taskResult = taskResultMapper.selectById(map.get("resultId").toString());
|
|
||||||
taskResultMapper.deleteById(taskResult.getResultId());
|
|
||||||
for (int i = 0; i < files.length; i++) {
|
|
||||||
TaskResult taskResult1 = BeanUtil.copyProperties(taskResult,
|
|
||||||
TaskResult.class);
|
|
||||||
String id = IdUtil.simpleUUID();
|
|
||||||
taskResult1.setResultId(id);
|
|
||||||
String firstFileName = files[i].getName();
|
|
||||||
String sourceFile = sourceFilePath + firstFileName;
|
|
||||||
|
|
||||||
String filepath1 = String.format("%s/%s/%s/%s/%s/%s/",
|
|
||||||
quartzJob.getStationCode(),
|
|
||||||
DateUtil.format(DateUtil.date(), "yyyy"),
|
|
||||||
DateUtil.format(DateUtil.date(), "MM"),
|
|
||||||
DateUtil.format(DateUtil.date(), "dd"),
|
|
||||||
quartzJob.getTaskCode(),
|
|
||||||
filetype
|
|
||||||
);
|
|
||||||
//文件命名格式为:日期_时间_间隔名_设备名_点位名_类型.jpg
|
|
||||||
// String filename1 = String.format("%s_%s_%s_%s_%s_%s_%s.jpg",
|
|
||||||
// DateUtil.format(DateUtil.date(), "yyyyMMdd"),
|
|
||||||
// DateUtil.format(DateUtil.date(), "HHmmss"),
|
|
||||||
// map.get("bayName").toString(),
|
|
||||||
// map.get("mainDeviceName").toString(),
|
|
||||||
// map.get("deviceName").toString(),
|
|
||||||
// i,
|
|
||||||
// "原图"
|
|
||||||
// );
|
|
||||||
String filename1 = firstFileName.replace(".", "_原图.");
|
|
||||||
String fullfilename1 = filepath1 + filename1;
|
|
||||||
FileUtil.touch(config.getSnapFilePath() + fullfilename1);
|
|
||||||
FileUtil.copy(sourceFile,
|
|
||||||
config.getSnapFilePath() + fullfilename1, true);
|
|
||||||
// FileUtil
|
|
||||||
// .del
|
|
||||||
// (sourceFile);
|
|
||||||
taskResult1.setFilePath(fullfilename1);
|
|
||||||
taskResultMapper.insert(taskResult1);
|
|
||||||
mapList.add(taskResult1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
log.error("目录为空或没有文件");
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log.error("指定的路径不是一个有效的目录");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,9 +483,9 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
//转码存储
|
//转码存储
|
||||||
String encodefilename = fullfilename;
|
String encodefilename = fullfilename;
|
||||||
fullfilename = URLEncoder.encode(fullfilename, "utf-8");
|
fullfilename = URLEncoder.encode(fullfilename, "utf-8");
|
||||||
if (!"3".equals(config.getFilefromtype())) {
|
// if (!"3".equals(config.getFilefromtype())) {
|
||||||
todoTaskService.updateTaskResultStatus(quartzJob.getTaskTodoId(), map.get("resultId").toString(), fullfilename, "1");
|
todoTaskService.updateTaskResultStatus(quartzJob.getTaskTodoId(), map.get("resultId").toString(), fullfilename, "1");
|
||||||
}
|
// }
|
||||||
// 3、 调用图片识别算法,进行图形识别
|
// 3、 调用图片识别算法,进行图形识别
|
||||||
//表计类型
|
//表计类型
|
||||||
// if (ObjectUtil.isNotEmpty(map.get("meterType"))) {
|
// if (ObjectUtil.isNotEmpty(map.get("meterType"))) {
|
||||||
@ -600,51 +549,9 @@ public class TodoTaskJob extends QuartzJobBean implements InterruptableJob {
|
|||||||
rtspurl, fullfilename, outsideAngle,
|
rtspurl, fullfilename, outsideAngle,
|
||||||
csvFilePath);
|
csvFilePath);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ("3".equals(config.getFilefromtype())) {
|
|
||||||
// for (TaskResult taskResult : mapList) {
|
|
||||||
// Thread.sleep(3000);
|
|
||||||
// httpUtil.callPicAnalyse(map.get("taskTodoId").toString(), taskResult.getResultId(), JSONUtil.toJsonStr(typelist), JSONUtil.toJsonStr(customParams), taskResult.getFilePath());
|
|
||||||
// }
|
|
||||||
// 线程池大小
|
|
||||||
int numberOfThreads = 1;
|
|
||||||
|
|
||||||
// 计算每个线程需要处理的数据量
|
|
||||||
int chunkSize = mapList.size() / numberOfThreads;
|
|
||||||
// 线程池
|
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads);
|
|
||||||
|
|
||||||
// 提交任务给线程池
|
|
||||||
for (int i = 0; i < numberOfThreads; i++) {
|
|
||||||
int start = i * chunkSize;
|
|
||||||
int end = (i == numberOfThreads - 1) ? mapList.size() : start + chunkSize;
|
|
||||||
List<TaskResult> subList = mapList.subList(start, end);
|
|
||||||
|
|
||||||
// 提交一个Callable或Runnable任务给线程池
|
|
||||||
// 这里我们使用Runnable和一个匿名内部类来简化示例
|
|
||||||
executor.submit(() -> {
|
|
||||||
for (TaskResult taskResult : subList) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(3000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error(e.getMessage());;
|
|
||||||
}
|
|
||||||
log.info("customParams:" + JSONUtil.toJsonStr(customParams));
|
|
||||||
try {
|
|
||||||
httpUtil.callPicAnalyse(map.get("taskTodoId").toString(), taskResult.getResultId(), JSONUtil.toJsonStr(typelist),
|
|
||||||
JSONUtil.toJsonStr(customParams), taskResult.getFilePath());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
callresult = httpUtil.callPicAnalyse(map.get("taskTodoId").toString(),
|
callresult = httpUtil.callPicAnalyse(map.get("taskTodoId").toString(),
|
||||||
map.get("resultId").toString(), JSONUtil.toJsonStr(typelist),
|
map.get("resultId").toString(), JSONUtil.toJsonStr(typelist),
|
||||||
JSONUtil.toJsonStr(customParams), encodefilename);
|
JSONUtil.toJsonStr(customParams), encodefilename);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解除摄像头的工作状态
|
// 解除摄像头的工作状态
|
||||||
|
@ -154,8 +154,8 @@ httpserver: #配置http请求访问的地址
|
|||||||
documentpath: d:\riis\document\
|
documentpath: d:\riis\document\
|
||||||
|
|
||||||
callmethod: 0 #热成像调用方式 0: 调用sdk, 1: 调用智能分析主机
|
callmethod: 0 #热成像调用方式 0: 调用sdk, 1: 调用智能分析主机
|
||||||
filefromtype: 1 # 1: 摄像机视频流截图, 2:机器人采集上传文件 3:测试检测目录文件
|
filefromtype: 3 # 1: 摄像机视频流截图, 2:机器人采集上传文件 3:测试检测目录文件
|
||||||
testfilepath: d:\Test\ #检测识别文件存放目录
|
testfilepath: d:\test\ #检测识别文件存放目录
|
||||||
|
|
||||||
algorithm:
|
algorithm:
|
||||||
manufacturer:
|
manufacturer:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
ad.source_type,
|
ad.source_type,
|
||||||
ad.device_id,
|
ad.device_id,
|
||||||
ad.device_name,
|
ad.device_name,
|
||||||
ad.id
|
ap.id
|
||||||
FROM
|
FROM
|
||||||
iis_algorithm_params ap
|
iis_algorithm_params ap
|
||||||
LEFT JOIN iis_algorithm_device ad ON ap.id = ad.param_id
|
LEFT JOIN iis_algorithm_device ad ON ap.id = ad.param_id
|
||||||
|
Loading…
Reference in New Issue
Block a user