修改订单价格时,订单update price字段问题处理
This commit is contained in:
parent
cb0a9121e5
commit
7164036d4c
@ -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]);
|
||||
|
@ -309,7 +309,7 @@ public class PriceDetailDTO implements Serializable {
|
||||
}
|
||||
|
||||
public Double getUpdatePrice() {
|
||||
if (updatePrice == null || updatePrice <= 0) {
|
||||
if (updatePrice == null) {
|
||||
return 0D;
|
||||
}
|
||||
return updatePrice;
|
||||
|
@ -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);
|
||||
|
||||
//修改子订单
|
||||
|
Loading…
x
Reference in New Issue
Block a user