| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- 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<AttOtherBase> 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<AttOtherBase> 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<AttOtherBase>> list(@ApiParam(name = "attOtherBaseParam", value = "attOtherBaseParam", required = true) @RequestBody AttOtherBaseParam attOtherBaseParam) {
- List<AttOtherBase> attOtherBaseList = attOtherBaseService.findList(attOtherBaseParam);
- return buildSuccessResponse(attOtherBaseList);
- }
- @ApiOperation(value = "获取其他检查基础信息表(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<AttOtherBase>> page(@ApiParam(name = "attOtherBaseParam", value = "attOtherBaseParam", required = true) @RequestBody AttOtherBaseParam attOtherBaseParam) {
- attOtherBaseParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId()));
- PageInfo<AttOtherBase> attOtherBaseList = attOtherBaseService.findPageInfo(attOtherBaseParam);
- return buildSuccessResponse(attOtherBaseList);
- }
- @ApiOperation(value = "添加飞检基础信息表集合")
- @RequestMapping(value = "/insertList", method = RequestMethod.POST)
- public BaseResponse<List<AttOtherBase>> insertList(@RequestBody AttOtherBaseDtos dtos) {
- int a = attOtherBaseService.insertList(dtos);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "获取不在其他飞检基础信息表里面的基础信息")
- @RequestMapping(value = "/getBasePageInfoNotInFsc", method = RequestMethod.POST)
- public BaseResponse<PageInfo<AttFscBase>> getBasePageInfoNotInFsc(@RequestBody AttOtherBaseParam attOtherBaseParam) {
- attOtherBaseParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId()));
- PageInfo pageInfo = attOtherBaseService.getBasePageInfoNotInFsc(attOtherBaseParam);
- return buildSuccessResponse(pageInfo);
- }
- }
|