package cn.com.goldenwater.dcproj.controller.rsvryn; 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.constValue.CommonLabel; import cn.com.goldenwater.dcproj.dto.BisInspRsvrynRgstrPcDto; import cn.com.goldenwater.dcproj.dto.BisInspVillRgstrDto; import cn.com.goldenwater.dcproj.model.AttRsBase; import cn.com.goldenwater.dcproj.model.BisInspPblm; import cn.com.goldenwater.dcproj.model.BisInspRsvrynRgstr; import cn.com.goldenwater.dcproj.param.*; import cn.com.goldenwater.dcproj.service.*; import cn.com.goldenwater.dcproj.target.Authority; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import cn.com.goldenwater.id.util.UuidUtil; 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 javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; /** * @author lune * @date 2019-2-18 */ @Api(value = "APP 督查水库登记管理", tags = "APP 督查水库登记管理") @RestController @RequestMapping("/bis/insp/rsvryn") public class BisInspRsvrynRgstrController extends BaseController { @Autowired private BisInspRsvrynRgstrService bisInspRsvrynRgstrService; @Autowired private BisInspVillRgstrService bisInspVillRgstrService; @Autowired private BisInspPblmService bisInspPblmService; @Autowired private OlBisInspOrgService olBisInspOrgService; @Autowired private BisInspRsmlRgstrService bisInspRsmlRgstrService; @ApiOperation(value = "添加督查水库登记") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspRsvrynRgstr", value = "BisInspRsvrynRgstr", required = true) @RequestBody BisInspRsvrynRgstr bisInspRsvrynRgstr) { int ret = bisInspRsvrynRgstrService.update(bisInspRsvrynRgstr); return buildSuccessResponse(bisInspRsvrynRgstr); } @ApiOperation(value = "提交督查水库登记,变更水库登记表状态") @RequestMapping(value = "/submit/{rgstrId}", method = RequestMethod.POST) public BaseResponse submit(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) { BisInspRsvrynRgstr rsvrRgstr = new BisInspRsvrynRgstr(); rsvrRgstr.setRgstrId(rgstrId); rsvrRgstr.setState("2"); rsvrRgstr.setUptm(new Date()); bisInspRsvrynRgstrService.updateRG(rsvrRgstr); return buildSuccessResponse(rgstrId); } @ApiOperation(value = "根据ID删除水库登记") @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisInspRsvrynRgstrService.deleteInFlag(id); return buildSuccessResponse(); } @ApiOperation(value = "更新水库登记信息,提交") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "bisInspRsvrynRgstr", value = "BisInspRsvrynRgstr", required = true) @RequestBody BisInspRsvrynRgstr bisInspRsvrynRgstr) { int ret = bisInspRsvrynRgstrService.update(bisInspRsvrynRgstr); return buildSuccessResponse(bisInspRsvrynRgstr); } @ApiOperation(value = "根据ID获取督查水库登记(单表),详细信息,包含填报状态") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspRsvrynRgstr bisInspRsvrynRgstr = bisInspRsvrynRgstrService.get(id); return buildSuccessResponse(bisInspRsvrynRgstr); } @ApiOperation(value = "获取水库信息督查表,如果不存在则创建登记表,对象objId,水库resCode") @RequestMapping(value = "/getBy/{objId}/{resCode}", method = RequestMethod.GET) public BaseResponse getBy(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId, @ApiParam(name = "resCode", value = "resCode", required = true) @PathVariable String resCode, HttpServletRequest request) { BisInspRsvrynRgstrParam inspRsvrRgstrParam = new BisInspRsvrynRgstrParam(); inspRsvrRgstrParam.setRsCode(resCode); inspRsvrRgstrParam.setObjId(objId); String persId = request.getHeader("persId"); inspRsvrRgstrParam.setRecPersId(persId); inspRsvrRgstrParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); BisInspRsvrynRgstr bisInspRsvrynRgstr = bisInspRsvrynRgstrService.getByRsvrRgstr(inspRsvrRgstrParam); return buildSuccessResponse(bisInspRsvrynRgstr); } @ApiOperation(value = "督查问题清单,根据ID获取督查当前督查的所有问题") @RequestMapping(value = "/list/{rgstrId}", method = RequestMethod.GET) public BaseResponse> list(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) { BisInspPblmParam pblmParam = new BisInspPblmParam(); pblmParam.setRegid(rgstrId); PageInfo inspPblmList = bisInspPblmService.findPageInfo(pblmParam); return buildSuccessResponse(inspPblmList); } @ApiOperation(value = "获取督查水库登记(分页表)") @RequestMapping(value = "/pageList", method = RequestMethod.POST) public BaseResponse> pageList(@ApiParam(name = "bisInspRsvrynRgstrParam", value = "bisInspRsvrynRgstrParam", required = true) @RequestBody BisInspRsvrynRgstrParam bisInspRsvrynRgstrParam) { bisInspRsvrynRgstrParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); PageInfo bisInspRsvrynRgstrPageInfo = bisInspRsvrynRgstrService.findPageInfo(bisInspRsvrynRgstrParam); return buildSuccessResponse(bisInspRsvrynRgstrPageInfo); } @Authority @ApiOperation(value = "根据记录人员id获取农水填录信息") @RequestMapping(value = "/findTree", method = RequestMethod.POST) public Object findTree(@RequestBody TypeParam typeParam) { typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); typeParam.setOrgId(getCurrentOrgId()); if (BisInspEnum.VILL.getKey().equals(typeParam.getType())) { List inspVillRgstrs = bisInspVillRgstrService.findTree(typeParam); return buildSuccessResponse(inspVillRgstrs); } return buildFailResponse("无重要列表信息!!"); } @ApiOperation(value = "根据用户persId,状态state,行政区话编码code,主要争对督查表操作") @RequestMapping(value = "/list/page", method = RequestMethod.POST) public Object page(@RequestBody TypeParam typeParam) { typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId())); typeParam.setOrgId(getCurrentOrgId()); if (StringUtils.isBlank(typeParam.getTabType())) { typeParam.setTabType(CommonLabel.TAB_TYPE); } String nowTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); typeParam.setNowTime(nowTime); typeParam.setInIdsSql(SqlUtils.getinIdsSql(getCurrentPersId(), typeParam.getProvince())); PageInfo rsvrRgstrPcDtoPageInfo = bisInspRsvrynRgstrService.findPcPage(typeParam); return buildSuccessResponse(rsvrRgstrPcDtoPageInfo); } @ApiOperation(value = "小水库基本信息(分页表)") @RequestMapping(value = "/attRsBase", method = RequestMethod.POST) public BaseResponse> pageList(@ApiParam(name = "attRsBase", value = "attRsBase", required = true) @RequestBody AttRsBaseParam attRsBaseParam) { attRsBaseParam.setProvince(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); PageInfo bisInspRsvrynRgstrPageInfo = bisInspRsvrynRgstrService.findAttBaseInfo(attRsBaseParam); return buildSuccessResponse(bisInspRsvrynRgstrPageInfo); } @ApiOperation(value = "根据rgstrId获取水库督查管理责任体系表(单表)") @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET) public BaseResponse getByRgstrId(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) { BisInspRsvrynRgstr bisInspRsvrynRgstr = bisInspRsvrynRgstrService.get(rgstrId); if (bisInspRsvrynRgstr != null) { return buildSuccessResponse(bisInspRsvrynRgstr); } BisInspRsmlRgstrParam param = new BisInspRsmlRgstrParam(); param.setId(rgstrId); return buildSuccessResponse(bisInspRsmlRgstrService.getBy(param)); } }