| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package cn.com.goldenwater.dcproj.controller.samrmp;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspSamrmpRgstrSmrmp;
- import cn.com.goldenwater.dcproj.param.BisInspSamrmpRgstrSmrmpParam;
- import cn.com.goldenwater.dcproj.service.BisInspSamrmpRgstrService;
- import cn.com.goldenwater.dcproj.service.BisInspSamrmpRgstrSmrmpService;
- 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.List;
- /**
- * @author lune
- * @date 2020-9-11
- */
- @Api(value = "BIS 中小河流治理项目抽查情况管理",tags="BIS 中小河流治理项目抽查情况管理")
- @RestController
- @RequestMapping("/bis/insp/samrmp/rgstr/smrmp")
- public class BisInspSamrmpRgstrSmrmpController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspSamrmpRgstrSmrmpService bisInspSamrmpRgstrSmrmpService;
- @Autowired
- private BisInspSamrmpRgstrService bisInspSamrmpRgstrService;
- @ApiOperation(value = "添加/修改中小河流治理项目抽查情况")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspSamrmpRgstrSmrmp> insert(@ApiParam(name = "bisInspSamrmpRgstrSmrmp", value = "BisInspSamrmpRgstrSmrmp", required = true) @RequestBody BisInspSamrmpRgstrSmrmp bisInspSamrmpRgstrSmrmp) {
- if(StringUtils.isBlank(bisInspSamrmpRgstrSmrmp.getId())) {
- // 生成uuid
- String uuid = UuidUtil.uuid();
- bisInspSamrmpRgstrSmrmp.setId(uuid);
- bisInspSamrmpRgstrSmrmpService.insert(bisInspSamrmpRgstrSmrmp);
- }else{
- bisInspSamrmpRgstrSmrmpService.update(bisInspSamrmpRgstrSmrmp);
- }
- if (StringUtils.isNotBlank(bisInspSamrmpRgstrSmrmp.getRgstrId())) {
- BisInspSamrmpRgstr rgstr = bisInspSamrmpRgstrService.get(bisInspSamrmpRgstrSmrmp.getRgstrId());
- if (rgstr != null) {
- rgstr.setSmrmpState(bisInspSamrmpRgstrSmrmp.getStatus());
- if (!"2".equals(rgstr.getState())) {
- rgstr.setState("1");
- }
- bisInspSamrmpRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(bisInspSamrmpRgstrSmrmp);
- }
- @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 = bisInspSamrmpRgstrSmrmpService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取中小河流治理项目抽查情况(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspSamrmpRgstrSmrmp> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspSamrmpRgstrSmrmp bisInspSamrmpRgstrSmrmp = bisInspSamrmpRgstrSmrmpService.get(id);
- return buildSuccessResponse(bisInspSamrmpRgstrSmrmp);
- }
- @ApiOperation(value = "获取中小河流治理项目抽查情况(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspSamrmpRgstrSmrmp>> list(@ApiParam(name = "bisInspSamrmpRgstrSmrmpParam", value = "bisInspSamrmpRgstrSmrmpParam", required = true) @RequestBody BisInspSamrmpRgstrSmrmpParam bisInspSamrmpRgstrSmrmpParam) {
- List<BisInspSamrmpRgstrSmrmp> bisInspSamrmpRgstrSmrmpList = bisInspSamrmpRgstrSmrmpService.findList(bisInspSamrmpRgstrSmrmpParam);
- return buildSuccessResponse(bisInspSamrmpRgstrSmrmpList);
- }
- @ApiOperation(value = "获取中小河流治理项目抽查情况(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspSamrmpRgstrSmrmp>> page(@ApiParam(name = "bisInspSamrmpRgstrSmrmpParam", value = "bisInspSamrmpRgstrSmrmpParam", required = true) @RequestBody BisInspSamrmpRgstrSmrmpParam bisInspSamrmpRgstrSmrmpParam) {
- PageInfo<BisInspSamrmpRgstrSmrmp> bisInspSamrmpRgstrSmrmpList = bisInspSamrmpRgstrSmrmpService.findPageInfo(bisInspSamrmpRgstrSmrmpParam);
- return buildSuccessResponse(bisInspSamrmpRgstrSmrmpList);
- }
- @ApiOperation(value = "根据登记表id获取取水单位用水情况")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspSamrmpRgstrSmrmp> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) {
- if(StringUtils.isBlank(rgstrId)) {
- return buildFailResponse();
- }
- BisInspSamrmpRgstrSmrmpParam param = new BisInspSamrmpRgstrSmrmpParam();
- param.setRgstrId(rgstrId);
- BisInspSamrmpRgstrSmrmp info = this.bisInspSamrmpRgstrSmrmpService.getBy(param);
- return buildSuccessResponse(info);
- }
- }
|