Pārlūkot izejas kodu

管理员可以撤回部门负责人审核的日报

seyason 2 gadi atpakaļ
vecāks
revīzija
3d8b8fdd22

+ 13 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -130,6 +130,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     @Resource
     WxCorpInfoMapper wxCorpInfoMapper;
     @Resource
+    SysFunctionService sysFunctionService;
+    @Resource
     private InformationServiceImpl informationService;
     @Resource
     private ProjectNotifyUserMapper projectNotifyUserMapper;
@@ -2118,8 +2120,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         }
         Report oneReport = reportMapper.selectById(ids.get(0));
         if(timeType.getReportAuditType()==5){
-            if(!user.getId().equals(oneReport.getAuditDeptManagerid())){
-                httpRespMsg.setError("非当前日报所属人员所在部门主要负责人");
+            //日报审核类型为5时,只有日报所属人员所在部门主要负责人或者有审核全公司日报的权限才能审核
+            Integer roleId = user.getRoleId();
+            boolean canAuditAllReport = sysFunctionService.hasPriviledge(roleId, "审核全员日报");
+            if(!user.getId().equals(oneReport.getAuditDeptManagerid()) && !canAuditAllReport){
+                httpRespMsg.setError("您无权操作权限");
                 return httpRespMsg;
             }
         }
@@ -5792,6 +5797,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             if (user.getIsActive() == 0 && i.isAfter(user.getInactiveDate())){
                 continue;
             }
+            //跳过入职日期以前的日期
+            if (user.getIsActive() == 1 && user.getInductionDate() != null && i.isBefore(user.getInductionDate())){
+                continue;
+            }
             Boolean workDay = timeTypeService.isWorkDay(user.getCompanyId(), i);
             if (workDay){
                 Double workTime = 0.0;
@@ -5809,6 +5818,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     Double fillHour = monthVO.getAllday() - workTime;
                     //将fillHour平均分配到每个项目
                     Double fillHourPerProject = fillHour / projectIds.size();
+                    //保留小数点后1位
+                    fillHourPerProject = new BigDecimal(fillHourPerProject).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
                     //遍历项目
                     double sumHours = 0;
                     for (int pIndex = 0; pIndex<projectIds.size(); pIndex++) {