/**
  * 5.2 搜索问题
  *
  * @param param
  * @param request
  * @return
  */
 @ResponseBody
 @RequestMapping("/searchQuestion")
 public String searchQuestion(@RequestBody String param, HttpServletRequest request) {
   System.out.println(param);
   String backInfo = "";
   try {
     Map<String, Object> map = JsonHandler.json2Map(param);
     System.out.println(map);
     String sid = (String) map.get("sid");
     System.out.println(sid);
     String q = (String) map.get("q");
     System.out.println(q);
     if (sid.trim() == null || "".equals(sid.trim())) {
       sid = "1,10";
     }
     if (q.trim() == null || "".equals(q.trim())) {
       q = "咨询";
     }
     backInfo =
         HttpClientUtils.get(UrlUtil.URL + "/api/question/search?sid=" + sid + "&q=" + q, null);
     System.out.println(backInfo);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return backInfo;
 }
 /**
  * 5.1 获取问答列表
  *
  * @param param
  * @param request
  * @return
  */
 @ResponseBody
 @RequestMapping("/getAnswerList")
 public String getAnswerList(@RequestBody String param, HttpServletRequest request) {
   System.out.println(param);
   String backInfo = "";
   try {
     Map<String, Object> map = JsonHandler.json2Map(param);
     System.out.println(map);
     String sid = (String) map.get("sid");
     System.out.println(sid);
     String p_size = (String) map.get("p_size");
     System.out.println(p_size);
     if (sid.trim() == null || "".equals(sid.trim())) {
       sid = "1,10";
     }
     if (p_size.trim() == null || "".equals(p_size.trim())) {
       p_size = "10";
     }
     backInfo =
         HttpClientUtils.get(
             UrlUtil.URL + "/api/questions?sid=" + sid + "&p_size=" + p_size, null);
     System.out.println(backInfo);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return backInfo;
 }
 /**
  * 5.17 获取热门问题标签
  *
  * @param param
  * @param request
  * @return
  */
 @ResponseBody
 @RequestMapping("/getHotTag")
 public String getHotTag(@RequestBody String param, HttpServletRequest request) {
   System.out.println(param);
   String backInfo = "";
   try {
     Map<String, Object> map = JsonHandler.json2Map(param);
     System.out.println(map);
     String count = (String) map.get("count");
     System.out.println(count);
     if (count.trim() == null || "".equals(count.trim())) {
       count = "8";
     }
     //			Map<String,Object> mapHead = JsonHandler.json2MapHead(param);
     //			System.out.println(mapHead);
     //			String token=(String) mapHead.get("X-AUTH-TOKEN");
     //			System.out.println(token);
     //			String info = JsonHandler.objectToJson(null);
     //			System.out.println(info);
     backInfo = HttpClientUtils.get(UrlUtil.URL + "/api/question/hot-tags?count=" + count, null);
     System.out.println(backInfo);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return backInfo;
 }
 /**
  * 5.4 根据回答ID获取回答
  *
  * @param param
  * @param request
  * @return
  */
 @ResponseBody
 @RequestMapping("/getAnswerById")
 public String getAnswerById(@RequestBody String param, HttpServletRequest request) {
   System.out.println(param);
   String backInfo = "";
   try {
     Map<String, Object> map = JsonHandler.json2Map(param);
     System.out.println(map);
     String answerId = (String) map.get("answerId");
     backInfo = HttpClientUtils.get(UrlUtil.URL + "/api/answer/" + answerId, null);
     System.out.println(backInfo);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return backInfo;
 }
 /**
  * 5.20 获取问题详情及回答列表
  *
  * @param param
  * @param request
  * @return
  */
 @ResponseBody
 @RequestMapping("/getDetail")
 public String getDetail(@RequestBody String param, HttpServletRequest request) {
   System.out.println(param);
   String backInfo = "";
   try {
     Map<String, Object> map = JsonHandler.json2Map(param);
     System.out.println(map);
     String questionId = (String) map.get("questionId");
     System.out.println(questionId);
     //			Map<String,Object> mapHead = JsonHandler.json2MapHead(param);
     //			System.out.println(mapHead);
     //			String token=(String) mapHead.get("X-AUTH-TOKEN");
     //			System.out.println(token);
     //			String info = JsonHandler.objectToJson(map);
     //			System.out.println(info);
     backInfo = HttpClientUtils.get(UrlUtil.URL + "/api/qa/question/" + questionId, null);
     System.out.println(backInfo);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return backInfo;
 }