23b91f29c4c7f8075039f47516defb0a3401d983.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package cn.com.goldenwater.dcproj.controller.other;
  2. import cn.com.goldenwater.dcproj.dto.AttOtherBaseDtos;
  3. import cn.com.goldenwater.dcproj.model.*;
  4. import cn.com.goldenwater.dcproj.param.AttOtherBaseParam;
  5. import cn.com.goldenwater.dcproj.service.*;
  6. import cn.com.goldenwater.core.web.BaseController;
  7. import cn.com.goldenwater.core.web.BaseResponse;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.apache.commons.lang3.StringUtils;
  13. import com.github.pagehelper.PageInfo;
  14. import org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.PathVariable;
  18. import org.springframework.web.bind.annotation.RequestBody;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RequestMethod;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import java.util.Date;
  23. import java.util.List;
  24. /**
  25. * @author lune
  26. * @date 2019-7-19
  27. */
  28. @Api(value = "ATT 其他检查基础信息表管理", tags = "ATT 其他检查基础信息表管理")
  29. @RestController
  30. @RequestMapping("/att/other/base")
  31. public class AttOtherBaseController extends BaseController {
  32. private Logger logger = LoggerFactory.getLogger(getClass());
  33. @Autowired
  34. private AttOtherBaseService attOtherBaseService;
  35. @Autowired
  36. private AttAdXBaseService baseService;
  37. @Autowired
  38. private BisInspOtherRgstrService bisInspOtherRgstrService;
  39. @Autowired
  40. private AttBasBaseService attBasBaseService;
  41. @Autowired
  42. private OlBisInspOrgService olBisInspOrgService;
  43. @ApiOperation(value = "添加/修改其他检查基础信息表")
  44. @RequestMapping(value = "", method = RequestMethod.POST)
  45. public BaseResponse<AttOtherBase> insert(@ApiParam(name = "attOtherBase", value = "AttOtherBase", required = true) @RequestBody AttOtherBase attOtherBase) {
  46. if (StringUtils.isBlank(attOtherBase.getId())) {
  47. String uuid = UuidUtil.uuid(); // 生成uuid
  48. attOtherBase.setId(uuid);
  49. attOtherBaseService.insert(attOtherBase);
  50. } else {
  51. attOtherBaseService.update(attOtherBase);
  52. if (StringUtils.isNotBlank(attOtherBase.getRgstrId())) {
  53. BisInspOtherRgstr rgstr = bisInspOtherRgstrService.get(attOtherBase.getRgstrId());
  54. if (rgstr != null) {
  55. rgstr.setAdCode(attOtherBase.getAdCode());
  56. rgstr.setAdmOrg(attOtherBase.getAdmOrg());
  57. rgstr.setCenterX(attOtherBase.getCenterX());
  58. rgstr.setCenterY(attOtherBase.getCenterY());
  59. rgstr.setType(attOtherBase.getType());
  60. rgstr.setLocation(attOtherBase.getLocation());
  61. rgstr.setUpTm(new Date());
  62. bisInspOtherRgstrService.update(rgstr);
  63. }
  64. }
  65. }
  66. return buildSuccessResponse(attOtherBase);
  67. }
  68. @ApiOperation(value = "根据ID删除其他检查基础信息表")
  69. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  70. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  71. int ret = attOtherBaseService.delete(id);
  72. return buildSuccessResponse();
  73. }
  74. @ApiOperation(value = "根据ID获取其他检查基础信息表(单表)")
  75. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  76. public BaseResponse<AttOtherBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. AttOtherBase attOtherBase = attOtherBaseService.get(id);
  78. if (attOtherBase == null) {
  79. return buildSuccessResponse(attOtherBase);
  80. }
  81. AttAdXBase xBase = baseService.get(attOtherBase.getAdCode());
  82. if (xBase != null) {
  83. attOtherBase.setAdName(xBase.getAdFullName());
  84. }
  85. AttBasBase basBase = attBasBaseService.get(attOtherBase.getAdmOrg());
  86. if (basBase != null) {
  87. attOtherBase.setBasName(basBase.getBasName());
  88. }
  89. return buildSuccessResponse(attOtherBase);
  90. }
  91. @ApiOperation(value = "获取其他检查基础信息表(列表所有)")
  92. @RequestMapping(value = "/list", method = RequestMethod.POST)
  93. public BaseResponse<List<AttOtherBase>> list(@ApiParam(name = "attOtherBaseParam", value = "attOtherBaseParam", required = true) @RequestBody AttOtherBaseParam attOtherBaseParam) {
  94. List<AttOtherBase> attOtherBaseList = attOtherBaseService.findList(attOtherBaseParam);
  95. return buildSuccessResponse(attOtherBaseList);
  96. }
  97. @ApiOperation(value = "获取其他检查基础信息表(列表--分页)")
  98. @RequestMapping(value = "/page", method = RequestMethod.POST)
  99. public BaseResponse<PageInfo<AttOtherBase>> page(@ApiParam(name = "attOtherBaseParam", value = "attOtherBaseParam", required = true) @RequestBody AttOtherBaseParam attOtherBaseParam) {
  100. attOtherBaseParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId()));
  101. PageInfo<AttOtherBase> attOtherBaseList = attOtherBaseService.findPageInfo(attOtherBaseParam);
  102. return buildSuccessResponse(attOtherBaseList);
  103. }
  104. @ApiOperation(value = "添加飞检基础信息表集合")
  105. @RequestMapping(value = "/insertList", method = RequestMethod.POST)
  106. public BaseResponse<List<AttOtherBase>> insertList(@RequestBody AttOtherBaseDtos dtos) {
  107. int a = attOtherBaseService.insertList(dtos);
  108. return buildSuccessResponse();
  109. }
  110. @ApiOperation(value = "获取不在其他飞检基础信息表里面的基础信息")
  111. @RequestMapping(value = "/getBasePageInfoNotInFsc", method = RequestMethod.POST)
  112. public BaseResponse<PageInfo<AttFscBase>> getBasePageInfoNotInFsc(@RequestBody AttOtherBaseParam attOtherBaseParam) {
  113. attOtherBaseParam.setProvince(olBisInspOrgService.getProvinceFlag(getCurrentOrgId()));
  114. PageInfo pageInfo = attOtherBaseService.getBasePageInfoNotInFsc(attOtherBaseParam);
  115. return buildSuccessResponse(pageInfo);
  116. }
  117. }