package com.yihu.jkedu.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.yihu.base.ConfigUtil; import com.yihu.utils.ApiUtil; import com.yihu.wsgw.api.ServiceBus; @Controller @RequestMapping("/config") public class ConfigSysControl { /** * @Title: getArticleORCode * @Description: 获取二维码配置 * @param @param request * @param @param response * @param @throws Exception 设定文件 * @return void 返回类型 * @throws */ @RequestMapping(value = "/getArticleORCode") public void getArticleORCode(HttpServletRequest request, HttpServletResponse response) throws Exception { try { response.setContentType("application/json;charset=UTF-8"); JSONObject params = new JSONObject(); String result = ServiceBus.getInstance( null, ConfigUtil.getInstance().getAppId()).call( "JkEdu.ConfigSys.getArticleORCode", params.toString(), false); JSONObject formResultObj = JSONObject.fromObject(result); int code = formResultObj.getInt("Code"); String msg = formResultObj.getString("Message"); JSONObject resultJson = new JSONObject(); if (code == 10000) {// 成功 JSONArray arrform = formResultObj.getJSONArray("Result"); resultJson.put("Code", 10000); resultJson.put("Message", msg); resultJson.put("Result", arrform); }else{ resultJson.put("Code", code); resultJson.put("Message", msg); resultJson.put("Result", null); } response.getWriter().write(resultJson.toString()); return; } catch (Exception e) { e.printStackTrace(); response.getWriter().write(ApiUtil.jsonResult(-14444, "获取二维码配置异常").toString()); return; } } /** * @Title: getSignatur * @Description:署名配置 * @param @param request * @param @param response * @param @throws Exception 设定文件 * @return void 返回类型 * @throws */ @RequestMapping(value = "/getSignatur") public void getSignatur(HttpServletRequest request, HttpServletResponse response) throws Exception { try { response.setContentType("application/json;charset=UTF-8"); JSONObject params = new JSONObject(); String result = ServiceBus.getInstance( null, ConfigUtil.getInstance().getAppId()).call( "JkEdu.ConfigSys.getSignatur", params.toString(), false); JSONObject formResultObj = JSONObject.fromObject(result); int code = formResultObj.getInt("Code"); String msg = formResultObj.getString("Message"); JSONObject resultJson = new JSONObject(); if (code == 10000) {// 成功 JSONArray arrform = formResultObj.getJSONArray("Result"); resultJson.put("Code", 10000); resultJson.put("Message", msg); resultJson.put("Result", arrform); }else{ resultJson.put("Code", code); resultJson.put("Message", msg); resultJson.put("Result", null); } response.getWriter().write(resultJson.toString()); return; } catch (Exception e) { e.printStackTrace(); response.getWriter().write(ApiUtil.jsonResult(-14444, "获取署名配置异常").toString()); return; } } }