1、指令is_judged变更为四个状态,修改指令研判接口

2、修改处理研判后任务的逻辑,若指令存在,增加is_judged判断,如果为2,要变为1,其他不变。如果指令不存在,isjudged默认为2
This commit is contained in:
PushM
2024-06-16 01:10:36 +08:00
parent 5af3493ba0
commit aa6188b1ef
5 changed files with 75 additions and 28 deletions

View File

@@ -70,6 +70,61 @@ public class CommandService {
return commandInfo.getUUID();
}
@DSTransactional
public String createCommand2(TaskCommandInfo commandInfo, Integer isJudged) {
String uuid = commandMapper.queryCommandInfo(commandInfo);
if (uuid != null) {
if (isJudged == 0){
//研判后任务,将本次忽略的指令设置为待研判
commandMapper.updateCommandIsJudgedIfIgnoreThisTime(uuid);
}
return uuid;
}
commandInfo.setDisplayId(
"ZL-"
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
+ "-"
+ String.format("%06d", counter.generateId("command"))
);
//指令:白名单检查
List<WhiteListObject> whiteListsHit = commandMapper.whiteListCommandCheck(commandInfo.getFiveTupleWithMask());
if (!whiteListsHit.isEmpty()) {
commandInfo.setUUID(UUID.randomUUID().toString());
commandMapper.createCommandInWhiteListHit(commandInfo);
commandMapper.createCommandWhiteListConnect(commandInfo.getUUID(), whiteListsHit);
//写入历史表
insertCommandHistory(commandInfo.getUUID());
return commandInfo.getUUID();
}
commandInfo.setUUID(UUID.randomUUID().toString());
commandMapper.createCommand(commandInfo);
//写入历史表
insertCommandHistory(commandInfo.getUUID());
//发送指令新建信号...实时任务 isJudged=1 才首次立刻下发
try {
if (isJudged == 1){
stateHandler.sendCommandDistributeSignal(Collections.singletonList(commandInfo.getUUID()));
}
}catch (Exception e) {
log.info(String.format("实时任务首次指令下发c3出错commandUUIDs: %s",
commandInfo.getUUID()));
}
//发送RCP查询信号
try {
if (isJudged == 1){
stateHandler.sendCommandRcpQuerySignal(Collections.singletonList(commandInfo.getUUID()));
}
}catch (Exception e) {
log.info(String.format("实时任务首次指令查询RCP出错commandUUIDs: %s",
commandInfo.getUUID()));
}
return commandInfo.getUUID();
}
public List<String> createCommands(List<TaskCommandInfo> taskCommandInfos) {
List<String> commandUUIDs = ListUtils.newArrayListWithExpectedSize(taskCommandInfos.size());
@@ -137,6 +192,8 @@ public class CommandService {
}
public Boolean setCommandJudged(String commandId, Integer isJudged) {
//查詢指令当前is_judged状态,如果为0才可以被修改
//设置指令是否已经研判
Boolean success = commandMapper.setCommandJudged(commandId, isJudged);
@@ -145,6 +202,7 @@ public class CommandService {
if (isJudged != 1) {
return success;
}
//如果isJudged=1,则发送指令首次下发信号和RCP首次查询信号
//指令首次下发
try {
stateHandler.sendCommandDistributeSignal(commandUUIDs);