1c9c397e18be60c35c1f33581de04f9bd520955e.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package cn.com.goldenwater.dcproj.controller.hyst;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.dto.BisInspHystRgstrDto;
  5. import cn.com.goldenwater.dcproj.model.BisInspHystInfo;
  6. import cn.com.goldenwater.dcproj.model.BisInspHystRgstr;
  7. import cn.com.goldenwater.dcproj.param.BisInspHystInfoParam;
  8. import cn.com.goldenwater.dcproj.param.BisInspHystRgstrParam;
  9. import cn.com.goldenwater.dcproj.param.TypeParam;
  10. import cn.com.goldenwater.dcproj.service.BisInspHystInfoService;
  11. import cn.com.goldenwater.dcproj.service.BisInspHystRgstrService;
  12. import cn.com.goldenwater.id.util.UuidUtil;
  13. import com.github.pagehelper.PageInfo;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import io.swagger.annotations.ApiParam;
  17. import org.apache.commons.lang3.StringUtils;
  18. import org.slf4j.Logger;
  19. import org.slf4j.LoggerFactory;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.web.bind.annotation.*;
  22. import java.util.Date;
  23. import java.util.List;
  24. /**
  25. * @author lune
  26. * @date 2021-3-2
  27. */
  28. @Api(value = "BIS 小水电县级督查登记表管理", tags = "BIS 小水电县级督查登记表管理")
  29. @RestController
  30. @RequestMapping("/bis/insp/hyst/rgstr")
  31. public class BisInspHystRgstrController extends BaseController {
  32. private Logger logger = LoggerFactory.getLogger(getClass());
  33. @Autowired
  34. private BisInspHystRgstrService bisInspHystRgstrService;
  35. @Autowired
  36. private BisInspHystInfoService bisInspHystInfoService;
  37. @ApiOperation(value = "添加/修改小水电县级督查登记表")
  38. @RequestMapping(value = "", method = RequestMethod.POST)
  39. public BaseResponse<BisInspHystRgstr> insert(@ApiParam(name = "bisInspHystRgstr", value = "BisInspHystRgstr", required = true) @RequestBody BisInspHystRgstr bisInspHystRgstr) {
  40. if (StringUtils.isBlank(bisInspHystRgstr.getId())) {
  41. // 生成uuid
  42. String uuid = UuidUtil.uuid();
  43. bisInspHystRgstr.setId(uuid);
  44. bisInspHystRgstr.setIntm(new Date());
  45. bisInspHystRgstrService.insert(bisInspHystRgstr);
  46. } else {
  47. bisInspHystRgstr.setUptm(new Date());
  48. bisInspHystRgstrService.update(bisInspHystRgstr);
  49. }
  50. //更新注册表状态
  51. return buildSuccessResponse(bisInspHystRgstr);
  52. }
  53. @ApiOperation(value = "根据ID删除小水电县级督查登记表")
  54. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  55. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  56. int ret = bisInspHystRgstrService.delete(id);
  57. return buildSuccessResponse();
  58. }
  59. @ApiOperation(value = "根据ID获取小水电县级督查登记表(单表)")
  60. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  61. public BaseResponse<BisInspHystRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  62. BisInspHystRgstr bisInspHystRgstr = bisInspHystRgstrService.get(id);
  63. //返回小水电列表
  64. BisInspHystInfoParam bisInspHystInfoParam = new BisInspHystInfoParam();
  65. bisInspHystInfoParam.setRgstrId(id);
  66. List<BisInspHystInfo> list = bisInspHystInfoService.findList(bisInspHystInfoParam);
  67. bisInspHystRgstr.setHtstList(list);
  68. return buildSuccessResponse(bisInspHystRgstr);
  69. }
  70. @ApiOperation(value = "获取小水电县级督查登记表(列表所有)")
  71. @RequestMapping(value = "/list", method = RequestMethod.POST)
  72. public BaseResponse<List<BisInspHystRgstr>> list(@ApiParam(name = "bisInspHystRgstrParam", value = "bisInspHystRgstrParam", required = true) @RequestBody BisInspHystRgstrParam bisInspHystRgstrParam) {
  73. List<BisInspHystRgstr> bisInspHystRgstrList = bisInspHystRgstrService.findList(bisInspHystRgstrParam);
  74. return buildSuccessResponse(bisInspHystRgstrList);
  75. }
  76. @ApiOperation(value = "获取小水电县级督查登记表(列表--分页)")
  77. @RequestMapping(value = "/page", method = RequestMethod.POST)
  78. public BaseResponse<PageInfo<BisInspHystRgstr>> page(@ApiParam(name = "bisInspHystRgstrParam", value = "bisInspHystRgstrParam", required = true) @RequestBody BisInspHystRgstrParam bisInspHystRgstrParam) {
  79. PageInfo<BisInspHystRgstr> bisInspHystRgstrList = bisInspHystRgstrService.findPageInfo(bisInspHystRgstrParam);
  80. return buildSuccessResponse(bisInspHystRgstrList);
  81. }
  82. @ApiOperation(value = "获取督查登记表列表")
  83. @RequestMapping(value = "/findHystPage", method = RequestMethod.POST)
  84. public BaseResponse<PageInfo<BisInspHystRgstrDto>> findHystPage(@RequestBody TypeParam param) {
  85. return buildSuccessResponse(bisInspHystRgstrService.findHystPage(param));
  86. }
  87. }