zouxuan 4 years ago
parent
commit
42ae9548ff

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -774,7 +774,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             sellOrder.setOrderId(orderByOrderNo.getId());
             sellOrder.setOrderNo(orderByOrderNo.getOrderNo());
             //获取比例
-            BigDecimal ratioAmount = goodsSellDto.getTotalGoodsPrice().divide(totalAmount, 6, BigDecimal.ROUND_HALF_UP);
+            BigDecimal ratioAmount = goodsSellDto.getTotalGoodsPrice().divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP);
 
             //如果有减免金额
             if(marketAmount.doubleValue() > 0l){
@@ -783,7 +783,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                     goodsSellDto.setTotalGoodsPrice(goodsSellDto.getTotalGoodsPrice().subtract(usableMarketAmount));
                 }else {
                     //获取分配的减免金额
-                    BigDecimal multiply = ratioAmount.multiply(usableMarketAmount);
+                    BigDecimal multiply = ratioAmount.multiply(usableMarketAmount).setScale(2,BigDecimal.ROUND_HALF_UP);
                     goodsSellDto.setTotalGoodsPrice(goodsSellDto.getTotalGoodsPrice().subtract(multiply));
                     usableMarketAmount = usableMarketAmount.subtract(multiply);
                 }
@@ -800,9 +800,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                     sellOrder.setBalanceAmount(usableBalance);
                 }else {
                     //获取分配的余额
-                    BigDecimal multiply = ratioAmount.multiply(balancePaymentAmount);
+                    BigDecimal multiply = ratioAmount.multiply(balancePaymentAmount).setScale(2,BigDecimal.ROUND_HALF_UP);
                     //分配的实际支付
-                    BigDecimal multiply1 = ratioAmount.multiply(realityAmount);
+                    BigDecimal multiply1 = ratioAmount.multiply(realityAmount).setScale(2,BigDecimal.ROUND_HALF_UP);
                     sellOrder.setActualAmount(multiply1);
                     sellOrder.setBalanceAmount(multiply);
                     usableAmount = usableAmount.subtract(multiply1);