Commit d1873f624060a5269378e6ee48690b0f3bd4d8e6
1 parent
933c3b08
update:商品计算总价修正
Showing
1 changed file
with
12 additions
and
10 deletions
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
@@ -1408,9 +1408,6 @@ public class OrderServiceImpl implements OrderService { | @@ -1408,9 +1408,6 @@ public class OrderServiceImpl implements OrderService { | ||
1408 | for(Long shopId :orderCreateDtos.keySet()){ | 1408 | for(Long shopId :orderCreateDtos.keySet()){ |
1409 | if(first){ | 1409 | if(first){ |
1410 | first = false; | 1410 | first = false; |
1411 | - orderCreateDtos.get(shopId).setTransportFee(multipleOrderDto.getTransportFee()); | ||
1412 | - orderCreateDtos.get(shopId).setTotleAmount(multipleOrderDto.getTotleAmount().add(multipleOrderDto.getTransportFee())); | ||
1413 | - orderCreateDtos.get(shopId).setTotlePayAmount(multipleOrderDto.getTotlePayAmount().add(multipleOrderDto.getTransportFee())); | ||
1414 | Order order = this.createOrder(orderCreateDtos.get(shopId), OrderOrderType.BUYER_ORDER.getCodeInteger(),true); | 1411 | Order order = this.createOrder(orderCreateDtos.get(shopId), OrderOrderType.BUYER_ORDER.getCodeInteger(),true); |
1415 | orders.add(order); | 1412 | orders.add(order); |
1416 | }else{ | 1413 | }else{ |
@@ -1524,6 +1521,10 @@ public class OrderServiceImpl implements OrderService { | @@ -1524,6 +1521,10 @@ public class OrderServiceImpl implements OrderService { | ||
1524 | Map<Long,OrderCreateDto> orderCreateDtoMap = new HashMap<>(); | 1521 | Map<Long,OrderCreateDto> orderCreateDtoMap = new HashMap<>(); |
1525 | BigDecimal totleAmount = new BigDecimal(0).setScale(2, RoundingMode.HALF_UP); | 1522 | BigDecimal totleAmount = new BigDecimal(0).setScale(2, RoundingMode.HALF_UP); |
1526 | Long tempShopid = 0L; | 1523 | Long tempShopid = 0L; |
1524 | + //配送情况增加计算运费 | ||
1525 | + if(multipleOrderDto.getAchieveType().equals(OrderAchieveType.SELLER_DELIVERY.getCodeInteger())){ | ||
1526 | + totleAmount = totleAmount.add(multipleOrderDto.getTransportFee()); | ||
1527 | + } | ||
1527 | for (ProductDto productDto : multipleOrderDto.getProductDtoList()){ | 1528 | for (ProductDto productDto : multipleOrderDto.getProductDtoList()){ |
1528 | for(ShopCartMessage shopCartMessage : messages){ | 1529 | for(ShopCartMessage shopCartMessage : messages){ |
1529 | if(shopCartMessage.getId().equals(productDto.getShopCertMessageId())){ | 1530 | if(shopCartMessage.getId().equals(productDto.getShopCertMessageId())){ |
@@ -1557,6 +1558,9 @@ public class OrderServiceImpl implements OrderService { | @@ -1557,6 +1558,9 @@ public class OrderServiceImpl implements OrderService { | ||
1557 | orderCreateDto.setTotlePayAmount(new BigDecimal(0).setScale(2, RoundingMode.HALF_UP)); | 1558 | orderCreateDto.setTotlePayAmount(new BigDecimal(0).setScale(2, RoundingMode.HALF_UP)); |
1558 | orderCreateDto.setUserMark(multipleOrderDto.getUserMark()); | 1559 | orderCreateDto.setUserMark(multipleOrderDto.getUserMark()); |
1559 | orderCreateDtoMap.put(orderCreateDto.getShopId(),orderCreateDto); | 1560 | orderCreateDtoMap.put(orderCreateDto.getShopId(),orderCreateDto); |
1561 | + BigDecimal transportFee = new BigDecimal(multipleOrderDto.getTransportFee().toString()); | ||
1562 | + orderCreateDto.setTransportFee(transportFee); | ||
1563 | + multipleOrderDto.setTransportFee(multipleOrderDto.getTransportFee().subtract(transportFee)); | ||
1560 | } | 1564 | } |
1561 | orderCreateDto.getProductDtoList().add(productDto); | 1565 | orderCreateDto.getProductDtoList().add(productDto); |
1562 | orderCreateDto.setTotleAmount(orderCreateDto.getTotlePayAmount().add(productDto.getProductTotalPrice())); | 1566 | orderCreateDto.setTotleAmount(orderCreateDto.getTotlePayAmount().add(productDto.getProductTotalPrice())); |
@@ -1566,10 +1570,7 @@ public class OrderServiceImpl implements OrderService { | @@ -1566,10 +1570,7 @@ public class OrderServiceImpl implements OrderService { | ||
1566 | 1570 | ||
1567 | tempShopid = productDto.getShopId(); | 1571 | tempShopid = productDto.getShopId(); |
1568 | } | 1572 | } |
1569 | - //配送情况增加计算运费 | ||
1570 | - if(multipleOrderDto.getAchieveType().equals(OrderAchieveType.SELLER_DELIVERY.getCodeInteger())){ | ||
1571 | - totleAmount = totleAmount.add(multipleOrderDto.getTransportFee()); | ||
1572 | - } | 1573 | + |
1573 | //订单总价,与订单总重效验 | 1574 | //订单总价,与订单总重效验 |
1574 | if(!(multipleOrderDto.getTotleAmount().compareTo(totleAmount)==0)){ | 1575 | if(!(multipleOrderDto.getTotleAmount().compareTo(totleAmount)==0)){ |
1575 | throw new OrderException(OrderErrorCode.PARAM_ERROR,"商品交易总价计算异常"); | 1576 | throw new OrderException(OrderErrorCode.PARAM_ERROR,"商品交易总价计算异常"); |
@@ -1585,9 +1586,10 @@ public class OrderServiceImpl implements OrderService { | @@ -1585,9 +1586,10 @@ public class OrderServiceImpl implements OrderService { | ||
1585 | throw new OrderException(OrderErrorCode.PARAM_ERROR,"商品待付总价计算异常"); | 1586 | throw new OrderException(OrderErrorCode.PARAM_ERROR,"商品待付总价计算异常"); |
1586 | } | 1587 | } |
1587 | }else{ | 1588 | }else{ |
1588 | - if(multipleOrderDto.getTotleDiscount().compareTo(NumberTransform.ZERO) > 0){ | ||
1589 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"多店铺订单无法使用优惠"); | ||
1590 | - } | 1589 | + throw new OrderException(OrderErrorCode.PARAM_ERROR,"多店铺订单暂不支持"); |
1590 | +// if(multipleOrderDto.getTotleDiscount().compareTo(NumberTransform.ZERO) > 0){ | ||
1591 | +// throw new OrderException(OrderErrorCode.PARAM_ERROR,"多店铺订单无法使用优惠"); | ||
1592 | +// } | ||
1591 | } | 1593 | } |
1592 | return orderCreateDtoMap; | 1594 | return orderCreateDtoMap; |
1593 | } | 1595 | } |