|
|
@@ -1,6 +1,7 @@
|
|
|
package com.zhiqiyun.open.router.apis;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dliyun.oap.framework.annotation.ServiceMethod;
|
|
|
import com.dliyun.oap.framework.annotation.ServiceMethodBean;
|
|
|
@@ -184,4 +185,68 @@ public class WlApi {
|
|
|
return OapResponse.fail(String.valueOf(resp.statusCode()), "HTTP ERROR - " + resp.statusCode());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private OapResponse getListOapResponse(String uri, Map<String, String> dataMap) throws Exception {
|
|
|
+ Connection.Response resp = Jsoup.connect(wlapiServerHost + uri).data(dataMap).method(Connection.Method.GET).ignoreContentType(true).ignoreHttpErrors(true).execute();
|
|
|
+ if (resp.statusCode() == 200) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(resp.body());
|
|
|
+ String code = jsonObject.getString("code");
|
|
|
+ String msg = jsonObject.getString("msg");
|
|
|
+ if (StringUtils.equals("0", code)) {
|
|
|
+ JSONArray data = jsonObject.getJSONArray("data");
|
|
|
+ return OapResponse.success().setBody(data);
|
|
|
+ } else {
|
|
|
+ return OapResponse.fail(code, msg);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return OapResponse.fail(String.valueOf(resp.statusCode()), "HTTP ERROR - " + resp.statusCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ServiceMethod(method = "wlapi.content.detail", title = "文章详情")
|
|
|
+ public OapResponse contentDetail(@RequestBody ContentRequest request) throws Exception {
|
|
|
+ Map<String, String> dataMap = new HashMap<>();
|
|
|
+ dataMap.put("id", request.getId().toString());
|
|
|
+ return this.getOapResponse("/openApi/content/detail", dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ServiceMethod(method = "wlapi.content.list.xczx", title = "文旅宣传,旅游资讯")
|
|
|
+ public OapResponse contentListWlxc(@RequestBody ContentRequest request) throws Exception {
|
|
|
+ Map<String, String> dataMap = new HashMap<>();
|
|
|
+ if(request.getType().equals(1)){//文旅宣传
|
|
|
+ dataMap.put("codes", "cultural_tourism_line,popular_attractions");
|
|
|
+ }else {//旅游资讯
|
|
|
+ dataMap.put("codes", "travel_news,industry_dynamics,notice_announcement");
|
|
|
+ }
|
|
|
+ dataMap.put("isRecommend", "1");
|
|
|
+ dataMap.put("page", request.getPage().toString());
|
|
|
+ dataMap.put("limit", request.getLimit().toString());
|
|
|
+ return this.getListOapResponse("/openApi/content/list", dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ServiceMethod(method = "wlapi.content.page.xwzx", title = "文旅路线,热门景点,旅发要闻,行业动态,通知公告")
|
|
|
+ public OapResponse contentListLyzx(@RequestBody ContentRequest request) throws Exception {
|
|
|
+ Map<String, String> dataMap = new HashMap<>();
|
|
|
+ switch (request.getType()) {
|
|
|
+ case 4://热门景点
|
|
|
+ dataMap.put("code", "popular_attractions");
|
|
|
+ break;
|
|
|
+ case 5://旅发要闻
|
|
|
+ dataMap.put("code", "travel_news");
|
|
|
+ break;
|
|
|
+ case 6://行业动态
|
|
|
+ dataMap.put("code", "industry_dynamics");
|
|
|
+ break;
|
|
|
+ case 7://通知公告
|
|
|
+ dataMap.put("code", "notice_announcement");
|
|
|
+ break;
|
|
|
+ default://文旅路线
|
|
|
+ dataMap.put("code", "cultural_tourism_line");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dataMap.put("page", request.getPage().toString());
|
|
|
+ dataMap.put("limit", request.getLimit().toString());
|
|
|
+ return this.getOapResponse("/openApi/content/page", dataMap);
|
|
|
+ }
|
|
|
}
|