7f7dd8bfcd21f8b755ddb6217785c7cfc82325e4.svn-base 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.dto.TacInspYearBatchAreaDto;
  5. import cn.com.goldenwater.dcproj.model.TacInspYearBatchArea;
  6. import cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam;
  7. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  8. import cn.com.goldenwater.dcproj.service.TacInspYearBatchAreaService;
  9. import cn.com.goldenwater.id.util.UuidUtil;
  10. import com.github.pagehelper.PageInfo;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.apache.commons.lang3.StringUtils;
  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.*;
  19. import java.util.List;
  20. import java.util.Map;
  21. /**
  22. * @author lune
  23. * @date 2019-9-6
  24. */
  25. @Api(value = "TAC 稽察组稽察区域管理", tags = "TAC 稽察组稽察区域管理")
  26. @RestController
  27. @RequestMapping("/tac/insp/year/batch/area")
  28. public class TacInspYearBatchAreaController extends BaseController {
  29. private Logger logger = LoggerFactory.getLogger(getClass());
  30. @Autowired
  31. private TacInspYearBatchAreaService tacInspYearBatchAreaService;
  32. @Autowired
  33. private OlBisInspOrgService olBisInspOrgService;
  34. @ApiOperation(value = "添加/修改稽察组稽察区域")
  35. @RequestMapping(value = "", method = RequestMethod.POST)
  36. public BaseResponse<TacInspYearBatchArea> insert(@ApiParam(name = "tacInspYearBatchArea", value = "TacInspYearBatchArea", required = true) @RequestBody TacInspYearBatchArea tacInspYearBatchArea) {
  37. tacInspYearBatchArea.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  38. if (StringUtils.isBlank(tacInspYearBatchArea.getId())) {
  39. String uuid = UuidUtil.uuid(); // 生成uuid
  40. tacInspYearBatchArea.setId(uuid);
  41. tacInspYearBatchAreaService.insert(tacInspYearBatchArea);
  42. } else {
  43. tacInspYearBatchAreaService.update(tacInspYearBatchArea);
  44. }
  45. return buildSuccessResponse(tacInspYearBatchArea);
  46. }
  47. @ApiOperation(value = "根据ID删除稽察组稽察区域")
  48. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  49. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  50. int ret = tacInspYearBatchAreaService.delete(id);
  51. return buildSuccessResponse();
  52. }
  53. @ApiOperation(value = "根据组id删除区域列表")
  54. @RequestMapping(value = "deleteYearBatchArearByGroupId", method = RequestMethod.POST)
  55. public BaseResponse deleteYearBatchArearByGroupId(@PathVariable String groupId) {
  56. int ret = tacInspYearBatchAreaService.deleteYearBatchArearByGroupId(groupId);
  57. return buildSuccessResponse();
  58. }
  59. @ApiOperation(value = "根据ID获取稽察组稽察区域(单表)")
  60. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  61. public BaseResponse<TacInspYearBatchArea> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  62. TacInspYearBatchArea tacInspYearBatchArea = tacInspYearBatchAreaService.get(id);
  63. return buildSuccessResponse(tacInspYearBatchArea);
  64. }
  65. @ApiOperation(value = "获取稽察组稽察区域(列表所有)")
  66. @RequestMapping(value = "/list", method = RequestMethod.POST)
  67. public BaseResponse<List<TacInspYearBatchArea>> list(@ApiParam(name = "tacInspYearBatchAreaParam", value = "tacInspYearBatchAreaParam", required = true) @RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
  68. tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  69. List<TacInspYearBatchArea> tacInspYearBatchAreaList = tacInspYearBatchAreaService.findList(tacInspYearBatchAreaParam);
  70. return buildSuccessResponse(tacInspYearBatchAreaList);
  71. }
  72. @ApiOperation(value = "获取稽察批次下包含稽察区域(满足已创建批次信息后附带地市信息)")
  73. @RequestMapping(value = "/areasListByBatch", method = RequestMethod.POST)
  74. public BaseResponse<List<Map<String,String>>> areaslistbybatch(@ApiParam(name = "tacInspYearBatchAreaParam", value = "tacInspYearBatchAreaParam", required = true) @RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
  75. tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  76. List<Map<String,String>> tacInspYearBatchAreaList = tacInspYearBatchAreaService.areasListByBatch(tacInspYearBatchAreaParam);
  77. return buildSuccessResponse(tacInspYearBatchAreaList);
  78. }
  79. @ApiOperation(value = "获取稽察组稽察区域(列表--分页)")
  80. @RequestMapping(value = "/page", method = RequestMethod.POST)
  81. public BaseResponse<PageInfo<TacInspYearBatchArea>> page(@ApiParam(name = "tacInspYearBatchAreaParam", value = "tacInspYearBatchAreaParam", required = true) @RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
  82. tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  83. PageInfo<TacInspYearBatchArea> tacInspYearBatchAreaList = tacInspYearBatchAreaService.findPageInfo(tacInspYearBatchAreaParam);
  84. return buildSuccessResponse(tacInspYearBatchAreaList);
  85. }
  86. @ApiOperation(value = "根据稽察人员id(非登录id)查询督查区域")
  87. @RequestMapping(value = "/getAreaListById", method = RequestMethod.POST)
  88. public BaseResponse<List<TacInspYearBatchArea>> getAreaListById(@RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
  89. tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  90. List<TacInspYearBatchArea> list = tacInspYearBatchAreaService.getAreaListById(tacInspYearBatchAreaParam);
  91. return buildSuccessResponse(list);
  92. }
  93. @ApiOperation(value = "根据批次id获取督查区域")
  94. @RequestMapping(value = "getAreaListByBatchId", method = RequestMethod.POST)
  95. public BaseResponse<TacInspYearBatchAreaDto> getAreaListByBatchId(@RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
  96. tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
  97. TacInspYearBatchAreaDto dto = tacInspYearBatchAreaService.getAreaListByBatchId(tacInspYearBatchAreaParam);
  98. return buildSuccessResponse(dto);
  99. }
  100. }