Commit 971f0d8c by 吕明尚

美团增加接口

parent 0d7b2ce3
package share.web.controller.system; package share.web.controller.system;
import com.dianping.openapi.sdk.api.tuangou.entity.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -8,6 +9,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -8,6 +9,8 @@ import org.springframework.web.bind.annotation.RestController;
import share.common.core.domain.R; import share.common.core.domain.R;
import share.system.service.QPService; import share.system.service.QPService;
import java.util.List;
@RestController @RestController
@RequestMapping("/front/chessCards") @RequestMapping("/front/chessCards")
@Api(tags = "首页-验券") @Api(tags = "首页-验券")
...@@ -17,37 +20,49 @@ public class QPController { ...@@ -17,37 +20,49 @@ public class QPController {
//输码验券校验接口 //输码验券校验接口
@GetMapping("/prepare") @GetMapping("/prepare")
public R prepare(String code) { public R<TuangouReceiptPrepareResponseEntity> prepare(String code) {
return R.ok(qpService.prepare(code)); return R.ok(qpService.prepare(code));
} }
//验券接口 //验券接口
@GetMapping("/consume") @GetMapping("/consume")
public R consume(String code, int count) { public R<List<TuangouReceiptConsumeResponseEntity>> consume(String code, int count) {
return R.ok(qpService.consume(code, count)); return R.ok(qpService.consume(code, count));
} }
//撤销验券接口 //撤销验券接口
@GetMapping("/reverseconsume") @GetMapping("/reverseconsume")
public R reverseconsume(String code, String appDealId) { public R<List<TuangouReceiptReverseConsumeResponseEntity>> reverseconsume(String code, String appDealId) {
return R.ok(qpService.reverseconsume(code, appDealId)); return R.ok(qpService.reverseconsume(code, appDealId));
} }
//查询已验券信息接口 //查询已验券信息接口
@GetMapping("/getconsumed") @GetMapping("/getconsumed")
public R getconsumed(String code) { public R<TuangouReceiptGetConsumedReponseEntity> getconsumed(String code) {
return R.ok(qpService.getconsumed(code)); return R.ok(qpService.getconsumed(code));
} }
//用户验券接口 //用户验券接口
@GetMapping("/consumeByUser") @GetMapping("/consumeByUser")
public R consumeByUser(String code, int count) { public R<String> consumeByUser(String code, int count) {
return R.ok(qpService.consumeByUser(code, count)); return R.ok(qpService.consumeByUser(code, count));
} }
//用户销券接口 //用户销券接口
@GetMapping("/reverseconsumeByUser") @GetMapping("/reverseconsumeByUser")
public R reverseconsumeByUser(Long id) { public R<String> reverseconsumeByUser(Long id) {
return R.ok(qpService.reverseconsumeByUser(id)); return R.ok(qpService.reverseconsumeByUser(id));
} }
//通过authCode,获取授权的session
@GetMapping("/oauthToken")
public R<String> oauthToken(String authCode) {
return R.ok(qpService.oauthToken(authCode));
}
//获取商家所有的团购信息
@GetMapping("/queryshopdeal")
public R<List<TuangouDealQueryShopDealResponseEntity>> queryshopdeal() {
return R.ok(qpService.queryshopdeal());
}
} }
package share.system.service; package share.system.service;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptConsumeResponseEntity; import com.dianping.openapi.sdk.api.tuangou.entity.*;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity; import share.common.core.domain.R;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptPrepareResponseEntity;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptReverseConsumeResponseEntity;
import java.util.List; import java.util.List;
...@@ -19,4 +17,8 @@ public interface QPService { ...@@ -19,4 +17,8 @@ public interface QPService {
String consumeByUser(String code, int count); String consumeByUser(String code, int count);
String reverseconsumeByUser(Long id); String reverseconsumeByUser(Long id);
String oauthToken(String authCode);
List<TuangouDealQueryShopDealResponseEntity> queryshopdeal();
} }
...@@ -126,9 +126,14 @@ public class QPServiceImpl implements QPService { ...@@ -126,9 +126,14 @@ public class QPServiceImpl implements QPService {
*/ */
@Override @Override
public List<TuangouReceiptConsumeResponseEntity> consume(String code, int count) { public List<TuangouReceiptConsumeResponseEntity> consume(String code, int count) {
//商家在自研系统或第三方服务商系统内登录的帐号
String app_shop_account = "app_shop_account";
//自研系统或第三方服务商系统内登陆的用户名
String app_shop_accountname = "app_shop_accountname";
String requestid = UUID.randomUUID().toString();
TuangouReceiptConsumeRequest request = new TuangouReceiptConsumeRequest(APP_KEY, APP_SECRET, "session", TuangouReceiptConsumeRequest request = new TuangouReceiptConsumeRequest(APP_KEY, APP_SECRET, "session",
"requestid", code, count, "open_shop_uuid", requestid, code, count, OPEN_SHOP_UUID,
"app_shop_account", "app_shop_accountname"); app_shop_account, app_shop_accountname);
DefaultOpenAPIClient openAPIClient = new DefaultOpenAPIClient(); DefaultOpenAPIClient openAPIClient = new DefaultOpenAPIClient();
TuangouReceiptConsume tuangouReceiptConsume = new TuangouReceiptConsume(request); TuangouReceiptConsume tuangouReceiptConsume = new TuangouReceiptConsume(request);
TuangouReceiptConsumeResponse invoke = openAPIClient.invoke(tuangouReceiptConsume); TuangouReceiptConsumeResponse invoke = openAPIClient.invoke(tuangouReceiptConsume);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment