Commit f193fbd9 by wuwenlong

Merge remote-tracking branch 'origin/main'

parents 464a76a2 860f749c
......@@ -174,3 +174,7 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
meituan:
developerId: 123456
signKey: abcdefghijklmnopqrstuvwxyz
appAuthToken: abcdefghijklmnopqrstuvwxyz
package share.system.service;
public interface MTService {
public String VerificationVouchers(String code, int num);
public String verificationVouchers(String code, int num);
public String revoke (String ERPId ,String ERPName ,String couponCode);
String preparation (String code);
String Verified (String code);
}
......@@ -8,6 +8,10 @@ import com.meituan.sdk.model.tuangouNg.coupon.couponCancel.CouponCancelRequest;
import com.meituan.sdk.model.tuangouNg.coupon.couponCancel.CouponCancelResponse;
import com.meituan.sdk.model.tuangouNg.coupon.msSuperConsume.MsSuperConsumeRequest;
import com.meituan.sdk.model.tuangouNg.coupon.msSuperConsume.MsSuperConsumeResponse;
import com.meituan.sdk.model.tuangouNg.coupon.msSuperPrepare.MsSuperPrepareRequest;
import com.meituan.sdk.model.tuangouNg.coupon.msSuperPrepare.MsSuperPrepareResponse;
import com.meituan.sdk.model.tuangouNg.coupon.queryCouponById.QueryCouponByIdRequest;
import com.meituan.sdk.model.tuangouNg.coupon.queryCouponById.QueryCouponByIdResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import share.system.service.MTService;
......@@ -20,8 +24,9 @@ public class MTServiceImpl implements MTService {
private String appAuthToken;
@Value("${meituan.developerId}")
private Long developerId;
//执行验券
@Override
public String VerificationVouchers(String code, int num) {
public String verificationVouchers(String code, int num) {
//developerId 服务商身份标识 signKey 服务商签名密钥
MeituanClient meituanClient = DefaultMeituanClient.builder(developerId, signKey).build();
MsSuperConsumeRequest msSuperConsumeRequest = new MsSuperConsumeRequest();
......@@ -44,6 +49,7 @@ public class MTServiceImpl implements MTService {
return null;
}
//撤销验券
@Override
public String revoke(String ERPId, String ERPName, String couponCode) {
MeituanClient meituanClient = DefaultMeituanClient.builder(developerId,signKey).build();
......@@ -66,4 +72,48 @@ public class MTServiceImpl implements MTService {
}
return null;
}
//验券准备
@Override
public String preparation(String code) {
MeituanClient meituanClient = DefaultMeituanClient.builder(developerId, signKey).build();
MsSuperPrepareRequest msSuperPrepareRequest = new MsSuperPrepareRequest();
msSuperPrepareRequest.setCode(code);
MeituanResponse<MsSuperPrepareResponse> response = null;
try {
response = meituanClient.invokeApi(msSuperPrepareRequest,appAuthToken);
} catch (MtSdkException e) {
throw new RuntimeException(e);
}
if (response.isSuccess()) {
MsSuperPrepareResponse resp = response.getData();
return resp.toString();
} else {
System.out.println("调用失败");
}
return null;
}
//已验券码查询
@Override
public String Verified(String code) {
MeituanClient meituanClient = DefaultMeituanClient.builder(developerId, signKey).build();
QueryCouponByIdRequest queryCouponByIdRequest = new QueryCouponByIdRequest();
queryCouponByIdRequest.setCouponCode(code);
MeituanResponse<QueryCouponByIdResponse> response = null;
try {
response = meituanClient.invokeApi(queryCouponByIdRequest, appAuthToken);
} catch (MtSdkException e) {
throw new RuntimeException(e);
}
if (response.isSuccess()) {
QueryCouponByIdResponse resp = response.getData();
return resp.toString();
} else {
System.out.println("调用失败");
}
return null;
}
}
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