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