ProcessController.java 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package com.yihu.hos.system.controller;
  2. import com.yihu.hos.system.service.ProcessManager;
  3. import com.yihu.hos.web.framework.model.Result;
  4. import com.yihu.hos.web.framework.util.controller.BaseController;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.ui.Model;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestMethod;
  10. /**
  11. * 流程管理
  12. * @author HZY
  13. * @vsrsion 1.0
  14. * Created at 2016/8/12.
  15. */
  16. @RequestMapping("/process")
  17. @Controller
  18. public class ProcessController extends BaseController {
  19. @Autowired
  20. private ProcessManager processManager;
  21. /**
  22. * 流程管理界面
  23. *
  24. * @param model
  25. * @return
  26. */
  27. @RequestMapping("/initial")
  28. public String processInitial(Model model) {
  29. model.addAttribute("contentPage", "system/process/process");
  30. return "partView";
  31. }
  32. @RequestMapping(value = "/getAllApp", method = RequestMethod.GET)
  33. public Result getAllApp() {
  34. try {
  35. return processManager.getAllApp();
  36. } catch (Exception e) {
  37. return Result.error("查找所有应用失败");
  38. }
  39. }
  40. @RequestMapping(value = "/getAllAppService", method = RequestMethod.GET)
  41. public Result getAllAppService() {
  42. try {
  43. return processManager.getAllAppService();
  44. } catch (Exception e) {
  45. return Result.error("查找所有服务失败");
  46. }
  47. }
  48. @RequestMapping(value = "/getAppService", method = RequestMethod.GET)
  49. public Result getAppService(String appId) {
  50. try {
  51. return processManager.getAppServiceByAppId(appId);
  52. } catch (Exception e) {
  53. return Result.error("查找服务失败");
  54. }
  55. }
  56. @RequestMapping(value = "/getAllProcessor", method = RequestMethod.GET)
  57. public Result getAllProcessor() {
  58. try {
  59. return processManager.getAllProcessor();
  60. } catch (Exception e) {
  61. return Result.error("查找所有转换器失败");
  62. }
  63. }
  64. @RequestMapping(value = "/json", method = RequestMethod.POST)
  65. public Result formatJson(String code, String name, String positionJson, String flowJson) {
  66. try {
  67. String fileName = processManager.formatJson(flowJson);
  68. processManager.saveProcess(code, name, fileName, positionJson);
  69. return Result.error("生成模板成功");
  70. } catch (Exception e) {
  71. return Result.error("生成模板失败");
  72. }
  73. }
  74. }