package cn.com.goldenwater.dcproj.controller; 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.AttCountryDto; import cn.com.goldenwater.dcproj.dto.BisNewDcuserRelVillDto; import cn.com.goldenwater.dcproj.model.BisInspVill2021Rgstr; import cn.com.goldenwater.dcproj.param.TypeParam; import cn.com.goldenwater.dcproj.service.AttAdXBaseService; import cn.com.goldenwater.dcproj.service.BisInspVill2021RgstrService; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; 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.List; /** * @author lhc * @date 2021-6-16 */ @Api(value = "097 2021农饮登记表管理", tags = "097 2021农饮登记表管理") @RestController @RequestMapping("/bis/insp/vill2021") public class BisInspVill2021RgstrController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspVill2021RgstrService bisInspVill2021RgstrService; @Autowired private OlBisInspOrgService olBisInspOrgService; @Autowired private AttAdXBaseService attAdXBaseService; @ApiOperation(value = "修改097 2021农饮登记表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspVill2021Rgstr", value = "BisInspVill2021Rgstr", required = true) @RequestBody BisInspVill2021Rgstr bisInspVill2021Rgstr) { bisInspVill2021RgstrService.update(bisInspVill2021Rgstr); return buildSuccessResponse(bisInspVill2021Rgstr); } @ApiOperation(value = "根据ID删除097 2021农饮登记表") @RequestMapping(value = "delete/{id}", method = RequestMethod.POST) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisInspVill2021RgstrService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取097 2021农饮登记表(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspVill2021Rgstr bisInspVill2021Rgstr = bisInspVill2021RgstrService.get(id); return buildSuccessResponse(bisInspVill2021Rgstr); } @ApiOperation(value = "列表--分页") @RequestMapping(value = "/findPage", method = RequestMethod.POST) public BaseResponse page(@ApiParam(name = "typeParam", value = "typeParam", required = true) @RequestBody TypeParam typeParam) { typeParam.setpType(BisInspEnum.VILL2021.getValue()); typeParam.setPresId(getCurrentPersId()); if (StringUtils.isBlank(typeParam.getAdCode())) { typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); } return buildSuccessResponse(bisInspVill2021RgstrService.findObjPageByType(typeParam, null)); } @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表") @RequestMapping(value = "/findNode/{code}/{regstrId}", method = RequestMethod.GET) public BaseResponse findNode( @ApiParam(name = "code", value = "code", required = true) @PathVariable String code, @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) { return buildSuccessResponse(bisInspVill2021RgstrService.findNode(code, regstrId)); } @ApiOperation(value = "获取督查中县-镇(乡)--村树节点") @RequestMapping(value = "/findTree/{code}/{regstrId}", method = RequestMethod.GET) public BaseResponse> findTree( @ApiParam(name = "code", value = "code", required = true) @PathVariable String code, @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) { //获取镇,乡 if (code.length() == 12) { code = code.substring(0, 6); } return buildSuccessResponse(attAdXBaseService.findZhenList(code, regstrId, BisInspEnum.VILL2021.getValue())); } @ApiOperation(value = "添加行政村县下镇(乡)--村树节点,code为县code") @RequestMapping(value = "/findCheckTree/{code}/{regstrId}", method = RequestMethod.GET) public BaseResponse> findCheckTree( @ApiParam(name = "code", value = "code", required = true) @PathVariable String code, @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId ) { if (code.length() == 12) { code = code.substring(0, 6); } return buildSuccessResponse(bisInspVill2021RgstrService.findCheckTree(code, regstrId)); } }