package cn.com.goldenwater.dcproj.controller.rdwsp; 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.dao.AttAdXBaseDao; import cn.com.goldenwater.dcproj.dto.AttCountryDto; import cn.com.goldenwater.dcproj.dto.BisNewDcuserRelVillDto; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.*; import cn.com.goldenwater.dcproj.service.*; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.id.util.UuidUtil; 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.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author lune * @date 2020-10-9 */ @Api(value = "BIS 农村饮水安全回头看登记表管理",tags="BIS 农村饮水安全回头看登记表管理") @RestController @RequestMapping("/bis/rdwsp/rgstr") public class BisRdwspRgstrController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisRdwspRgstrService bisRdwspRgstrService; @Autowired private OlBisInspOrgService olBisInspOrgService; @Autowired private BisInspRssfdrRgstrService bisInspRssfdrRgstrService; @Autowired private BisBisRdwspRgstrFeeService bisBisRdwspRgstrFeeService; @Autowired private BisRdwspRgstrPoorService bisRdwspRgstrPoorService; @Autowired private AttAdXBaseDao attAdXBaseDao; @ApiOperation(value = "添加/修改农村饮水安全回头看登记表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisRdwspRgstr", value = "BisRdwspRgstr", required = true) @RequestBody BisRdwspRgstr bisRdwspRgstr) { if(StringUtils.isBlank(bisRdwspRgstr.getId())) { // 生成uuid String uuid = UuidUtil.uuid(); bisRdwspRgstr.setId(uuid); bisRdwspRgstrService.insert(bisRdwspRgstr); }else{ bisRdwspRgstrService.update(bisRdwspRgstr); } return buildSuccessResponse(bisRdwspRgstr); } @ApiOperation(value = "根据ID删除农村饮水安全回头看登记表") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisRdwspRgstrService.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) { BisRdwspRgstr bisRdwspRgstr = bisRdwspRgstrService.get(id); return buildSuccessResponse(bisRdwspRgstr); } @ApiOperation(value = "获取农村饮水安全回头看登记表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "bisRdwspRgstrParam", value = "bisRdwspRgstrParam", required = true) @RequestBody BisRdwspRgstrParam bisRdwspRgstrParam) { List bisRdwspRgstrList = bisRdwspRgstrService.findList(bisRdwspRgstrParam); return buildSuccessResponse(bisRdwspRgstrList); } @ApiOperation(value = "获取农村饮水安全回头看登记表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisRdwspRgstrParam", value = "bisRdwspRgstrParam", required = true) @RequestBody BisRdwspRgstrParam bisRdwspRgstrParam) { PageInfo bisRdwspRgstrList = bisRdwspRgstrService.findPageInfo(bisRdwspRgstrParam); return buildSuccessResponse(bisRdwspRgstrList); } @ApiOperation(value = "获取督查登记表列表") @RequestMapping(value = "/findRdwspPage", method = RequestMethod.POST) public BaseResponse> findRdwspPage(@RequestBody TypeParam param) { param.setProvince(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); String adPr = AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())); if (StringUtils.isBlank(param.getAdCode())) { param.setAdCode(adPr); } PageInfo bisInspWrmRgstrList = bisRdwspRgstrService.findRdwspPage(param); return buildSuccessResponse(bisInspWrmRgstrList); } @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); } List attAdXBaseList= bisInspRssfdrRgstrService.findZhenListByType(code,regstrId, BisInspEnum.RDWSP.getValue()); return buildSuccessResponse(attAdXBaseList); } @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) { //获取镇,乡 Map map=new HashMap<>(); BisBisRdwspRgstrFeeParam feeParam=new BisBisRdwspRgstrFeeParam(); feeParam.setRegstrId(regstrId); if(code.length()==12 && code.endsWith("000")){ code=code.replace("000",""); } feeParam.setAdCode(code); List wateruserInfos=bisBisRdwspRgstrFeeService.findList(feeParam); BisRdwspRgstrPoorParam poorParam=new BisRdwspRgstrPoorParam(); poorParam.setAdCode(code); poorParam.setRegstrId(regstrId); List countryFeeList=bisRdwspRgstrPoorService.findList(poorParam); map.put("waterUsers",countryFeeList); map.put("countryPro",wateruserInfos); return buildSuccessResponse(map); } @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 ){ code=code.substring(0, 6); List zhenDtoList=attAdXBaseDao.findXZCZhenList(code); List countryDtoList=attAdXBaseDao.findXZCCunListByType(code,regstrId, BisInspEnum.RDWSP.getValue()); for(AttCountryDto attCountryDto:zhenDtoList){ String adCode=attCountryDto.getAdCode().replace("000",""); List childList=new ArrayList<>(); for(AttCountryDto countryDto:countryDtoList){ if(countryDto.getAdCode().startsWith(adCode)){ childList.add(countryDto); } } attCountryDto.setAttCountryDtoList(childList); } return buildSuccessResponse(zhenDtoList); } @ApiOperation(value = "问题栏目:问题列表根据当前登录用户id获取需要督查问题列表") @RequestMapping(value = "/list/{persId}", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "persId", value = "persId", required = true) @PathVariable String persId , @RequestBody(required = false) PlbmParam pblmParam) { pblmParam.setPresId(persId); PageInfo inspPblmList = bisBisRdwspRgstrFeeService.findPageList(pblmParam); return buildSuccessResponse(inspPblmList); } }