| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- package cn.com.goldenwater.dcproj.controller.waga;
- 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.AttWagaRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspWagaRgstrDto;
- import cn.com.goldenwater.dcproj.param.AttWagaRgstrParam;
- import cn.com.goldenwater.dcproj.service.AttWagaRgstrService;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.target.Authority;
- import cn.com.goldenwater.id.util.UuidUtil;
- import cn.com.goldenwater.util.common.SqlUtils;
- 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.util.Assert;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import cn.com.goldenwater.dcproj.param.TypeParam;
- /**
- * @author lune
- * @date 2019-4-22
- */
- @Api(value = "WAGA 水闸信息督查表管理", tags = "WAGA 水闸信息督查表管理")
- @RestController
- @RequestMapping("/att/waga/rgstr")
- public class AttWagaRgstrController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private AttWagaRgstrService attWagaRgstrService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @ApiOperation(value = "添加(或更新(通过唯一ID标识))水闸信息督查表管理")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<String> insert(@ApiParam(name = "attWagaRgstr", value = "AttWagaRgstr", required = true) @RequestBody AttWagaRgstr attWagaRgstr) {
- String uuid = UuidUtil.uuid();
- Date date=new Date();
- attWagaRgstr.setUptm(date);
- attWagaRgstr.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- attWagaRgstr.setOrgId(getCurrentOrgId());
- if (StringUtils.isBlank(attWagaRgstr.getId())) {
- attWagaRgstr.setId(uuid);
- attWagaRgstr.setIntm(date);
- attWagaRgstr.setUptm(date);
- attWagaRgstrService.insert(attWagaRgstr);
- } else {
- attWagaRgstr.setUptm(date);
- attWagaRgstrService.update(attWagaRgstr);
- }
- return buildSuccessResponse(uuid);
- }
- @ApiOperation(value = "根据ID删除水闸信息督查表管理")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- attWagaRgstrService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "更新水闸信息督查表管理信息")
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public BaseResponse update(@ApiParam(name = "attWagaRgstr", value = "AttWagaRgstr", required = true) @RequestBody AttWagaRgstr attWagaRgstr) {
- Assert.notNull(attWagaRgstr.getId(), "主键id为必填参数");
- attWagaRgstr.setUptm(new Date());
- attWagaRgstrService.update(attWagaRgstr);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取水闸信息督查表管理(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<AttWagaRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- AttWagaRgstr attWagaRgstr = attWagaRgstrService.get(id);
- return buildSuccessResponse(attWagaRgstr);
- }
- @ApiOperation(value = "获取水闸信息督查表,如果不存在则创建登记表,对象objId,水闸objCode")
- @RequestMapping(value = "/getBy/{objId}/{objCode}/{groupId}", method = RequestMethod.GET)
- public BaseResponse<AttWagaRgstr> getBy(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId,
- @ApiParam(name = "objCode", value = "objCode", required = true) @PathVariable String objCode,
- @ApiParam(name = "groupId", value = "groupId", required = false) @PathVariable String groupId, HttpServletRequest request) {
- AttWagaRgstrParam wagaRgstrParam = new AttWagaRgstrParam();
- wagaRgstrParam.setObjCode(objCode);
- wagaRgstrParam.setObjId(objId);
- wagaRgstrParam.setGroupId(groupId);
- wagaRgstrParam.setPersId(getCurrentPersId());
- AttWagaRgstr bisInspRsvrRgstr = attWagaRgstrService.getByRsvrRgstr(wagaRgstrParam);
- return buildSuccessResponse(bisInspRsvrRgstr);
- }
- @Authority
- @ApiOperation(value = "PC版根据用户persId,状态state,行政区话编码code,主要争对督查表操作")
- @RequestMapping(value = "/list/page", method = RequestMethod.POST)
- public Object page(@RequestBody TypeParam typeParam, HttpServletResponse response) {
- if(StringUtils.isBlank(typeParam.getTabType())){
- typeParam.setTabType(CommonLabel.TAB_TYPE);
- }
- String nowTime=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
- typeParam.setNowTime(nowTime);
- typeParam.setInIdsSql(SqlUtils.getinIdsSql(getCurrentPersId(),olBisInspOrgService.getProvince(getCurrentOrgId())));
- if ("1".equals(typeParam.getIsExport())) {
- attWagaRgstrService.findPcList(typeParam,response);
- }
- typeParam.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
- PageInfo<BisInspWagaRgstrDto> rsvrRgstrPcDtoPageInfo = attWagaRgstrService.findPcPage(typeParam, response);
- return buildSuccessResponse(rsvrRgstrPcDtoPageInfo);
- }
- @ApiOperation(value = "处理数据")
- @RequestMapping(value = "/updateBaseData", method = RequestMethod.POST)
- public BaseResponse updateBaseData(){
- int reulst = attWagaRgstrService.updateBaseData();
- return buildSuccessResponse();
- }
- }
|