package cn.com.goldenwater.dcproj.controller.wiujs; 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.dto.BisInspChmclsRgstrDto; import cn.com.goldenwater.dcproj.dto.BisInspWiujsRgstrDto; import cn.com.goldenwater.dcproj.model.BisInspWiujsRgstr; import cn.com.goldenwater.dcproj.param.TypeParam; import cn.com.goldenwater.dcproj.service.BisInspWiujsRgstrService; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.dcproj.utils.DateUtils; 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.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * @author * @date 2022-2-21 */ @Api(value = "江苏取用水督查管理", tags = "江苏取用水督查管理") @RestController @RequestMapping("/bis/insp/wiujs") public class BisInspWiujsRgstrController extends BaseController { @Autowired private BisInspWiujsRgstrService bisInspWiujsRgstrService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "修改江苏取用水督查") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspWiujsRgstr", value = "BisInspWiujsRgstr", required = true) @RequestBody BisInspWiujsRgstr bisInspWiujsRgstr) { if (StringUtils.isBlank(bisInspWiujsRgstr.getId()) || StringUtils.isNotBlank(bisInspWiujsRgstr.getRgstrId())) { // rgstrId 不为 空 时,传给ID bisInspWiujsRgstr.setId(bisInspWiujsRgstr.getRgstrId()); } if (StringUtils.isBlank(bisInspWiujsRgstr.getId())) { throw new CheckException("缺少登记表编码!"); } int ret = bisInspWiujsRgstrService.update(bisInspWiujsRgstr); return buildSuccessResponse(bisInspWiujsRgstr); } @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 = bisInspWiujsRgstrService.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) { BisInspWiujsRgstr bisInspWiujsRgstr = bisInspWiujsRgstrService.get(id); return buildSuccessResponse(bisInspWiujsRgstr); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisInspChmclsRgstrParam", value = "bisInspChmclsRgstrParam", required = true) @RequestBody TypeParam typeParam) { typeParam.setpType(BisInspEnum.WIUJS.getValue()); typeParam.setPresId(getCurrentPersId()); typeParam.setOrgId(getCurrentOrgId()); typeParam.setNowTime(DateUtils.getToday("yyyy-MM-dd")); if (!StringUtils.isBlank(typeParam.getAdCodes())) { typeParam.setAdCodes(AdLevelUtil.getListAddvcd(typeParam.getAdCodes())); } else { typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); } return buildSuccessResponse(bisInspWiujsRgstrService.findObjPageByType(typeParam, null)); } }