Commit 0ae21921 by 刘鹏飞

coco加点日志

parent ae0a9553
......@@ -13,6 +13,9 @@ import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo;
import cn.freemud.enums.ActivityTypeEnum;
import cn.freemud.service.ActivityService;
import cn.freemud.utils.WebUtil;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.card.sdk.log.ApiLog;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -55,12 +58,14 @@ public class FullSharingService {
activityTypeEnums.add(ActivityTypeEnum.TYPE_3);
activityTypeEnums.add(ActivityTypeEnum.TYPE_31);
String aa = LogThreadLocal.getTrackingNo();
if (discountResult == null || CollectionUtils.isEmpty(discountResult.getGoods())) {
/**
* 调用促销统一活动查询,过滤出参与的满减(目前只有每满减和阶梯满减)
*/
ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
ApiLog.info("满减提示,getTrackingNo:{},ActivityQueryResponseDto:{}",aa, JSONObject.toJSONString(activityQueryResponseDto));
if (null==activityQueryResponseDto || CollectionUtils.isEmpty(activityQueryResponseDto.getResult())) {
return;
}
......@@ -237,6 +242,8 @@ public class FullSharingService {
notInShopping.setDeduct(WebUtil.formatAmount(benefitBeanDto.getDiscountAmount() * 1.00 / 100).toString());
notInShopping.setMaxDeduct(WebUtil.formatAmount(activityResponseDto.getMaxMoney() * 1.00 / 100).toString());
activityList.add(notInShopping);
String aa = LogThreadLocal.getTrackingNo();
ApiLog.info("满减提示,getTrackingNo:{},TYPE_11:{}",aa, JSONObject.toJSONString(activityList));
}
if (Objects.equals(ActivityTypeEnum.TYPE_12.getCode(), activityResponseDto.getActivityType())) {
int len = benefitBeanDtos.size();
......@@ -259,6 +266,9 @@ public class FullSharingService {
notInShopping.setDeduct(WebUtil.formatAmount(benefitBeanDto.getDiscountAmount() * 1.00 / 100).toString());
activityList.add(notInShopping);
}
String aa = LogThreadLocal.getTrackingNo();
ApiLog.info("满减提示,getTrackingNo:{},TYPE_12:{}",aa, JSONObject.toJSONString(activityList));
}
}
......
......@@ -49,6 +49,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
});
}
// 促销的活动信息和商品优惠信息给前端做展示、打标签用
shoppingCartGoodsResponseVo.setDiscounts(discounts);
shoppingCartGoodsResponseVo.setGoods(discountResult.getGoods());
......@@ -101,6 +102,7 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
}
}
Integer newQty = product.getQty() - num;
// 数量减去购物车行之后如果为0就不加入购物车
// 主商品行要数量,价格
if(!Objects.equals(newQty,0)){
product.setAmount(product.getAmount() - discountAmount * num);
......@@ -120,8 +122,11 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
public CartGoods buildNewLine(CartGoods cgs,Integer activityType,Integer qty,Long newPrice){
CartGoods newCartGoods = new CartGoods();
// 购物车的行设置和原来的行一致,便于前端在更新商品数量的时候。能够根据购物车行聚合商品数量
// 因为半价行是从主行中拆出来的
newCartGoods.setCartGoodsUid(cgs.getCartGoodsUid());
newCartGoods.setGoodsId(cgs.getGoodsId());
// 这个地方不要放置商品id,因为半价行的商品不打活动标签
// 前端会根据这个活动检索
newCartGoods.setGoodsType(cgs.getGoodsType());
newCartGoods.setSpuId(cgs.getSpuId());
newCartGoods.setSkuId(cgs.getSkuId());
......
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