| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 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.CommonLabel;
- import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
- import cn.com.goldenwater.dcproj.model.BisInspEfpRgstr;
- import cn.com.goldenwater.dcproj.param.BisInspEfpRgstrParam;
- import cn.com.goldenwater.dcproj.param.TypeParam;
- import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrService;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- 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.HttpServletResponse;
- import java.text.SimpleDateFormat;
- 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")
- public class BisInspEfpRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspEfpRgstrService bisInspEfpRgstrService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "添加/修改超标洪水防御督查登记表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspEfpRgstr> insert(@ApiParam(name = "bisInspEfpRgstr", value = "BisInspEfpRgstr", required = true) @RequestBody BisInspEfpRgstr bisInspEfpRgstr) {
- if(StringUtils.isBlank(bisInspEfpRgstr.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspEfpRgstr.setId(uuid);
- bisInspEfpRgstrService.insert(bisInspEfpRgstr);
- }else{
- bisInspEfpRgstrService.update(bisInspEfpRgstr);
- }
- return buildSuccessResponse(bisInspEfpRgstr);
- }
- @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 = bisInspEfpRgstrService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取超标洪水防御督查登记表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspEfpRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspEfpRgstr bisInspEfpRgstr = bisInspEfpRgstrService.get(id);
- return buildSuccessResponse(bisInspEfpRgstr);
- }
- @ApiOperation(value = "获取超标洪水防御督查登记表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspEfpRgstr>> list(@ApiParam(name = "bisInspEfpRgstrParam", value = "bisInspEfpRgstrParam", required = true) @RequestBody BisInspEfpRgstrParam bisInspEfpRgstrParam) {
- List<BisInspEfpRgstr> bisInspEfpRgstrList = bisInspEfpRgstrService.findList(bisInspEfpRgstrParam);
- return buildSuccessResponse(bisInspEfpRgstrList);
- }
- @ApiOperation(value = "获取超标洪水防御督查登记表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspEfpRgstr>> page(@ApiParam(name = "bisInspEfpRgstrParam", value = "bisInspEfpRgstrParam", required = true) @RequestBody BisInspEfpRgstrParam bisInspEfpRgstrParam) {
- PageInfo<BisInspEfpRgstr> bisInspEfpRgstrList = bisInspEfpRgstrService.findPageInfo(bisInspEfpRgstrParam);
- return buildSuccessResponse(bisInspEfpRgstrList);
- }
- @ApiOperation(value = "获取督查列表")
- @RequestMapping(value = "/findEfpPage", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspRgstrDto>> findEfpPage(@RequestBody TypeParam typeParam, HttpServletResponse response) {
- typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- if(StringUtils.isBlank(typeParam.getTabType())){
- typeParam.setTabType(CommonLabel.TAB_TYPE);
- }
- String nowTime=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
- typeParam.setNowTime(nowTime);
- PageInfo<BisInspRgstrDto> bisInspEfpRgstrList = bisInspEfpRgstrService.findEfpPage(typeParam,response);
- return buildSuccessResponse(bisInspEfpRgstrList);
- }
- }
|