Commit ac5f04c3 by 刘鹏飞

Merge remote-tracking branch 'origin/feature/coco_three'

parents 1a4bf2c3 ecef885e
...@@ -109,7 +109,11 @@ public class OrderAdapter { ...@@ -109,7 +109,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}")
...@@ -177,6 +181,8 @@ public class OrderAdapter { ...@@ -177,6 +181,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()));
} }
...@@ -418,6 +424,23 @@ public class OrderAdapter { ...@@ -418,6 +424,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;
}
/** /**
* 计算用户收货地址实际配送费 * 计算用户收货地址实际配送费
......
...@@ -313,7 +313,7 @@ public class CheckOrder { ...@@ -313,7 +313,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);
} }
......
...@@ -136,8 +136,7 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService { ...@@ -136,8 +136,7 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
giftMap.put(giftProduct.getOcid(),giftProduct.getQty()); giftMap.put(giftProduct.getOcid(),giftProduct.getQty());
}); });
} }
Long itemAmount = 0L;
List<ProductVo> productVos = new ArrayList<>(); List<ProductVo> productVos = new ArrayList<>();
if(null != masterProducts && !masterProducts.isEmpty()){ if(null != masterProducts && !masterProducts.isEmpty()){
for(ProductVo product : masterProducts){ for(ProductVo product : masterProducts){
...@@ -155,8 +154,7 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService { ...@@ -155,8 +154,7 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
// 商品现单价 = 商品现单价+小料现单价 // 商品现单价 = 商品现单价+小料现单价
smallMaterialOriTotal = smallMaterialOriTotal == null ? 0 : smallMaterialOriTotal; smallMaterialOriTotal = smallMaterialOriTotal == null ? 0 : smallMaterialOriTotal;
product.setOriginalPrice(smallMaterialOriTotal + (product.getOriginalPrice() == null ? 0L : product.getOriginalPrice())); product.setOriginalPrice(smallMaterialOriTotal + (product.getOriginalPrice() == null ? 0L : product.getOriginalPrice()));
itemAmount = itemAmount + product.getOriginalPrice() * product.getQty();
// 如果商品参加了第二件半价活动,要把该行拆成数量为1的多行 // 如果商品参加了第二件半价活动,要把该行拆成数量为1的多行
QueryOrdersResponse.DataBean.OrderBean.ProductBean productBean = productMap.get(product.getCid()); QueryOrdersResponse.DataBean.OrderBean.ProductBean productBean = productMap.get(product.getCid());
...@@ -190,6 +188,9 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService { ...@@ -190,6 +188,9 @@ public class CocoOrderRelationServiceImpl implements OrderRelationService {
masterProducts.addAll(productVos); masterProducts.addAll(productVos);
queryOrderResponseVo.setProducts(masterProducts); queryOrderResponseVo.setProducts(masterProducts);
// 商品总价
queryOrderResponseVo.setItemAmount(itemAmount);
} }
} }
...@@ -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);
} }
......
...@@ -124,6 +124,13 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation ...@@ -124,6 +124,13 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
shoppingCartGoodsResponseVo.setActivityTip(activityTip); shoppingCartGoodsResponseVo.setActivityTip(activityTip);
} }
// 将配送费放到一个字段去
if(shoppingCartGoodsResponseVo.getIsDiscountDelivery() && ( shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() < shoppingCartGoodsResponseVo.getDeliveryAmount())){
shoppingCartGoodsResponseVo.setDeliveryAmount(shoppingCartGoodsResponseVo.getDiscountDeliveryAmount());
}
} }
@Override @Override
......
...@@ -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