|
|
|
@ -500,15 +500,15 @@ public class JobMainTask { |
|
|
|
if (PresetAction.PHOTO.getCode().equals(presetAction.getActionType())) { |
|
|
|
final String chanType = presetPos.getChannelType(); |
|
|
|
fileTypes.append("ir".equals(chanType) ? "1" : "vl".equals(chanType) ? "2" : "").append(","); |
|
|
|
boolean bOk = false; |
|
|
|
//boolean bOk = false; |
|
|
|
try { |
|
|
|
log.info("PHOTO PresetType uuid: {}, chanType: {}, videoNvrCode: {}, channelCode: {}, patrolPointId: {}", uuid, chanType, presetPos.getVideoNvrCode(), presetPos.getChannelCode(), presetPos.getPatrolPointId()); |
|
|
|
if ("vl".equals(chanType)) { |
|
|
|
String paramUrl = liveIVS_URL + "/api/v1/device/channelsnap?serial=" |
|
|
|
+ presetPos.getVideoNvrCode() |
|
|
|
+ "&realtime=true&code=" + presetPos.getChannelCode() |
|
|
|
+ "&presetName=" + URLEncoder.encode(presetPos.getPresetPosName(), ("UTF-8")) |
|
|
|
+ "&patrolPointId=" + presetPos.getPatrolPointId(); |
|
|
|
+ "&name=" + URLEncoder.encode(presetPos.getPresetPosName(), ("UTF-8")) |
|
|
|
+ "&id=" + presetPos.getPatrolPointId(); |
|
|
|
String paramFileName = taskPatrolId.split(StringUtils.UNDERLINE)[1] + StringUtils.UNDERLINE |
|
|
|
+ taskPatrolId.split(StringUtils.UNDERLINE)[2] + StringUtils.UNDERLINE |
|
|
|
+ presetPos.getPatrolPointId() + StringUtils.UNDERLINE |
|
|
|
@ -518,7 +518,7 @@ public class JobMainTask { |
|
|
|
FtpResult ftpResult = getFileAndSave(paramUrl, paramFileName, paramFileDir); |
|
|
|
if (ftpResult != null && StringUtils.isNotEmpty(ftpResult.getFilepath())) { |
|
|
|
log.info("filePath: {}", ftpResult.getFilepath()); |
|
|
|
bOk = ftpResult.isOk(); |
|
|
|
//bOk = ftpResult.isOk(); |
|
|
|
filePaths.append("/" + ftpResult.getFilepath()); |
|
|
|
} |
|
|
|
} else if ("ir".equals(chanType)) { |
|
|
|
@ -559,7 +559,7 @@ public class JobMainTask { |
|
|
|
FtpResult ftpResult = getFileAndSave(paramUrl, paramFileName, paramFileDir); |
|
|
|
if (ftpResult != null && StringUtils.isNotEmpty(ftpResult.getFilepath())) { |
|
|
|
log.info("红外处理新流程: filePath: {}", ftpResult.getFilepath()); |
|
|
|
bOk = ftpResult.isOk(); |
|
|
|
//bOk = ftpResult.isOk(); |
|
|
|
filePaths.append("/" + ftpResult.getFilepath()); |
|
|
|
} |
|
|
|
} else { // 古老的红外处理流程,保留勿删除 |
|
|
|
@ -584,7 +584,7 @@ public class JobMainTask { |
|
|
|
log.error("error", e); |
|
|
|
} |
|
|
|
|
|
|
|
recordPersist(bOk, taskExecRecord, infoListSize, patrolTaskInfo, presetPos, fileTypes, filePaths); |
|
|
|
recordPersist(taskExecRecord, infoListSize, patrolTaskInfo, presetPos, fileTypes, filePaths); |
|
|
|
} else if (PresetAction.VIDEO.getCode().equals(presetAction.getActionType())) { |
|
|
|
log.info("VIDEO PresetType videoNvrCode: {}, channelCode: {}", presetPos.getVideoNvrCode(), presetPos.getChannelCode()); |
|
|
|
fileTypes.append(4).append(","); |
|
|
|
@ -638,8 +638,7 @@ public class JobMainTask { |
|
|
|
return rectangles.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
synchronized private void addPointRecord(boolean bOk, |
|
|
|
PatrolTaskExecRecord taskExecRecord, |
|
|
|
synchronized private void addPointRecord(PatrolTaskExecRecord taskExecRecord, |
|
|
|
PatrolTaskInfo taskInfo, |
|
|
|
PatrolPresetPosSlim presetPos, |
|
|
|
StringBuffer fileTypes, |
|
|
|
@ -665,15 +664,10 @@ public class JobMainTask { |
|
|
|
.oldTaskPatrolledId(taskExecRecord.getOldTaskPatrolId()) |
|
|
|
.patrolPointId(presetPos.getPatrolPointId()) |
|
|
|
.time(new Date()) |
|
|
|
.isOk(bOk ? 1 : 0) |
|
|
|
.isOk(1) |
|
|
|
.build(); |
|
|
|
taskExecClient.addPatrolTaskPointExecRecord(pointExecRecord); |
|
|
|
|
|
|
|
if (!bOk) { |
|
|
|
log.info(Color.RED + "pointExecRecord crud add taskPatrolId: {}, deviceId: {}" + Color.END, taskPatrolId, deviceId); |
|
|
|
} |
|
|
|
|
|
|
|
//if (bOk) |
|
|
|
log.info(Color.RED + "pointExecRecord crud add taskPatrolId: {}, deviceId: {}" + Color.END, taskPatrolId, deviceId); |
|
|
|
//if(!testMode) |
|
|
|
{ |
|
|
|
String patrolId = taskExecRecord.getTaskPatrolId(); |
|
|
|
@ -750,7 +744,7 @@ public class JobMainTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
synchronized private int addCursorNumber(String taskPatrolId, boolean bOk, int infoListSize) { |
|
|
|
synchronized private int addCursorNumber(String taskPatrolId, int infoListSize) { |
|
|
|
PatrolTaskExecRecord taskExecRecord = taskExecClient.selectPatrolTaskExecRecordByTaskPatrolId(taskPatrolId); |
|
|
|
|
|
|
|
int total = taskExecRecord.getTotalNumber(); |
|
|
|
@ -866,17 +860,17 @@ public class JobMainTask { |
|
|
|
taskExecClient.updatePatrolTaskExecRecord(execRecord); |
|
|
|
} |
|
|
|
|
|
|
|
synchronized private PatrolTaskExecRecord recordPersist(boolean bOk, |
|
|
|
PatrolTaskExecRecord taskExecRecord, |
|
|
|
int infoListSize, |
|
|
|
PatrolTaskInfo taskInfo, |
|
|
|
PatrolPresetPosSlim presetPos, |
|
|
|
StringBuffer fileTypes, |
|
|
|
StringBuffer filePaths) { |
|
|
|
synchronized private PatrolTaskExecRecord recordPersist( |
|
|
|
PatrolTaskExecRecord taskExecRecord, |
|
|
|
int infoListSize, |
|
|
|
PatrolTaskInfo taskInfo, |
|
|
|
PatrolPresetPosSlim presetPos, |
|
|
|
StringBuffer fileTypes, |
|
|
|
StringBuffer filePaths) { |
|
|
|
|
|
|
|
log.info(Color.CYAN + "recordPersistTrace bOk: {}" + Color.END, bOk); |
|
|
|
//log.info(Color.CYAN + "recordPersistTrace bOk: {}" + Color.END, bOk); |
|
|
|
try { |
|
|
|
addPointRecord(bOk, taskExecRecord, taskInfo, presetPos, fileTypes, filePaths); |
|
|
|
addPointRecord(taskExecRecord, taskInfo, presetPos, fileTypes, filePaths); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("error", e); |
|
|
|
} |
|
|
|
@ -885,7 +879,7 @@ public class JobMainTask { |
|
|
|
log.info(Color.CYAN + "addCursorNumberStart" + Color.END); |
|
|
|
int cursorNumber = 0; |
|
|
|
try { |
|
|
|
cursorNumber = addCursorNumber(taskExecRecord.getTaskPatrolId(), bOk, infoListSize); |
|
|
|
cursorNumber = addCursorNumber(taskExecRecord.getTaskPatrolId(), infoListSize); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("error", e); |
|
|
|
} |
|
|
|
@ -1269,10 +1263,10 @@ public class JobMainTask { |
|
|
|
log.info("CompletableFuture Break Join: taskPatrolId: {}", patrolTaskExecRecord.getOldTaskPatrolId()); |
|
|
|
} |
|
|
|
|
|
|
|
private void handlePrePointBatch(final int threadCnt, final PatrolTaskExecRecord patrolTaskExecRecord, final List<PatrolTaskInfo> batch) { |
|
|
|
asyncTaskPatrolPointCnt.getAndAdd(batch.size()); |
|
|
|
private void handlePrePointBatch(final int threadCnt, final PatrolTaskExecRecord patrolTaskExecRecord, final List<PatrolTaskInfo> taskInfoBatch) { |
|
|
|
asyncTaskPatrolPointCnt.getAndAdd(taskInfoBatch.size()); |
|
|
|
log.info("handlePrePointBatch threadCnt: {}, asyncTaskPatrolPointCnt: {}, batch size: {}, devNo: {}, taskId: {}", |
|
|
|
threadCnt, asyncTaskPatrolPointCnt.get(), batch.size(), patrolTaskExecRecord.getDevNo(), patrolTaskExecRecord.getTaskId()); |
|
|
|
threadCnt, asyncTaskPatrolPointCnt.get(), taskInfoBatch.size(), patrolTaskExecRecord.getDevNo(), patrolTaskExecRecord.getTaskId()); |
|
|
|
|
|
|
|
final String taskPatrolId = patrolTaskExecRecord.getOldTaskPatrolId(); |
|
|
|
StatusMonitor monitor = TaskStatusManager.get(patrolTaskExecRecord.getOldTaskPatrolId()); |
|
|
|
@ -1288,7 +1282,7 @@ public class JobMainTask { |
|
|
|
return taskState; |
|
|
|
}); |
|
|
|
} |
|
|
|
for (final PatrolTaskInfo taskInfo : batch) { |
|
|
|
for (final PatrolTaskInfo taskInfo : taskInfoBatch) { |
|
|
|
log.info("handlePrePointBatch taskPatrolId: {}, patrolPointId: {}, lineId: {}", patrolTaskExecRecord.getTaskPatrolId(), taskInfo.getDeviceId(), taskInfo.getLineId()); |
|
|
|
int status = monitor.getStatus(); |
|
|
|
if (status == Integer.parseInt(TaskStatus.HALTED.getCode())) { |
|
|
|
@ -1306,7 +1300,7 @@ public class JobMainTask { |
|
|
|
} else if (status == -1 || status == 0) { |
|
|
|
log.info("task status error state taskPatrolId: {}", taskPatrolId); |
|
|
|
} |
|
|
|
prePointExec(patrolTaskExecRecord, taskInfo, batch.size()); |
|
|
|
prePointExec(patrolTaskExecRecord, taskInfo, taskInfoBatch.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|