Procházet zdrojové kódy

税费保留两位小数

chao před 4 roky
rodič
revize
7c497c2443

+ 3 - 3
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -62,7 +62,7 @@ public class PriceUtilService {
             boolean taxFlag = 0 == tax.getIncludedTax() && 1 == tax.getInvoiceType() || 2 == tax.getInvoiceType();
             //添加税费
             if (taxFlag) {
-                BigDecimal taxFee = MathUtil.div(MathUtil.mul(ladderPrices.get(i).getBuyPrice(), tax.getTaxPoint()), 100);
+                BigDecimal taxFee = MathUtil.div(MathUtil.mul(ladderPrices.get(i).getBuyPrice(), tax.getTaxPoint()), 100, 2);
                 ladderPrices.get(i).setBuyPrice(MathUtil.add(ladderPrices.get(i).getBuyPrice(),taxFee).doubleValue());
             }
             if (i == ladderPrices.size() - 1) {
@@ -110,7 +110,7 @@ public class PriceUtilService {
                     price.setPrice(promotions.getTouchPrice());
                     //添加税费
                     if (taxFlag) {
-                        BigDecimal taxFee = MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), price.getTaxRate()), 100);
+                        BigDecimal taxFee = MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), price.getTaxRate()), 100, 2);
                         promotions.setTouchPrice(MathUtil.add(promotions.getTouchPrice(),taxFee).doubleValue());
                     }
                 }
@@ -142,7 +142,7 @@ public class PriceUtilService {
             }
             //添加税费
             if (taxFlag) {
-                BigDecimal thisTaxFee = MathUtil.div(MathUtil.mul(price.getPrice(), price.getTaxRate()), 100);
+                BigDecimal thisTaxFee = MathUtil.div(MathUtil.mul(price.getPrice(), price.getTaxRate()), 100, 2);
                 price.setPrice(MathUtil.add(price.getPrice(), thisTaxFee).doubleValue());
             }
         } else {