3babf024c2f619e2e69802d47ce1f949a3e1af79.svn-base 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package cn.com.goldenwater.dcproj.controller.fjpjmgdp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.dto.BisInspFjpjmgdpDto;
  6. import cn.com.goldenwater.dcproj.model.BisInspFjpjmgdp;
  7. import cn.com.goldenwater.dcproj.param.TypeParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspFjpjmgdpService;
  9. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  10. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  11. import cn.com.goldenwater.target.CheckException;
  12. import com.github.pagehelper.PageInfo;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import io.swagger.annotations.ApiParam;
  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.util.Assert;
  21. import org.springframework.web.bind.annotation.PathVariable;
  22. import org.springframework.web.bind.annotation.RequestBody;
  23. import org.springframework.web.bind.annotation.RequestMapping;
  24. import org.springframework.web.bind.annotation.RequestMethod;
  25. import org.springframework.web.bind.annotation.RestController;
  26. import java.util.List;
  27. /**
  28. * @author lhc
  29. * @date 2023-11-8
  30. */
  31. @Api(value = "BIS 水利工程管理单位安全生产标准化评审标准管理",tags="BIS 水利工程管理单位安全生产标准化评审标准管理")
  32. @RestController
  33. @RequestMapping("/bis/insp/fjpjmgdp")
  34. public class BisInspFjpjmgdpController extends BaseController {
  35. private Logger logger = LoggerFactory.getLogger(getClass());
  36. @Autowired
  37. private BisInspFjpjmgdpService bisInspFjpjmgdpService;
  38. @Autowired
  39. private OlBisInspOrgService olBisInspOrgService;
  40. @ApiOperation(value = "添加xxx")
  41. @RequestMapping(value = "", method = RequestMethod.POST)
  42. public BaseResponse<BisInspFjpjmgdp> insert(@ApiParam(name = "bisInspFjpjmgdp", value = "BisInspFjpjmgdp", required = true) @RequestBody BisInspFjpjmgdp bisInspFjpjmgdp) {
  43. if (org.apache.commons.lang3.StringUtils.isBlank(bisInspFjpjmgdp.getId()) || org.apache.commons.lang3.StringUtils.isNotBlank(bisInspFjpjmgdp.getRgstrId())) {
  44. // rgstrId 不为 空 时,传给ID
  45. bisInspFjpjmgdp.setId(bisInspFjpjmgdp.getRgstrId());
  46. }
  47. if (org.apache.commons.lang3.StringUtils.isBlank(bisInspFjpjmgdp.getId())) {
  48. throw new CheckException("缺少登记表编码!");
  49. }
  50. bisInspFjpjmgdpService.update(bisInspFjpjmgdp);
  51. return buildSuccessResponse(bisInspFjpjmgdp);
  52. }
  53. @ApiOperation(value = "根据ID删除xxx")
  54. @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
  55. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  56. int ret = bisInspFjpjmgdpService.delete(id);
  57. return buildSuccessResponse();
  58. }
  59. @ApiOperation(value = "更新xxx信息")
  60. @RequestMapping(value = "/update", method = RequestMethod.POST)
  61. public BaseResponse<BisInspFjpjmgdp> update(@ApiParam(name = "bisInspFjpjmgdp", value = "BisInspFjpjmgdp", required = true) @RequestBody BisInspFjpjmgdp bisInspFjpjmgdp) {
  62. Assert.notNull(bisInspFjpjmgdp.getId(), "主键id为必填参数");
  63. int ret = bisInspFjpjmgdpService.update(bisInspFjpjmgdp);
  64. return buildSuccessResponse(bisInspFjpjmgdp);
  65. }
  66. @ApiOperation(value = "根据ID获取xxx(单表)")
  67. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  68. public BaseResponse<BisInspFjpjmgdp> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  69. BisInspFjpjmgdp bisInspFjpjmgdp = bisInspFjpjmgdpService.get(id);
  70. return buildSuccessResponse(bisInspFjpjmgdp);
  71. }
  72. @ApiOperation(value = "获取福建水利工程管理单位安全生产标准化评审标准列表")
  73. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  74. public BaseResponse<PageInfo<BisInspFjpjmgdpDto>> fingPage(@RequestBody TypeParam param) {
  75. param.setpType(BisInspEnum.FJPJMGDP.getValue());
  76. param.setPresId(getCurrentPersId());
  77. if (!StringUtils.isBlank(param.getAdCodes())) {
  78. param.setAdCodes(AdLevelUtil.getListAddvcd(param.getAdCodes()));
  79. } else {
  80. param.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  81. }
  82. return buildSuccessResponse(bisInspFjpjmgdpService.findQaPage(param));
  83. }
  84. @ApiOperation(value = "获取福建水利工程管理单位安全生产标准化评审标准列表")
  85. @RequestMapping(value = "/findPageOfficeList", method = RequestMethod.POST)
  86. public BaseResponse<List<BisInspFjpjmgdpDto>> list(@RequestBody TypeParam param) {
  87. param.setpType(BisInspEnum.FJPJMGDP.getValue());
  88. param.setPresId(getCurrentPersId());
  89. if (!StringUtils.isBlank(param.getAdCodes())) {
  90. param.setAdCodes(AdLevelUtil.getListAddvcd(param.getAdCodes()));
  91. } else {
  92. param.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  93. }
  94. return buildSuccessResponse(bisInspFjpjmgdpService.findPageOfficeList(param));
  95. }
  96. }