| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- package cn.com.goldenwater.dcproj.controller.efp;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.constValue.StateEnum;
- import cn.com.goldenwater.dcproj.model.BisInspEfpRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspEfpRgstrPlanCompl;
- import cn.com.goldenwater.dcproj.param.BisInspEfpRgstrPlanComplParam;
- import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrPlanComplService;
- import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrService;
- 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 javax.servlet.http.HttpServletRequest;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-5-27
- */
- @Api(value = "BIS 超标洪水防御预案编制情况管理",tags="BIS 超标洪水防御预案编制情况管理")
- @RestController
- @RequestMapping("/bis/insp/efp/rgstr/plan/compl")
- public class BisInspEfpRgstrPlanComplController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspEfpRgstrPlanComplService bisInspEfpRgstrPlanComplService;
- @Autowired
- private BisInspEfpRgstrService bisInspEfpRgstrService;
- @ApiOperation(value = "添加/修改超标洪水防御预案编制情况")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspEfpRgstrPlanCompl> insert(@ApiParam(name = "bisInspEfpRgstrPlanCompl", value = "BisInspEfpRgstrPlanCompl", required = true) @RequestBody BisInspEfpRgstrPlanCompl bisInspEfpRgstrPlanCompl) {
- bisInspEfpRgstrPlanCompl.setUptm(new Date());
- if(StringUtils.isBlank(bisInspEfpRgstrPlanCompl.getId())) {
- BisInspEfpRgstrPlanComplParam bisInspEfpRgstrPlanComplParam = new BisInspEfpRgstrPlanComplParam();
- bisInspEfpRgstrPlanComplParam.setRgstrId(bisInspEfpRgstrPlanCompl.getRgstrId());
- List<BisInspEfpRgstrPlanCompl> complList = bisInspEfpRgstrPlanComplService.findList(bisInspEfpRgstrPlanComplParam);
- if (complList.size() > 0) {
- bisInspEfpRgstrPlanCompl.setId(complList.get(0).getId());
- bisInspEfpRgstrPlanComplService.update(bisInspEfpRgstrPlanCompl);
- } else {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspEfpRgstrPlanCompl.setId(uuid);
- bisInspEfpRgstrPlanCompl.setIntm(new Date());
- bisInspEfpRgstrPlanComplService.insert(bisInspEfpRgstrPlanCompl);
- }
- }else{
- bisInspEfpRgstrPlanComplService.update(bisInspEfpRgstrPlanCompl);
- }
- if (StringUtils.isNotBlank(bisInspEfpRgstrPlanCompl.getRgstrId())) {
- BisInspEfpRgstr rgstr = bisInspEfpRgstrService.get(bisInspEfpRgstrPlanCompl.getRgstrId());
- if (!StateEnum.COMASTSTATE.getKey().equals(rgstr.getState())) {
- rgstr.setState(StateEnum.EXWASTSTATE.getKey());
- rgstr.setPlanStat(bisInspEfpRgstrPlanCompl.getStatus());
- bisInspEfpRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(bisInspEfpRgstrPlanCompl);
- }
- @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 = bisInspEfpRgstrPlanComplService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取超标洪水防御预案编制情况(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspEfpRgstrPlanCompl> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspEfpRgstrPlanCompl bisInspEfpRgstrPlanCompl = bisInspEfpRgstrPlanComplService.get(id);
- return buildSuccessResponse(bisInspEfpRgstrPlanCompl);
- }
- @ApiOperation(value = "获取超标洪水防御预案编制情况(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspEfpRgstrPlanCompl>> list(@ApiParam(name = "bisInspEfpRgstrPlanComplParam", value = "bisInspEfpRgstrPlanComplParam", required = true) @RequestBody BisInspEfpRgstrPlanComplParam bisInspEfpRgstrPlanComplParam) {
- List<BisInspEfpRgstrPlanCompl> bisInspEfpRgstrPlanComplList = bisInspEfpRgstrPlanComplService.findList(bisInspEfpRgstrPlanComplParam);
- return buildSuccessResponse(bisInspEfpRgstrPlanComplList);
- }
- @ApiOperation(value = "获取超标洪水防御预案编制情况(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspEfpRgstrPlanCompl>> page(@ApiParam(name = "bisInspEfpRgstrPlanComplParam", value = "bisInspEfpRgstrPlanComplParam", required = true) @RequestBody BisInspEfpRgstrPlanComplParam bisInspEfpRgstrPlanComplParam) {
- PageInfo<BisInspEfpRgstrPlanCompl> bisInspEfpRgstrPlanComplList = bisInspEfpRgstrPlanComplService.findPageInfo(bisInspEfpRgstrPlanComplParam);
- return buildSuccessResponse(bisInspEfpRgstrPlanComplList);
- }
- @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspEfpRgstrPlanCompl> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) {
- if(StringUtils.isBlank(rgstrId)) {
- return buildFailResponse();
- }
- BisInspEfpRgstrPlanComplParam param = new BisInspEfpRgstrPlanComplParam();
- param.setRgstrId(rgstrId);
- BisInspEfpRgstrPlanCompl info = this.bisInspEfpRgstrPlanComplService.getBy(param);
- return buildSuccessResponse(info);
- }
- }
|