Commit b3df8226 by 徐康

价格问题修复

parent 2d873d03
......@@ -577,6 +577,8 @@ public class ActivityCalculationDiscountResponseDto {
private String goodsId;
private String goodsName;
private Integer sendNumber;
private String picture;
private Integer originalPrice;
}
}
......
......@@ -64,6 +64,8 @@ public class ActivityList {
@Data
public static class McCafeSendGoods extends CartGoods {
private Integer isSelected;
private String originalPrice;
private String finalPrice;
}
}
......@@ -58,6 +58,9 @@ public class BuySendCalculation {
mcCafeSendGoods.setGoodsId(o.getGoodsId());
mcCafeSendGoods.setSpuName(o.getGoodsName());
mcCafeSendGoods.setQty(o.getSendNumber());
mcCafeSendGoods.setPic(o.getPicture());
mcCafeSendGoods.setOriginalPrice(MoneyUtils.parseFen2Yuan(o.getOriginalPrice()));
mcCafeSendGoods.setFinalPrice(MoneyUtils.parseFen2Yuan(o.getOriginalPrice()));
if(map.get(o.getGoodsId()) != null) {
mcCafeSendGoods.setIsSelected(1);
}
......
......@@ -186,6 +186,9 @@ public class CalculationServiceImpl {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = activityCalculationDiscountResponseDto.getResult();
if(null != calculationDiscountResult) {
if(CollectionUtils.isNotEmpty(calculationDiscountResult.getDiscounts())) {
Integer discount = calculationDiscountResult.getDiscounts().stream().mapToInt(o -> o.getDiscount()).sum();
calculationDiscountResult.setTotalDiscountAmount(calculationDiscountResult.getTotalDiscountAmount() - discount);
calculationDiscountResult.setOriginalTotalAmount(calculationDiscountResult.getOriginalTotalAmount() - discount);
calculationDiscountResult.getDiscounts().removeIf(o -> o.getType() == 230);
}
if(CollectionUtils.isNotEmpty(calculationDiscountResult.getGoods())) {
......
......@@ -7,4 +7,8 @@ public class MoneyUtils {
public static String parseFen2Yuan(Long fen) {
return new BigDecimal(fen).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toPlainString();
}
public static String parseFen2Yuan(Integer fen) {
return new BigDecimal(fen).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).toPlainString();
}
}
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