| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- package cn.com.goldenwater.dcproj.controller.rsfco;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspRsfcoRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspRsfcoRgstrFcs;
- import cn.com.goldenwater.dcproj.param.BisInspRsfcoRgstrFcsParam;
- import cn.com.goldenwater.dcproj.service.BisInspRsfcoRgstrFcsService;
- import cn.com.goldenwater.dcproj.service.BisInspRsfcoRgstrService;
- 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.List;
- /**
- * @author lune
- * @date 2021年3月29日
- */
- @Api(value = "BIS 水库防洪调度监督检查-新管理",tags="BIS 水库防洪调度监督检查-新管理")
- @RestController
- @RequestMapping("/bis/insp/rsfco/rgstr/fcs")
- public class BisInspRsfcoRgstrFcsController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspRsfcoRgstrFcsService bisInspRsfcoRgstrFcsService;
- @Autowired
- private BisInspRsfcoRgstrService bisInspRsfcoRgstrService;
- @ApiOperation(value = "添加/修改水库防洪调度监督检查-新")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspRsfcoRgstrFcs> insert(@ApiParam(name = "bisInspRsfcoRgstrFcs", value = "BisInspRsfcoRgstrFcs", required = true) @RequestBody BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs) {
- if (StringUtils.isNotBlank(bisInspRsfcoRgstrFcs.getRgstrId())){
- BisInspRsfcoRgstr rgstr = bisInspRsfcoRgstrService.get(bisInspRsfcoRgstrFcs.getRgstrId());
- if (rgstr != null){
- rgstr.setFcsState(bisInspRsfcoRgstrFcs.getStatus());
- if (!"2".equals(rgstr.getState())) {
- rgstr.setState("1");
- if (StringUtils.isNotBlank(bisInspRsfcoRgstrFcs.getStatus())) {
- rgstr.setFcsState(
- bisInspRsfcoRgstrFcs.getStatus());
- }
- }
- bisInspRsfcoRgstrService.update(rgstr);
- }
- } else {
- return buildFailResponse(new IllegalArgumentException("rgstrId 为必传字段"));
- }
- if(StringUtils.isBlank(bisInspRsfcoRgstrFcs.getId())) {
- // 生成uuid
- String uuid = UuidUtil.uuid();
- bisInspRsfcoRgstrFcs.setId(uuid);
- bisInspRsfcoRgstrFcsService.insert(bisInspRsfcoRgstrFcs);
- }else{
- bisInspRsfcoRgstrFcsService.update(bisInspRsfcoRgstrFcs);
- }
- return buildSuccessResponse(bisInspRsfcoRgstrFcs);
- }
- @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 = bisInspRsfcoRgstrFcsService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取水库防洪调度监督检查-新(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsfcoRgstrFcs> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs = bisInspRsfcoRgstrFcsService.getWith(id);
- return buildSuccessResponse(bisInspRsfcoRgstrFcs);
- }
- @ApiOperation(value = "根据ID获取水库防洪调度监督检查-新(单表)")
- @RequestMapping(value = "/getBy/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsfcoRgstrFcs> getBy(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- if(StringUtils.isBlank(id)) {
- return buildFailResponse();
- }
- BisInspRsfcoRgstrFcsParam fcs = new BisInspRsfcoRgstrFcsParam();
- fcs.setRgstrId(id);
- BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs = bisInspRsfcoRgstrFcsService.getBy(fcs);
- return buildSuccessResponse(bisInspRsfcoRgstrFcs);
- }
- @ApiOperation(value = "根据ID获取水库防洪调度监督检查-新(单表)")
- @RequestMapping(value = "getWith/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspRsfcoRgstrFcs> getWith(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs = bisInspRsfcoRgstrFcsService.get(id);
- return buildSuccessResponse(bisInspRsfcoRgstrFcs);
- }
- @ApiOperation(value = "获取水库防洪调度监督检查-新(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspRsfcoRgstrFcs>> list(@ApiParam(name = "bisInspRsfcoRgstrFcsParam", value = "bisInspRsfcoRgstrFcsParam", required = true) @RequestBody BisInspRsfcoRgstrFcsParam bisInspRsfcoRgstrFcsParam) {
- List<BisInspRsfcoRgstrFcs> bisInspRsfcoRgstrFcsList = bisInspRsfcoRgstrFcsService.findList(bisInspRsfcoRgstrFcsParam);
- return buildSuccessResponse(bisInspRsfcoRgstrFcsList);
- }
- @ApiOperation(value = "获取水库防洪调度监督检查-新(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspRsfcoRgstrFcs>> page(@ApiParam(name = "bisInspRsfcoRgstrFcsParam", value = "bisInspRsfcoRgstrFcsParam", required = true) @RequestBody BisInspRsfcoRgstrFcsParam bisInspRsfcoRgstrFcsParam) {
- PageInfo<BisInspRsfcoRgstrFcs> bisInspRsfcoRgstrFcsList = bisInspRsfcoRgstrFcsService.findPageInfo(bisInspRsfcoRgstrFcsParam);
- return buildSuccessResponse(bisInspRsfcoRgstrFcsList);
- }
- }
|