...
|
...
|
@@ -71,6 +71,10 @@ public class CouponProxyService extends AbsProxyService implements Compensator { |
|
|
return result.getCoupons();
|
|
|
}
|
|
|
|
|
|
private static final String KEY_UID = "uid",
|
|
|
KEY_ORDER_CODE = "orderCode",
|
|
|
KEY_COUPONCODES = "couponCodes";
|
|
|
|
|
|
/**
|
|
|
* 使用优惠券,有补偿功能
|
|
|
*
|
...
|
...
|
@@ -79,8 +83,9 @@ public class CouponProxyService extends AbsProxyService implements Compensator { |
|
|
* @param couponCodes
|
|
|
*/
|
|
|
@TxCompensatable(value = CouponProxyService.class)
|
|
|
public void orderUseCoupon(@TxCompensateArgs("uid") int uid, @TxCompensateArgs("orderCode") long orderCode,
|
|
|
@TxCompensateArgs("couponBos") List<String> couponCodes) {
|
|
|
public void orderUseCoupon(@TxCompensateArgs(KEY_UID) int uid,
|
|
|
@TxCompensateArgs(KEY_ORDER_CODE) long orderCode,
|
|
|
@TxCompensateArgs(KEY_COUPONCODES) List<String> couponCodes) {
|
|
|
logger.info("[{}] request to use coupon,couponCodes is {}", orderCode, couponCodes);
|
|
|
ApiResponse resp = ufoServiceCaller.call("ufo.coupons.use", uid, orderCode, couponCodes);
|
|
|
Boolean result = getResultFromApiResponse(resp);
|
...
|
...
|
@@ -133,9 +138,9 @@ public class CouponProxyService extends AbsProxyService implements Compensator { |
|
|
String[] couponCodes = null;
|
|
|
try {
|
|
|
JSONObject json = JSON.parseObject(message);
|
|
|
uid = json.getIntValue("uid");
|
|
|
orderCode = json.getLongValue("orderCode");
|
|
|
couponCodes = json.getObject("couponCodes", String[].class);
|
|
|
uid = json.getIntValue(KEY_UID);
|
|
|
orderCode = json.getLongValue(KEY_ORDER_CODE);
|
|
|
couponCodes = json.getObject(KEY_COUPONCODES, String[].class);
|
|
|
} catch (Exception ex) {
|
|
|
logger.warn("parse message to json error,message is {}", message, ex);
|
|
|
}
|
...
|
...
|
|