AlertController.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.yykj.sjnmtybt.controller;
  2. import com.yykj.sjnmtybt.common.ApiResponse;
  3. import com.yykj.sjnmtybt.common.PageResult;
  4. import com.yykj.sjnmtybt.dto.request.AlertHandleRequest;
  5. import com.yykj.sjnmtybt.dto.request.AlertQueryRequest;
  6. import com.yykj.sjnmtybt.dto.response.AlertVO;
  7. import com.yykj.sjnmtybt.service.BizDataService;
  8. import com.yykj.sjnmtybt.service.BizFlowService;
  9. import io.swagger.v3.oas.annotations.Operation;
  10. import io.swagger.v3.oas.annotations.Parameter;
  11. import io.swagger.v3.oas.annotations.tags.Tag;
  12. import org.springframework.validation.annotation.Validated;
  13. import org.springframework.web.bind.annotation.*;
  14. @Tag(name = "11-告警处置", description = "流程图红色系统预警(如死亡停发)及回盘/匹配异常;DMS sjnmtybt_alart")
  15. @RestController
  16. @RequestMapping("/api/alerts")
  17. public class AlertController {
  18. private final BizDataService biz;
  19. private final BizFlowService flow;
  20. public AlertController(BizDataService biz, BizFlowService flow) {
  21. this.biz = biz;
  22. this.flow = flow;
  23. }
  24. @Operation(summary = "分页查询告警",
  25. description = "按街镇/类型/处理状态/人员等筛选;含死亡停发、回盘失败、居保匹配异常等。")
  26. @PostMapping("/page")
  27. public ApiResponse<PageResult<AlertVO>> page(@RequestBody AlertQueryRequest req) {
  28. return ApiResponse.ok(biz.pageAlerts(req));
  29. }
  30. @Operation(summary = "告警详情", description = "含处理状态、生命周期节点与附件。")
  31. @GetMapping("/{id}")
  32. public ApiResponse<AlertVO> detail(
  33. @Parameter(description = "告警ID", required = true) @PathVariable String id) {
  34. AlertVO vo = biz.getAlert(id);
  35. if (vo == null) {
  36. return ApiResponse.fail(404, "告警不存在: " + id);
  37. }
  38. return ApiResponse.ok(vo);
  39. }
  40. @Operation(summary = "处置告警",
  41. description = "处理结果示例:恢复发放、纳入下月补发、更新银行卡、人工确认居保状态、关闭。")
  42. @PostMapping("/handle")
  43. public ApiResponse<AlertVO> handle(@Validated @RequestBody AlertHandleRequest req) {
  44. return ApiResponse.ok("告警已处置", flow.handleAlert(req));
  45. }
  46. }