package cn.com.goldenwater.dcproj.controller.rsfcoqh; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.constValue.BisInspEnum; import cn.com.goldenwater.dcproj.model.BisInspRsfcoqhRgstr; import cn.com.goldenwater.dcproj.param.TypeParam; import cn.com.goldenwater.dcproj.service.BisInspRsfcoqhRgstrService; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.target.CheckException; 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.util.Assert; import org.springframework.web.bind.annotation.*; /** * @author lhc * @date 2021-6-10 */ @Api(value = "青海-水库防洪调度督查登记表管理", tags = "青海-水库防洪调度督查登记表管理") @RestController @RequestMapping("/bis/insp/rsfcoqh") public class BisInspRsfcoqhRgstrController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspRsfcoqhRgstrService bisInspRsfcoqhRgstrService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "添加青海-水库防洪调度督查登记表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspRsfcoqhRgstr", value = "BisInspRsfcoqhRgstr", required = true) @RequestBody BisInspRsfcoqhRgstr bisInspRsfcoqhRgstr) { if (StringUtils.isNotBlank(bisInspRsfcoqhRgstr.getRgstrId()) && StringUtils.isBlank(bisInspRsfcoqhRgstr.getId())) { // rgstrId 不为 空 时,传给ID bisInspRsfcoqhRgstr.setId(bisInspRsfcoqhRgstr.getRgstrId()); } if (StringUtils.isBlank(bisInspRsfcoqhRgstr.getId())) { throw new CheckException("缺少登记表编码"); } bisInspRsfcoqhRgstrService.update(bisInspRsfcoqhRgstr); return buildSuccessResponse(bisInspRsfcoqhRgstr); } @ApiOperation(value = "根据ID删除青海-水库防洪调度督查登记表") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisInspRsfcoqhRgstrService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "更新青海-水库防洪调度督查登记表信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "bisInspRsfcoqhRgstr", value = "BisInspRsfcoqhRgstr", required = true) @RequestBody BisInspRsfcoqhRgstr bisInspRsfcoqhRgstr) { Assert.notNull(bisInspRsfcoqhRgstr.getId(), "主键id为必填参数"); int ret = bisInspRsfcoqhRgstrService.update(bisInspRsfcoqhRgstr); return buildSuccessResponse(bisInspRsfcoqhRgstr); } @ApiOperation(value = "根据ID获取青海-水库防洪调度督查登记表(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspRsfcoqhRgstr bisInspRsfcoqhRgstr = bisInspRsfcoqhRgstrService.get(id); return buildSuccessResponse(bisInspRsfcoqhRgstr); } @ApiOperation(value = "获取督查对象") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse page(@ApiParam(name = "typeParam", value = "typeParam", required = true) @RequestBody TypeParam typeParam) { typeParam.setpType(BisInspEnum.RSFCOQH.getValue()); typeParam.setPresId(getCurrentPersId()); if (StringUtils.isBlank(typeParam.getAdCode())) { typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); } return buildSuccessResponse(bisInspRsfcoqhRgstrService.findObjPageByType(typeParam, null)); } }