| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- 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.BisInspEfpRgstrReasonsRec;
- import cn.com.goldenwater.dcproj.param.BisInspEfpRgstrReasonsRecParam;
- import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrReasonsRecService;
- 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/reasons/rec")
- public class BisInspEfpRgstrReasonsRecController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspEfpRgstrReasonsRecService bisInspEfpRgstrReasonsRecService;
- @Autowired
- private BisInspEfpRgstrService bisInspEfpRgstrService;
- @ApiOperation(value = "添加/修改超标洪水防御预案原因分析和整改意见")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspEfpRgstrReasonsRec> insert(@ApiParam(name = "bisInspEfpRgstrReasonsRec", value = "BisInspEfpRgstrReasonsRec", required = true) @RequestBody BisInspEfpRgstrReasonsRec bisInspEfpRgstrReasonsRec) {
- bisInspEfpRgstrReasonsRec.setUptm(new Date());
- if(StringUtils.isBlank(bisInspEfpRgstrReasonsRec.getId())) {
- BisInspEfpRgstrReasonsRecParam bisInspEfpRgstrPlanComplParam = new BisInspEfpRgstrReasonsRecParam();
- bisInspEfpRgstrPlanComplParam.setRgstrId(bisInspEfpRgstrReasonsRec.getRgstrId());
- List<BisInspEfpRgstrReasonsRec> complList = bisInspEfpRgstrReasonsRecService.findList(bisInspEfpRgstrPlanComplParam);
- if (complList.size() > 0) {
- bisInspEfpRgstrReasonsRec.setId(complList.get(0).getId());
- bisInspEfpRgstrReasonsRecService.update(bisInspEfpRgstrReasonsRec);
- } else {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspEfpRgstrReasonsRec.setId(uuid);
- bisInspEfpRgstrReasonsRec.setIntm(new Date());
- bisInspEfpRgstrReasonsRecService.insert(bisInspEfpRgstrReasonsRec);
- }
- }else{
- bisInspEfpRgstrReasonsRecService.update(bisInspEfpRgstrReasonsRec);
- }
- if (StringUtils.isNotBlank(bisInspEfpRgstrReasonsRec.getRgstrId())) {
- BisInspEfpRgstr rgstr = bisInspEfpRgstrService.get(bisInspEfpRgstrReasonsRec.getRgstrId());
- if (!StateEnum.COMASTSTATE.getKey().equals(rgstr.getState())) {
- rgstr.setState(StateEnum.EXWASTSTATE.getKey());
- rgstr.setReasonStat(bisInspEfpRgstrReasonsRec.getStatus());
- bisInspEfpRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(bisInspEfpRgstrReasonsRec);
- }
- @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 = bisInspEfpRgstrReasonsRecService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取超标洪水防御预案原因分析和整改意见(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspEfpRgstrReasonsRec> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspEfpRgstrReasonsRec bisInspEfpRgstrReasonsRec = bisInspEfpRgstrReasonsRecService.get(id);
- return buildSuccessResponse(bisInspEfpRgstrReasonsRec);
- }
- @ApiOperation(value = "获取超标洪水防御预案原因分析和整改意见(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspEfpRgstrReasonsRec>> list(@ApiParam(name = "bisInspEfpRgstrReasonsRecParam", value = "bisInspEfpRgstrReasonsRecParam", required = true) @RequestBody BisInspEfpRgstrReasonsRecParam bisInspEfpRgstrReasonsRecParam) {
- List<BisInspEfpRgstrReasonsRec> bisInspEfpRgstrReasonsRecList = bisInspEfpRgstrReasonsRecService.findList(bisInspEfpRgstrReasonsRecParam);
- return buildSuccessResponse(bisInspEfpRgstrReasonsRecList);
- }
- @ApiOperation(value = "获取超标洪水防御预案原因分析和整改意见(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspEfpRgstrReasonsRec>> page(@ApiParam(name = "bisInspEfpRgstrReasonsRecParam", value = "bisInspEfpRgstrReasonsRecParam", required = true) @RequestBody BisInspEfpRgstrReasonsRecParam bisInspEfpRgstrReasonsRecParam) {
- PageInfo<BisInspEfpRgstrReasonsRec> bisInspEfpRgstrReasonsRecList = bisInspEfpRgstrReasonsRecService.findPageInfo(bisInspEfpRgstrReasonsRecParam);
- return buildSuccessResponse(bisInspEfpRgstrReasonsRecList);
- }
- @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspEfpRgstrReasonsRec> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) {
- if(StringUtils.isBlank(rgstrId)) {
- return buildFailResponse();
- }
- BisInspEfpRgstrReasonsRecParam param = new BisInspEfpRgstrReasonsRecParam();
- param.setRgstrId(rgstrId);
- BisInspEfpRgstrReasonsRec info = this.bisInspEfpRgstrReasonsRecService.getBy(param);
- return buildSuccessResponse(info);
- }
- }
|