Explorar el Código

double 计算小数问题

lem hace 4 años
padre
commit
377391dc68

+ 6 - 9
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtilCalculate.java

@@ -755,17 +755,14 @@ public class ExportUtilCalculate {
                     //摊入
 //                    powerEqmMater = powerValueTotal+powerInstallFee;//===所有的设备价值+安装费+材料费
                     if (Double.valueOf(transferOfPower2.getPowerValue())!=0.0){
-                        BigDecimal bigDecimal = new BigDecimal(transferOfPower2.getPowerValue());
-                        BigDecimal bigDecimal1 = BigDecimal.valueOf(powerInstallFee);
-                        BigDecimal bigDecimal2 = new BigDecimal(erpCredit.getOtherTotalFee());
-                        int i = bigDecimal.compareTo(BigDecimal.ZERO);
-                        int i1 = bigDecimal1.compareTo(BigDecimal.ZERO);
-                        if (i1 == 0) {
+                        Double aDouble = Double.valueOf(transferOfPower2.getPowerValue());
+                        Double b = Double.valueOf(erpCredit.getOtherTotalFee());
+                        if (powerInstallFee == 0) {
                             powerStandInFee = 0.0;
                         } else {
-                            BigDecimal divide = bigDecimal.divide(bigDecimal1, 2, BigDecimal.ROUND_HALF_UP);
-                            BigDecimal multiply = divide.multiply(bigDecimal2);
-                            powerStandInFee = multiply.doubleValue();
+                            double v = aDouble / powerInstallFee;
+                            double v1 = v * b;
+                            powerStandInFee = v1;
                         }
                     }else {
                         powerStandInFee =0.0;