diff --git a/framework/src/main/java/cn/lili/common/utils/CurrencyUtil.java b/framework/src/main/java/cn/lili/common/utils/CurrencyUtil.java index 6b1b9aa2..aa030d6e 100644 --- a/framework/src/main/java/cn/lili/common/utils/CurrencyUtil.java +++ b/framework/src/main/java/cn/lili/common/utils/CurrencyUtil.java @@ -36,9 +36,9 @@ public final class CurrencyUtil { return result.doubleValue(); } /** - * 提供精确的加法运算。 + * 提供精确的减法运算。 * - * @return 累加之和 + * @return 第一个参数为被减数,其余数字为减数 */ public static Double sub(double... params) { BigDecimal result = BigDecimal.valueOf(params[0]); diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java index dcc9ce66..67872901 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java @@ -309,7 +309,7 @@ public class PriceDetailDTO implements Serializable { } public Double getUpdatePrice() { - if (updatePrice == null || updatePrice <= 0) { + if (updatePrice == null) { return 0D; } return updatePrice; diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderPriceServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderPriceServiceImpl.java index dfb0bbd0..0210ffcf 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderPriceServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderPriceServiceImpl.java @@ -16,6 +16,7 @@ import cn.lili.modules.order.order.service.OrderPriceService; import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.payment.kit.plugin.bank.BankTransferPlugin; import cn.lili.modules.system.aspect.annotation.SystemLogPoint; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -29,6 +30,7 @@ import java.util.List; * @author Chopper * @since 2020/11/17 7:36 下午 */ +@Slf4j @Service public class OrderPriceServiceImpl implements OrderPriceService { @@ -106,10 +108,8 @@ public class OrderPriceServiceImpl implements OrderPriceService { //订单修改金额=使用订单原始金额-修改后金额 orderPriceDetailDTO.setUpdatePrice(CurrencyUtil.sub(orderPrice, orderPriceDetailDTO.getOriginalPrice())); order.setFlowPrice(orderPriceDetailDTO.getFlowPrice()); - order.setPriceDetail(JSONUtil.toJsonStr(orderPriceDetailDTO)); - //修改订单 - order.setPriceDetail(JSONUtil.toJsonStr(orderPriceDetailDTO)); + order.setPriceDetailDTO(orderPriceDetailDTO); orderService.updateById(order); //修改子订单