瀏覽代碼

人员工时分配

cs 2 年之前
父節點
當前提交
cbafff6b29

+ 14 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -5784,14 +5784,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         }
         List<Map<String, Object>> list = projectMapper.getUserWorkingTimeList(userId, user.getCompanyId(), startDate, endDate, projectId,start,size,branchDepartment,deptIds);
         long total=projectMapper.findCountWithUser(userId, user.getCompanyId(), startDate, endDate, projectId,null,null,departmentId,deptIds);
-        list.forEach(li->{
-            double isPublic = (double) li.get("isPublic");
-            double workingTime = (double) li.get("workingTime");
-            BigDecimal bdIsPublic=new BigDecimal(isPublic);
-            BigDecimal divide = bdIsPublic.divide(BigDecimal.valueOf(workingTime),2,BigDecimal.ROUND_HALF_UP);
-            NumberFormat nf = NumberFormat.getPercentInstance();
-            li.put("proportion",nf.format(divide));
-        });
         Integer companyId = user.getCompanyId();
         WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
         List<LeaveSheet> leaveSheet = leaveSheetMapper.selectLeave(companyId,startDate,endDate);
@@ -5838,7 +5830,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
 //            System.err.println("总时间为:"+leaveSum);
             map.put("leaveSum",leaveSum + "h");
+            double workTimeDouble = Double.parseDouble(map.get("workingTime").toString()) + leaveSum;
+            BigDecimal workTimeBig = new BigDecimal(workTimeDouble);
+            map.put("workingTime",workTimeBig.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
         }
+        list.forEach(li->{
+            double isPublic = (double) li.get("isPublic");
+            double workingTime = (double) li.get("workingTime");
+            BigDecimal bdIsPublic=new BigDecimal(isPublic);
+            BigDecimal divide = bdIsPublic.divide(BigDecimal.valueOf(workingTime),2,BigDecimal.ROUND_HALF_UP);
+            NumberFormat nf = NumberFormat.getPercentInstance();
+            li.put("proportion",nf.format(divide));
+        });
         HashMap map=new HashMap();
         map.put("total",total);
         map.put("result",list);
@@ -5922,6 +5925,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
 //            System.err.println("总时间为:"+leaveSum);
             item.put("leaveSum",leaveSum + "h");
+            double workTimeDouble = Double.parseDouble(item.get("workingTime").toString()) + leaveSum;
+            BigDecimal workTimeBig = new BigDecimal(workTimeDouble);
+            item.put("workingTime",workTimeBig.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
             List<String> subList=new ArrayList<>();
             double isPublic = (double) item.get("isPublic");
             double workingTime = (double) item.get("workingTime");