cc1f0cbb92df8e4dc6d8520727f4af7a784e5c24.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package cn.com.goldenwater.dcproj.controller.waga;
  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.model.AttWagaRgstr;
  6. import cn.com.goldenwater.dcproj.model.BisInspWagaRgstrDto;
  7. import cn.com.goldenwater.dcproj.param.AttWagaRgstrParam;
  8. import cn.com.goldenwater.dcproj.service.AttWagaRgstrService;
  9. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  10. import cn.com.goldenwater.dcproj.target.Authority;
  11. import cn.com.goldenwater.id.util.UuidUtil;
  12. import cn.com.goldenwater.util.common.SqlUtils;
  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.util.Assert;
  22. import org.springframework.web.bind.annotation.*;
  23. import javax.servlet.http.HttpServletRequest;
  24. import javax.servlet.http.HttpServletResponse;
  25. import java.text.SimpleDateFormat;
  26. import java.util.Date;
  27. import cn.com.goldenwater.dcproj.param.TypeParam;
  28. /**
  29. * @author lune
  30. * @date 2019-4-22
  31. */
  32. @Api(value = "WAGA 水闸信息督查表管理", tags = "WAGA 水闸信息督查表管理")
  33. @RestController
  34. @RequestMapping("/att/waga/rgstr")
  35. public class AttWagaRgstrController extends BaseController {
  36. private Logger logger = LoggerFactory.getLogger(getClass());
  37. @Autowired
  38. private AttWagaRgstrService attWagaRgstrService;
  39. @Autowired
  40. private OlBisInspOrgService olBisInspOrgService;
  41. @ApiOperation(value = "添加(或更新(通过唯一ID标识))水闸信息督查表管理")
  42. @RequestMapping(value = "", method = RequestMethod.POST)
  43. public BaseResponse<String> insert(@ApiParam(name = "attWagaRgstr", value = "AttWagaRgstr", required = true) @RequestBody AttWagaRgstr attWagaRgstr) {
  44. String uuid = UuidUtil.uuid();
  45. Date date=new Date();
  46. attWagaRgstr.setUptm(date);
  47. attWagaRgstr.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  48. attWagaRgstr.setOrgId(getCurrentOrgId());
  49. if (StringUtils.isBlank(attWagaRgstr.getId())) {
  50. attWagaRgstr.setId(uuid);
  51. attWagaRgstr.setIntm(date);
  52. attWagaRgstr.setUptm(date);
  53. attWagaRgstrService.insert(attWagaRgstr);
  54. } else {
  55. attWagaRgstr.setUptm(date);
  56. attWagaRgstrService.update(attWagaRgstr);
  57. }
  58. return buildSuccessResponse(uuid);
  59. }
  60. @ApiOperation(value = "根据ID删除水闸信息督查表管理")
  61. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  62. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  63. attWagaRgstrService.delete(id);
  64. return buildSuccessResponse();
  65. }
  66. @ApiOperation(value = "更新水闸信息督查表管理信息")
  67. @RequestMapping(value = "/update", method = RequestMethod.POST)
  68. public BaseResponse update(@ApiParam(name = "attWagaRgstr", value = "AttWagaRgstr", required = true) @RequestBody AttWagaRgstr attWagaRgstr) {
  69. Assert.notNull(attWagaRgstr.getId(), "主键id为必填参数");
  70. attWagaRgstr.setUptm(new Date());
  71. attWagaRgstrService.update(attWagaRgstr);
  72. return buildSuccessResponse();
  73. }
  74. @ApiOperation(value = "根据ID获取水闸信息督查表管理(单表)")
  75. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  76. public BaseResponse<AttWagaRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. AttWagaRgstr attWagaRgstr = attWagaRgstrService.get(id);
  78. return buildSuccessResponse(attWagaRgstr);
  79. }
  80. @ApiOperation(value = "获取水闸信息督查表,如果不存在则创建登记表,对象objId,水闸objCode")
  81. @RequestMapping(value = "/getBy/{objId}/{objCode}/{groupId}", method = RequestMethod.GET)
  82. public BaseResponse<AttWagaRgstr> getBy(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId,
  83. @ApiParam(name = "objCode", value = "objCode", required = true) @PathVariable String objCode,
  84. @ApiParam(name = "groupId", value = "groupId", required = false) @PathVariable String groupId, HttpServletRequest request) {
  85. AttWagaRgstrParam wagaRgstrParam = new AttWagaRgstrParam();
  86. wagaRgstrParam.setObjCode(objCode);
  87. wagaRgstrParam.setObjId(objId);
  88. wagaRgstrParam.setGroupId(groupId);
  89. wagaRgstrParam.setPersId(getCurrentPersId());
  90. AttWagaRgstr bisInspRsvrRgstr = attWagaRgstrService.getByRsvrRgstr(wagaRgstrParam);
  91. return buildSuccessResponse(bisInspRsvrRgstr);
  92. }
  93. @Authority
  94. @ApiOperation(value = "PC版根据用户persId,状态state,行政区话编码code,主要争对督查表操作")
  95. @RequestMapping(value = "/list/page", method = RequestMethod.POST)
  96. public Object page(@RequestBody TypeParam typeParam, HttpServletResponse response) {
  97. if(StringUtils.isBlank(typeParam.getTabType())){
  98. typeParam.setTabType(CommonLabel.TAB_TYPE);
  99. }
  100. String nowTime=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  101. typeParam.setNowTime(nowTime);
  102. typeParam.setInIdsSql(SqlUtils.getinIdsSql(getCurrentPersId(),olBisInspOrgService.getProvince(getCurrentOrgId())));
  103. if ("1".equals(typeParam.getIsExport())) {
  104. attWagaRgstrService.findPcList(typeParam,response);
  105. }
  106. typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  107. PageInfo<BisInspWagaRgstrDto> rsvrRgstrPcDtoPageInfo = attWagaRgstrService.findPcPage(typeParam, response);
  108. return buildSuccessResponse(rsvrRgstrPcDtoPageInfo);
  109. }
  110. @ApiOperation(value = "处理数据")
  111. @RequestMapping(value = "/updateBaseData", method = RequestMethod.POST)
  112. public BaseResponse updateBaseData(){
  113. int reulst = attWagaRgstrService.updateBaseData();
  114. return buildSuccessResponse();
  115. }
  116. }