1. DynamicRuleMapper中添加audit_status result映射
2. 给DynamicTaskInfo实体类中添加所有字段对应的Json字段 3. 修改sendFilter函数中的WebClient初始化URL和URI,修改mono.block的超时设置,添加对response字段中success的判断 4. 将TaskMapper中的getDynamicTaskInfos select语句的INNER JOIN修改为LEFT JOIN 5. updateStaticRUleAuditStatusInTask和updateDynamicRuleAuditStatusInTask添加对staticRuleIds列表的判断,确保SQL语句不会出现问题
This commit is contained in:
@@ -13,13 +13,14 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.springframework.web.reactive.function.client.WebClientResponseException;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class StateHandler {
|
||||
|
||||
private final WebClient client = WebClient.builder()
|
||||
.baseUrl("") // todo: unfinished
|
||||
.baseUrl("http://192.168.107.89:9081")
|
||||
.build();
|
||||
|
||||
protected Boolean handleStart(TaskService taskService, CommandService commandService, Long taskId) {
|
||||
@@ -110,12 +111,12 @@ public class StateHandler {
|
||||
throw new IllegalArgumentException("动态规则列表为空,请至少选择一个动态规则以启动动态/研判后类型任务");
|
||||
}
|
||||
|
||||
taskService.updateDynamicRuleAuditStatusInTask(task.getTaskId(), AuditStatusEnum.AUDITED);
|
||||
taskService.updateDynamicRuleAuditStatusInTask(task.getTaskId(), AuditStatusEnum.USING);
|
||||
|
||||
AtomicReference<Boolean> success = new AtomicReference<>(false);
|
||||
|
||||
Mono<SimpleResponse> mono = client.post()
|
||||
.uri("http://192.168.107.89:9081/api/v1/kafkasend") // todo: untested
|
||||
.uri("/api/v1/kafkasend")
|
||||
.bodyValue(dynamicTaskInfos)
|
||||
.exchangeToMono(res -> {
|
||||
if (res.statusCode().equals(HttpStatus.OK)) {
|
||||
@@ -126,9 +127,10 @@ public class StateHandler {
|
||||
})
|
||||
.doOnError(WebClientResponseException.class, res -> success.set(false));
|
||||
|
||||
SimpleResponse response = mono.block();
|
||||
|
||||
if (response == null) {
|
||||
SimpleResponse response = mono.block(Duration.ofSeconds(5));
|
||||
|
||||
if (response == null || response.getSuccess() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user