95da7a8f6b44dfcc328230ebff2d20777a366d76.svn-base 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package com.yihu.jkedu.action;
  2. import javax.servlet.http.HttpServletRequest;
  3. import javax.servlet.http.HttpServletResponse;
  4. import net.sf.json.JSONArray;
  5. import net.sf.json.JSONObject;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import com.yihu.base.ConfigUtil;
  9. import com.yihu.utils.ApiUtil;
  10. import com.yihu.wsgw.api.ServiceBus;
  11. @Controller
  12. @RequestMapping("/config")
  13. public class ConfigSysControl
  14. {
  15. /**
  16. * @Title: getArticleORCode
  17. * @Description: 获取二维码配置
  18. * @param @param request
  19. * @param @param response
  20. * @param @throws Exception 设定文件
  21. * @return void 返回类型
  22. * @throws
  23. */
  24. @RequestMapping(value = "/getArticleORCode")
  25. public void getArticleORCode(HttpServletRequest request,
  26. HttpServletResponse response) throws Exception {
  27. try {
  28. response.setContentType("application/json;charset=UTF-8");
  29. JSONObject params = new JSONObject();
  30. String result = ServiceBus.getInstance(
  31. null,
  32. ConfigUtil.getInstance().getAppId()).call(
  33. "JkEdu.ConfigSys.getArticleORCode", params.toString(), false);
  34. JSONObject formResultObj = JSONObject.fromObject(result);
  35. int code = formResultObj.getInt("Code");
  36. String msg = formResultObj.getString("Message");
  37. JSONObject resultJson = new JSONObject();
  38. if (code == 10000) {// 成功
  39. JSONArray arrform = formResultObj.getJSONArray("Result");
  40. resultJson.put("Code", 10000);
  41. resultJson.put("Message", msg);
  42. resultJson.put("Result", arrform);
  43. }else{
  44. resultJson.put("Code", code);
  45. resultJson.put("Message", msg);
  46. resultJson.put("Result", null);
  47. }
  48. response.getWriter().write(resultJson.toString());
  49. return;
  50. } catch (Exception e) {
  51. e.printStackTrace();
  52. response.getWriter().write(ApiUtil.jsonResult(-14444, "获取二维码配置异常").toString());
  53. return;
  54. }
  55. }
  56. /**
  57. * @Title: getSignatur
  58. * @Description:署名配置
  59. * @param @param request
  60. * @param @param response
  61. * @param @throws Exception 设定文件
  62. * @return void 返回类型
  63. * @throws
  64. */
  65. @RequestMapping(value = "/getSignatur")
  66. public void getSignatur(HttpServletRequest request,
  67. HttpServletResponse response) throws Exception {
  68. try {
  69. response.setContentType("application/json;charset=UTF-8");
  70. JSONObject params = new JSONObject();
  71. String result = ServiceBus.getInstance(
  72. null,
  73. ConfigUtil.getInstance().getAppId()).call(
  74. "JkEdu.ConfigSys.getSignatur", params.toString(), false);
  75. JSONObject formResultObj = JSONObject.fromObject(result);
  76. int code = formResultObj.getInt("Code");
  77. String msg = formResultObj.getString("Message");
  78. JSONObject resultJson = new JSONObject();
  79. if (code == 10000) {// 成功
  80. JSONArray arrform = formResultObj.getJSONArray("Result");
  81. resultJson.put("Code", 10000);
  82. resultJson.put("Message", msg);
  83. resultJson.put("Result", arrform);
  84. }else{
  85. resultJson.put("Code", code);
  86. resultJson.put("Message", msg);
  87. resultJson.put("Result", null);
  88. }
  89. response.getWriter().write(resultJson.toString());
  90. return;
  91. } catch (Exception e) {
  92. e.printStackTrace();
  93. response.getWriter().write(ApiUtil.jsonResult(-14444, "获取署名配置异常").toString());
  94. return;
  95. }
  96. }
  97. }