gongfuzhu 10 months ago
parent
commit
deaae1a111

+ 25 - 67
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/api/ypp/KfcApi.java

@@ -7,6 +7,8 @@ import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONConfig;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.github.microservice.auth.security.helper.AuthHelper;
+import com.github.microservice.auth.security.model.AuthDetails;
 import com.zswl.cloud.springBatch.client.model.ypp.kfc.request.OrderListRequest;
 import com.zswl.cloud.springBatch.client.model.ypp.kfc.request.CreateOrdereRquest;
 import com.zswl.cloud.springBatch.client.model.ypp.kfc.response.*;
@@ -25,6 +27,8 @@ import java.util.HashMap;
 @Component
 public class KfcApi {
 
+    @Autowired
+    TokenApi tokenApi;
     @Autowired
     RedisHelper redisHelper;
 
@@ -32,9 +36,9 @@ public class KfcApi {
     @Autowired
     private ApiLogDao apiLogDao;
 
+
     @Value("${ypp.entId}")
     private String entId;
-
     @Value("${ypp.appSecret}")
     private String appSecret;
 
@@ -42,10 +46,8 @@ public class KfcApi {
     private String appId;
     @Value("${ypp.test}")
     private Boolean test;
-
-
-    private final String tokenName = "ypp-token";
-    private final String tokenValue = "Bearer ";
+    @Autowired
+    private AuthHelper authHelper;
 
 
     /**
@@ -55,7 +57,7 @@ public class KfcApi {
      * @return
      */
     public OrderFileResponse order_files(String orderId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/kfc/order_files?id=" + orderId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/kfc/order_files?id=" + orderId);
 
         OrderFileResponse bean = JSONUtil.toBean(entries, OrderFileResponse.class);
         return bean;
@@ -70,7 +72,7 @@ public class KfcApi {
      */
 
     public OrderDetailResponse order_detail(String orderId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/kfc/order_detail?id=" + orderId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/kfc/order_detail?id=" + orderId);
 
         OrderDetailResponse bean = JSONUtil.toBean(entries, OrderDetailResponse.class);
         return bean;
@@ -83,7 +85,7 @@ public class KfcApi {
      * @return
      */
     public CityListResponse cityList() {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/city/list");
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/city/list");
 
         CityListResponse bean = JSONUtil.toBean(entries, CityListResponse.class);
         return bean;
@@ -97,7 +99,7 @@ public class KfcApi {
      * @return
      */
     public JSONObject pay_order(String orderId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/kfc/pay_order?id=" + orderId + "&test=" + test);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/kfc/pay_order?id=" + orderId + "&test=" + test);
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -112,7 +114,7 @@ public class KfcApi {
      */
     public CreateOrdereResponse create_order(CreateOrdereRquest createOrdereRquest) {
         createOrdereRquest.setAppId(appId);
-        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/kfc/create_order", createOrdereRquest);
+        JSONObject entries = tokenApi.httpPost("https://channel.youpiaopiao.cn/api/kfc/create_order", createOrdereRquest);
         CreateOrdereResponse bean = JSONUtil.toBean(entries, CreateOrdereResponse.class);
         return bean;
 
@@ -126,7 +128,7 @@ public class KfcApi {
      * @return
      */
     public JSONObject order_list(OrderListRequest orderListRequest) {
-        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/kfc/order_list", orderListRequest);
+        JSONObject entries = tokenApi.httpPost("https://channel.youpiaopiao.cn/api/kfc/order_list", orderListRequest);
         return entries;
 
     }
@@ -148,13 +150,14 @@ public class KfcApi {
         builder.queryParam("cityId", cityId);
         builder.queryParam("lat", lat);
         builder.queryParam("lon", lon);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         return JSONUtil.toBean(entries, ShopsResponse.class);
 
     }
 
     /**
      * 店铺详情,如果传了经纬度,返回距离
+     *
      * @param id
      * @param lat
      * @param lon
@@ -167,13 +170,14 @@ public class KfcApi {
         builder.queryParam("id", id);
         builder.queryParam("lat", lat);
         builder.queryParam("lon", lon);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         return JSONUtil.toBean(entries, ShopResponse.class);
 
     }
 
     /**
      * 菜单
+     *
      * @param shopId
      * @return
      */
@@ -182,7 +186,7 @@ public class KfcApi {
 
         UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl);
         builder.queryParam("shopId", shopId);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = new JSONConfig();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -191,6 +195,7 @@ public class KfcApi {
 
     /**
      * 商品详情(不同平台返回的商品详情不一致)
+     *
      * @param shopId
      * @param productId
      * @return
@@ -201,69 +206,22 @@ public class KfcApi {
         UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl);
         builder.queryParam("shopId", shopId);
         builder.queryParam("productId", productId);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = new JSONConfig();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
 
     }
 
+    public String index() {
+        AuthDetails currentUser = authHelper.getCurrentUser();
+        String member_token = tokenApi.member_token(currentUser.getUserId(), currentUser.getPhone());
+        String url = "https://www.youpiaopiao.cn/h10/#/pages/kfc/index?entid=" + entId + "&source=" + appId + "&token=" + member_token;
 
+        return url;
 
-    private String httpGet(String url) {
-        ApiLog apiLog = new ApiLog();
-        apiLog.setRequest(url);
-        apiLog.setSystem("kfc");
-        String token = getoken();
-        HttpRequest get = HttpUtil.createGet(url);
-        HttpResponse execute = get.header("Authorization", token).execute();
-        String body = execute.body();
-        apiLog.setResponse(body);
-        apiLogDao.save(apiLog);
-        JSONObject entries = JSONUtil.parseObj(body);
-        Integer code = (Integer) entries.get("code");
-        Assert.isTrue(execute.isOk(), "飘飘响应错误");
-        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
-        return body;
-
-    }
 
-    private JSONObject httpPost(String url, Object body) {
-
-        HttpRequest post = HttpUtil.createPost(url);
-        if (!url.contains("api/oauth/token")) {
-            String token = getoken();
-            post.header("Authorization", token);
-        }
-
-        ApiLog apiLog = new ApiLog();
-        apiLog.setRequest(url);
-        apiLog.setSystem("kfc");
-        apiLog.setService(url);
-        HttpResponse execute = post.body(JSONUtil.toJsonStr(body)).execute();
-        String response = execute.body();
-        apiLog.setRequest(JSONUtil.toJsonStr(body));
-        apiLog.setResponse(response);
-        apiLogDao.save(apiLog);
-        JSONObject entries = JSONUtil.parseObj(response);
-        Integer code = (Integer) entries.get("code");
-        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
-        return entries;
     }
 
-    private String getoken() {
-        Object value = redisHelper.getValue(tokenName);
-        if (!ObjectUtil.isEmpty(value)) {
-            return String.valueOf(value);
-        }
-        HashMap<String, String> para = new HashMap<>();
-        para.put("entId", entId);
-        para.put("appSecret", appSecret);
-        JSONObject http = httpPost("https://channel.youpiaopiao.cn/api/oauth/token", para);
-        String access_token = (String) http.getByPath("data.access_token");
-        String token = tokenValue + access_token;
-        redisHelper.cacheValue(tokenName, token, 82800);
-        return token;
-    }
 
 }

+ 123 - 0
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/api/ypp/TokenApi.java

@@ -0,0 +1,123 @@
+package com.zswl.cloud.springBtach.server.core.api.ypp;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.zswl.cloud.springBtach.server.core.dao.ApiLogDao;
+import com.zswl.cloud.springBtach.server.core.domain.ApiLog;
+import com.zswl.cloud.springBtach.server.core.helper.RedisHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.util.Assert;
+
+import java.util.HashMap;
+
+@Component
+public class TokenApi {
+
+
+    @Value("${ypp.entId}")
+    private String entId;
+
+    @Value("${ypp.appSecret}")
+    private String appSecret;
+
+    @Value("${ypp.appId}")
+    private String appId;
+
+    @Value("${ypp.test}")
+    private Boolean test;
+
+    @Autowired
+    RedisHelper redisHelper;
+
+
+    @Autowired
+    private ApiLogDao apiLogDao;
+
+
+    private final String tokenName = "ypp-token";
+    private final String member_token = "member-token-";
+    private final String tokenValue = "Bearer ";
+
+    public String getoken() {
+        Object value = redisHelper.getValue(tokenName);
+        if (!ObjectUtil.isEmpty(value)) {
+            return String.valueOf(value);
+        }
+        HashMap<String, String> para = new HashMap<>();
+        para.put("entId", entId);
+        para.put("appSecret", appSecret);
+        JSONObject http = httpPost("https://channel.youpiaopiao.cn/api/oauth/token", para);
+        String access_token = (String) http.getByPath("data.access_token");
+        String token = tokenValue + access_token;
+        redisHelper.cacheValue(tokenName, token, 82800);
+        return token;
+    }
+
+    public String member_token(String userId, String mobile) {
+
+        Object value = redisHelper.getValue(member_token + userId);
+        if (!ObjectUtil.isEmpty(value)) {
+            return String.valueOf(value);
+        }
+
+        HashMap<String, String> para = new HashMap<>();
+        para.put("appId", appId);
+        para.put("userId", userId);
+        para.put("mobile", mobile);
+
+
+        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/oauth/member_token", para);
+        String member_token = (String) entries.getByPath("data.access_token");
+        redisHelper.cacheValue(member_token + userId, tokenValue + member_token, 86400);
+        return member_token;
+    }
+
+
+    public String httpGet(String url) {
+        ApiLog apiLog = new ApiLog();
+        apiLog.setRequest(url);
+        apiLog.setSystem("kfc/movie");
+        String token = getoken();
+        HttpRequest get = HttpUtil.createGet(url);
+        HttpResponse execute = get.header("Authorization", token).execute();
+        String body = execute.body();
+        apiLog.setResponse(body);
+        apiLogDao.save(apiLog);
+        JSONObject entries = JSONUtil.parseObj(body);
+        Integer code = (Integer) entries.get("code");
+        Assert.isTrue(execute.isOk(), "飘飘响应错误");
+        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
+        return body;
+
+    }
+
+
+    public JSONObject httpPost(String url, Object body) {
+
+        HttpRequest post = HttpUtil.createPost(url);
+        if (!url.contains("api/oauth/token")) {
+            String token = getoken();
+            post.header("Authorization", token);
+        }
+
+        ApiLog apiLog = new ApiLog();
+        apiLog.setRequest(url);
+        apiLog.setSystem("kfc/movie");
+        apiLog.setService(url);
+        HttpResponse execute = post.body(JSONUtil.toJsonStr(body)).execute();
+        String response = execute.body();
+        apiLog.setRequest(JSONUtil.toJsonStr(body));
+        apiLog.setResponse(response);
+        apiLogDao.save(apiLog);
+        JSONObject entries = JSONUtil.parseObj(response);
+        Integer code = (Integer) entries.get("code");
+        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
+        return entries;
+    }
+}

+ 23 - 76
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/api/ypp/YppApi.java

@@ -31,6 +31,8 @@ public class YppApi {
     @Autowired
     RedisHelper redisHelper;
 
+    @Autowired
+    TokenApi tokenApi;
 
     @Autowired
     private ApiLogDao apiLogDao;
@@ -58,7 +60,7 @@ public class YppApi {
      * @return
      */
     public OrderDetailResponse order_detail(String orderId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/order_detail?id=" + orderId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/order_detail?id=" + orderId);
 
         OrderDetailResponse bean = JSONUtil.toBean(entries, OrderDetailResponse.class);
         return bean;
@@ -72,10 +74,10 @@ public class YppApi {
      * @return
      */
     public JSONObject pay_order(String orderId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/pay_order?id=" + orderId + "&test=" + test);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/pay_order?id=" + orderId + "&test=" + test);
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
-        return JSONUtil.parseObj(entries,jsonConfig);
+        return JSONUtil.parseObj(entries, jsonConfig);
 
     }
 
@@ -86,7 +88,7 @@ public class YppApi {
      * @return
      */
     public JSONObject order_list(OrderListRequest orderListRequest) {
-        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/movie/list", orderListRequest);
+        JSONObject entries = tokenApi.httpPost("https://channel.youpiaopiao.cn/api/movie/list", orderListRequest);
         return entries;
 
     }
@@ -98,7 +100,7 @@ public class YppApi {
      * @return
      */
     public JSONObject get_order(String orderId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/get_order?id=" + orderId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/get_order?id=" + orderId);
         return JSONUtil.parseObj(entries);
 
     }
@@ -111,7 +113,7 @@ public class YppApi {
      */
     public CreateOrdereResponse create_order(CreateOrdereRquest createOrdereRquest) {
         createOrdereRquest.setAppId(appId);
-        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/movie/create_order", createOrdereRquest);
+        JSONObject entries = tokenApi.httpPost("https://channel.youpiaopiao.cn/api/movie/create_order", createOrdereRquest);
         CreateOrdereResponse bean = JSONUtil.toBean(entries, CreateOrdereResponse.class);
         return bean;
 
@@ -126,7 +128,7 @@ public class YppApi {
     public CreateOrder2Response create_order2(CreateOrder2Request createOrder2Request) {
         createOrder2Request.setAppId(appId);
         createOrder2Request.setTest(test);
-        JSONObject entries = httpPost("https://channel.youpiaopiao.cn/api/movie/create_order2", createOrder2Request);
+        JSONObject entries = tokenApi.httpPost("https://channel.youpiaopiao.cn/api/movie/create_order2", createOrder2Request);
         return JSONUtil.toBean(entries, CreateOrder2Response.class);
 
     }
@@ -144,7 +146,7 @@ public class YppApi {
         builder.queryParam("cityId", cityId);
         builder.queryParam("pageIndex", pageIndex);
         builder.queryParam("pageSize", pageSize);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -158,10 +160,10 @@ public class YppApi {
      * @return
      */
     public JSONObject coming_movies(String cityId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/coming_movies?cityId=" + cityId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/coming_movies?cityId=" + cityId);
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
-        return JSONUtil.parseObj(entries,jsonConfig);
+        return JSONUtil.parseObj(entries, jsonConfig);
 
     }
 
@@ -172,10 +174,10 @@ public class YppApi {
      * @return
      */
     public JSONObject movie_detail(String movieId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/movie_detail?movieId=" + movieId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/movie_detail?movieId=" + movieId);
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
-        return JSONUtil.parseObj(entries,jsonConfig);
+        return JSONUtil.parseObj(entries, jsonConfig);
 
     }
 
@@ -195,10 +197,10 @@ public class YppApi {
         builder.queryParam("lat", lat);
         builder.queryParam("lng", lng);
 
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
-        return JSONUtil.parseObj(entries,jsonConfig);
+        return JSONUtil.parseObj(entries, jsonConfig);
 
     }
 
@@ -224,7 +226,7 @@ public class YppApi {
         builder.queryParam("cityId", cityId);
         builder.queryParam("lat", lat);
         builder.queryParam("lng", lng);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -238,10 +240,10 @@ public class YppApi {
      * @return
      */
     public JSONObject cinema_filter(String cityId) {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/cinema_filter?cityId=" + cityId);
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/cinema_filter?cityId=" + cityId);
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
-        return JSONUtil.parseObj(entries,jsonConfig);
+        return JSONUtil.parseObj(entries, jsonConfig);
 
     }
 
@@ -251,7 +253,7 @@ public class YppApi {
      * @return
      */
     public JSONObject get_citys() {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/get_citys");
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/get_citys");
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -271,7 +273,7 @@ public class YppApi {
         UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl);
         builder.queryParam("movieId", movieId);
         builder.queryParam("cinemaId", cinemaId);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -295,7 +297,7 @@ public class YppApi {
         builder.queryParam("cinemaId", cinemaId);
         builder.queryParam("movieId", movieId);
         builder.queryParam("sid", sid);
-        String entries = httpGet(builder.build().toUriString());
+        String entries = tokenApi.httpGet(builder.build().toUriString());
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
@@ -307,66 +309,11 @@ public class YppApi {
      * @return
      */
     public JSONObject ad_configs() {
-        String entries = httpGet("https://channel.youpiaopiao.cn/api/movie/ad_configs");
+        String entries = tokenApi.httpGet("https://channel.youpiaopiao.cn/api/movie/ad_configs");
         JSONConfig jsonConfig = JSONConfig.create();
         jsonConfig.setIgnoreError(true);
         return JSONUtil.parseObj(entries, jsonConfig);
     }
 
-    private String httpGet(String url) {
-        ApiLog apiLog = new ApiLog();
-        apiLog.setRequest(url);
-        apiLog.setSystem("movie");
-        String token = getoken();
-        HttpRequest get = HttpUtil.createGet(url);
-        HttpResponse execute = get.header("Authorization", token).execute();
-        String body = execute.body();
-        apiLog.setResponse(body);
-        apiLogDao.save(apiLog);
-        JSONObject entries = JSONUtil.parseObj(body);
-        Integer code = (Integer) entries.get("code");
-        Assert.isTrue(execute.isOk(), "飘飘响应错误");
-        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
-        return body;
-
-    }
-
-    private JSONObject httpPost(String url, Object body) {
-
-        HttpRequest post = HttpUtil.createPost(url);
-        if (!url.contains("api/oauth/token")) {
-            String token = getoken();
-            post.header("Authorization", token);
-        }
-
-        ApiLog apiLog = new ApiLog();
-        apiLog.setRequest(url);
-        apiLog.setSystem("movie");
-        apiLog.setService(url);
-        HttpResponse execute = post.body(JSONUtil.toJsonStr(body)).execute();
-        String response = execute.body();
-        apiLog.setRequest(JSONUtil.toJsonStr(body));
-        apiLog.setResponse(response);
-        apiLogDao.save(apiLog);
-        JSONObject entries = JSONUtil.parseObj(response);
-        Integer code = (Integer) entries.get("code");
-        Assert.isTrue(code.equals(0), String.valueOf(entries.get("message")));
-        return entries;
-    }
-
-    private String getoken() {
-        Object value = redisHelper.getValue(tokenName);
-        if (!ObjectUtil.isEmpty(value)) {
-            return String.valueOf(value);
-        }
-        HashMap<String, String> para = new HashMap<>();
-        para.put("entId", entId);
-        para.put("appSecret", appSecret);
-        JSONObject http = httpPost("https://channel.youpiaopiao.cn/api/oauth/token", para);
-        String access_token = (String) http.getByPath("data.access_token");
-        String token = tokenValue + access_token;
-        redisHelper.cacheValue(tokenName, token, 82800);
-        return token;
-    }
 
 }

+ 14 - 2
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/controller/YppController.java

@@ -5,6 +5,7 @@ import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
 import com.zhongshu.payment.client.model.order.v2.CreatOrderResultModel;
 import com.zswl.cloud.springBatch.client.model.ypp.movie.request.CreateOrder2Request;
+import com.zswl.cloud.springBtach.server.core.api.ypp.KfcApi;
 import com.zswl.cloud.springBtach.server.core.service.YppService;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
@@ -22,8 +23,8 @@ public class YppController {
     @Autowired
     private YppService yppService;
 
-
-
+    @Autowired
+    private KfcApi kfcApi;
 
 
     @ApiOperation("创建订单")
@@ -32,12 +33,14 @@ public class YppController {
     public ResultContent<CreatOrderResultModel> create_order(@RequestBody CreateOrder2Request createOrdereRquest) {
         return yppService.create_order(createOrdereRquest);
     }
+
     @ApiOperation("热映电影(pageIndex从0开始)")
     @ResourceAuth(value = "user", type = AuthType.User)
     @RequestMapping(value = "movies", method = RequestMethod.GET)
     public ResultContent movies(String cityId, String pageIndex, String pageSize) {
         return yppService.movies(cityId, pageIndex, pageSize);
     }
+
     @ApiOperation("即将上映电影")
     @ResourceAuth(value = "user", type = AuthType.User)
     @RequestMapping(value = "coming_movies", method = RequestMethod.GET)
@@ -101,4 +104,13 @@ public class YppController {
 
         return yppService.ad_configs();
     }
+
+    @ApiOperation("点餐聚合页")
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @RequestMapping(value = "kfcIndex", method = RequestMethod.GET)
+    public ResultContent kfcIndex() {
+
+        String index = kfcApi.index();
+        return ResultContent.buildContent(index);
+    }
 }