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

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

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

@ -118,9 +118,4 @@ public class Warning {
@ExcelIgnore @ExcelIgnore
private Date processTime; 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; 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 @Override
public void updateRead(Warning warning) throws Exception { public void updateState(Warning warning) throws Exception {
Optional<Warning> byId = repository.findById(warning.getId()); Optional<Warning> byId = repository.findById(warning.getId());
if (!byId.isPresent()) { if (!byId.isPresent()) {
throw new BusinessException("未找到该告警" + warning.getId()); throw new BusinessException("未找到该告警" + warning.getId());
} }
Warning war = byId.get(); Warning war = byId.get();
war.setIsread(warning.getIsread()); war.setState(warning.getState());
repository.save(war); repository.save(war);
} }
} }

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

Loading…
Cancel
Save