Browse Source

修复除不尽异常

QuYueTing 8 tháng trước cách đây
mục cha
commit
06103c0c1c

+ 15 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -13746,7 +13746,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     if(afterSetPlanHour>0){
                                         planHour=planHour-afterSetPlanHour;
                                     }
-                                    item.put("process",percentFormat.format(realHour/planHour));
+                                    if (planHour == 0) {
+                                        item.put("process", "0.00%");
+                                    } else {
+                                        item.put("process", percentFormat.format(realHour / planHour));
+                                    }
                                 }else {
                                     item.put("planHour",0);
                                     item.put("realHour",0);
@@ -13801,7 +13805,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     if(afterSetPlanHour>0){
                                         planHour=planHour-afterSetPlanHour;
                                     }
-                                    item.put("process",percentFormat.format(realHour/planHour));
+                                    if (planHour == 0) {
+                                        item.put("process", "0.00%");
+                                    } else {
+                                        item.put("process", percentFormat.format(realHour / planHour));
+                                    }
                                 }else {
                                     item.put("planHour",0);
                                     item.put("realHour",0);
@@ -13858,7 +13866,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     if(afterSetPlanHour>0){
                                         planHour=planHour-afterSetPlanHour;
                                     }
-                                    item.put("process",percentFormat.format(realHour/planHour));
+                                    if (planHour == 0) {
+                                        item.put("process", "0.00%");
+                                    } else {
+                                        item.put("process", percentFormat.format(realHour / planHour));
+                                    }
                                 }else {
                                     item.put("planHour",0);
                                     item.put("realHour",0);