zhangxin 1 月之前
父節點
當前提交
1bd10fba2c
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      prod-line-imes/src/main/java/com/huaxia/imes/service/MesLineService.java

+ 3 - 2
prod-line-imes/src/main/java/com/huaxia/imes/service/MesLineService.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.format.TextStyle;
@@ -368,10 +369,10 @@ public class MesLineService extends ServiceImpl<MesLineMapper, MesLine> implemen
                     Integer workerQty = (Integer) lineEntry.getValue().get("每日工作人数");
                     //计算平均人均产出
                     if (workerQty > 0) {
-                        BigDecimal averageOutputPerPerson = BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(workerQty), 1, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal averageOutputPerPerson = BigDecimal.valueOf(totalOutput).divide(BigDecimal.valueOf(workerQty), 0, RoundingMode.HALF_UP);
                         lineEntry.getValue().put("人均产出", averageOutputPerPerson);
                     } else {
-                        lineEntry.getValue().put("人均产出", 0.0);
+                        lineEntry.getValue().put("人均产出", BigDecimal.ZERO);
                     }
                 }
             }