package cn.com.goldenwater.dcproj.controller.swhsjs; 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.BisInspSwhsjs; import cn.com.goldenwater.dcproj.param.TypeParam; import cn.com.goldenwater.dcproj.service.BisInspSwhsjsService; 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-23 */ @Api(value = "江苏水源地登记管理", tags = "江苏水源地登记管理") @RestController @RequestMapping("/bis/insp/swhsjs") public class BisInspSwhsjsController extends BaseController { @Autowired private BisInspSwhsjsService bisInspSwhsjsService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "修改江苏水源地登记") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspSwhsjs", value = "BisInspSwhsjs", required = true) @RequestBody BisInspSwhsjs bisInspSwhsjs) { if (org.apache.commons.lang.StringUtils.isBlank(bisInspSwhsjs.getId()) || org.apache.commons.lang.StringUtils.isNotBlank(bisInspSwhsjs.getRgstrId())) { // rgstrId 不为 空 时,传给ID bisInspSwhsjs.setId(bisInspSwhsjs.getRgstrId()); } if (StringUtils.isBlank(bisInspSwhsjs.getId())) { throw new CheckException("缺少登记表编码!"); } int ret = bisInspSwhsjsService.update(bisInspSwhsjs); return buildSuccessResponse(bisInspSwhsjs); } @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 = bisInspSwhsjsService.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) { BisInspSwhsjs bisInspSwhsjs = bisInspSwhsjsService.get(id); return buildSuccessResponse(bisInspSwhsjs); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse page(@ApiParam(name = "bisInspSwhsjsParam", value = "bisInspSwhsjsParam", required = true) @RequestBody TypeParam typeParam) { typeParam.setpType(BisInspEnum.SWHSJS.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(bisInspSwhsjsService.findObjPageByType(typeParam, null)); } }