| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package cn.com.goldenwater.dcproj.controller.tac;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.dto.TacInspYearBatchAreaDto;
- import cn.com.goldenwater.dcproj.model.TacInspYearBatchArea;
- import cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.service.TacInspYearBatchAreaService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Map;
- /**
- * @author lune
- * @date 2019-9-6
- */
- @Api(value = "TAC 稽察组稽察区域管理", tags = "TAC 稽察组稽察区域管理")
- @RestController
- @RequestMapping("/tac/insp/year/batch/area")
- public class TacInspYearBatchAreaController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacInspYearBatchAreaService tacInspYearBatchAreaService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "添加/修改稽察组稽察区域")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<TacInspYearBatchArea> insert(@ApiParam(name = "tacInspYearBatchArea", value = "TacInspYearBatchArea", required = true) @RequestBody TacInspYearBatchArea tacInspYearBatchArea) {
- tacInspYearBatchArea.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- if (StringUtils.isBlank(tacInspYearBatchArea.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- tacInspYearBatchArea.setId(uuid);
- tacInspYearBatchAreaService.insert(tacInspYearBatchArea);
- } else {
- tacInspYearBatchAreaService.update(tacInspYearBatchArea);
- }
- return buildSuccessResponse(tacInspYearBatchArea);
- }
- @ApiOperation(value = "根据ID删除稽察组稽察区域")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = tacInspYearBatchAreaService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据组id删除区域列表")
- @RequestMapping(value = "deleteYearBatchArearByGroupId", method = RequestMethod.POST)
- public BaseResponse deleteYearBatchArearByGroupId(@PathVariable String groupId) {
- int ret = tacInspYearBatchAreaService.deleteYearBatchArearByGroupId(groupId);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取稽察组稽察区域(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacInspYearBatchArea> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacInspYearBatchArea tacInspYearBatchArea = tacInspYearBatchAreaService.get(id);
- return buildSuccessResponse(tacInspYearBatchArea);
- }
- @ApiOperation(value = "获取稽察组稽察区域(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<TacInspYearBatchArea>> list(@ApiParam(name = "tacInspYearBatchAreaParam", value = "tacInspYearBatchAreaParam", required = true) @RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
- tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- List<TacInspYearBatchArea> tacInspYearBatchAreaList = tacInspYearBatchAreaService.findList(tacInspYearBatchAreaParam);
- return buildSuccessResponse(tacInspYearBatchAreaList);
- }
- @ApiOperation(value = "获取稽察批次下包含稽察区域(满足已创建批次信息后附带地市信息)")
- @RequestMapping(value = "/areasListByBatch", method = RequestMethod.POST)
- public BaseResponse<List<Map<String,String>>> areaslistbybatch(@ApiParam(name = "tacInspYearBatchAreaParam", value = "tacInspYearBatchAreaParam", required = true) @RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
- tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- List<Map<String,String>> tacInspYearBatchAreaList = tacInspYearBatchAreaService.areasListByBatch(tacInspYearBatchAreaParam);
- return buildSuccessResponse(tacInspYearBatchAreaList);
- }
- @ApiOperation(value = "获取稽察组稽察区域(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<TacInspYearBatchArea>> page(@ApiParam(name = "tacInspYearBatchAreaParam", value = "tacInspYearBatchAreaParam", required = true) @RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
- tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- PageInfo<TacInspYearBatchArea> tacInspYearBatchAreaList = tacInspYearBatchAreaService.findPageInfo(tacInspYearBatchAreaParam);
- return buildSuccessResponse(tacInspYearBatchAreaList);
- }
- @ApiOperation(value = "根据稽察人员id(非登录id)查询督查区域")
- @RequestMapping(value = "/getAreaListById", method = RequestMethod.POST)
- public BaseResponse<List<TacInspYearBatchArea>> getAreaListById(@RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
- tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- List<TacInspYearBatchArea> list = tacInspYearBatchAreaService.getAreaListById(tacInspYearBatchAreaParam);
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据批次id获取督查区域")
- @RequestMapping(value = "getAreaListByBatchId", method = RequestMethod.POST)
- public BaseResponse<TacInspYearBatchAreaDto> getAreaListByBatchId(@RequestBody TacInspYearBatchAreaParam tacInspYearBatchAreaParam) {
- tacInspYearBatchAreaParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId()));
- TacInspYearBatchAreaDto dto = tacInspYearBatchAreaService.getAreaListByBatchId(tacInspYearBatchAreaParam);
- return buildSuccessResponse(dto);
- }
- }
|