ee9acdea077475f3976e7a64171700a2fff96774.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package cn.com.goldenwater.dcproj.controller.efp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.CommonLabel;
  5. import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
  6. import cn.com.goldenwater.dcproj.model.BisInspEfpRgstr;
  7. import cn.com.goldenwater.dcproj.param.BisInspEfpRgstrParam;
  8. import cn.com.goldenwater.dcproj.param.TypeParam;
  9. import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrService;
  10. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  11. import cn.com.goldenwater.id.util.UuidUtil;
  12. import com.github.pagehelper.PageInfo;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import io.swagger.annotations.ApiParam;
  16. import org.apache.commons.lang3.StringUtils;
  17. import org.slf4j.Logger;
  18. import org.slf4j.LoggerFactory;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.web.bind.annotation.*;
  21. import javax.servlet.http.HttpServletResponse;
  22. import java.text.SimpleDateFormat;
  23. import java.util.Date;
  24. import java.util.List;
  25. /**
  26. * @author lune
  27. * @date 2020-5-27
  28. */
  29. @Api(value = "BIS 超标洪水防御督查登记表管理",tags="BIS 超标洪水防御督查登记表管理")
  30. @RestController
  31. @RequestMapping("/bis/insp/efp/rgstr")
  32. public class BisInspEfpRgstrController extends BaseController {
  33. private Logger logger = LoggerFactory.getLogger(getClass());
  34. @Autowired
  35. private BisInspEfpRgstrService bisInspEfpRgstrService;
  36. @Autowired
  37. private OlBisInspOrgService olBisInspOrgService;
  38. @ApiOperation(value = "添加/修改超标洪水防御督查登记表")
  39. @RequestMapping(value = "", method = RequestMethod.POST)
  40. public BaseResponse<BisInspEfpRgstr> insert(@ApiParam(name = "bisInspEfpRgstr", value = "BisInspEfpRgstr", required = true) @RequestBody BisInspEfpRgstr bisInspEfpRgstr) {
  41. if(StringUtils.isBlank(bisInspEfpRgstr.getId())) {
  42. String uuid = UuidUtil.uuid(); // 生成uuid
  43. bisInspEfpRgstr.setId(uuid);
  44. bisInspEfpRgstrService.insert(bisInspEfpRgstr);
  45. }else{
  46. bisInspEfpRgstrService.update(bisInspEfpRgstr);
  47. }
  48. return buildSuccessResponse(bisInspEfpRgstr);
  49. }
  50. @ApiOperation(value = "根据ID删除超标洪水防御督查登记表")
  51. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  52. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  53. int ret = bisInspEfpRgstrService.delete(id);
  54. return buildSuccessResponse();
  55. }
  56. @ApiOperation(value = "根据ID获取超标洪水防御督查登记表(单表)")
  57. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  58. public BaseResponse<BisInspEfpRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  59. BisInspEfpRgstr bisInspEfpRgstr = bisInspEfpRgstrService.get(id);
  60. return buildSuccessResponse(bisInspEfpRgstr);
  61. }
  62. @ApiOperation(value = "获取超标洪水防御督查登记表(列表所有)")
  63. @RequestMapping(value = "/list", method = RequestMethod.POST)
  64. public BaseResponse<List<BisInspEfpRgstr>> list(@ApiParam(name = "bisInspEfpRgstrParam", value = "bisInspEfpRgstrParam", required = true) @RequestBody BisInspEfpRgstrParam bisInspEfpRgstrParam) {
  65. List<BisInspEfpRgstr> bisInspEfpRgstrList = bisInspEfpRgstrService.findList(bisInspEfpRgstrParam);
  66. return buildSuccessResponse(bisInspEfpRgstrList);
  67. }
  68. @ApiOperation(value = "获取超标洪水防御督查登记表(列表--分页)")
  69. @RequestMapping(value = "/page", method = RequestMethod.POST)
  70. public BaseResponse<PageInfo<BisInspEfpRgstr>> page(@ApiParam(name = "bisInspEfpRgstrParam", value = "bisInspEfpRgstrParam", required = true) @RequestBody BisInspEfpRgstrParam bisInspEfpRgstrParam) {
  71. PageInfo<BisInspEfpRgstr> bisInspEfpRgstrList = bisInspEfpRgstrService.findPageInfo(bisInspEfpRgstrParam);
  72. return buildSuccessResponse(bisInspEfpRgstrList);
  73. }
  74. @ApiOperation(value = "获取督查列表")
  75. @RequestMapping(value = "/findEfpPage", method = RequestMethod.POST)
  76. public BaseResponse<PageInfo<BisInspRgstrDto>> findEfpPage(@RequestBody TypeParam typeParam, HttpServletResponse response) {
  77. typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  78. if(StringUtils.isBlank(typeParam.getTabType())){
  79. typeParam.setTabType(CommonLabel.TAB_TYPE);
  80. }
  81. String nowTime=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  82. typeParam.setNowTime(nowTime);
  83. PageInfo<BisInspRgstrDto> bisInspEfpRgstrList = bisInspEfpRgstrService.findEfpPage(typeParam,response);
  84. return buildSuccessResponse(bisInspEfpRgstrList);
  85. }
  86. }