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.model.TacInspPersAreaPris; import cn.com.goldenwater.dcproj.param.TacInspPersAreaPrisParam; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.service.TacInspPersAreaPrisService; 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.Date; import java.util.List; /** * @author lune * @date 2019-9-6 */ @Api(value = "TAC 稽察批次人员及地区选择原则管理", tags = "TAC 稽察批次人员及地区选择原则管理") @RestController @RequestMapping("/tac/insp/pers/area/pris") public class TacInspPersAreaPrisController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacInspPersAreaPrisService tacInspPersAreaPrisService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "添加/修改稽察批次人员及地区选择原则") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacInspPersAreaPris", value = "TacInspPersAreaPris", required = true) @RequestBody TacInspPersAreaPris tacInspPersAreaPris) { tacInspPersAreaPris.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); if (StringUtils.isBlank(tacInspPersAreaPris.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid tacInspPersAreaPris.setId(uuid); tacInspPersAreaPris.setInTm(new Date()); tacInspPersAreaPris.setUpTm(new Date()); tacInspPersAreaPrisService.insertPris(tacInspPersAreaPris); } else { tacInspPersAreaPris.setUpTm(new Date()); tacInspPersAreaPrisService.updatePris(tacInspPersAreaPris); } return buildSuccessResponse(tacInspPersAreaPris); } @ApiOperation(value = "根据原则对象修改组以及区域") @RequestMapping(value = "/updatePersAreaPris", method = RequestMethod.POST) public BaseResponse updatePersAreaPris(@RequestBody TacInspPersAreaPris areaPris) { areaPris.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); int a = this.tacInspPersAreaPrisService.updatePersAreaPris(areaPris); return buildSuccessResponse(); } @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 = tacInspPersAreaPrisService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取稽察批次人员及地区选择原则(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { TacInspPersAreaPris tacInspPersAreaPris = tacInspPersAreaPrisService.get(id); return buildSuccessResponse(tacInspPersAreaPris); } @ApiOperation(value = "根据ID获取稽察批次人员及地区选择原则(单表)") @RequestMapping(value = "/getAreaPris", method = RequestMethod.GET) public BaseResponse getAreaPris(@RequestParam(name = "id", required = false) String id, @RequestParam(name = "yearBatchId", required = false) String yearBatchId) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); TacInspPersAreaPris tacInspPersAreaPris = tacInspPersAreaPrisService.getAreaPris(id, yearBatchId, province); return buildSuccessResponse(tacInspPersAreaPris); } @ApiOperation(value = "根据ID获取稽察批次人员及地区选择原则(单表)") @RequestMapping(value = "/getByYearBatchId", method = RequestMethod.GET) public BaseResponse getByYearBatchId(@RequestParam(name = "yearBatchId", required = false) String yearBatchId) { TacInspPersAreaPris tacInspPersAreaPris = tacInspPersAreaPrisService.getByYearBatchId(yearBatchId); return buildSuccessResponse(tacInspPersAreaPris); } @ApiOperation(value = "根据ID获取稽察批次人员及地区选择原则(单表)") @RequestMapping(value = "/getPersAreaPris", method = RequestMethod.GET) public BaseResponse getPersAreaPris(@RequestParam(name = "id", required = false) String id) { TacInspPersAreaPris tacInspPersAreaPris = tacInspPersAreaPrisService.getPersAreaPris(id, olBisInspOrgService.getRlProvince(getCurrentOrgId())); return buildSuccessResponse(tacInspPersAreaPris); } @ApiOperation(value = "获取稽察批次人员及地区选择原则(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "tacInspPersAreaPrisParam", value = "tacInspPersAreaPrisParam", required = true) @RequestBody TacInspPersAreaPrisParam tacInspPersAreaPrisParam) { List tacInspPersAreaPrisList = tacInspPersAreaPrisService.findList(tacInspPersAreaPrisParam); return buildSuccessResponse(tacInspPersAreaPrisList); } @ApiOperation(value = "获取稽察批次人员及地区选择原则(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "tacInspPersAreaPrisParam", value = "tacInspPersAreaPrisParam", required = true) @RequestBody TacInspPersAreaPrisParam tacInspPersAreaPrisParam) { PageInfo tacInspPersAreaPrisList = tacInspPersAreaPrisService.findPageInfo(tacInspPersAreaPrisParam); return buildSuccessResponse(tacInspPersAreaPrisList); } }