41e53d08709f793c9a91d1f3255aba45c698f479.svn-base 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. package cn.com.goldenwater.dcproj.controller.rsvryn;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  5. import cn.com.goldenwater.dcproj.dao.BisInspOrgDao;
  6. import cn.com.goldenwater.dcproj.model.BisInspOrg;
  7. import cn.com.goldenwater.dcproj.model.BisInspRsvrynPblmMend;
  8. import cn.com.goldenwater.dcproj.model.GwComFile;
  9. import cn.com.goldenwater.dcproj.param.BisInspRsvrynPblmMendParam;
  10. import cn.com.goldenwater.dcproj.param.GwComFileParam;
  11. import cn.com.goldenwater.dcproj.service.BisInspRsvrynPblmMendService;
  12. import cn.com.goldenwater.dcproj.service.GwComFileService;
  13. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  14. import cn.com.goldenwater.dcproj.utils.HttpClientUtils;
  15. import cn.com.goldenwater.id.util.UuidUtil;
  16. import com.github.pagehelper.PageInfo;
  17. import io.swagger.annotations.Api;
  18. import io.swagger.annotations.ApiOperation;
  19. import io.swagger.annotations.ApiParam;
  20. import org.apache.commons.lang3.StringUtils;
  21. import org.slf4j.Logger;
  22. import org.slf4j.LoggerFactory;
  23. import org.springframework.beans.factory.annotation.Autowired;
  24. import org.springframework.beans.factory.annotation.Value;
  25. import org.springframework.web.bind.annotation.*;
  26. import javax.servlet.http.HttpServletResponse;
  27. import java.util.Date;
  28. import java.util.HashMap;
  29. import java.util.List;
  30. import java.util.Map;
  31. /**
  32. * @author lune
  33. * @date 2020-7-7
  34. */
  35. @Api(value = "BIS 小水库问题清单整改情况管理", tags = "BIS 小水库问题清单整改情况管理")
  36. @RestController
  37. @RequestMapping("/bis/insp/rsvryn/pblm/mend")
  38. public class BisInspRsvrynPblmMendController extends BaseController {
  39. private Logger logger = LoggerFactory.getLogger(getClass());
  40. @Autowired
  41. private BisInspRsvrynPblmMendService bisInspRsvrynPblmMendService;
  42. @Autowired
  43. private BisInspOrgDao bisInspOrgDao;
  44. @Value("${mwr.ducha.url}")
  45. private String quanguoUrl;
  46. @Autowired
  47. private GwComFileService gwComFileService;
  48. @ApiOperation(value = "添加/修改小水库问题清单整改情况")
  49. @RequestMapping(value = "", method = RequestMethod.POST)
  50. public BaseResponse<BisInspRsvrynPblmMend> insert(@ApiParam(name = "bisInspRsvrynPblmMend", value = "BisInspRsvrynPblmMend", required = true) @RequestBody List<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList) {
  51. for (BisInspRsvrynPblmMend bisInspRsvrynPblmMend : bisInspRsvrynPblmMendList) {
  52. bisInspRsvrynPblmMendService.update(bisInspRsvrynPblmMend);
  53. }
  54. return buildSuccessResponse();
  55. }
  56. @ApiOperation(value = "修改小水库问题清单整改情况")
  57. @RequestMapping(value = "/2021/update", method = RequestMethod.POST)
  58. public BaseResponse<BisInspRsvrynPblmMend> update2021(@ApiParam(name = "bisInspRsvrynPblmMend", value = "BisInspRsvrynPblmMend", required = true) @RequestBody BisInspRsvrynPblmMend bisInspRsvrynPblmMend) {
  59. if (StringUtils.isBlank(bisInspRsvrynPblmMend.getId())) {
  60. String uuid = UuidUtil.uuid(); // 生成uuid
  61. bisInspRsvrynPblmMend.setId(uuid);
  62. bisInspRsvrynPblmMend.setIntm(new Date());
  63. bisInspRsvrynPblmMendService.insert2021(bisInspRsvrynPblmMend);
  64. } else {
  65. bisInspRsvrynPblmMend.setUptm(new Date());
  66. int a = bisInspRsvrynPblmMendService.update2021(bisInspRsvrynPblmMend);
  67. }
  68. return buildSuccessResponse(bisInspRsvrynPblmMend);
  69. }
  70. @ApiOperation(value = "根据ID删除小水库问题清单整改情况")
  71. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  72. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  73. int ret = bisInspRsvrynPblmMendService.delete(id);
  74. return buildSuccessResponse();
  75. }
  76. @ApiOperation(value = "根据ID获取小水库问题清单整改情况(单表)")
  77. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  78. public BaseResponse<BisInspRsvrynPblmMend> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  79. BisInspRsvrynPblmMend bisInspRsvrynPblmMend = bisInspRsvrynPblmMendService.get(id);
  80. return buildSuccessResponse(bisInspRsvrynPblmMend);
  81. }
  82. @ApiOperation(value = "根据ID获取小水库问题清单整改情况(单表)及附件")
  83. @RequestMapping(value = "/getWithExtras", method = RequestMethod.POST)
  84. public BaseResponse<BisInspRsvrynPblmMend> getWithExtras(@ApiParam(name = "param", value = "param", required = true) @RequestBody GwComFileParam param) {
  85. BisInspRsvrynPblmMend bisInspRsvrynPblmMend = bisInspRsvrynPblmMendService.get(param.getId());
  86. if (bisInspRsvrynPblmMend != null){
  87. param.setId("");
  88. List<GwComFile> list = gwComFileService.findList(param);
  89. bisInspRsvrynPblmMend.setGwComFiles(list);
  90. }
  91. return buildSuccessResponse(bisInspRsvrynPblmMend);
  92. }
  93. @ApiOperation(value = "获取小水库问题清单整改情况(列表--分页)")
  94. @RequestMapping(value = "/page", method = RequestMethod.POST)
  95. public BaseResponse<PageInfo<BisInspRsvrynPblmMend>> page(@ApiParam(name = "bisInspRsvrynPblmMendParam", value = "bisInspRsvrynPblmMendParam", required = true) @RequestBody BisInspRsvrynPblmMendParam bisInspRsvrynPblmMendParam, HttpServletResponse response) {
  96. //bisInspRsvrynPblmMendParam.setPersGuid(getCurrentPersId());
  97. bisInspRsvrynPblmMendParam.setOrgId(getCurrentOrgId());
  98. BisInspOrg org = bisInspOrgDao.get(bisInspRsvrynPblmMendParam.getOrgId());
  99. if (StringUtils.isNotBlank(org.getRlcode())) {
  100. bisInspRsvrynPblmMendParam.setRelCode(AdLevelUtil.SubAd(org.getRlcode()).get(SplitValue.SUBAD).toString());
  101. }
  102. PageInfo<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList = bisInspRsvrynPblmMendService.findRsvrPblmPage(bisInspRsvrynPblmMendParam);
  103. return buildSuccessResponse(bisInspRsvrynPblmMendList);
  104. }
  105. @ApiOperation(value = "获取小水库问题清单整改情况(列表所有)")
  106. @RequestMapping(value = "/list", method = RequestMethod.POST)
  107. public BaseResponse<List<BisInspRsvrynPblmMend>> list(@ApiParam(name = "bisInspRsvrynPblmMendParam", value = "bisInspRsvrynPblmMendParam", required = true) @RequestBody BisInspRsvrynPblmMendParam bisInspRsvrynPblmMendParam) {
  108. List<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList = bisInspRsvrynPblmMendService.findList(bisInspRsvrynPblmMendParam);
  109. return buildSuccessResponse(bisInspRsvrynPblmMendList);
  110. }
  111. @ApiOperation(value = "Pc获取小水库问题清单整改情况(列表--分页)")
  112. @RequestMapping(value = "/pagePc", method = RequestMethod.POST)
  113. public BaseResponse<PageInfo<BisInspRsvrynPblmMend>> pagePc(@ApiParam(name = "bisInspRsvrynPblmMendParam", value = "bisInspRsvrynPblmMendParam", required = true) @RequestBody BisInspRsvrynPblmMendParam bisInspRsvrynPblmMendParam, HttpServletResponse response) {
  114. PageInfo<BisInspRsvrynPblmMend> pc = bisInspRsvrynPblmMendService.pagerPc(bisInspRsvrynPblmMendParam);
  115. return buildSuccessResponse(pc);
  116. }
  117. @ApiOperation(value = "单条或批量反馈水利部")
  118. @RequestMapping(value = "/updateMwr", method = RequestMethod.POST)
  119. public BaseResponse<BisInspRsvrynPblmMend> updateMwr(@ApiParam(name = "bisInspRsvrynPblmMend", value = "BisInspRsvrynPblmMend", required = true) @RequestBody List<BisInspRsvrynPblmMend> bisInspRsvrynPblmMendList) {
  120. for (BisInspRsvrynPblmMend bisInspRsvrynPblmMend : bisInspRsvrynPblmMendList) {
  121. String url = quanguoUrl + "/bis/insp/rsvr/pblm/mend";
  122. Map<String, String> map = new HashMap<>();
  123. map.put("id", bisInspRsvrynPblmMend.getId());
  124. map.put("rectConc", bisInspRsvrynPblmMend.getRectConc());
  125. map.put("rectMsrs", bisInspRsvrynPblmMend.getRectMsrs());
  126. try {
  127. HttpClientUtils.doHttpsPost2(url, map, new HashMap());
  128. bisInspRsvrynPblmMend.setIsRect("2");
  129. } catch (Exception e) {
  130. logger.error("部里整改状态修改失败!:{}", e.getMessage());
  131. bisInspRsvrynPblmMend.setIsRect("3");//反馈失败
  132. } finally {
  133. bisInspRsvrynPblmMendService.update(bisInspRsvrynPblmMend);
  134. }
  135. }
  136. return buildSuccessResponse();
  137. }
  138. }