修改订单价格时,订单update price字段问题处理

This commit is contained in:
Chopper 2022-01-21 14:34:05 +08:00
parent cb0a9121e5
commit 7164036d4c
3 changed files with 6 additions and 6 deletions

View File

@ -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]);

View File

@ -309,7 +309,7 @@ public class PriceDetailDTO implements Serializable {
}
public Double getUpdatePrice() {
if (updatePrice == null || updatePrice <= 0) {
if (updatePrice == null) {
return 0D;
}
return updatePrice;

View File

@ -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);
//修改子订单