| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | |
| | | double money = 0; |
| | | for (OrderDetail orderDetail : OrderDetails) { |
| | | orderDetail = updateOrderMoneyComputed(orderDetail,order.getCalculateType()); |
| | | money+= orderDetail.getGrossAmount(); |
| | | BigDecimal getGrossAmount= BigDecimal.valueOf(orderDetail.getGrossAmount()); |
| | | money+=getGrossAmount.doubleValue(); |
| | | } |
| | | |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | if(orderOtherMoney.getQuantity()!=null && orderOtherMoney.getPrice()!=null){ |
| | | orderOtherMoney.setMoney((orderOtherMoney.getQuantity()*orderOtherMoney.getPrice())); |
| | |
| | | } |
| | | |
| | | private OrderDetail updateOrderMoneyComputed(OrderDetail orderDetail, Integer calculateType) { |
| | | BigDecimal getPrice= BigDecimal.valueOf(orderDetail.getPrice()); |
| | | BigDecimal getQuantity= BigDecimal.valueOf(orderDetail.getQuantity()); |
| | | BigDecimal getComputeGrossArea= BigDecimal.valueOf(orderDetail.getComputeGrossArea()); |
| | | if (calculateType == 3) { |
| | | orderDetail.setGrossAmount(orderDetail.getPrice() * orderDetail.getQuantity()); |
| | | orderDetail.setGrossAmount(getPrice.multiply(getQuantity).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } else { |
| | | orderDetail.setGrossAmount(orderDetail.getComputeGrossArea() * orderDetail.getPrice()); |
| | | orderDetail.setGrossAmount(getPrice.multiply(getComputeGrossArea).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | return orderDetail; |
| | | } |