1167bf957d6cb3e04e0432d049d09c7a06be3903.svn-base 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. package cn.com.goldenwater.dcproj.controller.rdwsp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.dao.AttAdXBaseDao;
  6. import cn.com.goldenwater.dcproj.dto.AttCountryDto;
  7. import cn.com.goldenwater.dcproj.dto.BisNewDcuserRelVillDto;
  8. import cn.com.goldenwater.dcproj.model.*;
  9. import cn.com.goldenwater.dcproj.param.*;
  10. import cn.com.goldenwater.dcproj.service.*;
  11. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  12. import cn.com.goldenwater.id.util.UuidUtil;
  13. import com.github.pagehelper.PageInfo;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import io.swagger.annotations.ApiParam;
  17. import org.apache.commons.lang3.StringUtils;
  18. import org.slf4j.Logger;
  19. import org.slf4j.LoggerFactory;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.web.bind.annotation.*;
  22. import java.util.ArrayList;
  23. import java.util.HashMap;
  24. import java.util.List;
  25. import java.util.Map;
  26. /**
  27. * @author lune
  28. * @date 2020-10-9
  29. */
  30. @Api(value = "BIS 农村饮水安全回头看登记表管理",tags="BIS 农村饮水安全回头看登记表管理")
  31. @RestController
  32. @RequestMapping("/bis/rdwsp/rgstr")
  33. public class BisRdwspRgstrController extends BaseController {
  34. private Logger logger = LoggerFactory.getLogger(getClass());
  35. @Autowired
  36. private BisRdwspRgstrService bisRdwspRgstrService;
  37. @Autowired
  38. private OlBisInspOrgService olBisInspOrgService;
  39. @Autowired
  40. private BisInspRssfdrRgstrService bisInspRssfdrRgstrService;
  41. @Autowired
  42. private BisBisRdwspRgstrFeeService bisBisRdwspRgstrFeeService;
  43. @Autowired
  44. private BisRdwspRgstrPoorService bisRdwspRgstrPoorService;
  45. @Autowired
  46. private AttAdXBaseDao attAdXBaseDao;
  47. @ApiOperation(value = "添加/修改农村饮水安全回头看登记表")
  48. @RequestMapping(value = "", method = RequestMethod.POST)
  49. public BaseResponse<BisRdwspRgstr> insert(@ApiParam(name = "bisRdwspRgstr", value = "BisRdwspRgstr", required = true) @RequestBody BisRdwspRgstr bisRdwspRgstr) {
  50. if(StringUtils.isBlank(bisRdwspRgstr.getId())) {
  51. // 生成uuid
  52. String uuid = UuidUtil.uuid();
  53. bisRdwspRgstr.setId(uuid);
  54. bisRdwspRgstrService.insert(bisRdwspRgstr);
  55. }else{
  56. bisRdwspRgstrService.update(bisRdwspRgstr);
  57. }
  58. return buildSuccessResponse(bisRdwspRgstr);
  59. }
  60. @ApiOperation(value = "根据ID删除农村饮水安全回头看登记表")
  61. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  62. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  63. int ret = bisRdwspRgstrService.delete(id);
  64. return buildSuccessResponse();
  65. }
  66. @ApiOperation(value = "根据ID获取农村饮水安全回头看登记表(单表)")
  67. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  68. public BaseResponse<BisRdwspRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  69. BisRdwspRgstr bisRdwspRgstr = bisRdwspRgstrService.get(id);
  70. return buildSuccessResponse(bisRdwspRgstr);
  71. }
  72. @ApiOperation(value = "获取农村饮水安全回头看登记表(列表所有)")
  73. @RequestMapping(value = "/list", method = RequestMethod.POST)
  74. public BaseResponse<List<BisRdwspRgstr>> list(@ApiParam(name = "bisRdwspRgstrParam", value = "bisRdwspRgstrParam", required = true) @RequestBody BisRdwspRgstrParam bisRdwspRgstrParam) {
  75. List<BisRdwspRgstr> bisRdwspRgstrList = bisRdwspRgstrService.findList(bisRdwspRgstrParam);
  76. return buildSuccessResponse(bisRdwspRgstrList);
  77. }
  78. @ApiOperation(value = "获取农村饮水安全回头看登记表(列表--分页)")
  79. @RequestMapping(value = "/page", method = RequestMethod.POST)
  80. public BaseResponse<PageInfo<BisRdwspRgstr>> page(@ApiParam(name = "bisRdwspRgstrParam", value = "bisRdwspRgstrParam", required = true) @RequestBody BisRdwspRgstrParam bisRdwspRgstrParam) {
  81. PageInfo<BisRdwspRgstr> bisRdwspRgstrList = bisRdwspRgstrService.findPageInfo(bisRdwspRgstrParam);
  82. return buildSuccessResponse(bisRdwspRgstrList);
  83. }
  84. @ApiOperation(value = "获取督查登记表列表")
  85. @RequestMapping(value = "/findRdwspPage", method = RequestMethod.POST)
  86. public BaseResponse<PageInfo<BisInspWrmRgstr>> findRdwspPage(@RequestBody TypeParam param) {
  87. param.setProvince(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  88. String adPr = AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()));
  89. if (StringUtils.isBlank(param.getAdCode())) {
  90. param.setAdCode(adPr);
  91. }
  92. PageInfo<BisInspWrmRgstr> bisInspWrmRgstrList = bisRdwspRgstrService.findRdwspPage(param);
  93. return buildSuccessResponse(bisInspWrmRgstrList);
  94. }
  95. @ApiOperation(value = "获取督查中县-镇(乡)--村树节点")
  96. @RequestMapping(value = "/findTree/{code}/{regstrId}", method = RequestMethod.GET)
  97. public BaseResponse<List<BisNewDcuserRelVillDto>> findTree(
  98. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  99. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  100. //获取镇,乡
  101. if(code.length()==12){
  102. code=code.substring(0, 6);
  103. }
  104. List<BisNewDcuserRelVillDto> attAdXBaseList= bisInspRssfdrRgstrService.findZhenListByType(code,regstrId, BisInspEnum.RDWSP.getValue());
  105. return buildSuccessResponse(attAdXBaseList);
  106. }
  107. @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表")
  108. @RequestMapping(value = "/findNode/{code}/{regstrId}", method = RequestMethod.GET)
  109. public BaseResponse<Object> findNode(
  110. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  111. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  112. //获取镇,乡
  113. Map<String,Object> map=new HashMap<>();
  114. BisBisRdwspRgstrFeeParam feeParam=new BisBisRdwspRgstrFeeParam();
  115. feeParam.setRegstrId(regstrId);
  116. if(code.length()==12 && code.endsWith("000")){
  117. code=code.replace("000","");
  118. }
  119. feeParam.setAdCode(code);
  120. List<BisBisRdwspRgstrFee> wateruserInfos=bisBisRdwspRgstrFeeService.findList(feeParam);
  121. BisRdwspRgstrPoorParam poorParam=new BisRdwspRgstrPoorParam();
  122. poorParam.setAdCode(code);
  123. poorParam.setRegstrId(regstrId);
  124. List<BisRdwspRgstrPoor> countryFeeList=bisRdwspRgstrPoorService.findList(poorParam);
  125. map.put("waterUsers",countryFeeList);
  126. map.put("countryPro",wateruserInfos);
  127. return buildSuccessResponse(map);
  128. }
  129. @ApiOperation(value = "添加行政村县下镇(乡)--村树节点,code为县code")
  130. @RequestMapping(value = "/findCheckTree/{code}/{regstrId}", method = RequestMethod.GET)
  131. public BaseResponse<List<AttCountryDto>> findCheckTree(
  132. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  133. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
  134. ){
  135. code=code.substring(0, 6);
  136. List<AttCountryDto> zhenDtoList=attAdXBaseDao.findXZCZhenList(code);
  137. List<AttCountryDto> countryDtoList=attAdXBaseDao.findXZCCunListByType(code,regstrId, BisInspEnum.RDWSP.getValue());
  138. for(AttCountryDto attCountryDto:zhenDtoList){
  139. String adCode=attCountryDto.getAdCode().replace("000","");
  140. List<AttCountryDto> childList=new ArrayList<>();
  141. for(AttCountryDto countryDto:countryDtoList){
  142. if(countryDto.getAdCode().startsWith(adCode)){
  143. childList.add(countryDto);
  144. }
  145. }
  146. attCountryDto.setAttCountryDtoList(childList);
  147. }
  148. return buildSuccessResponse(zhenDtoList);
  149. }
  150. @ApiOperation(value = "问题栏目:问题列表根据当前登录用户id获取需要督查问题列表")
  151. @RequestMapping(value = "/list/{persId}", method = RequestMethod.POST)
  152. public BaseResponse<PageInfo<BisInspPblm>> list(@ApiParam(name = "persId", value = "persId", required = true) @PathVariable String persId
  153. , @RequestBody(required = false) PlbmParam pblmParam) {
  154. pblmParam.setPresId(persId);
  155. PageInfo<BisInspPblm> inspPblmList = bisBisRdwspRgstrFeeService.findPageList(pblmParam);
  156. return buildSuccessResponse(inspPblmList);
  157. }
  158. }