WarningStaController.java 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. package com.iden.bms.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.iden.bms.service.WarningStaService;
  4. import com.iden.common.annotation.Permission;
  5. import com.iden.common.exception.BDException;
  6. import com.iden.common.util.PageResult;
  7. import com.iden.common.util.Result;
  8. import com.iden.common.util.WebPageUtils;
  9. import com.iden.common.vo.PageReqVO;
  10. import com.iden.common.vo.UserLoginedConvertVO;
  11. import com.iden.common.vo.WarningPersonVO;
  12. import com.iden.common.vo.WarningStaVO;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiImplicitParam;
  15. import io.swagger.annotations.ApiImplicitParams;
  16. import io.swagger.annotations.ApiOperation;
  17. import lombok.extern.slf4j.Slf4j;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.*;
  20. import javax.servlet.http.HttpServletRequest;
  21. import java.util.List;
  22. /**
  23. * @Author: lilt
  24. * @Date: 2021/5/26
  25. * @Desc:
  26. */
  27. @RestController
  28. @Api(value = "WarningStaController", tags = { "预警管理" })
  29. @Slf4j
  30. @RequestMapping("/bms/warningSta")
  31. @Permission
  32. public class WarningStaController {
  33. @Autowired
  34. private WarningStaService warningStaService;
  35. @GetMapping("/countCommunity")
  36. @ApiOperation(value = "当前小区个数查询")
  37. @ApiImplicitParams(value = {
  38. @ApiImplicitParam(paramType = "query", name = "type", value = "预警类型,1 陌生人员预警 2重点人员预警 3常住人员预警 4昼伏夜出人员预警"),
  39. @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
  40. @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
  41. @ApiImplicitParam(paramType = "query", name = "communityName", value = "小区名称"),
  42. @ApiImplicitParam(paramType = "query", name = "beginDate", value = "开始时间"),
  43. @ApiImplicitParam(paramType = "query", name = "endDate", value = "结束时间")
  44. })
  45. public Result<Integer> countCommunity(HttpServletRequest request, @RequestHeader(value = "token") String token,
  46. @RequestParam(value = "type", required = true) String type,
  47. @RequestParam(value = "district", required = false) String district,
  48. @RequestParam(value = "subdistrict", required = false) String subdistrict,
  49. @RequestParam(value = "communityName", required = false) String communityName,
  50. @RequestParam(value = "beginDate", required = false) String beginDate,
  51. @RequestParam(value = "endDate", required = false) String endDate){
  52. try {
  53. UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
  54. Integer count = this.warningStaService.countCommunity(type,district,subdistrict,communityName,beginDate,endDate,loginUser);
  55. return Result.success("查询成功!",count);
  56. }catch (BDException e) {
  57. log.error("当前小区个数查询-出现异常",e);
  58. return PageResult.error(e.getMessage());
  59. } catch (Exception e) {
  60. log.error("预警管理: 当前小区个数查询出现异常",e);
  61. return PageResult.error( "获取数据失败");
  62. }
  63. }
  64. @GetMapping("/listWarningSta")
  65. @ApiOperation(value = "预警统计列表分页 ")
  66. @ApiImplicitParams(value = {
  67. @ApiImplicitParam(paramType = "query", name = "type", value = "预警类型,1 陌生人员预警 2重点人员预警 3常住人员预警 4昼伏夜出人员预警"),
  68. @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
  69. @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
  70. @ApiImplicitParam(paramType = "query", name = "communityName", value = "小区名称"),
  71. @ApiImplicitParam(paramType = "query", name = "beginDate", value = "开始时间"),
  72. @ApiImplicitParam(paramType = "query", name = "endDate", value = "结束时间")
  73. })
  74. public PageResult<List<WarningStaVO>> listWarningSta(HttpServletRequest request, @RequestHeader(value = "token") String token,
  75. @RequestParam(value = "type", required = true) String type,
  76. @RequestParam(value = "district", required = false) String district,
  77. @RequestParam(value = "subdistrict", required = false) String subdistrict,
  78. @RequestParam(value = "communityName", required = false) String communityName,
  79. @RequestParam(value = "beginDate", required = false) String beginDate,
  80. @RequestParam(value = "endDate", required = false) String endDate,
  81. PageReqVO pageReqVo){
  82. try {
  83. UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
  84. IPage<WarningStaVO> pageResponse = this.warningStaService.listWarningSta(type,district,subdistrict,communityName,beginDate,endDate,loginUser ,pageReqVo);
  85. return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
  86. }catch (BDException e) {
  87. log.error("预警统计列表查询-分页列表出现异常",e);
  88. return PageResult.error(e.getMessage());
  89. } catch (Exception e) {
  90. log.error("预警管理: 预警统计列表查询出现异常",e);
  91. return PageResult.error( "获取列表失败");
  92. }
  93. }
  94. @GetMapping("/listWarningPersonbyCommunity")
  95. @ApiOperation(value = "根据小区查询预警人员列表分页 ")
  96. @ApiImplicitParams(value = {
  97. @ApiImplicitParam(paramType = "query", name = "type", value = "预警类型,1 陌生人员预警 2重点人员预警 3常住人员预警 4昼伏夜出人员预警"),
  98. @ApiImplicitParam(paramType = "query", name = "communityId", value = "小区ID"),
  99. @ApiImplicitParam(paramType = "query", name = "nameOrCred", value = "名称/身份证"),
  100. @ApiImplicitParam(paramType = "query", name = "populationType", value = "人口类型"),
  101. @ApiImplicitParam(paramType = "query", name = "crowdId", value = "人群类型ID"),
  102. @ApiImplicitParam(paramType = "query", name = "beginDate", value = "开始时间"),
  103. @ApiImplicitParam(paramType = "query", name = "endDate", value = "结束时间")
  104. })
  105. public PageResult<List<WarningPersonVO>> listWarningPersonbyCommunity(HttpServletRequest request, @RequestHeader(value = "token") String token,
  106. @RequestParam(value = "type", required = true) String type,
  107. @RequestParam(value = "communityId", required = true) Long communityId,
  108. @RequestParam(value = "nameOrCred", required = false) String nameOrCred,
  109. @RequestParam(value = "populationType", required = false) String populationType,
  110. @RequestParam(value = "crowdId", required = false) Long crowdId,
  111. @RequestParam(value = "beginDate", required = false) String beginDate,
  112. @RequestParam(value = "endDate", required = false) String endDate,
  113. PageReqVO pageReqVo){
  114. try {
  115. UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
  116. IPage<WarningPersonVO> pageResponse = this.warningStaService.listWarningPersonbyCommunity(type,communityId,nameOrCred,populationType,crowdId,beginDate,endDate,loginUser ,pageReqVo);
  117. return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
  118. }catch (BDException e) {
  119. log.error("根据小区查询预警人员列表查询-分页列表出现异常",e);
  120. return PageResult.error(e.getMessage());
  121. } catch (Exception e) {
  122. log.error("预警管理: 根据小区查询预警人员列表查询出现异常",e);
  123. return PageResult.error( "获取列表失败");
  124. }
  125. }
  126. }