Procházet zdrojové kódy

正常工时修改,餐补计算逻辑修改

QuYueTing před 5 hodinami
rodič
revize
9cacf516bc
17 změnil soubory, kde provedl 218 přidání a 180 odebrání
  1. 7 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/OvertimeAllowanceController.java
  2. 69 45
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  3. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserCorpwxTimeController.java
  4. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WxCorpInfoController.java
  5. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/OvertimeAllowance.java
  6. 1 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java
  7. 55 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  8. 35 24
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java
  9. 2 2
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/OvertimeAllowanceMapper.xml
  10. 6 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml
  11. 0 3
      fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json
  12. 0 3
      fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json
  13. 14 7
      fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue
  14. 1 1
      fhKeeper/formulahousekeeper/timesheet/src/views/project/gantt.vue
  15. 0 80
      fhKeeper/formulahousekeeper/timesheet/src/views/project/project_gantt.vue
  16. 3 3
      fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue
  17. 22 6
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

+ 7 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/OvertimeAllowanceController.java

@@ -115,7 +115,7 @@ public class OvertimeAllowanceController {
         boolean noRecords = false;
         if (departmentId != null) {
             // 部门以及子部门
-            List<Department> allDepts = departmentService.list(new QueryWrapper<Department>().eq("company_id", departmentId));
+            List<Department> allDepts = departmentService.list(new QueryWrapper<Department>().eq("company_id", companyId));
             List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(departmentId, allDepts);
             if (deptIds.size() > 0) {
                 List<User> deptUsers = userMapper.selectList(new QueryWrapper<User>().in("department_id", deptIds));
@@ -273,7 +273,7 @@ public class OvertimeAllowanceController {
         boolean noRecords = false;
         List<String> corpwxUserids = null;
         if (departmentId != null) {
-            List<Department> allDepts = departmentService.list(new QueryWrapper<Department>().eq("company_id", departmentId));
+            List<Department> allDepts = departmentService.list(new QueryWrapper<Department>().eq("company_id", companyId));
             List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(departmentId, allDepts);
             if (deptIds.size() > 0) {
                 List<User> deptUsers = userMapper.selectList(new QueryWrapper<User>().in("department_id", deptIds));
@@ -730,6 +730,11 @@ public class OvertimeAllowanceController {
                             crossMidnightStr = "否";
                             comment = "全天加班";
                             break;
+                        case 5:
+                            typeStr = "白班";
+                            crossMidnightStr = "是";
+                            comment = "加班过凌晨4点,餐补 50 元";
+                            break;
                         default:
                             comment = String.valueOf(allowance.getType());
                     }

+ 69 - 45
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -1281,7 +1281,12 @@ public class ReportController {
                             if (comTimeType.getReportAuditType() == 3) {
                                 report.setAuditorSetting(auditorSettingList.get(i));
                             }
-                            setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                            String errorMsg = setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                            if (errorMsg != null) {
+                                HttpRespMsg msg = new HttpRespMsg();
+                                msg.setError(errorMsg);
+                                return msg;
+                            }
                             if (taskId != null && taskId[i] != null && taskId[i] != 0) {
                                 report.setTaskId(taskId[i]);
                             }
@@ -1341,7 +1346,12 @@ public class ReportController {
                                 if (comTimeType.getReportAuditType() == 3) {
                                     report.setAuditorSetting(auditorSettingList.get(i));
                                 }
-                                setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                                String errorMsg = setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                                if (errorMsg != null) {
+                                    HttpRespMsg msg = new HttpRespMsg();
+                                    msg.setError(errorMsg);
+                                    return msg;
+                                }
                                 if (taskId != null && taskId[i] != null && taskId[i] != 0) {
                                     report.setTaskId(taskId[i]);
                                 }
@@ -1401,7 +1411,12 @@ public class ReportController {
                         if (comTimeType.getReportAuditType() == 3) {
                             report.setAuditorSetting(auditorSettingList.get(i));
                         }
-                        setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                        String errorMsg = setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                        if (errorMsg != null) {
+                            HttpRespMsg msg = new HttpRespMsg();
+                            msg.setError(errorMsg);
+                            return msg;
+                        }
                         if (taskId != null && taskId[i] != null && taskId[i] != 0) {
                             report.setTaskId(taskId[i]);
                         }
@@ -1472,7 +1487,12 @@ public class ReportController {
                             } else {
                                 //并非并行审核模式下的代填,需要设置审核状态
                                 report.setState(0);
-                                setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                                String errorMsg = setReportWorkflowAuditor(auditWorkflowList, allDeptList, report,comTimeType);
+                                if (errorMsg != null) {
+                                    HttpRespMsg msg = new HttpRespMsg();
+                                    msg.setError(errorMsg);
+                                    return msg;
+                                }
                             }
                             if (taskId != null && taskId[i] != null && taskId[i] != 0) {
                                 report.setTaskId(taskId[i]);
@@ -1566,15 +1586,16 @@ public class ReportController {
                             double overTimeSum = reportList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId())).mapToDouble(Report::getOvertimeHours).sum();
                             UserCorpwxTime userCorpwxTime = userCorpwxTimeMapper.selectOne(new QueryWrapper<UserCorpwxTime>().ne("ot_status", 0).eq("corpwx_userid", curReporter.getCorpwxUserid()).eq("create_date", report.getCreateDate()));
                             if(overTimeSum > 0){
+                                double allowMoreThan = (company.getId() == Constant.XI_HE_CHAO_DAO_COMPANY_ID || company.getId() == Constant.XI_HE_CHAO_DAO_JIA_XING_COMPANY_ID) ? 2.001 : 0.001;//允许超过打卡中的加班时长的范围
                                 if (company.getPackageOvertime() == 1) {//启用了加班管理模块,去校验加班申请的时长
                                     Overtime overtime = overtimeMapper.selectOne(new QueryWrapper<Overtime>().select("sum(duration) as duration").eq("user_id", curReporter.getId()).eq("date", report.getCreateDate()).ne("status", -1).ne("status", 3).ne("status", 4));
                                     if (overtime == null) {
-                                        httpRespMsg.setError("请先补填加班申请单");
+                                        httpRespMsg.setError("尚无审核通过的加班单");
                                         return httpRespMsg;
                                     } else {
                                         double applyOvertime = 1.0*overtime.getDuration()/3600;//转化为小时
-                                        if (overTimeSum - applyOvertime > 0.001) {
-                                            httpRespMsg.setError("填报加班时长不得超过加班申请时长("+applyOvertime+"h)");
+                                        if (overTimeSum - applyOvertime > allowMoreThan) {
+                                            httpRespMsg.setError("填报加班时长不得超过加班申请时长("+applyOvertime+"h)" + (allowMoreThan > 0.001? "+2h" : ""));
                                             return httpRespMsg;
                                         }
                                     }
@@ -1582,9 +1603,11 @@ public class ReportController {
                                     if (userCorpwxTime == null || userCorpwxTime.getOtTime() == 0) {
                                         httpRespMsg.setError("未同步到企微加班时长,请先补填加班申请");
                                         return httpRespMsg;
-                                    } else if (overTimeSum - userCorpwxTime.getOtTime() > 0.001) {
-                                        httpRespMsg.setError("填报加班时长("+overTimeSum+"h)不得超过考勤加班时长("+userCorpwxTime.getOtTime()+"h)");
-                                        return httpRespMsg;
+                                    } else {
+                                        if (overTimeSum - userCorpwxTime.getOtTime() > allowMoreThan) {
+                                            httpRespMsg.setError("填报加班时长("+overTimeSum+"h)不得超过考勤加班时长("+userCorpwxTime.getOtTime()+"h)" + (allowMoreThan > 0.001? "+2h" : ""));
+                                            return httpRespMsg;
+                                        }
                                     }
                                 }
                             }
@@ -1874,38 +1897,28 @@ public class ReportController {
                     }
                 }
                 //针对羲合超导-合肥,校验加班时长不得超过加班申请单的时长。同理,只要加班申请单有记录就校验。不然不校验。
-                if (Constant.XI_HE_CHAO_DAO_COMPANY_ID == company.getId()) {
-                    //查找当前的填报的加班时长和数据库中的加班时长
-                    if (overtime > 0) {
-                        //存在加班时长的情况下,才去校验
-                        Overtime sumOverTimeApply = overtimeMapper.selectOne(new QueryWrapper<Overtime>().select("sum(duration) duration").eq("date", cDate).eq("user_id", creatorId));
-                        if (sumOverTimeApply != null) {
-                            if (sumOverTimeApply.getDuration() != null) {
-                                if (sumOverTimeApply.getDuration() < overtime*3600) {
-                                    HttpRespMsg httpRespMsg = new HttpRespMsg();
-                                    httpRespMsg.setError("合计加班时长"+overtime+"h不得超过加班申请单的时长"+sumOverTimeApply.getDuration()/3600+"h");
-                                    return httpRespMsg;
-                                } else {
-                                    //去查找数据库中已经填报的加班时长
-                                    Report oldReportSum = reportMapper.selectOne(new QueryWrapper<Report>().select("sum(overtime_hours) as overTime").eq("create_date", cDate).eq("creator_id", creatorId).gt("overtime_hours", 0));
-                                    if (oldReportSum != null) {
-                                        if (oldReportSum.getOvertimeHours() != null) {
-                                            if ((oldReportSum.getOvertimeHours() + overtime) * 3600 > sumOverTimeApply.getDuration()) {
-                                                HttpRespMsg httpRespMsg = new HttpRespMsg();
-                                                httpRespMsg.setError("合计加班时长"+(oldReportSum.getOvertimeHours() + overtime)+"h不得超过加班申请单的时长"+sumOverTimeApply.getDuration()/3600+"h");
-                                                return httpRespMsg;
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        } else {
-                            HttpRespMsg httpRespMsg = new HttpRespMsg();
-                            httpRespMsg.setError(cDate.toString()+"的加班申请单不存在,无法填报加班日报");
-                            return httpRespMsg;
-                        }
-                    }
-                }
+//                if (Constant.XI_HE_CHAO_DAO_COMPANY_ID == company.getId()) {
+//                    //查找当前的填报的加班时长和数据库中的加班时长
+//                    if (overtime > 0) {
+//                        //存在加班时长的情况下,才去校验
+//                        Overtime sumOverTimeApply = overtimeMapper.selectOne(new QueryWrapper<Overtime>().select("sum(duration) duration").eq("date", cDate).eq("user_id", creatorId));
+//                        if (sumOverTimeApply != null) {
+//                            if (sumOverTimeApply.getDuration() != null) {
+//                                if (sumOverTimeApply.getDuration() < overtime*3600) {
+//                                    HttpRespMsg httpRespMsg = new HttpRespMsg();
+//                                    httpRespMsg.setError("合计加班时长"+overtime+"h不得超过加班申请单的时长"+sumOverTimeApply.getDuration()/3600+"h");
+//                                    return httpRespMsg;
+//                                } else {
+//
+//                                }
+//                            }
+//                        } else {
+//                            HttpRespMsg httpRespMsg = new HttpRespMsg();
+//                            httpRespMsg.setError(cDate.toString()+"的加班申请单不存在,无法填报加班日报");
+//                            return httpRespMsg;
+//                        }
+//                    }
+//                }
 
                 //HardCode:对于正北两家公司,校验填报工时不得少于考勤时长。(代填的不校验)
                 if ((SysConstant.ZhengBeiCompIds.contains(company.getId())) && (report.getFillUserid() == null || creatorId.equals(report.getFillUserid()))) {
@@ -2457,6 +2470,12 @@ public class ReportController {
             for (Report report : reportList) {
                 Optional<Project> first = projectList.stream().filter(pl -> pl.getId().equals(report.getProjectId())).findFirst();
                 if (first.isPresent()) {
+                    LocalDate planStartDate = first.get().getPlanStartDate();
+                    if (planStartDate != null && planStartDate.isAfter(report.getCreateDate())) {
+                        HttpRespMsg msg = new HttpRespMsg();
+                        msg.setError("项目["+first.get().getProjectName()+"]于"+dateTimeFormatter.format(planStartDate)+"开始,不得提前填报");
+                        return msg;
+                    }
                     LocalDate planEndDate = first.get().getPlanEndDate();
                     if (planEndDate != null && planEndDate.isBefore(report.getCreateDate())) {
                         HttpRespMsg msg = new HttpRespMsg();
@@ -2513,9 +2532,8 @@ public class ReportController {
             if (companySetAutoApprove) {
                 List<String> reportIds = reportList.stream().map(Report::getId).map(String::valueOf).collect(Collectors.toList());
                 //直接修改状态为审核通过
-//            reportMapper.update(new Report().setState(1), new LambdaQueryWrapper<Report>().in(Report::getId, reportIds));
                 String rIds = reportIds.stream().collect(Collectors.joining(","));
-                approveReport(rIds, 0, request, null);
+                reportService.autoApproveReport(rIds);
             } else if (company.getId() == 862 || company.getId() == 3344 || company.getId() == 936 || comTimeType.getAutoProjectApprove()) {
                 //项目审核人是提交人的情况,直接审核
                 List<String> reportIds = new ArrayList<>();
@@ -2790,7 +2808,8 @@ public class ReportController {
         }
     }
 
-    private void setReportWorkflowAuditor(List<AuditWorkflowTimeSetting> auditWorkflowList, List<Department> allDeptList, Report report, TimeType comTimeType) {
+    private String setReportWorkflowAuditor(List<AuditWorkflowTimeSetting> auditWorkflowList, List<Department> allDeptList, Report report, TimeType comTimeType) {
+        String errorMsg = null;
         //增加没有开通审批流的判断
         if (comTimeType.getReportWorkflow() == 0 || comTimeType.getReportAuditType() > 1 || auditWorkflowList.size() == 0) {
             //没有自定义审核流,默认的直接是项目负责人审核
@@ -2824,8 +2843,13 @@ public class ReportController {
                 } else {
                     report.setAuditDeptManagerid(curDeptManagerId);
                 }
+                if (report.getAuditDeptManagerid() == null) {
+                    //没有设置好审核人
+                    errorMsg = "员工所在部门尚未设置主要负责人";
+                }
             }
         }
+         return errorMsg;
     }
 
     /**

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserCorpwxTimeController.java

@@ -1779,7 +1779,7 @@ public class UserCorpwxTimeController {
                 //解析返回错误了,需要中断直接返回。
                 return staffAllocationMsg;
             }
-            List<Map<String, Object>> staffAllocationResult = (List<Map<String, Object>>)msg.data;
+            List<Map<String, Object>> staffAllocationResult = (List<Map<String, Object>>)staffAllocationMsg.data;
             //检查系统中是否存在表格中员工没有参与的项目
             List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
             List<Participation> participationList = participationMapper.selectList(new QueryWrapper<Participation>().in("project_id", projectList.stream().map(Project::getId).collect(Collectors.toList())));

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WxCorpInfoController.java

@@ -198,7 +198,7 @@ public class WxCorpInfoController {
             queryWrapper.eq("creator_id", userId);
         }
         List<Report> reportList = reportMapper.selectList(queryWrapper);
-        int time = reportList.size() / 100 + 1;
+        int time = reportList.size() / 1000 + 1;
         wxCorpInfoService.handleUserAllowanceByReport(reportList);
         msg.msg = "刷新餐补任务进行中...,请稍后检查报表, 大约需要" + time + "分钟";
         return msg;

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/OvertimeAllowance.java

@@ -84,7 +84,7 @@ public class OvertimeAllowance extends Model<OvertimeAllowance> {
     private Integer companyId;
 
     /**
-     * 0-白班加班3.0小时, 1- 白班加班超过12点,2-小夜班,3-大夜班,4-非工作日加班,全天加班
+     * 0-白班加班3.0小时, 1- 白班加班超过12点,2-小夜班,3-大夜班,4-非工作日加班,全天加班, 跨天并且是第二天凌晨4点以后下班,补贴50
      */
     @TableField("type")
     private Integer type;

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java

@@ -51,6 +51,7 @@ public interface ReportService extends IService<Report> {
                                HttpServletRequest request);
 
     HttpRespMsg approveReport(String reportIds, Integer isDepartment, HttpServletRequest request,String evaluate);
+    HttpRespMsg autoApproveReport(String reportIds);
 
     HttpRespMsg denyReport(String date, String reportIds, String reason, Integer isDepartment, HttpServletRequest request);
 

+ 55 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -1585,7 +1585,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 if (wxCorpInfo != null) {
                     List<String> auditorCorpwxUserids = new ArrayList<>();
                     for (Report report : reportList) {
-                        String corpwxUserid = userMapper.selectById((report.getIsDeptAudit() == null || report.getIsDeptAudit() == 0)?report.getProjectAuditorId():report.getAuditDeptManagerid()).getCorpwxUserid();
+                        User auditor = userMapper.selectById((report.getIsDeptAudit() == null || report.getIsDeptAudit() == 0)?report.getProjectAuditorId():report.getAuditDeptManagerid());
+                        if (auditor == null) {
+                            System.err.println("审核人尚未设置,report.getIsDeptAudit()="+report.getIsDeptAudit()+", report.getProjectAuditorId()="+report.getProjectAuditorId() + ", report.getAuditDeptManagerid()="+report.getAuditDeptManagerid() + ", deptId=" + report.getDeptId());
+                        }
+                        String corpwxUserid = auditor.getCorpwxUserid();
                         //推送到企业微信
                         JSONObject json=new JSONObject();
                         JSONArray dataJson=new JSONArray();
@@ -3754,6 +3758,56 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         return httpRespMsg;
     }
 
+    @Override
+    public HttpRespMsg autoApproveReport(String reportIds) {
+        //默认按照项目日报审核人的模式进行审核
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String token = request.getHeader("TOKEN");
+        User userCompany = userMapper.selectById(token);
+        Integer companyId = userCompany.getCompanyId();
+        Company company = companyMapper.selectById(companyId);
+        final List<Integer> ids = ListUtil.convertIntegerIdsArrayToList(reportIds);
+        Report oneReport = reportMapper.selectById(ids.get(0));
+        reportMapper.update(new Report().setState(1).setProjectAuditState(1).setProjectAuditTime(LocalDateTime.now()),
+                new QueryWrapper<Report>().in("id", ids));
+
+        List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().in("id", ids));
+        List<Integer> collect = reportList.stream().map(rl -> rl.getProjectId()).distinct().collect(Collectors.toList());
+        List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", collect));
+        List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+        String pNames = projectList.stream().map(Project::getProjectName).collect(Collectors.joining(", ", "[", "]"));
+        //按项目拆分,每个项目审核一次
+        for (Project project : projectList) {
+            Report curReport = reportList.stream().filter(one->one.getProjectId().equals(project.getId())).findFirst().get();
+            User auditor = userList.stream().filter(u->u.getId().equals(curReport.getProjectAuditorId())).findFirst().orElse(null);
+            if (auditor != null) {
+                ReportAuditLog log = new ReportAuditLog();
+                log.setAuditChannel(0);
+                log.setCompanyId(company.getId());
+                log.setResult(MessageUtils.message("profession.approved"));
+                log.setUserId(auditor.getId());
+                log.setUserName(auditor.getName());
+                log.setProjectName(pNames);
+                if (pNames.length() > 2000) {
+                    log.setProjectName(pNames.substring(0, 2000));
+                }
+                reportAuditLogMapper.insert(log);
+                //员工的日期
+                ReportAlogMembdate membdate = new ReportAlogMembdate();
+                membdate.setRlogId(log.getId());
+                membdate.setState(1);//通过
+                membdate.setCreateDate(oneReport.getCreateDate());
+                membdate.setUserId(oneReport.getCreatorId());
+                membdate.setUserName(userMapper.selectById(oneReport.getCreatorId()).getName());
+                reportAlogMembdateMapper.insert(membdate);
+
+                //日报的审核过程记录
+                saveApproveReportLog(company.getId(), reportList, auditor.getId(), auditor.getName());
+            }
+        }
+        return httpRespMsg;
+    }
+
 
     private String getTokenOfYiWei(){
         String url = "http://183.194.0.98:3202/api/web-server/controlCenter/token";

+ 35 - 24
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1215,23 +1215,37 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     public void handleUserAllowanceByReport(List<Report> reportList) {
         //从reportList中按照createDate和creatorId进行分组,去重,得到一个新的reportList, 里面的createDate和creatorId组合都是唯一的
         List<Report> distinctReportList = new ArrayList<>();
+        List<String> distinctUserIds = new ArrayList<>();
+
         for (Report report : reportList) {
             if (!distinctReportList.stream().anyMatch(r -> r.getCreatorId().equals(report.getCreatorId()) && r.getCreateDate().equals(report.getCreateDate()))) {
                 distinctReportList.add(report);
+                if (!distinctUserIds.contains(report.getCreatorId())) {
+                    distinctUserIds.add(report.getCreatorId());
+                }
             }
         }
+        LocalDate minDate = distinctReportList.stream().min(Comparator.comparing(Report::getCreateDate)).get().getCreateDate();
+        LocalDate maxDate = distinctReportList.stream().max(Comparator.comparing(Report::getCreateDate)).get().getCreateDate();
+
+        List<Report> sumReportList = reportMapper.selectList(new QueryWrapper<Report>()
+                .select("creator_id,create_date, sum(overtime_hours) as overtime_hours")
+                .in("creator_id", distinctUserIds).between("create_date", minDate, maxDate).ne("state", 2).groupBy("creator_id,create_date"));//驳回的不算
+        List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", distinctUserIds));
+        List<String> corpwxUserIds = userList.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
+        List<UserCorpwxTime> userCorpwxTimes = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().in("corpwx_userid", corpwxUserIds).between("create_date", minDate, maxDate));
         for (Report item : distinctReportList) {
             String userId = item.getCreatorId();
             LocalDate date = item.getCreateDate();
             //查询日报的合计加班时长
-            Report report = reportMapper.selectOne(new QueryWrapper<Report>().select("sum(overtime_hours) as overtime_hours").eq("creator_id", userId).eq("create_date", date));
-            double reportOvertime = report == null ? 0 : report.getOvertimeHours();
-            User user = userMapper.selectById(userId);
-            UserCorpwxTime userCorpwxTime = userCorpwxTimeMapper.selectOne(new QueryWrapper<UserCorpwxTime>().eq("corpwx_userid", user.getCorpwxUserid()).eq("create_date", date));
+            double reportOvertime = sumReportList.stream().filter(r -> r.getCreatorId().equals(userId) && r.getCreateDate().equals(date)).findFirst().map(Report::getOvertimeHours).orElse(0.0);
+            User user = userList.stream().filter(u -> u.getId().equals(userId)).findFirst().orElse(null);
+            UserCorpwxTime userCorpwxTime = userCorpwxTimes.stream().filter(u -> u.getCorpwxUserid().equals(user.getCorpwxUserid()) && u.getCreateDate().equals(date)).findFirst().orElse(null);
             if (userCorpwxTime != null) {
                 handleAllowance(userCorpwxTime, "08:00", "12:00", "13:00", "17:00", 1.0, reportOvertime);
             }
         }
+
     }
 
     private void handleAllowance(UserCorpwxTime userCorpwxTime, String baseMorningStart, String baseMorningEnd, String baseAfternoonStart, String baseAfternoonEnd, double restTime, double reportOvertime) {
@@ -1240,25 +1254,27 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         allowance.setCompanyId(userCorpwxTime.getCompanyId());
         allowance.setCorpwxUserid(userCorpwxTime.getCorpwxUserid());
         allowance.setDate(userCorpwxTime.getCreateDate());
+        allowance.setOvertimeDuration(reportOvertime);
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyy-MM-dd HH:mm");
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
         LocalDateTime startTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate()) + " " + userCorpwxTime.getStartTime(), df);
         String endTimeStr = userCorpwxTime.getEndTime();
         boolean isNextDay = endTimeStr.startsWith("次日") || endTimeStr.compareTo(userCorpwxTime.getStartTime()) < 0;
-        LocalDateTime endTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate()) + " " + userCorpwxTime.getEndTime(), df);
+        LocalDateTime endTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate()) + " " + userCorpwxTime.getEndTime().replace("次日", ""), df);
         if (isNextDay) {
-            endTime = endTime.plusDays(1);
-        }
-        if (startTime.toLocalTime().isBefore(LocalTime.parse(baseMorningStart,timeFormatter))) {
-            //上班时间校准为正常上班开始时间
-            startTime.withHour(Integer.parseInt(baseMorningStart.split(":")[0])).withMinute(Integer.parseInt(baseMorningStart.split(":")[1])).withSecond(0).withNano(0);
+            endTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate().plusDays(1)) + " " + userCorpwxTime.getEndTime().replace("次日", ""), df);
+        } else {
+            endTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate()) + " " + userCorpwxTime.getEndTime(), df);
         }
+//        if (startTime.toLocalTime().isBefore(LocalTime.parse(baseMorningStart,timeFormatter))) {
+//            //上班时间校准为正常上班开始时间
+//            startTime.withHour(Integer.parseInt(baseMorningStart.split(":")[0])).withMinute(Integer.parseInt(baseMorningStart.split(":")[1])).withSecond(0).withNano(0);
+//        }
         allowance.setStartTime(startTime);
         allowance.setEndTime(endTime);
         String startTimeTxt = userCorpwxTime.getStartTime();
         String endTimeTxt = userCorpwxTime.getEndTime();
-        //判断是否是加班
         BigDecimal bigDecimal = new BigDecimal(Duration.between(startTime,endTime).toMinutes());
         bigDecimal = bigDecimal.divide(BigDecimal.valueOf(60),1,BigDecimal.ROUND_HALF_UP);//按小时为单位
         double standWorkHours = 8.0;
@@ -1285,19 +1301,21 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     //当天加班,补贴20
                     if (endTime.toLocalDate().compareTo(startTime.toLocalDate()) == 0) {
                         allowance.setType(0);
-                        allowance.setOvertimeDuration(reportOvertime);
                         allowance.setAllowance(20);
                     } else {
                         //跨天,加班超过凌晨了,补贴30
-                        allowance.setType(1);
-                        allowance.setOvertimeDuration(reportOvertime);
-                        allowance.setAllowance(30);
+                        //跨天并且是第二天凌晨4点以后下班,补贴50
+                        if (endTimeTxt.compareTo("04:00") >= 0) {
+                            allowance.setType(5);
+                            allowance.setAllowance(50);
+                        } else {
+                            allowance.setType(1);
+                            allowance.setAllowance(30);
+                        }
                     }
                 } else {
                     //不足3小时
-//                        System.out.println("工作日加班不足3小时:"+(time - standWorkHours));
                     allowance.setType(-1);
-                    allowance.setOvertimeDuration(reportOvertime);
                     allowance.setAllowance(0);
                 }
             } else if (startTimeTxt.compareTo("16:00") >= 0) {
@@ -1305,12 +1323,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                 if (time >= 12.0) {
                     //大夜班,超过12小时了
                     allowance.setType(3);
-                    allowance.setOvertimeDuration(reportOvertime);
                     allowance.setAllowance(50);
                 } else if (time >= standWorkHours && endTime.toLocalDate().isAfter(startTime.toLocalDate())) {//工作超过凌晨了
                     //小夜班,补贴30
                     allowance.setType(2);
-                    allowance.setOvertimeDuration(reportOvertime);
                     allowance.setAllowance(30);
                 }
             }
@@ -1321,12 +1337,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                 if (startTimeTxt.compareTo(baseMorningEnd) < 0) {
                     if (endTime.toLocalDate().isEqual(startTime.toLocalDate())) {
                         allowance.setType(4);
-                        allowance.setOvertimeDuration(reportOvertime);
                         allowance.setAllowance(20);
                     } else {
                         //加班超过凌晨了
                         allowance.setType(1);
-                        allowance.setOvertimeDuration(reportOvertime);
                         allowance.setAllowance(30);
                     }
                 } else if (startTimeTxt.compareTo("16:00") >= 0) {
@@ -1334,19 +1348,16 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     if (time >= 12.0) {
                         //大夜班,超过12小时了
                         allowance.setType(3);
-                        allowance.setOvertimeDuration(reportOvertime);
                         allowance.setAllowance(50);
                     } else if (time >= standWorkHours){
                         //跨天,加班超过凌晨了,补贴30
                         allowance.setType(2);
-                        allowance.setOvertimeDuration(reportOvertime);
                         allowance.setAllowance(30);
                     }
                 }
             } else if (reportOvertime >= 3.0) {
                 //加班工作时长超过3小时,补20元
                 allowance.setType(0);
-                allowance.setOvertimeDuration(reportOvertime);
                 allowance.setAllowance(20);
             }
         }

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/OvertimeAllowanceMapper.xml

@@ -80,8 +80,8 @@
             SUM(work_hours)         AS work_hours,
             SUM(overtime_duration)  AS overtime_duration,
             SUM(allowance)          AS allowance,
-        -- 夜班补贴:type = 1、2、3
-        SUM(CASE WHEN type IN (1,2,3) THEN allowance ELSE 0 END) AS night_allowance,
+        -- 夜班补贴:type = 1、2、3、5
+        SUM(CASE WHEN type IN (1,2,3, 5) THEN allowance ELSE 0 END) AS night_allowance,
         -- 餐补:其他所有情况
         SUM(CASE WHEN type NOT IN (1,2,3) THEN allowance ELSE 0 END) AS meal_allowance
         FROM overtime_allowance

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -1965,6 +1965,12 @@
         FROM report r
         INNER JOIN user u ON r.creator_id = u.id
         WHERE r.company_id = #{companyId}
+        <if test="state != null">
+            AND r.state = #{state}
+        </if>
+        <if test="state == null">
+            AND (r.state = 0 or r.state = 1 or r.state = 2)
+        </if>
         <if test="startDate != null and startDate != ''">
             AND r.create_date &gt;= #{startDate}
         </if>

+ 0 - 3
fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json

@@ -1458,8 +1458,6 @@
   "twolayer": "2 layer",
   "an-ren-yuan-cha-kan": "According to personnel needs",
   "an-xiang-mu-cha-kan": "View by project",
-  "zi-yuan-xu-qiu": "resource requirements",
-  "zi-yuan-xu-qiu-dao-ru-mo-ban": "Import a template for resource requirements",
   "dao-ru-xu-qiu": "Import demand",
   "dao-chu-xu-qiu": "Export demand",
   "jin-qi-ri-huo-yue-ren-yuan": "Active staff for seven days",
@@ -1472,7 +1470,6 @@
   "chu-cha": "evection",
   "xuan-xiang-1": "Option 1",
   "xuan-xiang-2": "Option 2",
-  "zi-yuan-xu-qiu-dao-chu": "Exporting Resource Requirements",
   "bumenchanyuqingkuang": "Project information of the departments involved",
   "can-yu-de-xiang-mu-de-shu-liang": "number of projects involved",
   "can-yu-ren-ci": "Number of participants",

+ 0 - 3
fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json

@@ -1464,8 +1464,6 @@
   "threelayer": "3层",
   "an-ren-yuan-cha-kan": "按人员查看",
   "an-xiang-mu-cha-kan": "按项目查看",
-  "zi-yuan-xu-qiu": "资源需求",
-  "zi-yuan-xu-qiu-dao-ru-mo-ban": "资源需求导入模板",
   "dao-ru-xu-qiu": "导入需求",
   "dao-chu-xu-qiu": "导出需求",
   "jin-qi-ri-huo-yue-ren-yuan": "近七日活跃人员",
@@ -1477,7 +1475,6 @@
   "bu-men-jin-du": "部门进度",
   "xuan-xiang-1": "选项1",
   "xuan-xiang-2": "选项2",
-  "zi-yuan-xu-qiu-dao-chu": "资源需求导出",
   "chu-cha": "出差",
   "bumenchanyuqingkuang": "部门参与项目情况表",
   "can-yu-de-xiang-mu-de-shu-liang": "参与的项目的数量",

+ 14 - 7
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -2211,6 +2211,8 @@
                             ? "白班"
                             : scope.row.type == 4
                             ? "白班"
+                            : scope.row.type == 5
+                            ? "白班"
                             : "-"
                         }}
                       </template>
@@ -5493,6 +5495,8 @@
                         ? "白班"
                         : scope.row.type == 4
                         ? "白班"
+                        : scope.row.type == 5
+                        ? "白班"
                         : "-"
                     }}
                   </template>
@@ -5507,7 +5511,8 @@
                     {{
                       scope.row.type == 1 ||
                       scope.row.type == 2 ||
-                      scope.row.type == 3
+                      scope.row.type == 3 || 
+                      scope.row.type == 5 //白班,跨天到第二天凌晨4点以后
                         ? "是"
                         : "否"
                     }}
@@ -5567,6 +5572,8 @@
                         ? "大夜班,补贴 50 元"
                         : scope.row.type == 4
                         ? "全天加班"
+                        : scope.row.type == 5
+                        ? "加班过凌晨4点,餐补 50 元"
                         : "-"
                     }}
                   </template>
@@ -8753,11 +8760,7 @@ export default {
       } else if (this.ins == 5) {
         this.getProjectStages();
       } else if (this.ins == 6) {
-        if (
-          this.user.companyId == 8555 ||
-          this.user.companyId == 5792 ||
-          this.user.companyId == 10
-        ) {
+        if (this.user.companyId == 8555 || this.user.companyId == 5792) {
           this.getMealAllowance(false);
         } else {
           this.overTime();
@@ -8853,7 +8856,11 @@ export default {
         this.getAbnormalWorkHours();
       }
       if (this.ins == 36) {
-        this.getMealAllowance();
+        if (this.allowanceTabActive === "detail") {
+          this.getMealAllowance();
+        } else {
+          this.getMealAllowanceSummary();
+        }
       }
       if (this.ins == 37) {
         this.getDailyWorkHours();

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/gantt.vue

@@ -178,7 +178,7 @@ export default {
         month_full: [this.$t('yiYue'), this.$t('erYue'), this.$t('sanYue'), this.$t('siYue'), this.$t('thisTWuyue'), this.$t('liuYue'), this.$t('qiYue'), this.$t('baYue'), this.$t('jiuYue'), this.$t('shiYue'), this.$t('shiYiYue'), this.$t('shiErYue')],
         month_short: [this.$t('1Yue'), this.$t('2Yue'), this.$t('3Yue'), this.$t('4Yue'), this.$t('5Yue'), this.$t('6Yue'), this.$t('7Yue'), this.$t('8Yue'), this.$t('9Yue'), this.$t('10Yue'), this.$t('11Yue'), this.$t('12Yue')],
         day_full: [this.$t('xingQiRi'), this.$t('xingQiYi'), this.$t('xingQiEr'), this.$t('xingQiSan'), this.$t('xingQiSi'), this.$t('xingQiWu'), this.$t('xingQiLiu')],
-        day_short: [this.$t('ri'), "一", "二", "三", "四", "五", "六"]
+        day_short: ['日', "一", "二", "三", "四", "五", "六"]
       },
       labels: {
         dhx_cal_today_button: this.$t('jinTian'),

+ 0 - 80
fhKeeper/formulahousekeeper/timesheet/src/views/project/project_gantt.vue

@@ -6,9 +6,7 @@
           <el-radio-group v-model="radio1" @change="selChange()" size="small">
             <el-radio-button :label="$t('an-ren-yuan-cha-kan')" value="renyuan"></el-radio-button>
             <el-radio-button :label="$t('an-xiang-mu-cha-kan')" value="xiangmu"></el-radio-button>
-            <el-radio-button :label="$t('zi-yuan-xu-qiu')" value="demand"></el-radio-button>
           </el-radio-group>
-          <!-- <el-checkbox v-if="radio1 != $t('zi-yuan-xu-qiu') && user.companyId == 876" v-model="justWaitForMe" style="margin-left: 14px;" @change="selChange()">待我审核</el-checkbox> -->
         </div>
       </div>
       <!-- 时间段筛选  -->
@@ -62,18 +60,6 @@
           </el-select>
           <selectCat v-if="!reqpar1 && user.userNameNeedTranslate == '1'" style="margin-left:9px;" :size="'small'" :widthStr="'153'" :subject="screenList" :subjectId="valuex" :distinction="'1'" @selectCal="selectCal"></selectCat>
       </div>
-      <!-- 资源需求导入/导出 -->
-      <div class="head_files" v-if="!isDataLoaded">
-        <div style="margin-left:10px;float:left;">
-          <el-link type="primary" :underline="false" :href="'./upload/'+$t('zi-yuan-xu-qiu-dao-ru-mo-ban')+'.xlsx'" download="资源需求导入模板.xlsx">{{ $t('Downloadthetemplate') }}</el-link>
-        </div>
-        <el-upload ref="upload" style="margin-left:10px;float:left;" action="#" :limit="1" :http-request="importProject" :show-file-list="false">
-          <el-link type="primary" :underline="false" >{{ $t('dao-ru-xu-qiu') }}</el-link>
-        </el-upload>
-        <div style="margin-left:10px;float:left;">
-        <el-link type="primary" :underline="false" @click="exportProjectData" download="资源需求导出.xlsx">{{ $t('dao-chu-xu-qiu') }}</el-link>
-        </div>
-      </div>
     </div>
 
     <gantt v-if="isDataLoaded && user.userNameNeedTranslate != 1" ref="ganttTable1" class="left-container" :tasks="tasks" 
@@ -269,72 +255,6 @@ export default {
         
         this.getList()
       },
-      // 资源需求导出
-      exportProjectData() {
-        let parameter = {}
-        if(this.valuex){
-          parameter.projectId = this.valuex
-        }
-        if(this.valuex2){
-          parameter.groupName = this.valuex2
-        }
-                this.http.post('/project-requirement/exportData',parameter,
-                res => {
-                    if (res.code == "ok") {
-                        let filePath = res.data;
-                        const a = document.createElement('a'); // 创建a标签
-                        a.setAttribute('download', this.$t('zi-yuan-xu-qiu-dao-chu')+'.xlsx');// download属性
-                        a.setAttribute('href', filePath);// href链接
-                        a.click(); //自执行点击事件
-                        a.remove();
-                    } 
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                    }
-                );
-            },
-      // 资源需求导入
-      importProject(item) {
-                //首先判断文件类型
-                let str = item.file.name.split(".");
-                let format = str[str.length - 1];
-                if (format != "xls" && format != "xlsx") {
-                    this.$message({
-                        message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
-                        type: "error"
-                    });
-                } else {
-                    let formData = new FormData();
-                    formData.append("multipartFile", item.file);
-                    this.http.uploadFile('/project-requirement/importData', formData,
-                    res => {
-                        this.$refs.upload.clearFiles();
-                        if (res.code == "ok") {
-                            this.$message({
-                                message: this.$t('other.importSuccess'),
-                                type: "success"
-                            });
-                            this.getDemandList();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: "error"
-                            });
-                        }
-                    },
-                    error => {
-                        this.$refs.upload.clearFiles();
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    });
-                }
-            },
       // 人员/项目切换
       selChange(){
         this.valuex = null

+ 3 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -779,7 +779,7 @@
               }}<el-input-number
                 v-model="timeType.reportAutoApproveDays"
                 style="width: 150px; margin: 0 10px"
-                min="1"
+                min="0"
               ></el-input-number
               >{{ $t("dyas") }}
             </el-form-item>
@@ -3850,9 +3850,9 @@ export default {
               ? this.timeType.customDataMaxValue
               : 100;
             this.timeType.reportAutoApproveDays = this.timeType
-              .reportAutoApproveDays
+              .reportAutoApproveDays != null
               ? this.timeType.reportAutoApproveDays
-              : 1;
+              : 0;
             this.timeType.stopReport = this.timeType.stopReport ? true : false;
             this.timeType.notAllowedOnNonWorkday = this.timeType
               .notAllowedOnNonWorkday

+ 22 - 6
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -513,7 +513,14 @@
                     <!--加班申请时长-->
                     <el-form-item label="已通过加班申请" v-if="workForm.overtime"><span style="color:#FFA500;">{{ workForm.overtime.toFixed(1) }} h</span></el-form-item>
                     <!-- 000000 -->
-                    <div v-for="(domain, index) in workForm.domains" :key="domain.id" class="time_box" :style="index>0?'border-top: none;':''" >
+                    <div v-for="(domain, index) in workForm.domains" :key="domain.id" class="time_box" >
+                        <div class="time_title">
+                            <i class="el-icon-plus"></i> <span>项目&nbsp;{{index+1}}</span>
+                            <el-link v-if="(index >= 1 || workForm.domains.length > 1)&&domain.canEdit"  :underline="false" @click="delDomain(index)" style="position:absolute;right:15px;"
+                                :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
+                                <i class="el-icon-close" style="font-size:18px;"></i>
+                            </el-link>
+                        </div>
                         <div v-if="reportTimeType.multiWorktime==0">
                         <template v-if="user.timeType.timeInputNormal">
                             <el-form-item v-if="!(permissions.reportHideWorkingHours && workForm.domains[index].state == 1)" label="正常工时" :prop="'domains.' + index + '.'+timeFields[reportTimeType.type]"
@@ -655,10 +662,6 @@
                                 @click="getProjectRemainingTime(workForm.domains[index])"></el-button>
                             </template>
                             
-                            <el-link v-if="(index >= 1 || workForm.domains.length > 1)&&domain.canEdit" type="primary" :underline="false" @click="delDomain(index)" style="float:right;margin-right:15%;"
-                                :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
-                                <i class="fa fa-trash" style="color: red;;font-size:18px;"></i>
-                            </el-link>
                             <!-- <el-link type="primary" v-if="canEdit"
                                 :underline="false" style="margin-left:10px;" @click="copyProject(index)">复制</el-link> -->
                             <!--针对柘中,显示项目对应的工程分类-->
@@ -11041,6 +11044,19 @@
         box-shadow: 0 6px 20px 0 rgba(102, 126, 234, 0.6);
     }
     .time_box {
-        padding-top:15px;border:0.5px dashed #ddd;margin-right:20px;
+        margin-right:15px;
+    }
+    .time_title {
+        margin: 0px;
+        background: #f3f3f3;
+        margin-bottom:15px;
+        font-size:13px;
+        padding:0 0 0 39px;
+        display: flex;
+        align-items: center;
+        height: 30px;
+        box-sizing: border-box;
+        position: relative;
+        border-radius: 4px;
     }
 </style>