Authored by wujiexiang

查询地址信息

... ... @@ -155,10 +155,6 @@ public class ShoppingServiceImpl implements IShoppingService {
ActivityPrice activityPrice = checkAndGetActivityPrice(request, skupGood);
//构建算费
ChargeContext chargeContext = buildChargeContext(request, skupGood, activityPrice, ChargeParam.PAYMENT);
if (StringUtils.isNoneBlank(request.getAddressId())){
Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request);
chargeContext.setUserAddressPair(addressInfoPair);
}
//算费
chargeService.charge(chargeContext);
//算费结果
... ... @@ -300,9 +296,35 @@ public class ShoppingServiceImpl implements IShoppingService {
int chargeStage) {
return chargeContextFactory.buildChargeContext(request, skupInfo, activityPrice, chargeStage,
DeliveryWayUtils::findDeliveryWayCodeBySkupType,
this::getAndCheckAddressInfo);
(shoppingRequest) -> {
if (StringUtils.isNoneBlank(request.getAddressId())) {
return getAndCheckAddressInfo(request);
} else {
return null;
}
});
}
/**
*
* @param request
* @param skupInfo
* @param activityPrice
* @param chargeStage
* @param userAddressPair 指定地址信息
* @return
*/
private ChargeContext buildChargeContext(ShoppingRequest request,
SellerOrderGoods skupInfo,
ActivityPrice activityPrice,
int chargeStage,
Pair<AddressInfo, AddressInfo> userAddressPair) {
return chargeContextFactory.buildChargeContext(request, skupInfo, activityPrice, chargeStage,
DeliveryWayUtils::findDeliveryWayCodeBySkupType,
(shoppingRequest) -> userAddressPair);
}
@Override
public ShoppingCouponListResp selectCoupon(ShoppingRequest request) {
... ... @@ -319,10 +341,7 @@ public class ShoppingServiceImpl implements IShoppingService {
//构建算费
ChargeContext chargeContext = buildChargeContext(request, skupGood, activityPrice, ChargeParam.SELECT_COUPON);
if (StringUtils.isNoneBlank(request.getAddressId())){
Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request);
chargeContext.setUserAddressPair(addressInfoPair);
}
//算费
chargeService.charge(chargeContext);
... ... @@ -363,10 +382,7 @@ public class ShoppingServiceImpl implements IShoppingService {
ActivityPrice activityPrice = checkAndGetActivityPrice(request, skupGood);
//构建算费
ChargeContext chargeContext = buildChargeContext(request, skupGood, activityPrice, ChargeParam.COMPUTE);
if (StringUtils.isNoneBlank(request.getAddressId())){
Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request);
chargeContext.setUserAddressPair(addressInfoPair);
}
//算费
chargeService.charge(chargeContext);
//算费结果
... ... @@ -431,9 +447,8 @@ public class ShoppingServiceImpl implements IShoppingService {
long orderCode;
try {
//算费
ChargeContext chargeContext = buildChargeContext(shoppingRequest, psog, activityPrice, ChargeParam.SUBMIT);
ChargeContext chargeContext = buildChargeContext(shoppingRequest, psog, activityPrice, ChargeParam.SUBMIT, userAddressPair);
chargeContext.setShipFeeRequird(true);
chargeContext.setUserAddressPair(userAddressPair);
ChargeGoods chargeGoods = chargeContext.getChargeGoods();
chargeGoods.setDepositCode(goodsPrepareData.getDepositCode());
chargeService.charge(chargeContext);
... ... @@ -509,10 +524,6 @@ public class ShoppingServiceImpl implements IShoppingService {
//构建算费
ChargeContext chargeContext = buildChargeContext(request, skupGood, activityPrice, ChargeParam.AUTO_RECOMMENDED_COUPON);
if (StringUtils.isNoneBlank(request.getAddressId())){
Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request);
chargeContext.setUserAddressPair(addressInfoPair);
}
//算费
chargeService.charge(chargeContext);
... ...