0e0c181e8d60fa3aeacde31a60c1436a2b49e167.svn-base 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package cn.com.goldenwater.dcproj.controller.tac;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.TacInspBatch;
  5. import cn.com.goldenwater.dcproj.param.TacInspBatchParam;
  6. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  7. import cn.com.goldenwater.dcproj.service.TacInspBatchService;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import com.github.pagehelper.PageInfo;
  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 org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.List;
  19. /**
  20. * @author lune
  21. * @date 2019-9-6
  22. */
  23. @Api(value = "TAC 稽察批次字典表管理", tags = "TAC 稽察批次字典表管理")
  24. @RestController
  25. @RequestMapping("/tac/insp/batch")
  26. public class TacInspBatchController extends BaseController {
  27. private Logger logger = LoggerFactory.getLogger(getClass());
  28. @Autowired
  29. private TacInspBatchService tacInspBatchService;
  30. @Autowired
  31. private OlBisInspOrgService olBisInspOrgService;
  32. @ApiOperation(value = "添加/修改稽察批次字典表")
  33. @RequestMapping(value = "", method = RequestMethod.POST)
  34. public BaseResponse<TacInspBatch> insert(@ApiParam(name = "tacInspBatch", value = "TacInspBatch", required = true) @RequestBody TacInspBatch tacInspBatch) {
  35. tacInspBatch.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  36. if (StringUtils.isBlank(tacInspBatch.getId())) {
  37. String uuid = UuidUtil.uuid(); // 生成uuid
  38. tacInspBatch.setId(uuid);
  39. tacInspBatchService.insert(tacInspBatch);
  40. } else {
  41. tacInspBatchService.update(tacInspBatch);
  42. }
  43. return buildSuccessResponse(tacInspBatch);
  44. }
  45. @ApiOperation(value = "根据ID删除稽察批次字典表")
  46. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  47. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  48. int ret = tacInspBatchService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "根据ID获取稽察批次字典表(单表)")
  52. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  53. public BaseResponse<TacInspBatch> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  54. TacInspBatch tacInspBatch = tacInspBatchService.get(id);
  55. return buildSuccessResponse(tacInspBatch);
  56. }
  57. @ApiOperation(value = "获取稽察批次字典表(列表所有)")
  58. @RequestMapping(value = "/list", method = RequestMethod.POST)
  59. public BaseResponse<List<TacInspBatch>> list(@ApiParam(name = "tacInspBatchParam", value = "tacInspBatchParam", required = true) @RequestBody TacInspBatchParam tacInspBatchParam) {
  60. tacInspBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  61. List<TacInspBatch> tacInspBatchList = tacInspBatchService.findList(tacInspBatchParam);
  62. return buildSuccessResponse(tacInspBatchList);
  63. }
  64. @ApiOperation(value = "获取稽察批次字典表(列表--分页)")
  65. @RequestMapping(value = "/page", method = RequestMethod.POST)
  66. public BaseResponse<PageInfo<TacInspBatch>> page(@ApiParam(name = "tacInspBatchParam", value = "tacInspBatchParam", required = true) @RequestBody TacInspBatchParam tacInspBatchParam) {
  67. tacInspBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  68. PageInfo<TacInspBatch> tacInspBatchList = tacInspBatchService.findPageInfo(tacInspBatchParam);
  69. return buildSuccessResponse(tacInspBatchList);
  70. }
  71. @ApiOperation(value = "根据年度获取稽察批次列表")
  72. @RequestMapping(value = "/getBatchListByYear", method = RequestMethod.POST)
  73. public BaseResponse<List<TacInspBatch>> getBatchListByYear(@RequestBody TacInspBatchParam tacInspBatchParam) {
  74. tacInspBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  75. List<TacInspBatch> list = tacInspBatchService.getBatchListByYear(tacInspBatchParam);
  76. return buildSuccessResponse(list);
  77. }
  78. }