package cn.com.goldenwater.dcproj.controller.other; import cn.com.goldenwater.dcproj.dto.AttOtherBaseDtos; import cn.com.goldenwater.dcproj.model.*; import cn.com.goldenwater.dcproj.param.AttOtherBaseParam; import cn.com.goldenwater.dcproj.service.*; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; 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-7-19 */ @Api(value = "ATT 其他检查基础信息表管理", tags = "ATT 其他检查基础信息表管理") @RestController @RequestMapping("/att/other/base") public class AttOtherBaseController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttOtherBaseService attOtherBaseService; @Autowired private AttAdXBaseService baseService; @Autowired private BisInspOtherRgstrService bisInspOtherRgstrService; @Autowired private AttBasBaseService attBasBaseService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "添加/修改其他检查基础信息表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "attOtherBase", value = "AttOtherBase", required = true) @RequestBody AttOtherBase attOtherBase) { if (StringUtils.isBlank(attOtherBase.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid attOtherBase.setId(uuid); attOtherBaseService.insert(attOtherBase); } else { attOtherBaseService.update(attOtherBase); if (StringUtils.isNotBlank(attOtherBase.getRgstrId())) { BisInspOtherRgstr rgstr = bisInspOtherRgstrService.get(attOtherBase.getRgstrId()); if (rgstr != null) { rgstr.setAdCode(attOtherBase.getAdCode()); rgstr.setAdmOrg(attOtherBase.getAdmOrg()); rgstr.setCenterX(attOtherBase.getCenterX()); rgstr.setCenterY(attOtherBase.getCenterY()); rgstr.setType(attOtherBase.getType()); rgstr.setLocation(attOtherBase.getLocation()); rgstr.setUpTm(new Date()); bisInspOtherRgstrService.update(rgstr); } } } return buildSuccessResponse(attOtherBase); } @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 = attOtherBaseService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取其他检查基础信息表(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { AttOtherBase attOtherBase = attOtherBaseService.get(id); if (attOtherBase == null) { return buildSuccessResponse(attOtherBase); } AttAdXBase xBase = baseService.get(attOtherBase.getAdCode()); if (xBase != null) { attOtherBase.setAdName(xBase.getAdFullName()); } AttBasBase basBase = attBasBaseService.get(attOtherBase.getAdmOrg()); if (basBase != null) { attOtherBase.setBasName(basBase.getBasName()); } return buildSuccessResponse(attOtherBase); } @ApiOperation(value = "获取其他检查基础信息表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "attOtherBaseParam", value = "attOtherBaseParam", required = true) @RequestBody AttOtherBaseParam attOtherBaseParam) { List attOtherBaseList = attOtherBaseService.findList(attOtherBaseParam); return buildSuccessResponse(attOtherBaseList); } @ApiOperation(value = "获取其他检查基础信息表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "attOtherBaseParam", value = "attOtherBaseParam", required = true) @RequestBody AttOtherBaseParam attOtherBaseParam) { attOtherBaseParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId())); PageInfo attOtherBaseList = attOtherBaseService.findPageInfo(attOtherBaseParam); return buildSuccessResponse(attOtherBaseList); } @ApiOperation(value = "添加飞检基础信息表集合") @RequestMapping(value = "/insertList", method = RequestMethod.POST) public BaseResponse> insertList(@RequestBody AttOtherBaseDtos dtos) { int a = attOtherBaseService.insertList(dtos); return buildSuccessResponse(); } @ApiOperation(value = "获取不在其他飞检基础信息表里面的基础信息") @RequestMapping(value = "/getBasePageInfoNotInFsc", method = RequestMethod.POST) public BaseResponse> getBasePageInfoNotInFsc(@RequestBody AttOtherBaseParam attOtherBaseParam) { attOtherBaseParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId())); PageInfo pageInfo = attOtherBaseService.getBasePageInfoNotInFsc(attOtherBaseParam); return buildSuccessResponse(pageInfo); } }