| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- package cn.com.goldenwater.dcproj.controller.villgd;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.dto.BisInspVillgdVillDto;
- import cn.com.goldenwater.dcproj.model.BisInspVillgd;
- import cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp;
- import cn.com.goldenwater.dcproj.param.TypeParam;
- import cn.com.goldenwater.dcproj.service.BisInspVillgdService;
- 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 cn.com.goldenwater.util.common.SqlUtils;
- 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-4-23
- */
- @Api(value = "xxx管理", tags = "xxx管理")
- @RestController
- @RequestMapping("/bis/insp/villgd")
- public class BisInspVillgdController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspVillgdService bisInspVillgdService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "修改xxx")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspVillgd> insert(@ApiParam(name = "bisInspVillgd", value = "BisInspVillgd", required = true) @RequestBody BisInspVillgd bisInspVillgd) {
- if (StringUtils.isBlank(bisInspVillgd.getId()) ||
- StringUtils.isNotBlank(bisInspVillgd.getRgstrId())) {
- // rgstrId 不为 空 时,传给ID
- bisInspVillgd.setId(bisInspVillgd.getRgstrId());
- }
- if (StringUtils.isBlank(bisInspVillgd.getId())) {
- throw new CheckException("缺少登记表编码!");
- }
- bisInspVillgdService.update(bisInspVillgd);
- return buildSuccessResponse(bisInspVillgd);
- }
- @ApiOperation(value = "根据ID删除xxx")
- @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspVillgdService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取xxx(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspVillgd> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspVillgd bisInspVillgd = bisInspVillgdService.get(id);
- return buildSuccessResponse(bisInspVillgd);
- }
- @ApiOperation(value = "根据ID获取xxx(单表)")
- @RequestMapping(value = "getVillTree/{id}", method = RequestMethod.GET)
- public BaseResponse<List<BisInspVillgdVillDto>> getVillTree(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- return buildSuccessResponse(bisInspVillgdService.getVillTree(id));
- }
- @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表")
- @RequestMapping(value = "/findNode/{villId}/{regstrId}", method = RequestMethod.GET)
- public BaseResponse findNode(
- @ApiParam(name = "villId", value = "villId", required = true) @PathVariable String villId,
- @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
- return buildSuccessResponse(bisInspVillgdService.findNode(villId, regstrId));
- }
- @ApiOperation(value = "根据ID获取xxx(单表)")
- @RequestMapping(value = "/findPage", method = RequestMethod.POST)
- public BaseResponse<PageInfo> listOfPage(@RequestBody TypeParam typeParam) {
- typeParam.setPresId(getCurrentPersId());
- typeParam.setOrgId(getCurrentOrgId());
- typeParam.setNowTime(DateUtils.getToday("yyyy-MM-dd"));
- typeParam.setInIdsSql(SqlUtils.getinIdsSql(typeParam.getPresId(), typeParam.getProvince()));
- if (!org.apache.commons.lang.StringUtils.isBlank(typeParam.getAdCodes())) {
- typeParam.setAdCodes(AdLevelUtil.getListAddvcd(typeParam.getAdCodes()));
- } else {
- typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
- }
- return buildSuccessResponse(bisInspVillgdService.findObjPageByType(typeParam, null));
- }
- }
|