Commit 971f0d8c by 吕明尚

美团增加接口

parent 0d7b2ce3
package share.web.controller.system;
import com.dianping.openapi.sdk.api.tuangou.entity.*;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -8,6 +9,8 @@ import org.springframework.web.bind.annotation.RestController;
import share.common.core.domain.R;
import share.system.service.QPService;
import java.util.List;
@RestController
@RequestMapping("/front/chessCards")
@Api(tags = "首页-验券")
......@@ -17,37 +20,49 @@ public class QPController {
//输码验券校验接口
@GetMapping("/prepare")
public R prepare(String code) {
public R<TuangouReceiptPrepareResponseEntity> prepare(String code) {
return R.ok(qpService.prepare(code));
}
//验券接口
@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));
}
//撤销验券接口
@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));
}
//查询已验券信息接口
@GetMapping("/getconsumed")
public R getconsumed(String code) {
public R<TuangouReceiptGetConsumedReponseEntity> getconsumed(String code) {
return R.ok(qpService.getconsumed(code));
}
//用户验券接口
@GetMapping("/consumeByUser")
public R consumeByUser(String code, int count) {
public R<String> consumeByUser(String code, int count) {
return R.ok(qpService.consumeByUser(code, count));
}
//用户销券接口
@GetMapping("/reverseconsumeByUser")
public R reverseconsumeByUser(Long id) {
public R<String> reverseconsumeByUser(Long 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;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptConsumeResponseEntity;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptPrepareResponseEntity;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptReverseConsumeResponseEntity;
import com.dianping.openapi.sdk.api.tuangou.entity.*;
import share.common.core.domain.R;
import java.util.List;
......@@ -19,4 +17,8 @@ public interface QPService {
String consumeByUser(String code, int count);
String reverseconsumeByUser(Long id);
String oauthToken(String authCode);
List<TuangouDealQueryShopDealResponseEntity> queryshopdeal();
}
......@@ -126,9 +126,14 @@ public class QPServiceImpl implements QPService {
*/
@Override
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",
"requestid", code, count, "open_shop_uuid",
"app_shop_account", "app_shop_accountname");
requestid, code, count, OPEN_SHOP_UUID,
app_shop_account, app_shop_accountname);
DefaultOpenAPIClient openAPIClient = new DefaultOpenAPIClient();
TuangouReceiptConsume tuangouReceiptConsume = new TuangouReceiptConsume(request);
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