|
|
|
@ -1921,12 +1921,15 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
childOrder.setGoodsImg(childObject.getString("imgUrl")); |
|
|
|
|
childOrder.setSaleCount(childObject.getInteger("quantity")); |
|
|
|
|
childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice")); |
|
|
|
|
childOrder.setGoodsActualPrice(childObject.getBigDecimal("unitPrice")); |
|
|
|
|
|
|
|
|
|
if (object.getLong("memDiscountId") != null) { |
|
|
|
|
childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice")); |
|
|
|
|
} else { |
|
|
|
|
childOrder.setGoodsActualPrice(childObject.getBigDecimal("unitPrice")); |
|
|
|
|
} |
|
|
|
|
// 计算利润
|
|
|
|
|
BigDecimal profitPrice = childObject.getBigDecimal("unitPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); |
|
|
|
|
BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); |
|
|
|
|
// 计算子订单支付金额
|
|
|
|
|
BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP); |
|
|
|
|
BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP); |
|
|
|
|
if (childPrice.compareTo(childObject.getBigDecimal("marketPrice")) > 0) { |
|
|
|
|
childPrice = childObject.getBigDecimal("marketPrice"); |
|
|
|
|
} |
|
|
|
@ -1986,13 +1989,17 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
childOrder.setGoodsImg(childObject.getString("imageUrl")); |
|
|
|
|
childOrder.setSaleCount(childObject.getInteger("quantity")); |
|
|
|
|
childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice")); |
|
|
|
|
childOrder.setGoodsActualPrice(childObject.getBigDecimal("price")); |
|
|
|
|
if (object.getLong("memDiscountId") != null) { |
|
|
|
|
childOrder.setGoodsActualPrice(childObject.getBigDecimal("originPrice")); |
|
|
|
|
} else { |
|
|
|
|
childOrder.setGoodsActualPrice(childObject.getBigDecimal("price")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算利润
|
|
|
|
|
BigDecimal profitPrice = childObject.getBigDecimal("price").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); |
|
|
|
|
BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); |
|
|
|
|
// 计算子订单支付金额
|
|
|
|
|
BigDecimal childPrice = childObject.getBigDecimal("price").add(profitPrice).setScale(2 , RoundingMode.HALF_UP); |
|
|
|
|
BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP); |
|
|
|
|
if (childPrice.compareTo(childObject.getBigDecimal("originPrice")) > 0) { |
|
|
|
|
childPrice = childObject.getBigDecimal("originPrice"); |
|
|
|
|
} |
|
|
|
@ -2041,9 +2048,13 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
childOrder.setGoodsName(memberProduct.getName()); |
|
|
|
|
childOrder.setSaleCount(1); |
|
|
|
|
childOrder.setGoodsPrice(marketPrice); |
|
|
|
|
|
|
|
|
|
childOrder.setGoodsActualPrice(orderPayPrice); |
|
|
|
|
childOrder.setTotalPrice(orderPayPrice); |
|
|
|
|
if (object.getLong("memDiscountId") != null) { |
|
|
|
|
childOrder.setGoodsActualPrice(marketPrice); |
|
|
|
|
childOrder.setTotalPrice(marketPrice); |
|
|
|
|
} else { |
|
|
|
|
childOrder.setGoodsActualPrice(orderPayPrice); |
|
|
|
|
childOrder.setTotalPrice(orderPayPrice); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
highChildOrderMapper.insert(childOrder); |
|
|
|
|
|
|
|
|
@ -2053,6 +2064,7 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
HighDiscountUserRel highDiscountUserRel = null; |
|
|
|
|
// 判断是否有优惠券
|
|
|
|
|
if (object.getLong("memDiscountId") != null) { |
|
|
|
|
orderPayPrice = marketPrice; |
|
|
|
|
// 优惠券信息
|
|
|
|
|
highDiscountUserRel = highDiscountUserRelService.getRelById(object.getLong("memDiscountId")); |
|
|
|
|
highOrder.setMemDiscountId(object.getLong("memDiscountId")); |
|
|
|
@ -2067,7 +2079,6 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 使用优惠券
|
|
|
|
|
// 优惠券抵扣
|
|
|
|
|
if (highDiscountUserRel != null) { |
|
|
|
|
highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName()); |
|
|
|
@ -2097,7 +2108,6 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
|
|
|
|
|
// 使用优惠券
|
|
|
|
|
if (highOrder.getMemDiscountId() != null) { |
|
|
|
|
orderPayPrice = marketPrice; |
|
|
|
|
HighDiscountUserRel discountUserRel = highDiscountUserRelService.getRelById(highOrder.getMemDiscountId()); |
|
|
|
|
discountUserRel.setUseTime(new Date()); // 使用时间
|
|
|
|
|
discountUserRel.setStatus(2); //状态 0:已过期 1:未使用 2:已使用
|
|
|
|
|