| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- package cn.com.goldenwater.dcproj.controller.sap;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspWagaSapRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspWagaSapRgstrBase;
- import cn.com.goldenwater.dcproj.param.BisInspWagaSapRgstrBaseParam;
- import cn.com.goldenwater.dcproj.service.BisInspWagaSapRgstrBaseService;
- import cn.com.goldenwater.dcproj.service.BisInspWagaSapRgstrService;
- import cn.com.goldenwater.dcproj.utils.Builder;
- import cn.com.goldenwater.dcproj.utils.Constant;
- 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.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Optional;
- /**
- * @author lune
- * @date 2021-4-6
- */
- @Api(value = "BIS 堤防险工险段督查登记基本情况表管理", tags = "BIS 堤防险工险段督查登记基本情况表管理")
- @RestController
- @RequestMapping("/bis/insp/waga/sap/rgstr/base")
- public class BisInspWagaSapRgstrBaseController extends BaseController {
- @Autowired
- private BisInspWagaSapRgstrBaseService bisInspWagaSapRgstrBaseService;
- @Autowired
- private BisInspWagaSapRgstrService bisInspWagaSapRgstrService;
- @ApiOperation(value = "添加/修改堤防险工险段督查登记基本情况表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspWagaSapRgstrBase> insert(@ApiParam(name = "bisInspWagaSapRgstrBase", value = "BisInspWagaSapRgstrBase", required = true) @RequestBody BisInspWagaSapRgstrBase bisInspWagaSapRgstrBase) {
- String rgstrId = bisInspWagaSapRgstrBase.getRgstrId();
- BisInspWagaSapRgstrBase base = bisInspWagaSapRgstrBaseService.getBy(Builder.of(BisInspWagaSapRgstrBaseParam::new).with(BisInspWagaSapRgstrBaseParam::setRgstrId, rgstrId).build());
- Optional.ofNullable(base).ifPresent(b -> bisInspWagaSapRgstrBase.setId(b.getId()));
- if (StringUtils.isBlank(bisInspWagaSapRgstrBase.getId())) {
- // 生成uuid
- String uuid = UuidUtil.uuid();
- bisInspWagaSapRgstrBase.setId(uuid);
- bisInspWagaSapRgstrBase.setRecPersId(getCurrentPersId());
- bisInspWagaSapRgstrBaseService.insert(bisInspWagaSapRgstrBase);
- } else {
- bisInspWagaSapRgstrBaseService.update(bisInspWagaSapRgstrBase);
- }
- BisInspWagaSapRgstr sapRgstr = bisInspWagaSapRgstrService.get(rgstrId);
- //修改登记表督查状态
- sapRgstr.setBaseStat(bisInspWagaSapRgstrBase.getStatus());
- if (!Constant.STRING_TWO.equals(sapRgstr.getState())) {
- if (!Constant.STRING_ONE.equals(sapRgstr.getState())) {
- bisInspWagaSapRgstrService.setMessage(sapRgstr);
- }
- sapRgstr.setState(Constant.STRING_ONE);
- }
- sapRgstr.setSapName(bisInspWagaSapRgstrBase.getSapName());
- sapRgstr.setSapLen(bisInspWagaSapRgstrBase.getSapLen());
- sapRgstr.setDikeGrad(bisInspWagaSapRgstrBase.getDikeGrad());
- sapRgstr.setRiverBank(bisInspWagaSapRgstrBase.getRiverBank());
- sapRgstr.setLake(bisInspWagaSapRgstrBase.getLake());
- sapRgstr.setCoast(bisInspWagaSapRgstrBase.getCoast());
- sapRgstr.setMampu(bisInspWagaSapRgstrBase.getMampu());
- sapRgstr.setMampuAttn(bisInspWagaSapRgstrBase.getMampuAttn());
- sapRgstr.setMampuAttnTel(bisInspWagaSapRgstrBase.getMampuAttnTel());
- bisInspWagaSapRgstrService.update(sapRgstr);
- return buildSuccessResponse(bisInspWagaSapRgstrBase);
- }
- @ApiOperation(value = "根据ID删除堤防险工险段督查登记基本情况表")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- bisInspWagaSapRgstrBaseService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取堤防险工险段督查登记基本情况表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspWagaSapRgstrBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspWagaSapRgstrBase bisInspWagaSapRgstrBase = bisInspWagaSapRgstrBaseService.get(id);
- return buildSuccessResponse(bisInspWagaSapRgstrBase);
- }
- @ApiOperation(value = "获取堤防险工险段督查登记基本情况表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspWagaSapRgstrBase>> list(@ApiParam(name = "bisInspWagaSapRgstrBaseParam", value = "bisInspWagaSapRgstrBaseParam", required = true) @RequestBody BisInspWagaSapRgstrBaseParam bisInspWagaSapRgstrBaseParam) {
- List<BisInspWagaSapRgstrBase> bisInspWagaSapRgstrBaseList = bisInspWagaSapRgstrBaseService.findList(bisInspWagaSapRgstrBaseParam);
- return buildSuccessResponse(bisInspWagaSapRgstrBaseList);
- }
- @ApiOperation(value = "获取堤防险工险段督查登记基本情况表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspWagaSapRgstrBase>> page(@ApiParam(name = "bisInspWagaSapRgstrBaseParam", value = "bisInspWagaSapRgstrBaseParam", required = true) @RequestBody BisInspWagaSapRgstrBaseParam bisInspWagaSapRgstrBaseParam) {
- PageInfo<BisInspWagaSapRgstrBase> bisInspWagaSapRgstrBaseList = bisInspWagaSapRgstrBaseService.findPageInfo(bisInspWagaSapRgstrBaseParam);
- return buildSuccessResponse(bisInspWagaSapRgstrBaseList);
- }
- @ApiOperation(value = "根据rgstrId获取堤防险工险段督查登记基本情况表(单表)")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspWagaSapRgstrBase> getByRgstrId(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
- return buildSuccessResponse(bisInspWagaSapRgstrBaseService.getWagaSapRgstrBaseByRgstrId(rgstrId));
- }
- }
|