WarningLogController.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.zoniot.ccrc.controller.system;
  2. import com.zoniot.ccrc.commom.model.AjaxMessage;
  3. import com.zoniot.ccrc.commom.model.Pagination;
  4. import com.zoniot.ccrc.commom.model.ResultStatus;
  5. import com.zoniot.ccrc.dto.BuildingSelectDto;
  6. import com.zoniot.ccrc.dto.WarningLogDto;
  7. import com.zoniot.ccrc.service.WarningLogService;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.format.annotation.DateTimeFormat;
  13. import org.springframework.stereotype.Controller;
  14. import org.springframework.web.bind.annotation.GetMapping;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RequestParam;
  17. import org.springframework.web.bind.annotation.ResponseBody;
  18. import java.time.LocalDateTime;
  19. import java.util.List;
  20. @Controller
  21. @ResponseBody
  22. @RequestMapping("system/warningLog")
  23. @Api(tags = "预警记录")
  24. public class WarningLogController {
  25. @Autowired
  26. private WarningLogService warningLogService;
  27. @GetMapping("getList")
  28. @ApiOperation(value = "查询预警记录列表")
  29. public AjaxMessage<Pagination<WarningLogDto>> getList(
  30. @ApiParam(value = "设备ID", required = false) @RequestParam(required = false) Long deviceId,
  31. @ApiParam(value = "场景ID", required = false) @RequestParam(required = false) Integer channelId,
  32. @ApiParam(value = "设备编号/电子号", required = false) @RequestParam(required = false) String deviceNo,
  33. @ApiParam(value = "预警类型 1:较上日用水量激增30% 2:连续无用水量超过7天", required = false) @RequestParam(required = false) Integer warningType,
  34. @ApiParam(value = "客户名称", required = false) @RequestParam(required = false) String clientName,
  35. @ApiParam(value = "反馈状态 0:待反馈 1:已确认无异常 2:已反馈信息", required = false) @RequestParam(required = false) Integer feedbackStatus,
  36. @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime startDate,
  37. @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime endDate,
  38. @ApiParam(value = "省", required = false) @RequestParam(required = false) Integer provinceId,
  39. @ApiParam(value = "市", required = false) @RequestParam(required = false) Integer cityId,
  40. @ApiParam(value = "区", required = false) @RequestParam(required = false) Integer regionId,
  41. @ApiParam(value = "小区", required = false) @RequestParam(required = false) Integer communityId,
  42. @ApiParam(value = "建筑id", required = false) @RequestParam(required = false) Integer buildingId,
  43. @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
  44. @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") int pageSize
  45. ){
  46. Pagination<WarningLogDto> pageInfo = warningLogService.getList(
  47. deviceId,channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,
  48. startDate,endDate, pageNum, pageSize);
  49. return new AjaxMessage<>(ResultStatus.OK, pageInfo);
  50. }
  51. @GetMapping("getAreaList")
  52. @ApiOperation(value = "查询预警记录区域列表")
  53. public AjaxMessage<List<BuildingSelectDto>> getAreaList(
  54. @ApiParam(value = "场景ID", required = false) @RequestParam(required = false) Integer channelId,
  55. @ApiParam(value = "设备编号/电子号", required = false) @RequestParam(required = false) String deviceNo,
  56. @ApiParam(value = "预警类型 1:较上日用水量激增30% 2:连续无用水量超过7天", required = false) @RequestParam(required = false) Integer warningType,
  57. @ApiParam(value = "客户名称", required = false) @RequestParam(required = false) String clientName,
  58. @ApiParam(value = "反馈状态 0:待反馈 1:已确认无异常 2:已反馈信息", required = false) @RequestParam(required = false) Integer feedbackStatus,
  59. @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime startDate,
  60. @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime endDate
  61. ){
  62. List<BuildingSelectDto> list = warningLogService.getAreaList(
  63. channelId,deviceNo,warningType,clientName,feedbackStatus,startDate,endDate
  64. );
  65. return new AjaxMessage<>(ResultStatus.OK, list);
  66. }
  67. }