677a2c283a7e008b97b4586340c67f5edb4791af.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package cn.com.goldenwater.dcproj.controller.wtunt;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr;
  5. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrCollege;
  6. import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrCollegeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrCollegeService;
  8. import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrService;
  9. import cn.com.goldenwater.dcproj.utils.Constant;
  10. import cn.com.goldenwater.id.util.UuidUtil;
  11. import com.github.pagehelper.PageInfo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import org.apache.commons.collections.CollectionUtils;
  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 java.util.Date;
  22. import java.util.List;
  23. /**
  24. * @author lune
  25. * @date 2020-8-17
  26. */
  27. @Api(value = "BIS 2020年度用水单位节约用水情况检查表(高校)管理",tags="BIS 2020年度用水单位节约用水情况检查表(高校)管理")
  28. @RestController
  29. @RequestMapping("/bis/insp/wtunt/rgstr/college")
  30. public class BisInspWtuntRgstrCollegeController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspWtuntRgstrCollegeService bisInspWtuntRgstrCollegeService;
  34. @Autowired
  35. private BisInspWtuntRgstrService bisInspWtuntRgstrService;
  36. @ApiOperation(value = "添加/修改2020年度用水单位节约用水情况检查表(高校)")
  37. @RequestMapping(value = "", method = RequestMethod.POST)
  38. public BaseResponse<BisInspWtuntRgstrCollege> insert(@ApiParam(name = "bisInspWtuntRgstrCollege", value = "BisInspWtuntRgstrCollege", required = true) @RequestBody BisInspWtuntRgstrCollege bisInspWtuntRgstrCollege) {
  39. String rgstrId = bisInspWtuntRgstrCollege.getRgstrId();
  40. bisInspWtuntRgstrCollege.setUptm(new Date());
  41. if(StringUtils.isBlank(bisInspWtuntRgstrCollege.getId())) {
  42. BisInspWtuntRgstrCollegeParam collegeParam = new BisInspWtuntRgstrCollegeParam();
  43. collegeParam.setRgstrId(rgstrId);
  44. List<BisInspWtuntRgstrCollege> list = bisInspWtuntRgstrCollegeService.findList(collegeParam);
  45. if(CollectionUtils.isEmpty(list)){
  46. bisInspWtuntRgstrCollege.setId(UuidUtil.uuid());
  47. bisInspWtuntRgstrCollege.setIntm(new Date());
  48. bisInspWtuntRgstrCollegeService.insert(bisInspWtuntRgstrCollege);
  49. }else{
  50. bisInspWtuntRgstrCollege.setId(list.get(0).getId());
  51. bisInspWtuntRgstrCollegeService.update(bisInspWtuntRgstrCollege);
  52. }
  53. }else{
  54. bisInspWtuntRgstrCollegeService.update(bisInspWtuntRgstrCollege);
  55. }
  56. //修改登记表督查状态
  57. if(StringUtils.isNotBlank(rgstrId)) {
  58. BisInspWtuntRgstr wtuntRgstr = bisInspWtuntRgstrService.get(rgstrId);
  59. if (!Constant.STRING_TWO.equals(wtuntRgstr.getState())) {
  60. wtuntRgstr.setUptm(new Date());
  61. wtuntRgstr.setState(Constant.STRING_ONE);
  62. wtuntRgstr.setWtuntStat(bisInspWtuntRgstrCollege.getStatus());
  63. bisInspWtuntRgstrService.update(wtuntRgstr);
  64. }
  65. }
  66. return buildSuccessResponse(bisInspWtuntRgstrCollege);
  67. }
  68. @ApiOperation(value = "根据ID删除2020年度用水单位节约用水情况检查表(高校)")
  69. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  70. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  71. int ret = bisInspWtuntRgstrCollegeService.delete(id);
  72. return buildSuccessResponse();
  73. }
  74. @ApiOperation(value = "根据ID获取2020年度用水单位节约用水情况检查表(高校)(单表)")
  75. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  76. public BaseResponse<BisInspWtuntRgstrCollege> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. BisInspWtuntRgstrCollege bisInspWtuntRgstrCollege = bisInspWtuntRgstrCollegeService.get(id);
  78. return buildSuccessResponse(bisInspWtuntRgstrCollege);
  79. }
  80. @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(高校)(列表所有)")
  81. @RequestMapping(value = "/list", method = RequestMethod.POST)
  82. public BaseResponse<List<BisInspWtuntRgstrCollege>> list(@ApiParam(name = "bisInspWtuntRgstrCollegeParam", value = "bisInspWtuntRgstrCollegeParam", required = true) @RequestBody BisInspWtuntRgstrCollegeParam bisInspWtuntRgstrCollegeParam) {
  83. List<BisInspWtuntRgstrCollege> bisInspWtuntRgstrCollegeList = bisInspWtuntRgstrCollegeService.findList(bisInspWtuntRgstrCollegeParam);
  84. return buildSuccessResponse(bisInspWtuntRgstrCollegeList);
  85. }
  86. @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(高校)(列表--分页)")
  87. @RequestMapping(value = "/page", method = RequestMethod.POST)
  88. public BaseResponse<PageInfo<BisInspWtuntRgstrCollege>> page(@ApiParam(name = "bisInspWtuntRgstrCollegeParam", value = "bisInspWtuntRgstrCollegeParam", required = true) @RequestBody BisInspWtuntRgstrCollegeParam bisInspWtuntRgstrCollegeParam) {
  89. PageInfo<BisInspWtuntRgstrCollege> bisInspWtuntRgstrCollegeList = bisInspWtuntRgstrCollegeService.findPageInfo(bisInspWtuntRgstrCollegeParam);
  90. return buildSuccessResponse(bisInspWtuntRgstrCollegeList);
  91. }
  92. @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(高校)(列表--分页)")
  93. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.POST)
  94. public BaseResponse<BisInspWtuntRgstrCollege> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
  95. BisInspWtuntRgstrCollegeParam collegeParam = new BisInspWtuntRgstrCollegeParam();
  96. collegeParam.setRgstrId(rgstrId);
  97. return buildSuccessResponse(bisInspWtuntRgstrCollegeService.getBy(collegeParam));
  98. }
  99. }