fix:告警去除是否已读,修改接口更新处理状态

haikang
郭承 8 months ago
parent 07cec04b6c
commit 6749856f57

@ -54,13 +54,13 @@ public class WarningController extends BasicController {
.doWrite(result);
}
@PostMapping("updateRead")
@ApiOperation("修改是否已读状态")
public Response<String> updateRead(@Validated @RequestBody Warning warning) throws Exception {
@PostMapping("updateState")
@ApiOperation("修改处理状态")
public Response<String> updateState(@Validated @RequestBody Warning warning) throws Exception {
if (warning.getId() == null) {
throw new BusinessException("id不能为空!");
}
service.updateRead(warning);
service.updateState(warning);
return Response.success("OK");
}

@ -118,9 +118,4 @@ public class Warning {
@ExcelIgnore
private Date processTime;
@ApiModelProperty("是否已读 0:未读 1:已读")
@Column(name = "isread")
@ExcelIgnore
private Integer isread;
}

@ -13,5 +13,5 @@ public interface WarningService {
List<Warning> listAll(ConditionModel condition) throws Exception;
void updateRead(Warning warning) throws Exception;
void updateState(Warning warning) throws Exception;
}

@ -74,13 +74,13 @@ public class WarningServiceImpl implements WarningService {
}
@Override
public void updateRead(Warning warning) throws Exception {
public void updateState(Warning warning) throws Exception {
Optional<Warning> byId = repository.findById(warning.getId());
if (!byId.isPresent()) {
throw new BusinessException("未找到该告警" + warning.getId());
}
Warning war = byId.get();
war.setIsread(warning.getIsread());
war.setState(warning.getState());
repository.save(war);
}
}

@ -85,7 +85,6 @@ public class RuleCheckTask {
.triggerDesc(rule.getOperatorDesc() + " 阈值(" + rule.getThreshold() + ")")
.warnTime(new Date())
.processTime(new Date())
.isread(0)
.build();
warningRepository.save(warning);
String str = warning.getZsbName() + "--" + warning.getWarnDesc() + " "

Loading…
Cancel
Save