Commit 4b2ef69a by zhiheng.zhang

Merge remote-tracking branch 'origin/qa' into qa

parents 82d7ed13 c67395e7
...@@ -116,7 +116,11 @@ public class OrderAdapter { ...@@ -116,7 +116,11 @@ public class OrderAdapter {
private String mcCafePartnerId; private String mcCafePartnerId;
@Value("${mcCafe.refund.interval}") @Value("${mcCafe.refund.interval}")
private String mccafeRefundInterval; private String mccafeRefundInterval;
/**
* coco商户
*/
@Value("#{'${coco.partnerId}'.split(',')}")
private List<String> cocoPartnerId;
@Value("${saas.reverseNotifyiDcUrl}") @Value("${saas.reverseNotifyiDcUrl}")
private String reverseNotifyiDcUrl; private String reverseNotifyiDcUrl;
@Value("${saas.refund.notify.callback}") @Value("${saas.refund.notify.callback}")
...@@ -184,6 +188,8 @@ public class OrderAdapter { ...@@ -184,6 +188,8 @@ public class OrderAdapter {
if (CollectionUtils.isNotEmpty(cartGoodsDetailDto.getActivityDiscountsDtos())) { if (CollectionUtils.isNotEmpty(cartGoodsDetailDto.getActivityDiscountsDtos())) {
if(mcCafePartnerId.equals(createOrderDto.getCompanyId())) { if(mcCafePartnerId.equals(createOrderDto.getCompanyId())) {
createOrderProductDto.setAccounts(getMCCafeAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos())); createOrderProductDto.setAccounts(getMCCafeAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()));
}else if(cocoPartnerId.contains(createOrderDto.getCompanyId())){
createOrderProductDto.setAccounts(getCocoAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()));
} else { } else {
createOrderProductDto.setAccounts(getAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos())); createOrderProductDto.setAccounts(getAccounts(createOrderProductDto, cartGoodsDetailDto.getActivityDiscountsDtos()));
} }
...@@ -426,6 +432,23 @@ public class OrderAdapter { ...@@ -426,6 +432,23 @@ public class OrderAdapter {
return orderAccountDtos; return orderAccountDtos;
} }
public List<CreateOrderAccountRequest> getCocoAccounts(CreateOrderProductRequest createOrderProductDto, List<ActivityDiscountsDto> activityDiscountsDtos) {
List<CreateOrderAccountRequest> orderAccountDtos = new ArrayList<>();
for (ActivityDiscountsDto activityDiscountsDto : activityDiscountsDtos) {
CreateOrderAccountRequest createOrderAccountDto = CreateOrderAccountRequest.builder()
.accountId(activityDiscountsDto.getActivityCode())
.name(activityDiscountsDto.getActivityName())
.price(activityDiscountsDto.getDiscountAmount().longValue())
.accountType(getQueryOrderAccountType(getOrderAccountType(activityDiscountsDto.getActivityType())))
.sequence(createOrderProductDto.getSequence())
.productId(createOrderProductDto.getSpecification())
.discountQty(activityDiscountsDto.getActualActivityGoodsNumber())
.build();
orderAccountDtos.add(createOrderAccountDto);
}
return orderAccountDtos;
}
/** /**
* 计算用户收货地址实际配送费 * 计算用户收货地址实际配送费
...@@ -2448,7 +2471,7 @@ public class OrderAdapter { ...@@ -2448,7 +2471,7 @@ public class OrderAdapter {
public CreateOrderProductRequest convent2OrderProductDemo(ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto) { public CreateOrderProductRequest convent2OrderProductDemo(ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto) {
CreateOrderProductRequest createOrderProductDemoDto = new CreateOrderProductRequest(); CreateOrderProductRequest createOrderProductDemoDto = new CreateOrderProductRequest();
createOrderProductDemoDto.setProductId(cartGoodsDetailDto.getSpuId()); createOrderProductDemoDto.setProductId(StringUtils.isNotBlank(cartGoodsDetailDto.getSpuId()) ? cartGoodsDetailDto.getSpuId() : cartGoodsDetailDto.getSkuId());
createOrderProductDemoDto.setProductName(cartGoodsDetailDto.getSpuName()); createOrderProductDemoDto.setProductName(cartGoodsDetailDto.getSpuName());
createOrderProductDemoDto.setSpecification(cartGoodsDetailDto.getSkuId()); createOrderProductDemoDto.setSpecification(cartGoodsDetailDto.getSkuId());
createOrderProductDemoDto.setSpecificationName(cartGoodsDetailDto.getSkuName()); createOrderProductDemoDto.setSpecificationName(cartGoodsDetailDto.getSkuName());
......
...@@ -306,7 +306,7 @@ public class CheckOrder { ...@@ -306,7 +306,7 @@ public class CheckOrder {
} }
} }
//订单金额小于起送费提示 //订单金额小于起送费提示
else if (2 == storeDeliveryInfoDto.getDeliveryCondition() && storeDeliveryInfoDto.getDeliveryLimitAmount() > shoppingCartGoodsDto.getTotalAmount()) { else if ((2 == storeDeliveryInfoDto.getDeliveryCondition() && storeDeliveryInfoDto.getDeliveryLimitAmount() > shoppingCartGoodsDto.getTotalAmount()) && !cocoPartnerId.contains(createOrderVo.getPartnerId())) {
throw new ServiceException(ResponseResult.STORE_DISCONTENT_DELIVERY_FEE); throw new ServiceException(ResponseResult.STORE_DISCONTENT_DELIVERY_FEE);
} }
......
...@@ -282,7 +282,7 @@ public class ShoppingCartConvertAdapter { ...@@ -282,7 +282,7 @@ public class ShoppingCartConvertAdapter {
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto(); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto();
cartGoodsDetailDto.setTaxId(cartGoods.getTaxId()); cartGoodsDetailDto.setTaxId(cartGoods.getTaxId());
cartGoodsDetailDto.setTax(cartGoods.getTax()); cartGoodsDetailDto.setTax(cartGoods.getTax());
cartGoodsDetailDto.setSpuId(comboxGoods.getSpuId()); cartGoodsDetailDto.setSpuId(StringUtils.isEmpty(comboxGoods.getSpuId()) ? comboxGoods.getSpuId() : comboxGoods.getGoodsId());
cartGoodsDetailDto.setSpuName(comboxGoods.getSpuName()); cartGoodsDetailDto.setSpuName(comboxGoods.getSpuName());
cartGoodsDetailDto.setSkuId(comboxGoods.getGoodsId()); cartGoodsDetailDto.setSkuId(comboxGoods.getGoodsId());
cartGoodsDetailDto.setSkuName(StringUtils.isEmpty(comboxGoods.getSkuName()) ? comboxGoods.getSpuName() : comboxGoods.getSkuName()); cartGoodsDetailDto.setSkuName(StringUtils.isEmpty(comboxGoods.getSkuName()) ? comboxGoods.getSpuName() : comboxGoods.getSkuName());
......
...@@ -21,6 +21,7 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -21,6 +21,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -44,6 +45,12 @@ import static cn.freemud.constant.ShoppingCartConstant.SHOPPING_CART_INVALIAD_GO ...@@ -44,6 +45,12 @@ import static cn.freemud.constant.ShoppingCartConstant.SHOPPING_CART_INVALIAD_GO
@Slf4j @Slf4j
public class CalculationCommonService { public class CalculationCommonService {
/**
* coco商户
*/
@Value("#{'${coco.partnerId}'.split(',')}")
private List<String> cocoPartnerId;
@Autowired @Autowired
private CustomerApplicationClient customerApplicationClient; private CustomerApplicationClient customerApplicationClient;
...@@ -160,9 +167,10 @@ public class CalculationCommonService { ...@@ -160,9 +167,10 @@ public class CalculationCommonService {
* @return * @return
*/ */
public ShoppingCartGoodsDto.CartGoodsDetailDto convertCartGoods2DetailGoodsList(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods calculationGoods public ShoppingCartGoodsDto.CartGoodsDetailDto convertCartGoods2DetailGoodsList(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods calculationGoods
, CartGoods cartGoods) { , CartGoods cartGoods
, String partnerId) {
log.debug("convertCartGoods2DetailGoodsList ->calculationGoods:{},cartGoods:{}", calculationGoods, cartGoods); log.debug("convertCartGoods2DetailGoodsList ->calculationGoods:{},cartGoods:{}", calculationGoods, cartGoods);
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = this.convertCartGoods2DetailGoods(calculationGoods, cartGoods); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = this.convertCartGoods2DetailGoods(calculationGoods, cartGoods,partnerId);
return cartGoodsDetailDto; return cartGoodsDetailDto;
} }
...@@ -305,7 +313,8 @@ public class CalculationCommonService { ...@@ -305,7 +313,8 @@ public class CalculationCommonService {
* @param calculationGoods * @param calculationGoods
*/ */
private ShoppingCartGoodsDto.CartGoodsDetailDto convertCartGoods2DetailGoods(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods calculationGoods private ShoppingCartGoodsDto.CartGoodsDetailDto convertCartGoods2DetailGoods(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods calculationGoods
, CartGoods cartGoods) { , CartGoods cartGoods
, String partnerId) {
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto(); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto();
cartGoodsDetailDto.setCartGoodsUid(cartGoods.getCartGoodsUid()); cartGoodsDetailDto.setCartGoodsUid(cartGoods.getCartGoodsUid());
...@@ -356,6 +365,9 @@ public class CalculationCommonService { ...@@ -356,6 +365,9 @@ public class CalculationCommonService {
activityDiscountsDto.setActivityName(this.convertName(discount.getType(), discount.getActivityName())); activityDiscountsDto.setActivityName(this.convertName(discount.getType(), discount.getActivityName()));
activityDiscountsDto.setActivityType(this.convertType(discount.getType())); activityDiscountsDto.setActivityType(this.convertType(discount.getType()));
activityDiscountsDto.setDiscountAmount(discount.getDiscount().intValue()); activityDiscountsDto.setDiscountAmount(discount.getDiscount().intValue());
if(cocoPartnerId.contains(partnerId)){
activityDiscountsDto.setActualActivityGoodsNumber(discount.getActualGoodsNumber());
}
activityDiscountsDtoList.add(activityDiscountsDto); activityDiscountsDtoList.add(activityDiscountsDto);
} }
} }
......
...@@ -115,7 +115,7 @@ public class CalculationSharingEquallyService { ...@@ -115,7 +115,7 @@ public class CalculationSharingEquallyService {
if (goods!=null) { if (goods!=null) {
find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get(); find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get();
} }
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product,shoppingCartInfoRequestVo.getPartnerId());
cartGoodsDetailDtoList.add(cartGoodsDetailDto); cartGoodsDetailDtoList.add(cartGoodsDetailDto);
} }
......
...@@ -420,13 +420,26 @@ public class CalculationServiceImpl { ...@@ -420,13 +420,26 @@ public class CalculationServiceImpl {
if("0".equals(materialGoods.getGoodsId())){ if("0".equals(materialGoods.getGoodsId())){
continue; continue;
} }
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material(); ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material productGroup =
material.setType(2); new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setGoodsId(materialGoods.getGoodsId()); productGroup.setType(2);
material.setGoodsQuantity(materialGoods.getQty()); productGroup.setGoodsId(materialGoods.getGoodsId());
material.setOriginalPrice(null != materialGoods.getFinalPrice() ? productGroup.setGoodsQuantity(materialGoods.getQty());
productGroup.setOriginalPrice(null != materialGoods.getFinalPrice() ?
materialGoods.getFinalPrice() : 0); materialGoods.getFinalPrice() : 0);
materials.add(material); materials.add(productGroup);
if (CollectionUtils.isNotEmpty(materialGoods.getProductMaterialList())){
for (CartGoods.MaterialGoods goods : materialGoods.getProductMaterialList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1);
material.setGoodsId(goods.getSpuId());
material.setGoodsQuantity(1);
material.setOriginalPrice(null != goods.getFinalPrice() ?
goods.getFinalPrice() : 0);
materials.add(material);
}
}
} }
} }
......
...@@ -93,7 +93,7 @@ public class CartTest { ...@@ -93,7 +93,7 @@ public class CartTest {
shoppingCartGoodsResponseVo.setProducts(cartGoodsList); shoppingCartGoodsResponseVo.setProducts(cartGoodsList);
for (CartGoods product : shoppingCartGoodsResponseVo.getProducts()) { for (CartGoods product : shoppingCartGoodsResponseVo.getProducts()) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get(); CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get();
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product,"");
cartGoodsDetailDtoList.add(cartGoodsDetailDto); cartGoodsDetailDtoList.add(cartGoodsDetailDto);
} }
} }
...@@ -130,7 +130,7 @@ public class CartTest { ...@@ -130,7 +130,7 @@ public class CartTest {
shoppingCartGoodsResponseVo.setProducts(cartGoodsList); shoppingCartGoodsResponseVo.setProducts(cartGoodsList);
for (CartGoods product : shoppingCartGoodsResponseVo.getProducts()) { for (CartGoods product : shoppingCartGoodsResponseVo.getProducts()) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get(); CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get();
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product,"");
cartGoodsDetailDtoList.add(cartGoodsDetailDto); cartGoodsDetailDtoList.add(cartGoodsDetailDto);
} }
//ShoppingCartInfoRequestVo //ShoppingCartInfoRequestVo
...@@ -169,7 +169,7 @@ public class CartTest { ...@@ -169,7 +169,7 @@ public class CartTest {
shoppingCartGoodsResponseVo.setProducts(cartGoodsList); shoppingCartGoodsResponseVo.setProducts(cartGoodsList);
for (CartGoods product : shoppingCartGoodsResponseVo.getProducts()) { for (CartGoods product : shoppingCartGoodsResponseVo.getProducts()) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get(); CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods find = goods.stream().filter((k) -> k.getCartGoodsUid().equals(product.getCartGoodsUid())).findFirst().get();
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product); ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = calculationCommonService.convertCartGoods2DetailGoodsList(find, product,"");
cartGoodsDetailDtoList.add(cartGoodsDetailDto); cartGoodsDetailDtoList.add(cartGoodsDetailDto);
} }
/** /**
......
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