bffcc00908b00c97f79dd10a4dab8cde982c29ad.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. package cn.com.goldenwater.dcproj.controller.mend;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.controller.mend.bpm.RespDTO;
  5. import cn.com.goldenwater.dcproj.model.BisInspPblmPlist;
  6. import cn.com.goldenwater.dcproj.model.BisInspPblmPlistFormDTO;
  7. import cn.com.goldenwater.dcproj.param.BisInspPblmPlistParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspPblmPlistFormService;
  9. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  10. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.hateoas.Link;
  18. import org.springframework.hateoas.mvc.ControllerLinkBuilder;
  19. import org.springframework.web.bind.annotation.*;
  20. import java.util.HashMap;
  21. import java.util.List;
  22. import java.util.Map;
  23. import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
  24. /**
  25. * @author lhc
  26. * @date 2020-11-4
  27. */
  28. @Api(value = "督查问题整改", tags = "督查问题整改")
  29. @RestController
  30. @RequestMapping("/bis/insp/pblm/plist/form")
  31. public class BisInspPblmlistFormController extends BaseController {
  32. private Logger logger = LoggerFactory.getLogger(getClass());
  33. @Autowired
  34. private BisInspPblmPlistFormService formService;
  35. @Autowired
  36. private OlBisInspOrgService olBisInspOrgService;
  37. @ApiOperation(value = "发起-问题整改-一键下发")
  38. @RequestMapping(value = "/allStartup", method = RequestMethod.POST)
  39. public BaseResponse allStartup(@ApiParam(name = "bisInspPblmPlistParam", value = "BisInspPblmPlistParam", required = true) @RequestBody BisInspPblmPlistParam bisInspPblmPlistParam) {
  40. String orgId = getCurrentOrgId();
  41. String province = olBisInspOrgService.getProvince(orgId);
  42. bisInspPblmPlistParam.setProvince(AdLevelUtil.getAddvcd(province));
  43. bisInspPblmPlistParam.setOrgId(orgId);
  44. bisInspPblmPlistParam.setPersId(getCurrentPersId());
  45. Map<String, String> params = new HashMap<>(3);
  46. params.put("orgId", orgId);
  47. params.put("province", province);
  48. params.put("persId", getCurrentPersId());
  49. formService.allStartup(bisInspPblmPlistParam, params);
  50. return buildSuccessResponse();
  51. }
  52. @ApiOperation(value = "发起-问题整改-审批")
  53. @RequestMapping(value = "/", method = RequestMethod.POST)
  54. public BaseResponse startup(@ApiParam(name = "bisInspPblmPlist", value = "BisInspPblmPlist", required = true) @RequestBody List<BisInspPblmPlistFormDTO> dtos) {
  55. String province = olBisInspOrgService.getProvince(getCurrentOrgId());
  56. for (int i = 0; i < dtos.size(); i++) {
  57. formService.saveFormsAndStartFlow(dtos.get(i), getCurrentPersId(), getCurrentOrgId(), province);
  58. }
  59. return buildSuccessResponse();
  60. }
  61. /**
  62. * 提交/下发
  63. */
  64. @ApiOperation(value = "提交")
  65. @PostMapping("/submit")
  66. public BaseResponse submit(@RequestBody BisInspPblmPlistFormDTO dto) {
  67. logger.info("=============================================提交=====================================================");
  68. return formService.submitForm(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  69. }
  70. /**
  71. * 反馈
  72. */
  73. @ApiOperation(value = "反馈")
  74. @PostMapping("/feedback")
  75. public BaseResponse feedback(@RequestBody BisInspPblmPlistFormDTO dto) {
  76. logger.info("=============================================反馈=====================================================");
  77. return formService.feedbackForm(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  78. }
  79. /**
  80. * 退回
  81. */
  82. @ApiOperation(value = "退回")
  83. @PostMapping("/backward")
  84. public BaseResponse backward(@RequestBody BisInspPblmPlistFormDTO dto) {
  85. logger.info("=============================================退回=====================================================");
  86. return formService.backwardForm(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  87. }
  88. /**
  89. * 完成
  90. */
  91. @ApiOperation(value = "完成")
  92. @PostMapping("/complete")
  93. public BaseResponse complete(@RequestBody BisInspPblmPlistFormDTO dto) {
  94. return formService.complete(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  95. }
  96. /**
  97. * 下发
  98. */
  99. @ApiOperation(value = "下发到县 根据网关要跳转到县反馈")
  100. @PostMapping("/sendCounty")
  101. public BaseResponse sendCounty(@RequestBody BisInspPblmPlistFormDTO dto) {
  102. logger.info("=============================================根据网关要跳转到县反馈=====================================================");
  103. return formService.sendCountyForm(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  104. }
  105. /**
  106. * 转省本级反馈
  107. */
  108. @ApiOperation(value = "转省本级反馈")
  109. @PostMapping("/sendProvince")
  110. public BaseResponse sendProvince(@RequestBody BisInspPblmPlistFormDTO dto) {
  111. logger.info("=============================================转省本级反馈=====================================================");
  112. return formService.sendProvinceForm(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  113. }
  114. /**
  115. * 市转本级反馈
  116. */
  117. @ApiOperation(value = "下发 市转本级反馈")
  118. @PostMapping("/feedbackCity")
  119. public BaseResponse feedbackCity(@RequestBody BisInspPblmPlistFormDTO dto) {
  120. return formService.feedbackCityForm(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  121. }
  122. /**
  123. * 暂存反馈
  124. */
  125. @ApiOperation(value = "暂存反馈")
  126. @PostMapping("/holdSave")
  127. public BaseResponse holdSave(@RequestBody BisInspPblmPlistFormDTO dto) {
  128. return formService.holdSave(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  129. }
  130. /**
  131. * 流程表单-详情明细
  132. */
  133. @ApiOperation(value = "流程表单-详情明细")
  134. @GetMapping("/{applyFormId}")
  135. public BaseResponse<RespDTO<BisInspPblmPlist>> getDetail(@PathVariable(value = "applyFormId") String applyFormId) {
  136. RespDTO<BisInspPblmPlist> result = new RespDTO<>();
  137. result.setContent(formService.getProblemListInfo(applyFormId));
  138. return buildSuccessResponse(buildLinks(result));
  139. }
  140. /**
  141. * 转 水利工程建设处 审核 山东
  142. */
  143. @ApiOperation(value = "转 水利工程建设处 审核 山东")
  144. @PostMapping("/sendBuild")
  145. public BaseResponse sendBuild(@RequestBody BisInspPblmPlistFormDTO dto) {
  146. return formService.sendBuild(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  147. }
  148. /**
  149. * 转 运行管理处 审核 山东
  150. */
  151. @ApiOperation(value = "转 运行管理处 审核 山东")
  152. @PostMapping("/sendRunMgr")
  153. public BaseResponse sendRunMgr(@RequestBody BisInspPblmPlistFormDTO dto) {
  154. return formService.sendRunMgr(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  155. }
  156. /**
  157. * 转 水旱灾害防御处 审核 山东
  158. */
  159. @ApiOperation(value = "转 水旱灾害防御处 审核 山东")
  160. @PostMapping("/sendFloods")
  161. public BaseResponse sendFloods(@RequestBody BisInspPblmPlistFormDTO dto) {
  162. return formService.sendFloods(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  163. }
  164. /**
  165. * 转 农村水利处 审核 山东
  166. */
  167. @ApiOperation(value = "转 农村水利处 审核 山东")
  168. @PostMapping("/sendWater")
  169. public BaseResponse sendWater(@RequestBody BisInspPblmPlistFormDTO dto) {
  170. return formService.sendWater(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  171. }
  172. /**
  173. * 转 监督处 审核 山东
  174. */
  175. @ApiOperation(value = "转 监督处 审核 山东")
  176. @PostMapping("/sendSupervise")
  177. public BaseResponse sendSupervise(@RequestBody BisInspPblmPlistFormDTO dto) {
  178. return formService.sendSupervise(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  179. }
  180. /**
  181. * 转 南水北调工程管理处 审核 山东
  182. */
  183. @ApiOperation(value = "转 河湖管理处 审核 山东")
  184. @PostMapping("/sendSouth")
  185. public BaseResponse sendSouth(@RequestBody BisInspPblmPlistFormDTO dto) {
  186. return formService.sendSouth(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  187. }
  188. /**
  189. * 转 河湖管理处 审核 山东
  190. */
  191. @ApiOperation(value = "转 河湖管理处 审核 山东")
  192. @PostMapping("/sendLakes")
  193. public BaseResponse sendLakes(@RequestBody BisInspPblmPlistFormDTO dto) {
  194. return formService.sendLakes(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  195. }
  196. /**
  197. * 转 行政许可处 审核 山东
  198. */
  199. @ApiOperation(value = "转 河湖管理处 审核 山东")
  200. @PostMapping("/sendPermissions")
  201. public BaseResponse sendPermissions(@RequestBody BisInspPblmPlistFormDTO dto) {
  202. return formService.sendPermissions(dto, getCurrentPersId(), getCurrentOrgId()) ? buildSuccessResponse() : buildFailResponse();
  203. }
  204. /**
  205. * _links
  206. */
  207. private RespDTO<BisInspPblmPlist> buildLinks(RespDTO<BisInspPblmPlist> result) {
  208. Link submitLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).submit(null)).withRel("submit");
  209. Link feedbackLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).feedback(null)).withRel("feedback");
  210. Link backwardLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).backward(null)).withRel("backward");
  211. Link sendCountyLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendCounty(null)).withRel("sendCounty");
  212. Link feedbackCityLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).feedbackCity(null)).withRel("feedbackCity");
  213. Link completeLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).complete(null)).withRel("complete");
  214. Link sendProvinceLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendProvince(null)).withRel("sendProvince");
  215. Link holdSaveLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).holdSave(null)).withRel("holdSave");
  216. //山东构建发送不同业务处室
  217. Link sendBuildLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendBuild(null)).withRel("sendBuild");
  218. Link sendRunMgrLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendRunMgr(null)).withRel("sendRunMgr");
  219. Link sendFloodsLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendFloods(null)).withRel("sendFloods");
  220. Link sendWaterLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendWater(null)).withRel("sendWater");
  221. Link sendSuperviseLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendSupervise(null)).withRel("sendSupervise");
  222. Link sendSouthLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendSouth(null)).withRel("sendSouth");
  223. Link sendLakesLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendLakes(null)).withRel("sendLakes");
  224. Link sendPermissionsLink = linkTo(ControllerLinkBuilder.methodOn(BisInspPblmlistFormController.class).sendPermissions(null)).withRel("sendPermissions");
  225. Map<String, String> linkMap = new HashMap<>();
  226. linkMap.put("submit", submitLink.getHref().substring(submitLink.getHref().indexOf("/bis/")));
  227. linkMap.put("feedback", feedbackLink.getHref().substring(feedbackLink.getHref().indexOf("/bis/")));
  228. linkMap.put("backward", backwardLink.getHref().substring(backwardLink.getHref().indexOf("/bis/")));
  229. linkMap.put("sendCounty", sendCountyLink.getHref().substring(sendCountyLink.getHref().indexOf("/bis/")));
  230. linkMap.put("feedbackCity", feedbackCityLink.getHref().substring(feedbackCityLink.getHref().indexOf("/bis/")));
  231. linkMap.put("complete", completeLink.getHref().substring(completeLink.getHref().indexOf("/bis/")));
  232. linkMap.put("sendProvince", sendProvinceLink.getHref().substring(sendProvinceLink.getHref().indexOf("/bis/")));
  233. linkMap.put("holdSave", holdSaveLink.getHref().substring(holdSaveLink.getHref().indexOf("/bis/")));
  234. linkMap.put("sendBuild", sendBuildLink.getHref().substring(sendBuildLink.getHref().indexOf("/bis/")));
  235. linkMap.put("sendRunMgr", sendRunMgrLink.getHref().substring(sendRunMgrLink.getHref().indexOf("/bis/")));
  236. linkMap.put("sendFloods", sendFloodsLink.getHref().substring(sendFloodsLink.getHref().indexOf("/bis/")));
  237. linkMap.put("sendWater", sendWaterLink.getHref().substring(sendWaterLink.getHref().indexOf("/bis/")));
  238. linkMap.put("sendSupervise", sendSuperviseLink.getHref().substring(sendSuperviseLink.getHref().indexOf("/bis/")));
  239. linkMap.put("sendSouth", sendSouthLink.getHref().substring(sendSouthLink.getHref().indexOf("/bis/")));
  240. linkMap.put("sendLakes", sendLakesLink.getHref().substring(sendLakesLink.getHref().indexOf("/bis/")));
  241. linkMap.put("sendPermissions", sendPermissionsLink.getHref().substring(sendPermissionsLink.getHref().indexOf("/bis/")));
  242. result.set_links(linkMap);
  243. return result;
  244. }
  245. }