Authored by chenchao

fix compensate param key issue

... ... @@ -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);
}
... ...
... ... @@ -91,7 +91,7 @@ public class ActivityServiceImpl implements IActivityService {
ProductPoolDetail productPoolDetail = productPoolDetailMapper.selectByPoolId(productId, Integer.valueOf(productScope.getLimitValues()));
if ((productScope.getLimitType() == 1 && productPoolDetail == null)
|| (productScope.getLimitType() == 2 && productPoolDetail != null)) {
logger.info("check promotion Scope: not in productScope. productId is {}, productPoolId is {}", productScope.getLimitValues());
logger.warn("check promotion Scope: not in productScope. productId is {}, productPoolId is {}", productScope.getLimitValues());
return false;
}
}
... ...