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.TacCountDto; import cn.com.goldenwater.dcproj.model.TacInspYearBatch; import cn.com.goldenwater.dcproj.param.TacInspYearBatchParam; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.service.TacInspYearBatchService; 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 org.springframework.web.multipart.MultipartFile; import java.util.Date; 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") public class TacInspYearBatchController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacInspYearBatchService tacInspYearBatchService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "添加/修改稽察年度批次表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacInspYearBatch", value = "TacInspYearBatch", required = true) @RequestBody TacInspYearBatch tacInspYearBatch) { tacInspYearBatch.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); if (StringUtils.isBlank(tacInspYearBatch.getId())) { tacInspYearBatchService.insert(tacInspYearBatch); } else { tacInspYearBatchService.updateYearBatch(tacInspYearBatch); } return buildSuccessResponse(tacInspYearBatch); } @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 = tacInspYearBatchService.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) { String province = olBisInspOrgService.getRlProvince(getCurrentOrgId()); TacInspYearBatch tacInspYearBatch = tacInspYearBatchService.getTacInspYearBatchById(id, province); return buildSuccessResponse(tacInspYearBatch); } @ApiOperation(value = "获取稽察年度批次表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "tacInspYearBatchParam", value = "tacInspYearBatchParam", required = true) @RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List tacInspYearBatchList = tacInspYearBatchService.findList(tacInspYearBatchParam); return buildSuccessResponse(tacInspYearBatchList); } @ApiOperation(value = "获取稽察年度批次表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "tacInspYearBatchParam", value = "tacInspYearBatchParam", required = true) @RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); PageInfo tacInspYearBatchList = tacInspYearBatchService.findPageInfo(tacInspYearBatchParam); return buildSuccessResponse(tacInspYearBatchList); } @ApiOperation(value = "获取稽察年度批次表") @RequestMapping(value = "/getTacInspYearBatchList", method = RequestMethod.POST) public BaseResponse> getTacInspYearBatchList(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = this.tacInspYearBatchService.getTacInspYearBatchList(tacInspYearBatchParam); return buildSuccessResponse(list); } @ApiOperation(value = "获取稽察年度批次表") @RequestMapping(value = "/getTacInspYearBatchPage", method = RequestMethod.POST) public BaseResponse> getTacInspYearBatchPage(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); PageInfo pageInfo = this.tacInspYearBatchService.getTacInspYearBatchPage(tacInspYearBatchParam); return buildSuccessResponse(pageInfo); } @ApiOperation(value = "根据批次id清空所有信息") @RequestMapping(value = "cleanObjByYearBatchId/{yearBatchId}", method = RequestMethod.POST) public BaseResponse cleanObjByYearBatchId(@PathVariable String yearBatchId) { if (StringUtils.isBlank(yearBatchId)) { return buildFailResponse(17001, "批次不能为空"); } int a = this.tacInspYearBatchService.cleanAllObjByYearBatchId(yearBatchId); return buildSuccessResponse(); } @ApiOperation(value = "删除批次以及批次关联数据") @RequestMapping(value = "/deleteYearBatchAllObj/{id}", method = RequestMethod.POST) public BaseResponse deleteYearBatchAllObj(@PathVariable String id) { if (StringUtils.isBlank(id)) { return buildFailResponse(17001, "批次不能为空"); } int a = this.tacInspYearBatchService.deleteYearBatchAllObj(id, olBisInspOrgService.getRlProvince(getCurrentOrgId())); return buildSuccessResponse(); } @ApiOperation(value = "获取当前年度批次对象") @RequestMapping(value = "/getCurrTacInspBatch", method = RequestMethod.POST) public BaseResponse getCurrTacInspBatch(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); TacInspYearBatch tacInspYearBatch = this.tacInspYearBatchService.getCurrTacInspBatch(tacInspYearBatchParam); return buildSuccessResponse(tacInspYearBatch); } @ApiOperation(value = "获取用户关联的批次对象") @RequestMapping(value = "/getTacInspBatchByPersId", method = RequestMethod.POST) public BaseResponse> getTacInspBatchByPersId(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacInspYearBatchService.getTacInspBatchByPersId(tacInspYearBatchParam); return buildSuccessResponse(list); } @ApiOperation(value = "获取批次列表,参数多选") @RequestMapping(value = "/getBatchList", method = RequestMethod.POST) public BaseResponse> getBatchList(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacInspYearBatchService.getBatchList(tacInspYearBatchParam); return buildSuccessResponse(list); } @ApiOperation(value = "获取批次列表分页,参数多选") @RequestMapping(value = "/getBatchPage", method = RequestMethod.POST) public BaseResponse> getBatchPage(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); PageInfo pageInfo = tacInspYearBatchService.getBatchPage(tacInspYearBatchParam); return buildSuccessResponse(pageInfo); } @ApiOperation(value = "统计组数与人数") @RequestMapping(value = "/countGroupAndPers", method = RequestMethod.POST) public BaseResponse> countGroupAndPers(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacInspYearBatchService.countGroupAndPers(tacInspYearBatchParam); return buildSuccessResponse(list); } @ApiOperation(value = "统计角色与人数") @RequestMapping(value = "/countRoleTypeAndPers", method = RequestMethod.POST) public BaseResponse> countRoleTypeAndPers(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacInspYearBatchService.countRoleTypeAndPers(tacInspYearBatchParam); return buildSuccessResponse(list); } @ApiOperation(value = "统计行政区划与次数") @RequestMapping(value = "/countArea", method = RequestMethod.POST) public BaseResponse> countArea(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); List list = tacInspYearBatchService.countArea(tacInspYearBatchParam); return buildSuccessResponse(list); } @ApiOperation(value = "获取总人数") @RequestMapping(value = "/getAllCountPers", method = RequestMethod.POST) public BaseResponse getAllCountPers(@RequestBody TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); TacCountDto tacCountDto = tacInspYearBatchService.getAllCountPers(tacInspYearBatchParam); return buildSuccessResponse(tacCountDto); } @ApiOperation(value = "稽察记录导入") @RequestMapping(value = "/uploadAuditExcel", method = RequestMethod.POST) public BaseResponse uploadAuditExcel(@RequestParam("file") MultipartFile file, TacInspYearBatchParam tacInspYearBatchParam) { tacInspYearBatchParam.setProvince(olBisInspOrgService.getRlProvince(getCurrentOrgId())); Map map = tacInspYearBatchService.uploadAuditExcel(file, tacInspYearBatchParam); return buildSuccessResponse(map); } }