1. 解除动态规则发送请求成功/失败返回状态
2. 在指令中添加局点/部门信息
This commit is contained in:
@@ -90,4 +90,26 @@ public class FiveTupleWithMask {
|
||||
assert protocol != null;
|
||||
this.protocolNum = protocol.getNumber();
|
||||
}
|
||||
|
||||
public void setMask() {
|
||||
if (this.sourceIP != null && this.maskSourceIP == null) {
|
||||
this.maskSourceIP = "255.255.255.255";
|
||||
}
|
||||
|
||||
if (this.sourcePort != null && this.maskSourcePort == null) {
|
||||
this.maskSourcePort = "65535";
|
||||
}
|
||||
|
||||
if (this.destinationIP != null && this.maskDestinationIP == null) {
|
||||
this.maskDestinationIP = "255.255.255.255";
|
||||
}
|
||||
|
||||
if (this.destinationPort != null && this.maskDestinationPort == null) {
|
||||
this.maskDestinationPort = "65535";
|
||||
}
|
||||
|
||||
if (this.protocol != null && this.maskProtocol == null) {
|
||||
this.maskProtocol = "255"; // 协议掩码这里填写255以确保覆盖大部分协议
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,14 @@ public class TaskCommandInfo {
|
||||
@JsonProperty("task_act")
|
||||
private String taskAct;
|
||||
|
||||
@Schema(description = "部门", example = "XXX")
|
||||
@JsonProperty("department")
|
||||
private String department;
|
||||
|
||||
@Schema(description = "局点", example = "北京")
|
||||
@JsonProperty("distribute_point")
|
||||
private String distributePoint;
|
||||
|
||||
@Schema(description = "指令下发频率", example = "30")
|
||||
@NotNull(message = "指令下发频率不能为空。")
|
||||
@JsonProperty("frequency")
|
||||
@@ -114,6 +122,8 @@ public class TaskCommandInfo {
|
||||
this.taskName = original.taskName;
|
||||
this.taskType = original.taskType;
|
||||
this.taskAct = original.taskAct;
|
||||
this.department = original.department;
|
||||
this.distributePoint = original.distributePoint;
|
||||
this.frequency = original.frequency;
|
||||
this.startTime = original.startTime;
|
||||
this.endTime = original.endTime;
|
||||
@@ -132,4 +142,8 @@ public class TaskCommandInfo {
|
||||
public void setProtocolNum() {
|
||||
this.fiveTupleWithMask.setProtocolNum();
|
||||
}
|
||||
|
||||
public void setMask() {
|
||||
this.fiveTupleWithMask.setMask();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,12 @@ public class TaskService {
|
||||
|
||||
public List<TaskCommandInfo> getStaticCommandInfos(Long taskId) {
|
||||
List<TaskCommandInfo> staticCommandInfos = taskMapper.getStaticCommandInfos(taskId);
|
||||
staticCommandInfos.forEach(TaskCommandInfo::setProtocolNum);
|
||||
|
||||
staticCommandInfos.forEach(taskCommandInfo -> {
|
||||
taskCommandInfo.setProtocolNum();
|
||||
taskCommandInfo.setMask();
|
||||
});
|
||||
|
||||
return staticCommandInfos;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,14 +75,11 @@ public class StateHandler {
|
||||
// todo: 如果是实时任务或者研判后处置任务,那么就需要在任务启动之后,立刻向动态规则中指定的系统发送日志筛选请求。
|
||||
// 筛选完成后,系统返回日志,需要由接收端点提取字段,并且合成一条静态规则,再按照任务开始时间、结束时间和任务类型进行指令创建
|
||||
private Boolean handleJudgedTaskStart(TaskService taskService, Long taskId) {
|
||||
// return sendFilters(taskService, taskId);
|
||||
// 还没配置帅选条件发送的url,不配置会出错,所以先注释
|
||||
return true;
|
||||
return sendFilters(taskService, taskId);
|
||||
}
|
||||
|
||||
private Boolean handleDynamicTaskStart(TaskService taskService, Long taskId) {
|
||||
// return sendFilters(taskService, taskId);
|
||||
return true;
|
||||
return sendFilters(taskService, taskId);
|
||||
}
|
||||
|
||||
private Boolean handleStaticTaskStart(CommandService commandService, TaskService taskService, Long taskId) {
|
||||
@@ -106,7 +103,7 @@ public class StateHandler {
|
||||
AtomicReference<Boolean> success = new AtomicReference<>(false);
|
||||
|
||||
Mono<SimpleResponse> mono = client.post()
|
||||
.uri("") // todo: unfinished
|
||||
.uri("192.168.107.89:65432") // todo: unfinished
|
||||
.bodyValue(dynamicTaskInfos)
|
||||
.exchangeToMono(res -> {
|
||||
if (res.statusCode().equals(HttpStatus.OK)) {
|
||||
|
||||
Reference in New Issue
Block a user