| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- package cn.com.goldenwater.dcproj.controller.wrws;
- 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.model.BisInspOrg;
- import cn.com.goldenwater.dcproj.model.BisInspWrwsRgstr;
- import cn.com.goldenwater.dcproj.param.BisInspWrwsRgstrParam;
- import cn.com.goldenwater.dcproj.service.BisInspWrwsRgstrService;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- 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.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.text.SimpleDateFormat;
- import java.util.Date;
- /**
- * @author lhc
- * @date 2020-9-23
- */
- @Api(value = "水资源管理及节水管理复核管理", tags = "水资源管理及节水管理复核管理")
- @RestController
- @RequestMapping("/bis/insp/wrws")
- public class BisInspWrwsRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspWrwsRgstrService bisInspWrwsRgstrService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "添加或修改水资源管理及节水管理复核")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspWrwsRgstr> insert(@ApiParam(name = "bisInspWrwsRgstr", value = "BisInspWrwsRgstr", required = true)
- @RequestBody BisInspWrwsRgstr bisInspWrwsRgstr) {
- int ret = 0;
- if (StringUtils.isNotBlank(bisInspWrwsRgstr.getRgstrId())) {
- // rgstrId 不为 空 时,传给ID
- bisInspWrwsRgstr.setId(bisInspWrwsRgstr.getRgstrId());
- }
- if (StringUtils.isBlank(bisInspWrwsRgstr.getId())) {
- if (StringUtils.isNotBlank(bisInspWrwsRgstr.getObjId())) {
- BisInspWrwsRgstrParam param = new BisInspWrwsRgstrParam();
- param.setObjId(bisInspWrwsRgstr.getId());
- BisInspWrwsRgstr rgstr = bisInspWrwsRgstrService.getBy(param);
- // 如果没有注册表,添加
- if (null == rgstr) {
- ret = bisInspWrwsRgstrService.insert(bisInspWrwsRgstr);
- }
- }
- } else {
- bisInspWrwsRgstr.setUptm(new Date());
- ret = bisInspWrwsRgstrService.update(bisInspWrwsRgstr);
- }
- return buildSuccessResponse(bisInspWrwsRgstr);
- }
- @ApiOperation(value = "根据ID删除水资源管理及节水管理复核")
- @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspWrwsRgstrService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取水资源管理及节水管理复核(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspWrwsRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspWrwsRgstr bisInspWrwsRgstr = bisInspWrwsRgstrService.get(id);
- return buildSuccessResponse(bisInspWrwsRgstr);
- }
- @ApiOperation(value = "节水载体复核表登记表(福建)(列表--分页)")
- @RequestMapping(value = "/findPage", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspWrwsRgstr>> page(@ApiParam(name = "bisInspWrwsRgstrParam", value = "bisInspWrwsRgstrParam", required = true)
- @RequestBody BisInspWrwsRgstrParam bisInspWrwsRgstrParam) {
- BisInspOrg defaultOrg = olBisInspOrgService.getDefaultOrg(getCurrentOrgId());
- bisInspWrwsRgstrParam.setProvince(AdLevelUtil.getAddvcd(defaultOrg.getRlcode()));
- if(null != bisInspWrwsRgstrParam.getAdCode()){
- bisInspWrwsRgstrParam.setAdCode(AdLevelUtil.getAddvcd(bisInspWrwsRgstrParam.getAdCode()));
- }
- if(StringUtils.isBlank(bisInspWrwsRgstrParam.getTabType())){
- bisInspWrwsRgstrParam.setTabType(CommonLabel.TAB_TYPE);
- }
- String nowTime=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
- bisInspWrwsRgstrParam.setNowTime(nowTime);
- PageInfo<BisInspWrwsRgstr> rgstrPageInfo = bisInspWrwsRgstrService.findPageInfo(bisInspWrwsRgstrParam);
- return buildSuccessResponse(rgstrPageInfo);
- }
- }
|