5d079cfc2c56424f0d5b8179f96add8e71a473a8.svn-base 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package cn.com.goldenwater.dcproj.controller.wintu;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.dao.BisInspWintuRgstrDao;
  5. import cn.com.goldenwater.dcproj.model.BisInspWintRgstrChkIn;
  6. import cn.com.goldenwater.dcproj.model.BisInspWintuRgstr;
  7. import cn.com.goldenwater.dcproj.param.BisInspWintRgstrChkInParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspWintRgstrChkInService;
  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-7-15
  26. */
  27. @Api(value = "BIS 取水口核查登记情况抽查表管理",tags="BIS 取水口核查登记情况抽查表管理")
  28. @RestController
  29. @RequestMapping("/bis/insp/wint/rgstr/chk/in")
  30. public class BisInspWintRgstrChkInController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspWintRgstrChkInService bisInspWintRgstrChkInService;
  34. @Autowired
  35. private BisInspWintuRgstrDao bisInspWintuRgstrDao;
  36. @ApiOperation(value = "添加/修改取水口核查登记情况抽查表")
  37. @RequestMapping(value = "", method = RequestMethod.POST)
  38. public BaseResponse<BisInspWintRgstrChkIn> insert(@ApiParam(name = "bisInspWintRgstrChkIn", value = "BisInspWintRgstrChkIn", required = true) @RequestBody BisInspWintRgstrChkIn bisInspWintRgstrChkIn) {
  39. String rgstrId = bisInspWintRgstrChkIn.getRgstrId();
  40. bisInspWintRgstrChkIn.setUptm(new Date());
  41. if(StringUtils.isBlank(bisInspWintRgstrChkIn.getId())) {
  42. BisInspWintRgstrChkInParam chkInParam = new BisInspWintRgstrChkInParam();
  43. chkInParam.setRgstrId(rgstrId);
  44. List<BisInspWintRgstrChkIn> bisInspWintRgstrChkInList = bisInspWintRgstrChkInService.findList(chkInParam);
  45. if(CollectionUtils.isNotEmpty(bisInspWintRgstrChkInList)){
  46. bisInspWintRgstrChkIn.setId(bisInspWintRgstrChkInList.get(0).getId());
  47. bisInspWintRgstrChkInService.update(bisInspWintRgstrChkIn);
  48. }else {
  49. bisInspWintRgstrChkIn.setId(UuidUtil.uuid());
  50. bisInspWintRgstrChkIn.setIntm(new Date());
  51. bisInspWintRgstrChkInService.insert(bisInspWintRgstrChkIn);
  52. }
  53. }else{
  54. bisInspWintRgstrChkInService.update(bisInspWintRgstrChkIn);
  55. }
  56. //修改登记表督查状态
  57. if(StringUtils.isNotBlank(rgstrId)) {
  58. BisInspWintuRgstr bisInspWintuRgstr = bisInspWintuRgstrDao.get(rgstrId);
  59. if (!Constant.STRING_TWO.equals(bisInspWintuRgstr.getState())) {
  60. bisInspWintuRgstr.setUpTm(new Date());
  61. bisInspWintuRgstr.setState(Constant.STRING_ONE);
  62. bisInspWintuRgstr.setChkInStat(bisInspWintRgstrChkIn.getStatus());
  63. bisInspWintuRgstr.setPersId(bisInspWintRgstrChkIn.getRecPersId());
  64. bisInspWintuRgstrDao.update(bisInspWintuRgstr);
  65. }
  66. }
  67. return buildSuccessResponse(bisInspWintRgstrChkIn);
  68. }
  69. @ApiOperation(value = "根据ID删除取水口核查登记情况抽查表")
  70. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  71. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  72. int ret = bisInspWintRgstrChkInService.delete(id);
  73. return buildSuccessResponse();
  74. }
  75. @ApiOperation(value = "根据ID获取取水口核查登记情况抽查表(单表)")
  76. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  77. public BaseResponse<BisInspWintRgstrChkIn> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  78. BisInspWintRgstrChkIn bisInspWintRgstrChkIn = bisInspWintRgstrChkInService.get(id);
  79. return buildSuccessResponse(bisInspWintRgstrChkIn);
  80. }
  81. @ApiOperation(value = "获取取水口核查登记情况抽查表(列表所有)")
  82. @RequestMapping(value = "/list", method = RequestMethod.POST)
  83. public BaseResponse<List<BisInspWintRgstrChkIn>> list(@ApiParam(name = "bisInspWintRgstrChkInParam", value = "bisInspWintRgstrChkInParam", required = true) @RequestBody BisInspWintRgstrChkInParam bisInspWintRgstrChkInParam) {
  84. List<BisInspWintRgstrChkIn> bisInspWintRgstrChkInList = bisInspWintRgstrChkInService.findList(bisInspWintRgstrChkInParam);
  85. return buildSuccessResponse(bisInspWintRgstrChkInList);
  86. }
  87. @ApiOperation(value = "获取取水口核查登记情况抽查表(列表--分页)")
  88. @RequestMapping(value = "/page", method = RequestMethod.POST)
  89. public BaseResponse<PageInfo<BisInspWintRgstrChkIn>> page(@ApiParam(name = "bisInspWintRgstrChkInParam", value = "bisInspWintRgstrChkInParam", required = true) @RequestBody BisInspWintRgstrChkInParam bisInspWintRgstrChkInParam) {
  90. PageInfo<BisInspWintRgstrChkIn> bisInspWintRgstrChkInList = bisInspWintRgstrChkInService.findPageInfo(bisInspWintRgstrChkInParam);
  91. return buildSuccessResponse(bisInspWintRgstrChkInList);
  92. }
  93. @ApiOperation(value = "获取取水口核查登记情况抽查表(单标)")
  94. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  95. public BaseResponse<BisInspWintRgstrChkIn> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
  96. BisInspWintRgstrChkInParam bisInspWintRgstrChkInParam = new BisInspWintRgstrChkInParam();
  97. bisInspWintRgstrChkInParam.setRgstrId(rgstrId);
  98. return buildSuccessResponse(bisInspWintRgstrChkInService.getBy(bisInspWintRgstrChkInParam));
  99. }
  100. }