3aaaecaa649c0ac9b8050fd14fd935375ce491bf.svn-base 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package cn.com.goldenwater.dcproj.controller.mfdp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.CommonLabel;
  5. import cn.com.goldenwater.dcproj.dao.AttAdXBaseDao;
  6. import cn.com.goldenwater.dcproj.dto.AttCountryDto;
  7. import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
  8. import cn.com.goldenwater.dcproj.model.AttAdXBase;
  9. import cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr;
  10. import cn.com.goldenwater.dcproj.model.BisInspOrg;
  11. import cn.com.goldenwater.dcproj.param.BisInspMfdpRgstrParam;
  12. import cn.com.goldenwater.dcproj.param.TypeParam;
  13. import cn.com.goldenwater.dcproj.service.BisInspMfdpRgstrService;
  14. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  15. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  16. import cn.com.goldenwater.target.CheckException;
  17. import com.github.pagehelper.PageInfo;
  18. import io.swagger.annotations.Api;
  19. import io.swagger.annotations.ApiOperation;
  20. import io.swagger.annotations.ApiParam;
  21. import org.apache.commons.lang3.StringUtils;
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.web.bind.annotation.PathVariable;
  26. import org.springframework.web.bind.annotation.RequestBody;
  27. import org.springframework.web.bind.annotation.RequestMapping;
  28. import org.springframework.web.bind.annotation.RequestMethod;
  29. import org.springframework.web.bind.annotation.RestController;
  30. import javax.servlet.http.HttpServletResponse;
  31. import java.text.SimpleDateFormat;
  32. import java.util.ArrayList;
  33. import java.util.Date;
  34. import java.util.List;
  35. /**
  36. * @author lune
  37. * @date 2020-4-26
  38. */
  39. @Api(value = "BIS 山洪灾害防御督查登记表管理",tags="BIS 山洪灾害防御督查登记表管理")
  40. @RestController
  41. @RequestMapping("/bis/insp/mfdp/rgstr")
  42. public class BisInspMfdpRgstrController extends BaseController {
  43. private Logger logger = LoggerFactory.getLogger(getClass());
  44. @Autowired
  45. private BisInspMfdpRgstrService bisInspMfdpRgstrService;
  46. @Autowired
  47. private AttAdXBaseDao attAdXBaseDao;
  48. @Autowired
  49. private OlBisInspOrgService olBisInspOrgService;
  50. @ApiOperation(value = "添加/修改山洪灾害防御督查登记表")
  51. @RequestMapping(value = "", method = RequestMethod.POST)
  52. public BaseResponse<BisInspMfdpRgstr> insert(@ApiParam(name = "bisInspMfdpRgstr", value = "BisInspMfdpRgstr", required = true) @RequestBody BisInspMfdpRgstr bisInspMfdpRgstr) {
  53. if(StringUtils.isBlank(bisInspMfdpRgstr.getId())) {
  54. throw new CheckException("缺少登记表编码!");
  55. }
  56. bisInspMfdpRgstrService.update(bisInspMfdpRgstr);
  57. return buildSuccessResponse(bisInspMfdpRgstr);
  58. }
  59. @ApiOperation(value = "根据ID删除山洪灾害防御督查登记表")
  60. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  61. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  62. int ret = bisInspMfdpRgstrService.delete(id);
  63. return buildSuccessResponse();
  64. }
  65. @ApiOperation(value = "根据ID获取山洪灾害防御督查登记表(单表)")
  66. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  67. public BaseResponse<BisInspMfdpRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  68. BisInspMfdpRgstr bisInspMfdpRgstr = bisInspMfdpRgstrService.get(id);
  69. AttAdXBase adXBase = attAdXBaseDao.getByCode(bisInspMfdpRgstr.getAdCode());
  70. if (bisInspMfdpRgstr != null && adXBase != null) {
  71. bisInspMfdpRgstr.setLgtd(String.valueOf(adXBase.getLgtd()));
  72. bisInspMfdpRgstr.setLttd(String.valueOf(adXBase.getLttd()));
  73. bisInspMfdpRgstr.setGdX(String.valueOf(adXBase.getLgtdpc()));
  74. bisInspMfdpRgstr.setGdY(String.valueOf(adXBase.getLttdpc()));
  75. bisInspMfdpRgstr.setLocation(adXBase.getAdFullName());
  76. }
  77. return buildSuccessResponse(bisInspMfdpRgstr);
  78. }
  79. @ApiOperation(value = "获取山洪灾害防御督查登记表(列表所有)")
  80. @RequestMapping(value = "/list", method = RequestMethod.POST)
  81. public BaseResponse<List<BisInspMfdpRgstr>> list(@ApiParam(name = "bisInspMfdpRgstrParam", value = "bisInspMfdpRgstrParam", required = true) @RequestBody BisInspMfdpRgstrParam bisInspMfdpRgstrParam) {
  82. List<BisInspMfdpRgstr> bisInspMfdpRgstrList = bisInspMfdpRgstrService.findList(bisInspMfdpRgstrParam);
  83. return buildSuccessResponse(bisInspMfdpRgstrList);
  84. }
  85. @ApiOperation(value = "获取山洪灾害防御督查登记表(列表--分页)")
  86. @RequestMapping(value = "/page", method = RequestMethod.POST)
  87. public BaseResponse<PageInfo<BisInspMfdpRgstr>> page(@ApiParam(name = "bisInspMfdpRgstrParam", value = "bisInspMfdpRgstrParam", required = true) @RequestBody BisInspMfdpRgstrParam bisInspMfdpRgstrParam) {
  88. PageInfo<BisInspMfdpRgstr> bisInspMfdpRgstrList = bisInspMfdpRgstrService.findPageInfo(bisInspMfdpRgstrParam);
  89. return buildSuccessResponse(bisInspMfdpRgstrList);
  90. }
  91. @ApiOperation(value = "获取督查对象")
  92. @RequestMapping(value = "/findMfdpPage", method = RequestMethod.POST)
  93. public BaseResponse<PageInfo<BisInspRgstrDto>> findMfdpPage(@RequestBody TypeParam param, HttpServletResponse response){
  94. BisInspOrg defaultOrg = olBisInspOrgService.getDefaultOrg(getCurrentOrgId());
  95. param.setProvince(AdLevelUtil.getAddvcd(defaultOrg.getRlcode()));
  96. param.setAdCode(AdLevelUtil.getAddvcd(defaultOrg.getAdCode()));
  97. if(StringUtils.isBlank(param.getTabType())){
  98. param.setTabType(CommonLabel.TAB_TYPE);
  99. }
  100. String nowTime=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  101. param.setNowTime(nowTime);
  102. PageInfo<BisInspRgstrDto> pageInfo = bisInspMfdpRgstrService.findMfdpPage(param, response);
  103. return buildSuccessResponse(pageInfo);
  104. }
  105. @ApiOperation(value = "添加行政村县下镇(乡)--村树节点,code为县code")
  106. @RequestMapping(value = "/findCheckTree/{code}/{regstrId}", method = RequestMethod.GET)
  107. public BaseResponse<List<AttCountryDto>> findCheckTree(
  108. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  109. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
  110. ){
  111. code=code.replace("00","");
  112. List<AttCountryDto> zhenDtoList=attAdXBaseDao.findXZCZhenList(code);
  113. List<AttCountryDto> countryDtoList=attAdXBaseDao.findXZCCunMfdpList(code,regstrId);
  114. for(AttCountryDto attCountryDto:zhenDtoList){
  115. String adCode=attCountryDto.getAdCode().replace("000","");
  116. List<AttCountryDto> childList=new ArrayList<>();
  117. for(AttCountryDto countryDto:countryDtoList){
  118. if(countryDto.getAdCode().startsWith(adCode)){
  119. childList.add(countryDto);
  120. }
  121. }
  122. attCountryDto.setAttCountryDtoList(childList);
  123. }
  124. return buildSuccessResponse(zhenDtoList);
  125. }
  126. @ApiOperation(value = "添加镇")
  127. @RequestMapping(value = "/findCountry/{code}/{regstrId}", method = RequestMethod.GET)
  128. public BaseResponse<List<AttCountryDto>> findCountry(
  129. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  130. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
  131. ){
  132. code=code.replace("00","");
  133. List<AttCountryDto> zhenDtoList=attAdXBaseDao.findXZCZhenMfdpList(code,regstrId);
  134. return buildSuccessResponse(zhenDtoList);
  135. }
  136. @ApiOperation(value = "添加村")
  137. @RequestMapping(value = "/findVillage/{code}/{regstrId}", method = RequestMethod.GET)
  138. public BaseResponse<List<AttCountryDto>> findVillage(
  139. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  140. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
  141. ){
  142. code=code.substring(0,9);
  143. List<AttCountryDto> zhenDtoList=attAdXBaseDao.findXZCCunMfdpList(code,regstrId);
  144. return buildSuccessResponse(zhenDtoList);
  145. }
  146. }