c733442634086bc18dd905be0de7eeb6bf7c7602.svn-base 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package cn.com.goldenwater.dcproj.controller.wiu;
  2. import cn.com.goldenwater.dcproj.model.BisInspWiuRgstr;
  3. import cn.com.goldenwater.dcproj.model.BisInspWiuRgstrApprInfo;
  4. import cn.com.goldenwater.dcproj.param.BisInspWiuRgstrApprInfoParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspWiuRgstrApprInfoService;
  6. import cn.com.goldenwater.core.web.BaseController;
  7. import cn.com.goldenwater.core.web.BaseResponse;
  8. import cn.com.goldenwater.dcproj.service.BisInspWiuRgstrService;
  9. import cn.com.goldenwater.id.util.UuidUtil;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import io.swagger.annotations.ApiParam;
  13. import org.apache.commons.lang3.StringUtils;
  14. import com.github.pagehelper.PageInfo;
  15. import org.slf4j.Logger;
  16. import org.slf4j.LoggerFactory;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.PathVariable;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestMethod;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import javax.servlet.http.HttpServletRequest;
  24. import java.util.Date;
  25. import java.util.List;
  26. /**
  27. * @author lune
  28. * @date 2019-8-9
  29. */
  30. @Api(value = "BIS 取水许可审批监管情况管理",tags="BIS 取水许可审批监管情况管理")
  31. @RestController
  32. @RequestMapping("/bis/insp/wiu/rgstr/appr/info")
  33. public class BisInspWiuRgstrApprInfoController extends BaseController {
  34. private Logger logger = LoggerFactory.getLogger(getClass());
  35. @Autowired
  36. private BisInspWiuRgstrApprInfoService bisInspWiuRgstrApprInfoService;
  37. @Autowired
  38. private BisInspWiuRgstrService wiuRgstrService;
  39. @ApiOperation(value = "添加/修改取水许可审批监管情况")
  40. @RequestMapping(value = "", method = RequestMethod.POST)
  41. public BaseResponse<BisInspWiuRgstrApprInfo> insert(@ApiParam(name = "bisInspWiuRgstrApprInfo", value = "BisInspWiuRgstrApprInfo", required = true) @RequestBody BisInspWiuRgstrApprInfo bisInspWiuRgstrApprInfo) {
  42. if(StringUtils.isBlank(bisInspWiuRgstrApprInfo.getId())) {
  43. String uuid = UuidUtil.uuid(); // 生成uuid
  44. bisInspWiuRgstrApprInfo.setId(uuid);
  45. bisInspWiuRgstrApprInfo.setInTm(new Date());
  46. bisInspWiuRgstrApprInfo.setUpTm(new Date());
  47. bisInspWiuRgstrApprInfoService.insert(bisInspWiuRgstrApprInfo);
  48. }else{
  49. bisInspWiuRgstrApprInfo.setUpTm(new Date());
  50. bisInspWiuRgstrApprInfoService.update(bisInspWiuRgstrApprInfo);
  51. }
  52. if (StringUtils.isNotBlank(bisInspWiuRgstrApprInfo.getRgstrId())) {
  53. BisInspWiuRgstr rgstr = wiuRgstrService.get(bisInspWiuRgstrApprInfo.getRgstrId());
  54. if (rgstr != null) {
  55. rgstr.setApprInfoStat(bisInspWiuRgstrApprInfo.getDataStat());
  56. if (!"2".equals(rgstr.getState())) {
  57. rgstr.setState("1");
  58. }
  59. wiuRgstrService.update(rgstr);
  60. }
  61. }
  62. return buildSuccessResponse(bisInspWiuRgstrApprInfo);
  63. }
  64. @ApiOperation(value = "根据ID删除取水许可审批监管情况")
  65. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  66. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  67. int ret = bisInspWiuRgstrApprInfoService.delete(id);
  68. return buildSuccessResponse();
  69. }
  70. @ApiOperation(value = "根据ID获取取水许可审批监管情况(单表)")
  71. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  72. public BaseResponse<BisInspWiuRgstrApprInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  73. BisInspWiuRgstrApprInfo bisInspWiuRgstrApprInfo = bisInspWiuRgstrApprInfoService.get(id);
  74. return buildSuccessResponse(bisInspWiuRgstrApprInfo);
  75. }
  76. @ApiOperation(value = "获取取水许可审批监管情况(列表所有)")
  77. @RequestMapping(value = "/list", method = RequestMethod.POST)
  78. public BaseResponse<List<BisInspWiuRgstrApprInfo>> list(@ApiParam(name = "bisInspWiuRgstrApprInfoParam", value = "bisInspWiuRgstrApprInfoParam", required = true) @RequestBody BisInspWiuRgstrApprInfoParam bisInspWiuRgstrApprInfoParam) {
  79. List<BisInspWiuRgstrApprInfo> bisInspWiuRgstrApprInfoList = bisInspWiuRgstrApprInfoService.findList(bisInspWiuRgstrApprInfoParam);
  80. return buildSuccessResponse(bisInspWiuRgstrApprInfoList);
  81. }
  82. @ApiOperation(value = "获取取水许可审批监管情况(列表--分页)")
  83. @RequestMapping(value = "/page", method = RequestMethod.POST)
  84. public BaseResponse<PageInfo<BisInspWiuRgstrApprInfo>> page(@ApiParam(name = "bisInspWiuRgstrApprInfoParam", value = "bisInspWiuRgstrApprInfoParam", required = true) @RequestBody BisInspWiuRgstrApprInfoParam bisInspWiuRgstrApprInfoParam) {
  85. PageInfo<BisInspWiuRgstrApprInfo> bisInspWiuRgstrApprInfoList = bisInspWiuRgstrApprInfoService.findPageInfo(bisInspWiuRgstrApprInfoParam);
  86. return buildSuccessResponse(bisInspWiuRgstrApprInfoList);
  87. }
  88. @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
  89. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  90. public BaseResponse<BisInspWiuRgstrApprInfo> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId,HttpServletRequest request) {
  91. if(StringUtils.isBlank(rgstrId)) {
  92. return buildFailResponse();
  93. }
  94. BisInspWiuRgstrApprInfoParam param = new BisInspWiuRgstrApprInfoParam();
  95. param.setRgstrId(rgstrId);
  96. BisInspWiuRgstrApprInfo info = this.bisInspWiuRgstrApprInfoService.getBy(param);
  97. return buildSuccessResponse(info);
  98. }
  99. }