49ab5f84da82b03522672493bd85b446ec88903d.svn-base 8.1 KB

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