| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package cn.com.goldenwater.dcproj.controller.wint;
- import cn.com.goldenwater.dcproj.model.BisInspWintRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspWintRgstrIntInfo;
- import cn.com.goldenwater.dcproj.param.BisInspWintRgstrIntInfoParam;
- import cn.com.goldenwater.dcproj.service.BisInspWintRgstrIntInfoService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.service.BisInspWintRgstrService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import com.github.pagehelper.PageInfo;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2019-8-22
- */
- @Api(value = "BIS 年度水量分配及取用水管控情况抽查表管理",tags="BIS 年度水量分配及取用水管控情况抽查表管理")
- @RestController
- @RequestMapping("/bis/insp/wint/rgstr/int/info")
- public class BisInspWintRgstrIntInfoController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspWintRgstrIntInfoService bisInspWintRgstrIntInfoService;
- @Autowired
- private BisInspWintRgstrService wintRgstrService;
- @ApiOperation(value = "添加/修改年度水量分配及取用水管控情况抽查表")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspWintRgstrIntInfo> insert(@ApiParam(name = "bisInspWintRgstrIntInfo", value = "BisInspWintRgstrIntInfo", required = true) @RequestBody BisInspWintRgstrIntInfo bisInspWintRgstrIntInfo) {
- bisInspWintRgstrIntInfo.setUpTm(new Date());
- if(StringUtils.isBlank(bisInspWintRgstrIntInfo.getId())) {
- BisInspWintRgstrIntInfoParam param = new BisInspWintRgstrIntInfoParam();
- param.setRgstrId(bisInspWintRgstrIntInfo.getRgstrId());
- List<BisInspWintRgstrIntInfo> list = bisInspWintRgstrIntInfoService.findList(param);
- if (list.size() > 0 ){
- return buildFailResponse(10001,"该督查对象已有抽查记录,无法重复添加");
- }
- bisInspWintRgstrIntInfo.setInTm(new Date());
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspWintRgstrIntInfo.setId(uuid);
- bisInspWintRgstrIntInfoService.insert(bisInspWintRgstrIntInfo);
- }else{
- bisInspWintRgstrIntInfoService.update(bisInspWintRgstrIntInfo);
- }
- if (StringUtils.isNotBlank(bisInspWintRgstrIntInfo.getRgstrId())) {
- BisInspWintRgstr rgstr = wintRgstrService.get(bisInspWintRgstrIntInfo.getRgstrId());
- if (rgstr != null) {
- rgstr.setIntInfoStat(bisInspWintRgstrIntInfo.getDataStat());
- if (!"2".equals(rgstr.getState())) {
- rgstr.setState("1");
- }
- wintRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(bisInspWintRgstrIntInfo);
- }
- @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 = bisInspWintRgstrIntInfoService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取年度水量分配及取用水管控情况抽查表(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspWintRgstrIntInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspWintRgstrIntInfo bisInspWintRgstrIntInfo = bisInspWintRgstrIntInfoService.get(id);
- return buildSuccessResponse(bisInspWintRgstrIntInfo);
- }
- @ApiOperation(value = "获取年度水量分配及取用水管控情况抽查表(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspWintRgstrIntInfo>> list(@ApiParam(name = "bisInspWintRgstrIntInfoParam", value = "bisInspWintRgstrIntInfoParam", required = true) @RequestBody BisInspWintRgstrIntInfoParam bisInspWintRgstrIntInfoParam) {
- List<BisInspWintRgstrIntInfo> bisInspWintRgstrIntInfoList = bisInspWintRgstrIntInfoService.findList(bisInspWintRgstrIntInfoParam);
- return buildSuccessResponse(bisInspWintRgstrIntInfoList);
- }
- @ApiOperation(value = "获取年度水量分配及取用水管控情况抽查表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspWintRgstrIntInfo>> page(@ApiParam(name = "bisInspWintRgstrIntInfoParam", value = "bisInspWintRgstrIntInfoParam", required = true) @RequestBody BisInspWintRgstrIntInfoParam bisInspWintRgstrIntInfoParam) {
- PageInfo<BisInspWintRgstrIntInfo> bisInspWintRgstrIntInfoList = bisInspWintRgstrIntInfoService.findPageInfo(bisInspWintRgstrIntInfoParam);
- return buildSuccessResponse(bisInspWintRgstrIntInfoList);
- }
- @ApiOperation(value = "根据督查表主键主键ID获取水库工程实体(单表)")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspWintRgstrIntInfo> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
- BisInspWintRgstrIntInfoParam rsvrProjectParam = new BisInspWintRgstrIntInfoParam();
- rsvrProjectParam.setRgstrId(rgstrId);
- BisInspWintRgstrIntInfo bisInspRsvrProject = bisInspWintRgstrIntInfoService.getBy(rsvrProjectParam);
- return buildSuccessResponse(bisInspRsvrProject);
- }
- }
|