Selaa lähdekoodia

通用版按周填报模式

QuYueTing 1 viikko sitten
vanhempi
commit
ca660c6d62

+ 25 - 26
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -2510,44 +2510,43 @@ public class ReportController {
                         msg.setError("补考勤下班时间必须大于上班时间");
                         return msg;
                     }
-                } else {
-                    //跨天,不可超过24小时间隔
-                    if (abnormalEndTime.compareTo(abnormalStartTime) >= 0) {
-                        HttpRespMsg msg = new HttpRespMsg();
-                        msg.setError("跨天上下班不可超过24小时");
-                        return msg;
-                    }
                 }
             }
         }
         HttpRespMsg httpRespMsg = reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId(), summary, weeklyAttachment, abnormalStartTime, abnormalEndTime, abnormalEndDay);
         //填报自动通过功能:【上海绎维】、【火石演示】、【博通容合】、【威派格】使用;以及设置了自动审核通过的公司
         //开启了按时间自动审核的功能,直接通过
-        boolean companySetAutoApprove = comTimeType.getReportAutoApprove() == 1 && comTimeType.getReportAutoApproveDays() == 0;
-        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));
-        } else if (company.getId() == 862 || company.getId() == 3344 || company.getId() == 936 || comTimeType.getAutoProjectApprove()) {
-            //项目审核人是提交人的情况,直接审核
-            List<String> reportIds = new ArrayList<>();
-            for (int i = 0; i<id.length; i++) {
-                Integer oneId = id[i];
-                if (oneId == -1) {
-                    Report report = reportList.get(i);
-                    if (report.getState() == 0) {//部门也直接审核通过
-                        if ((report.getCreatorId().equals(report.getProjectAuditorId()) || (comTimeType.getAutoProjectApprove() && report.getIsDeptAudit() == 1 && report.getAuditDeptManagerid().equals(report.getCreatorId())))) {
-                            reportIds.add(report.getId().toString());
+        if (draft == 0) {
+            //提交了(非草稿),检查是否要自动审核通过
+            boolean companySetAutoApprove = comTimeType.getReportAutoApprove() == 1 && comTimeType.getReportAutoApproveDays() == 0;
+            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);
+            } else if (company.getId() == 862 || company.getId() == 3344 || company.getId() == 936 || comTimeType.getAutoProjectApprove()) {
+                //项目审核人是提交人的情况,直接审核
+                List<String> reportIds = new ArrayList<>();
+                for (int i = 0; i<id.length; i++) {
+                    Integer oneId = id[i];
+                    if (oneId == -1) {
+                        Report report = reportList.get(i);
+                        if (report.getState() == 0) {//部门也直接审核通过
+                            if ((report.getCreatorId().equals(report.getProjectAuditorId()) || (comTimeType.getAutoProjectApprove() && report.getIsDeptAudit() == 1 && report.getAuditDeptManagerid().equals(report.getCreatorId())))) {
+                                reportIds.add(report.getId().toString());
+                            }
                         }
                     }
                 }
-            }
-            if (reportIds.size() > 0) {
-                String rIds = reportIds.stream().collect(Collectors.joining(","));
-                approveReport(rIds, 0, request, null);
+                if (reportIds.size() > 0) {
+                    String rIds = reportIds.stream().collect(Collectors.joining(","));
+                    approveReport(rIds, 0, request, null);
+                }
             }
         }
 
+
         String estimateWarningMsg = "";
         if (estimateTimeSetting != null) {
             if (!StringUtils.isEmpty(warningLackProjects)) {

+ 6 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -275,12 +275,12 @@ public class TaskController {
                         return msg;
                     }
                     //计算当前分组下的所有任务的计划工时
-                    List<Task> taskList = taskMapper.selectList(new LambdaQueryWrapper<Task>().select(Task::getPlanHours).eq(Task::getGroupId, taskGroup.getId()).isNotNull(Task::getPlanHours).ne(task.getId()!=null,Task::getId,task.getId()));
-                    int sum = taskList.stream().mapToInt(Task::getPlanHours).sum();
-                    if((sum+(task.getPlanHours()==null?0:task.getPlanHours()))>(taskGroup.getManDay()*8)){
-                        msg.setError("任务分组的预估工时不足,请增加预估工时");
-                        return msg;
-                    }
+//                    List<Task> taskList = taskMapper.selectList(new LambdaQueryWrapper<Task>().select(Task::getPlanHours).eq(Task::getGroupId, taskGroup.getId()).isNotNull(Task::getPlanHours).ne(task.getId()!=null,Task::getId,task.getId()));
+//                    int sum = taskList.stream().mapToInt(Task::getPlanHours).sum();
+//                    if((sum+(task.getPlanHours()==null?0:task.getPlanHours()))>(taskGroup.getManDay()*8)){
+//                        msg.setError("任务分组的预估工时不足,请增加预估工时");
+//                        return msg;
+//                    }
                 }
             }
             //检查执行人是否在当前分组的参与人当中

+ 1 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ExcelParserService.java

@@ -193,8 +193,7 @@ public class ExcelParserService {
         String[] startParts = startTime.split(":");
         boolean isEndNextDay = endTime.startsWith("次日");
         if (endTime.startsWith("次日")) {
-            endTime = endTime.substring(3);
-            System.out.println("去掉次日后="+endTime);
+            endTime = endTime.substring(2).trim();
         }
         String[] endParts = endTime.split(":");
 

+ 0 - 250
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ExcelParserService.java~

@@ -1,250 +0,0 @@
-package com.management.platform.service;
-
-import com.management.platform.entity.UserCorpwxTime;
-import com.management.platform.util.DateTimeUtil;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.List;
-
-@Service
-public class ExcelParserService {
-
-    public List<UserCorpwxTime> parseAttendanceExcel(MultipartFile file, boolean onlyReduceRestTime) throws IOException {
-        List<UserCorpwxTime> attendanceList = new ArrayList<>();
-
-        try (Workbook workbook = new XSSFWorkbook(file.getInputStream())) {
-            Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
-
-            // 获取表头行
-            Row headerRow = sheet.getRow(0);
-            // 从第二行开始解析数据(假设第一行是表头)
-            boolean isHandlingNightWork = false;
-            for (int i = 2; i <= sheet.getLastRowNum(); i++) {
-                Row row = sheet.getRow(i);
-                if (row == null) continue;
-
-                // 获取姓名和部门
-                String name = getCellValue(row.getCell(0));
-                // 从第4列开始是日期列
-                for (int col = 3; col < row.getLastCellNum(); col++) {
-                    Cell dateCell = headerRow.getCell(col);
-                    Cell timeCell = row.getCell(col);
-
-                    if (dateCell == null || timeCell == null) continue;
-
-                    // 解析日期(格式如:03-01\n周六)
-                    String dateStr = getCellValue(dateCell);
-                    String[] dateParts = dateStr.split("\n");
-                    if (dateParts.length < 1) continue;
-
-                    // 假设年份是当前年(可能需要根据实际情况调整)
-                    String monthDay = dateParts[0];
-                    int year = LocalDate.now().getYear();
-                    LocalDate date = LocalDate.parse(year + "-" + monthDay, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-
-                    // 解析时间记录
-                    String timeRecord = getCellValue(timeCell);
-                    if (timeRecord == null || timeRecord.isEmpty() || "-".equals(timeRecord)) {
-                        continue;
-                    }
-
-                    // 分割时间记录(可能有多个打卡时间)
-                    String[] times = timeRecord.split("\n");
-                    if (isHandlingNightWork) {
-                        // 如果是处理夜班工作,忽略12:00前的打卡
-                        times = java.util.Arrays.stream(times)
-                                .filter(t -> t.compareTo("12:00") >= 0)
-                                .toArray(String[]::new);
-                        isHandlingNightWork = false;
-                    }
-
-                    if (times.length == 1) {
-                        if (times[0].length() > "00:00".length()) {
-                            //去掉后面的秒
-                            times[0] = times[0].substring(0, "00:00".length());
-                        }
-                        //当前只有一次打卡,可能是晚班,要获取次日最晚打卡作为下班打卡。
-                        if (times[0].compareTo("18:00") > 0) {
-                            String sTime = times[0];
-                            //次日最晚打卡
-                            Cell nextDateCell = headerRow.getCell(col + 1);
-                            String nextDateStr = getCellValue(nextDateCell);
-                            if (!StringUtils.isEmpty(nextDateStr)) {
-                                Cell nextDayTime = row.getCell(col + 1);
-                                String nextDayTimeStr = getCellValue(nextDayTime);
-                                if (!StringUtils.isEmpty(nextDayTimeStr) && !"-".equals(nextDayTimeStr)) {
-                                    String[] nextDayTimes = nextDayTimeStr.split("\n");
-                                    //取次日12点前的最晚打卡
-                                    nextDayTimes = java.util.Arrays.stream(nextDayTimes)
-                                            .filter(t -> t.compareTo("12:00") < 0)
-                                            .toArray(String[]::new);
-                                    if (nextDayTimes.length > 0) {
-                                        //次日上午打卡结束
-                                        String nextDayEndTime = "次日"+nextDayTimes[nextDayTimes.length -1];
-                                        times = new String[2];
-                                        times[0] = sTime;
-                                        times[1] = nextDayEndTime;
-                                        isHandlingNightWork = true;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    if (times.length < 2) continue;
-
-                    // 取第一个和最后一个时间作为上班和下班时间
-                    String startTime = times[0];
-                    String endTime = times[times.length - 1];
-
-                    // 创建考勤记录对象
-                    UserCorpwxTime attendance = new UserCorpwxTime();
-                    attendance.setName(name);
-                    attendance.setCreateDate(date);
-                    attendance.setStartTime(startTime);
-                    attendance.setEndTime(endTime);
-
-                    // 计算工作时长(这里简化处理,实际需要更精确的计算)
-                    if (startTime != null && endTime != null) {
-                        try {
-                            double workHours = calculateZhengBeiWorkHours(startTime, endTime, onlyReduceRestTime);
-                            attendance.setWorkHours(workHours);
-                        } catch (Exception e) {
-                            // 时间格式不正确时忽略
-                        }
-                    }
-
-                    // 设置星期几
-                    if (dateParts.length > 1) {
-                        attendance.setWeekDayTxt(dateParts[1]);
-                        // 可以根据星期文字设置星期数字
-                        attendance.setWeekDay(convertWeekDay(dateParts[1]));
-                    }
-
-                    attendanceList.add(attendance);
-                }
-            }
-        }
-
-        return attendanceList;
-    }
-
-    private String getCellValue(Cell cell) {
-        if (cell == null) {
-            return null;
-        }
-
-        switch (cell.getCellTypeEnum()) {
-            case STRING:
-                return cell.getStringCellValue().trim();
-            case NUMERIC:
-                if (DateUtil.isCellDateFormatted(cell)) {
-                    java.util.Date date = cell.getDateCellValue();
-                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
-                    return simpleDateFormat.format(date);
-                } else {
-                    return String.valueOf(cell.getNumericCellValue());
-                }
-            case BOOLEAN:
-                return String.valueOf(cell.getBooleanCellValue());
-            case FORMULA:
-                return cell.getCellFormula();
-            default:
-                return "";
-        }
-    }
-
-    public static void main(String[] args) {
-        String startTime = "08:20";
-        String endTime = "12:30";
-        double workHours = calculateZhengBeiWorkHours(startTime, endTime, true);
-
-        System.out.println("工作时长:" + workHours + "小时");
-    }
-
-
-
-    public static double calculateZhengBeiWorkHours(String startTime, String endTime, boolean onlyReduceRestTime) {
-        // 简单计算工作时长(小时)
-        if (startTime.compareTo("08:30") < 0 && endTime.compareTo("08:30") < 0) {
-            //上下班都是八点半之前,忽略掉
-            return 0;
-        }
-        // 实际应用中需要更精确的计算,考虑午休时间等
-        if (!onlyReduceRestTime && startTime.compareTo("08:30") < 0) {
-            startTime = "08:30";
-        }
-        // 12:00-13:00为午休,中间来的得从下午上班时间开始算
-        if (startTime.compareTo("12:00") > 0 && startTime.compareTo("13:00") < 0) {
-            startTime = "13:00";
-        }
-        if (endTime.compareTo("12:00") > 0 && endTime.compareTo("13:00") < 0) {
-            endTime = "12:00";
-        }
-        String[] startParts = startTime.split(":");
-        boolean isEndNextDay = endTime.startsWith("次日");
-        if (endTime.startsWith("次日")) {
-            endTime = endTime.substring(3);
-            System.out.println("去掉次日后="+endTime);
-        }
-        String[] endParts = endTime.split(":");
-
-        int startHour = Integer.parseInt(startParts[0]);
-        int startMinute = Integer.parseInt(startParts[1]);
-        int endHour = Integer.parseInt(endParts[0]) + (isEndNextDay ? 24 : 0);
-        int endMinute = Integer.parseInt(endParts[1]);
-
-        double hours = (endHour - startHour) + (endMinute - startMinute) / 60.0;
-
-        // 减去午休时间(假设12:00-13:00为午休)
-        if (startHour <= 12 && endHour >= 13) {
-            hours -= 1;
-        }
-        if (!onlyReduceRestTime) {
-            //减去晚休时间,17:30-18:00
-            if (startHour <= 17 && endHour >= 18) {
-                hours -= 0.5;
-            }
-        }
-
-        //夜班减去休息1.5小时
-        if (startHour >= 20 || endHour >= 30) {
-            hours -= 1.5;
-        }
-        double minPart = hours - (int)hours;
-
-        //按0.5小时对齐
-        if (minPart > 0 && minPart < 0.5) {
-            minPart = 0;
-        } else if (minPart > 0.5) {
-            minPart = 0.5;
-        }
-        hours = (int)hours + minPart;
-        //四舍五入到小数点后一位
-        BigDecimal bigDecimal = new BigDecimal(hours);
-        bigDecimal = bigDecimal.setScale(1, BigDecimal.ROUND_HALF_UP);
-        return bigDecimal.doubleValue();
-    }
-
-    private int convertWeekDay(String weekDayTxt) {
-        switch (weekDayTxt) {
-            case "周一": return 1;
-            case "周二": return 2;
-            case "周三": return 3;
-            case "周四": return 4;
-            case "周五": return 5;
-            case "周六": return 6;
-            case "周日": return 7;
-            default: return 0;
-        }
-    }
-}

+ 6 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -3162,6 +3162,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 List<String> headListOne = new ArrayList<String>();
                 //headList.add("人员");
                 headListOne.add("");
+                headListOne.add("");
                 headListOne.add("项目编号");
                 projectCodes.forEach(pn->{
                     headListOne.add(String.valueOf(pn));
@@ -3175,8 +3176,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     }
                 });
                 List<String> headListTwo = new ArrayList<String>();
-                //headList.add("人员");
-                headListTwo.add(MessageUtils.message("entry.personnel"));
+                headListTwo.add("人员");
+                headListTwo.add("工号");
                 headListTwo.add("部门");
                 projectNames.forEach(pn->{
                     if ("hours".equals(exportContent) && functionTimeList.size()>0){
@@ -3233,6 +3234,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     Optional<Department> first = allDepartmentList.stream().filter(dl -> dl.getDepartmentId().equals(user.getDepartmentId())).findFirst();
                     if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
                         membRowData.add((String)("$userName="+user.getCorpwxUserid()+"$"));
+                        membRowData.add(user.getJobNumber());
                         if(first.isPresent()){
                             membRowData.add((String)("$departmentName="+first.get().getCorpwxDeptid()+"$"));
                         }else {
@@ -3240,6 +3242,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
                         membRowData.add((String)("$userName="+user.getName()+"$"));
+                        membRowData.add(user.getJobNumber());
                         if(first.isPresent()){
                             membRowData.add((String)("$departmentName="+first.get().getDdDeptid()+"$"));
                         }else {
@@ -3247,6 +3250,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }else {
                         membRowData.add(user.getName());
+                        membRowData.add(user.getJobNumber());
                         if(first.isPresent()){
                             membRowData.add(first.get().getDepartmentName());
                         }else {

+ 184 - 144
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -522,7 +522,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     setConstructionStageList(reportList, stageList);
                 }
             }
-            if (timeType.getEnableNewWeeklyfill() == 1 || timeType.getEnableNewWeeklyfill() == 2) {
+            if (timeType.getEnableNewWeeklyfill() > 0) {
                 //新版按周填报有周总结
                 List<Integer> batchIds = new ArrayList<>();
                 for (Map map : nameList) {
@@ -1493,7 +1493,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             reportService.saveOrUpdateBatch(reportList);
             //成都明夷电子,需要生成批量记录
             Company company = companyMapper.selectById(companyId);
-            if (company.getCompanyName().equals("成都明夷电子科技股份有限公司") || timeType.getEnableNewWeeklyfill() == 1 || timeType.getWeeklyChargeFilter() == 1) {//物奇需要填写周总结
+            if (company.getCompanyName().equals("成都明夷电子科技股份有限公司") || timeType.getEnableNewWeeklyfill() > 0 || timeType.getWeeklyChargeFilter() == 1) {//物奇需要填写周总结
                 if (date.contains("@")) {
                     //批量填报
                     String[] split = date.split("\\@");
@@ -1518,7 +1518,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     //每日或按周填报,为每天生成一条记录; 每日或者按周填报时,填报人就是操作人自己,不存在代填的情况
                     List<LocalDate> dateList = reportList.stream().map(Report::getCreateDate).distinct().collect(Collectors.toList());
                     String creatorId = reportList.get(0).getCreatorId();
-                    if (timeType.getEnableNewWeeklyfill() == 1 || timeType.getWeeklyChargeFilter() == 1) {
+                    if (timeType.getEnableNewWeeklyfill() > 0 || timeType.getWeeklyChargeFilter() == 1) {
                         //按周填报,需要保存周总结
                         //获取本周开始和结束的日期
                         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -1529,7 +1529,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                             List<HashMap> dateRange = (List<HashMap>)mapItem.get("dateList");
                             minDate = LocalDate.parse((String)dateRange.get(0).get("date"), dtf);
                             maxDate = LocalDate.parse((String)dateRange.get(dateRange.size()-1).get("date"), dtf);
-                        } else if (timeType.getWeeklyChargeFilter() == 1) {
+                        } else if (timeType.getEnableNewWeeklyfill() == 2 || timeType.getWeeklyChargeFilter() == 1) {
                             //根据targetDate获取本周的日期
                             LocalDate inWeekDate = dateList.get(0);
                             minDate = inWeekDate.with(DayOfWeek.MONDAY);
@@ -1773,8 +1773,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 userCorpwxTime.setName(user.getName());
                 userCorpwxTime.setCreateDate(createDate);
                 userCorpwxTime.setStartTime(abnormalStartTime);
-                userCorpwxTime.setEndTime(abnormalEndTime);
                 String convertEndTime = (abnormalEndDay==1?"次日":"") + abnormalEndTime;
+                userCorpwxTime.setEndTime(convertEndTime);
                 userCorpwxTime.setWorkHours(DateTimeUtil.calculateWorkHours(abnormalStartTime, convertEndTime));
                 userCorpwxTime.setWeekDay(createDate.getDayOfWeek().getValue());
                 userCorpwxTime.setWeekDayTxt(DateTimeUtil.getWeekDayTxt(createDate.getDayOfWeek().getValue()));
@@ -1965,12 +1965,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         List<ReportLogDetail> addLogDetailList = new ArrayList<>();
 //        List<Integer> projectIds = reportList.stream().map(Report::getProjectId).collect(Collectors.toList());
 //        List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id, project_name").in("id", projectIds));
+        TimeType timeType = timeTypeMapper.selectById(companyId);
         //操作审核通过
         for (Report report : reportList) {
             ReportLog log = new ReportLog();
             log.setCreatorId(report.getCreatorId());
             log.setCreateDate(report.getCreateDate());
             String msg = opName+"审核通过了日报";
+            if (timeType.getReportAutoApprove() == 1 && timeType.getReportAutoApproveDays() == 0) {
+                msg += "(自动审核)";
+            }
             //去重
             Optional<ReportLog> oldLog = addLogList.stream().filter(add -> add.getCreateDate().isEqual(log.getCreateDate()) && add.getCreatorId().equals(log.getCreatorId())).findFirst();
             if (!oldLog.isPresent()) {
@@ -2672,6 +2676,38 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     }
                 }
             }
+
+            if (timeType.getEnableNewWeeklyfill() > 0) {
+                //新版按周填报有周总结
+                List<Integer> batchIds = new ArrayList<>();
+                for (Map map : nameList) {
+                    List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
+                    for (Map<String, Object> report : reportList) {
+                        Integer batchId = (Integer)report.get("batchId");
+                        if (!batchIds.contains(batchId)) {
+                            batchIds.add(batchId);
+                        }
+                    }
+                }
+                if (batchIds.size() > 0) {
+                    List<ReportBatch> batchList = reportBatchMapper.selectList(new QueryWrapper<ReportBatch>().in("id", batchIds));
+                    DateTimeFormatter sdf = DateTimeFormatter.ofPattern("MM/dd");
+                    for (Map map : nameList) {
+                        List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
+                        if (reportList.size() > 0) {
+                            Integer batchId = (Integer)((Map)reportList.get(0)).get("batchId");
+                            Optional<ReportBatch> first = batchList.stream().filter(b -> b.getId().equals(batchId)).findFirst();
+                            if (first.isPresent()) {
+                                ReportBatch batchItem = first.get();
+                                map.put("summaryTitle", sdf.format(batchItem.getStartDate())+"至"+sdf.format(batchItem.getEndDate())+"周总结:");
+                                map.put("summary", batchItem.getSummary());
+                                map.put("attachment", batchItem.getAttachment());
+                            }
+                        }
+                    }
+                }
+            }
+
             //针对昱众,设置职能分工显示
             if (companyId == 3385) {
                 List<ProjectFunctionalDivision> allDivList = projectFunctionalDivisionMapper.selectList(new QueryWrapper<ProjectFunctionalDivision>().eq("company_id", companyId));
@@ -2733,6 +2769,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                             double wh = first.get().getWorkHours();
                             //赋值打卡时长
                             map.put("cardHours", wh);
+                            map.put("modifiedByAdmin", first.get().getModifiedByAdmin());
                             map.put("startTime", first.get().getStartTime());
                             map.put("endTime", first.get().getEndTime());
                             if (company.getPackageOvertime() == 1) {
@@ -2745,6 +2782,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                                 map.put("overtime", first.get().getOtTime());//加班申请时长
                             }
                             map.put("askLeaveTime", first.get().getAskLeaveTime());//请假时长
+                            map.put("outdoorTime", first.get().getOutdoorTime());//外出时长
+                            map.put("askLeaveType", first.get().getAskLeaveType());//请假类型
                         }
                     }
                 }
@@ -9992,50 +10031,49 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         LocalDate date = LocalDate.parse(targetDate, dtf);
         LocalDate firstDayOfWeek = date.with(DayOfWeek.MONDAY);
-        LocalDate sunday = date.with(DayOfWeek.SUNDAY);
         //需要填报的最后一天
-        LocalDate lastDayOfWeek = sunday;
-        int days = sunday.lengthOfMonth() - sunday.getDayOfMonth();
-        if (days <= 3) {
-            //周日距离月底相差天数在3天以内,比如周日是10.28,则10.29,10.30和10.31也算在本周内
-            lastDayOfWeek = sunday.plusDays(days);
-        }
+        LocalDate lastDayOfWeek = date.with(DayOfWeek.SUNDAY);
+//        int days = sunday.lengthOfMonth() - sunday.getDayOfMonth();
+//        if (days <= 3) {
+//            //周日距离月底相差天数在3天以内,比如周日是10.28,则10.29,10.30和10.31也算在本周内
+//            lastDayOfWeek = sunday.plusDays(days);
+//        }
         //如果上周只有2天以内工作日,需要并到这周来
-        LocalDate lastSunday = firstDayOfWeek.minusDays(1);
-        LocalDate lastSaturday = lastSunday.with(DayOfWeek.SATURDAY);
-
-        if (WorkDayCalculateUtils.isWorkDay(lastSunday) && WorkDayCalculateUtils.isWorkDay(lastSaturday)) {
-            //合并上周的工作日的情况:上周周末两天是工作日,并且只有2天以内工作日,需要并到这周来
-            LocalDate lastMonday = lastSunday.with(DayOfWeek.MONDAY);
-            boolean hasMoreWorkDays = false;
-            while (lastMonday.isBefore(lastSaturday)) {
-                if (WorkDayCalculateUtils.isWorkDay(lastMonday)) {
-                    hasMoreWorkDays = true;
-                    break;
-                }
-                lastMonday = lastMonday.plusDays(1);
-            }
-            if (!hasMoreWorkDays) {
-                firstDayOfWeek = lastSaturday;
-            }
-        } else {
-            //剔除被合并到上周的情况,如果本周一周二周三中有工作日,但是是上个月的月末,会被合并到上周去,本周要去掉
-            boolean hasFirstDayOfMonth = false;
-            LocalDate checkDate = firstDayOfWeek;
-            int beforeDays = 0;
-            while (!checkDate.isAfter(lastDayOfWeek)) {
-                if (checkDate.getDayOfMonth() == 1) {
-                    hasFirstDayOfMonth = true;
-                    break;
-                } else {
-                    beforeDays++;
-                }
-                checkDate = checkDate.plusDays(1);
-            }
-            if (hasFirstDayOfMonth && beforeDays <= 3) {
-                firstDayOfWeek = checkDate;
-            }
-        }
+//        LocalDate lastSunday = firstDayOfWeek.minusDays(1);
+//        LocalDate lastSaturday = lastSunday.with(DayOfWeek.SATURDAY);
+
+//        if (WorkDayCalculateUtils.isWorkDay(lastSunday) && WorkDayCalculateUtils.isWorkDay(lastSaturday)) {
+//            //合并上周的工作日的情况:上周周末两天是工作日,并且只有2天以内工作日,需要并到这周来
+//            LocalDate lastMonday = lastSunday.with(DayOfWeek.MONDAY);
+//            boolean hasMoreWorkDays = false;
+//            while (lastMonday.isBefore(lastSaturday)) {
+//                if (WorkDayCalculateUtils.isWorkDay(lastMonday)) {
+//                    hasMoreWorkDays = true;
+//                    break;
+//                }
+//                lastMonday = lastMonday.plusDays(1);
+//            }
+//            if (!hasMoreWorkDays) {
+//                firstDayOfWeek = lastSaturday;
+//            }
+//        } else {
+//            //剔除被合并到上周的情况,如果本周一周二周三中有工作日,但是是上个月的月末,会被合并到上周去,本周要去掉
+//            boolean hasFirstDayOfMonth = false;
+//            LocalDate checkDate = firstDayOfWeek;
+//            int beforeDays = 0;
+//            while (!checkDate.isAfter(lastDayOfWeek)) {
+//                if (checkDate.getDayOfMonth() == 1) {
+//                    hasFirstDayOfMonth = true;
+//                    break;
+//                } else {
+//                    beforeDays++;
+//                }
+//                checkDate = checkDate.plusDays(1);
+//            }
+//            if (hasFirstDayOfMonth && beforeDays <= 3) {
+//                firstDayOfWeek = checkDate;
+//            }
+//        }
 
 //        if (WorkDayCalculateUtils.isWorkDay(firstDayOfWeek) && firstDayOfWeek.getDayOfMonth() >= 30) {
 //            firstDayOfWeek = firstDayOfWeek.plusDays(1);
@@ -10044,10 +10082,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 //            }
 //        }
         //死代码 2025-01-27 周一 合并到1-26号那一周
-        LocalDate specialDate = LocalDate.of(2025, 1, 27);
-        if(lastDayOfWeek.plusDays(1).isEqual(specialDate)){
-            lastDayOfWeek = specialDate;
-        }
+//        LocalDate specialDate = LocalDate.of(2025, 1, 27);
+//        if(lastDayOfWeek.plusDays(1).isEqual(specialDate)){
+//            lastDayOfWeek = specialDate;
+//        }
 
 
 
@@ -10111,82 +10149,90 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", collect));
                 final List<Project> finalProjectList = projectList;
                 //获取项目的任务分组列表
-                //需要是他参与的任务分组
-                List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().eq("user_id", userId));
-                List<Integer> joinGroupList = groupParticipatorList.stream().map(GroupParticipator::getGroupId).collect(Collectors.toList());
-                if (joinGroupList.size() > 0) {
-                    List<TaskGroup> taskGroups = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", collect).in("id", joinGroupList));
-                    //获取负责人的用户集合
-                    List<String> inchargerIds = taskGroups.stream().map(TaskGroup::getInchargerId).collect(Collectors.toList());
-                    if (inchargerIds.size() == 0) {
-                        inchargerIds.add("-1");
-                    }
-                    List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", inchargerIds));
-                    reportList.forEach(r->{
-                        r.setTaskGroups(taskGroups.stream().filter(tg->tg.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
-                        for (TaskGroup gp : r.getTaskGroups()) {
-                            if (!StringUtils.isEmpty(gp.getInchargerId()) ) {
-                                if (gp.getInchargerId().equals(userId)) {
-                                    //自己担任任务分组的负责人,自己的审核人是项目经理
-                                    gp.setInchargerId(projectMapper.selectById(r.getProjectId()).getInchargerId());
-                                    //如果自己就是项目经理,审核人变成自己的部门负责人
-                                    if (gp.getInchargerId().equals(userId)) {
-                                        Integer dpId = user.getDepartmentId();
-                                        if (dpId != null && dpId > 0) {
-                                            Department department = departmentMapper.selectById(dpId);
-                                            if (department != null) {
-                                                gp.setInchargerId(department.getManagerId());
-                                            }
-                                        }
-                                    }
-                                    //不存在的话,加上项目经理
-                                    if (!userList.stream().anyMatch(u->u.getId().equals(gp.getInchargerId()))) {
-                                        userList.add(userMapper.selectById(gp.getInchargerId()));
+
+
+                QueryWrapper<TaskGroup> taskGroupQueryWrapper = new QueryWrapper<TaskGroup>().in("project_id", collect);
+                if (timeType.getReportAuditType() == 1) {//分组负责人审核模式,需要按参与的任务分组显示
+                    //需要是他参与的任务分组
+                    List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().eq("user_id", userId));
+                    List<Integer> joinGroupList = groupParticipatorList.stream().map(GroupParticipator::getGroupId).collect(Collectors.toList());
+                    if (joinGroupList.size() > 0) {
+                        taskGroupQueryWrapper.in("id", joinGroupList);
+                    } else {
+                        taskGroupQueryWrapper.eq("id", -1);//没有分组
+                    }
+                }
+                List<TaskGroup> taskGroups = taskGroupMapper.selectList(taskGroupQueryWrapper);
+                //获取负责人的用户集合
+                List<String> inchargerIds = taskGroups.stream().map(TaskGroup::getInchargerId).collect(Collectors.toList());
+                if (inchargerIds.size() == 0) {
+                    inchargerIds.add("-1");
+                }
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", inchargerIds));
+                reportList.forEach(r->{
+                    r.setTaskGroups(taskGroups.stream().filter(tg->tg.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
+//                    for (TaskGroup gp : r.getTaskGroups()) {
+//                        if (!StringUtils.isEmpty(gp.getInchargerId()) ) {
+//                            if (gp.getInchargerId().equals(userId)) {
+//                                //自己担任任务分组的负责人,自己的审核人是项目经理
+//                                gp.setInchargerId(projectMapper.selectById(r.getProjectId()).getInchargerId());
+//                                //如果自己就是项目经理,审核人变成自己的部门负责人
+//                                if (gp.getInchargerId().equals(userId)) {
+//                                    Integer dpId = user.getDepartmentId();
+//                                    if (dpId != null && dpId > 0) {
+//                                        Department department = departmentMapper.selectById(dpId);
+//                                        if (department != null) {
+//                                            gp.setInchargerId(department.getManagerId());
+//                                        }
+//                                    }
+//                                }
+//                                //不存在的话,加上项目经理
+//                                if (!userList.stream().anyMatch(u->u.getId().equals(gp.getInchargerId()))) {
+//                                    userList.add(userMapper.selectById(gp.getInchargerId()));
+//                                }
+//                            }
+//                            Optional<User> first = userList.stream().filter(u -> u.getId().equals(gp.getInchargerId())).findFirst();
+//                            if (first.isPresent()) {
+//                                gp.setInchargerName(first.get().getName());
+//                            }
+//                        }
+//                    }
+                    //设置项目名称
+                    Optional<Project> optional = finalProjectList.stream().filter(p->p.getId().equals(r.getProjectId())).findFirst();
+                    if (optional.isPresent()) {
+                        r.setProjectName(optional.get().getProjectName());
+                    }
+                    //设置自定义维度
+                    if (timeType.getCustomDegreeActive() == 1) {
+                        if (timeType.getCustomDegreeWithPro() == 1) {
+                            String associateDegrees = optional.get().getAssociateDegrees();
+                            List<HashMap> degreeMapList = new ArrayList<>();
+                            if (associateDegrees != null) {
+                                String[] split = associateDegrees.split("\\,");
+                                for (int i=0;i<split.length; i++) {
+                                    HashMap map = new HashMap();
+                                    if (!StringUtils.isEmpty(split[i])) {
+                                        Integer id = Integer.parseInt(split[i]);
+                                        map.put("id", id);
+                                        map.put("name", degreeList.stream().filter(d->d.getId().equals(id)).findFirst().get().getName());
+                                        degreeMapList.add(map);
                                     }
                                 }
-                                Optional<User> first = userList.stream().filter(u -> u.getId().equals(gp.getInchargerId())).findFirst();
-                                if (first.isPresent()) {
-                                    gp.setInchargerName(first.get().getName());
-                                }
                             }
-                        }
-                        //设置项目名称
-                        Optional<Project> optional = finalProjectList.stream().filter(p->p.getId().equals(r.getProjectId())).findFirst();
-                        if (optional.isPresent()) {
-                            r.setProjectName(optional.get().getProjectName());
-                        }
-                        //设置自定义维度
-                        if (timeType.getCustomDegreeActive() == 1) {
-                            if (timeType.getCustomDegreeWithPro() == 1) {
-                                String associateDegrees = optional.get().getAssociateDegrees();
-                                List<HashMap> degreeMapList = new ArrayList<>();
-                                if (associateDegrees != null) {
-                                    String[] split = associateDegrees.split("\\,");
-                                    for (int i=0;i<split.length; i++) {
-                                        HashMap map = new HashMap();
-                                        if (!StringUtils.isEmpty(split[i])) {
-                                            Integer id = Integer.parseInt(split[i]);
-                                            map.put("id", id);
-                                            map.put("name", degreeList.stream().filter(d->d.getId().equals(id)).findFirst().get().getName());
-                                            degreeMapList.add(map);
-                                        }
-                                    }
-                                }
-                                r.setDegreeList(degreeMapList);
-                            } else {
-                                //把degreeList改成HashMap结构
-                                List<HashMap> mapDegreeList = new ArrayList<>();
-                                for (ReportExtraDegree degree : degreeList) {
-                                    HashMap map = new HashMap();
-                                    map.put("id", degree.getId());
-                                    map.put("name", degree.getName());
-                                    mapDegreeList.add(map);
-                                }
-                                r.setDegreeList(mapDegreeList);
+                            r.setDegreeList(degreeMapList);
+                        } else {
+                            //把degreeList改成HashMap结构
+                            List<HashMap> mapDegreeList = new ArrayList<>();
+                            for (ReportExtraDegree degree : degreeList) {
+                                HashMap map = new HashMap();
+                                map.put("id", degree.getId());
+                                map.put("name", degree.getName());
+                                mapDegreeList.add(map);
                             }
+                            r.setDegreeList(mapDegreeList);
                         }
-                    });
-                }
+                    }
+                });
             }
 
             reportMap.put("projectList", projectList);
@@ -10195,25 +10241,23 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             LocalDate today = LocalDate.now();
             LocalDate itemDate = firstDayOfWeek;
             while(true) {
-                if (WorkDayCalculateUtils.isWorkDay(itemDate)) {
-                    HashMap item = new HashMap();
-                    item.put("date", itemDate.format(dtf));
-                    //计算显示的周几
-                    item.put("weekDayTxt", DateTimeUtil.getWeekDayTxt(itemDate.getDayOfWeek().getValue()));
-                    //不可提前填报
-                    if (timeType.getFillAhead() == 0 && itemDate.isAfter(today)) {
-                        item.put("canFill", 0);
-                    } else {
-                        item.put("canFill", 1);
-                    }
-                    //放入当天对应的日报
-                    final LocalDate finalItemDate = itemDate;
-                    List<Report> dateReportList = reportList.stream().filter(r -> r.getCreateDate().isEqual(finalItemDate)).collect(Collectors.toList());
-                    item.put("reportList", dateReportList);
-                    double sum = dateReportList.stream().mapToDouble(Report::getWorkingTime).sum();
-                    item.put("filledTime", sum);
-                    dateList.add(item);
+                HashMap item = new HashMap();
+                item.put("date", itemDate.format(dtf));
+                //计算显示的周几
+                item.put("weekDayTxt", DateTimeUtil.getWeekDayTxt(itemDate.getDayOfWeek().getValue()));
+                //不可提前填报
+                if (timeType.getFillAhead() == 0 && itemDate.isAfter(today)) {
+                    item.put("canFill", 0);
+                } else {
+                    item.put("canFill", 1);
                 }
+                //放入当天对应的日报
+                final LocalDate finalItemDate = itemDate;
+                List<Report> dateReportList = reportList.stream().filter(r -> r.getCreateDate().isEqual(finalItemDate)).collect(Collectors.toList());
+                item.put("reportList", dateReportList);
+                double sum = dateReportList.stream().mapToDouble(Report::getWorkingTime).sum();
+                item.put("filledTime", sum);
+                dateList.add(item);
                 //往后推一天
                 itemDate = itemDate.plusDays(1);
                 //超过最后一天了,跳出循环
@@ -10221,10 +10265,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     break;
                 }
             }
-            //241226 当日期为 25-01-27 周一 时,去掉列表
-            if(firstDayOfWeek.isEqual(specialDate)){
-                dateList = new ArrayList<>();
-            }
             reportMap.put("dateList", dateList);
             //查询考勤请假状态
             WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1249,8 +1249,9 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         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);
-        if (endTime.isBefore(startTime)) {
+        if (isNextDay) {
             endTime = endTime.plusDays(1);
         }
         if (startTime.toLocalTime().isBefore(LocalTime.parse(baseMorningStart,timeFormatter))) {

+ 8 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/DateTimeUtil.java

@@ -110,8 +110,7 @@ public class DateTimeUtil {
         String[] startParts = startTime.split(":");
         boolean isEndNextDay = endTime.startsWith("次日");
         if (endTime.startsWith("次日")) {
-            endTime = endTime.substring(3);
-            System.out.println("去掉次日后="+endTime);
+            endTime = endTime.substring(2).trim();
         }
         String[] endParts = endTime.split(":");
 
@@ -126,6 +125,9 @@ public class DateTimeUtil {
         if (startHour <= 12 && endHour >= 13) {
             hours -= 1;
         }
+        if (isEndNextDay && endHour >= 13) {
+            hours -= 1;//跨天,再减去第二天的午休时间
+        }
 
         double minPart = hours - (int)hours;
 
@@ -143,11 +145,10 @@ public class DateTimeUtil {
     }
 
     public static void main(String[] args) {
-        LocalDate localDate = LocalDate.now();
-        System.out.println(getLastDayOfYearMonth("2025-08"));
-        System.out.println(localDate.getDayOfWeek().getValue());
-        localDate = localDate.with(DayOfWeek.SUNDAY);
-        System.out.println(localDate);
+        String startTime = "07:54";
+        String endTime = "次日17:00";
+        double d = calculateWorkHours(startTime, endTime);
+        System.out.println(d);
     }
 
     public static String getLastDayOfYearMonth(String yearMonth) {

+ 1 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/WorkDayCalculateUtils.java

@@ -385,8 +385,7 @@ public class WorkDayCalculateUtils {
         String[] startParts = startTime.split(":");
         boolean isEndNextDay = endTime.startsWith("次日");
         if (endTime.startsWith("次日")) {
-            endTime = endTime.substring(3);
-            System.out.println("去掉次日后="+endTime);
+            endTime = endTime.substring(2).trim();
         }
         String[] endParts = endTime.split(":");
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7 - 9
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue


+ 9 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/dailyReportReview.vue

@@ -91,6 +91,12 @@
                   </template>
                   <template slot-scope="props">
                       <el-timeline>
+                          <div v-if="user.timeType.enableNewWeeklyfill != 0" style="margin-left:20px;">
+                            <p v-if="props.row.summary != null" v-html="'<b>'+props.row.summaryTitle+'</b><br>'+props.row.summary.replace(/[\r\n]/g,'<br>')"> </p>
+                            <p v-if="props.row.attachment != null" >附件
+                                <a v-for="file in JSON.parse(props.row.attachment)" style="margin-right:5px;" :href="'/upload/'+file.serverName" :download="file.originName">{{ file.originName }}</a>
+                            </p>
+                          </div>
                           <el-timeline-item v-for="(item,index) in props.row.data" :key="index">
                               <el-card shadow="never">
                                   <p>{{ $t('other.project') + ':' }}<b>{{item.projectCode+'/'+item.project}}<span v-if="item.subProjectName != null"> / {{item.subProjectName}}</span>
@@ -253,8 +259,10 @@
                         <span v-if="scope.row.cardHours" :style="scope.row.cardHours != scope.row.reportTime?'color:red':''">
                             <span>{{ scope.row.startTime }} ~ {{ scope.row.endTime }}</span>  
                             <span v-if="scope.row.cardHours">共 {{ scope.row.cardHours.toFixed(1) }} 小时</span>
+                            <span v-if="scope.row.modifiedByAdmin == 2" style="color:#FFA500;">(补)</span>
                             <span v-if="scope.row.overtime" style="color:#20a0ff;">加班申请 {{ scope.row.overtime.toFixed(1) }} 小时</span>
-                            <span v-if="scope.row.askLeaveTime" style="color:#20a0ff;">请假 {{ scope.row.askLeaveTime.toFixed(1) }} 小时</span>
+                            <span v-if="scope.row.askLeaveTime" style="color:#20a0ff;">{{ scope.row.askLeaveType == null?'请假': scope.row.askLeaveType}}{{ scope.row.askLeaveTime.toFixed(1) }} 小时</span>
+                            <span v-if="scope.row.outdoorTime" style="color:#20a0ff;">外出 {{ scope.row.outdoorTime.toFixed(1) }} 小时</span>
                         </span>
                         <span v-else="scope.row.cardHours">-</span>
                         <div style="padding-left: 10px" v-if="user.dingdingUserid">

+ 26 - 19
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/newWeeklyCustomization.vue

@@ -52,7 +52,7 @@
                             <div>
                                 <el-input size="small" type="textarea" :rows="2" v-model="scope.row.content"
                                     :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill"
-                                    resize="none" :maxlength="user.companyId == wuqiId && 30" :show-word-limit="user.companyId == wuqiId" :placeholder="user.companyId == wuqiId ? '所在项目负责哪一模块(可重复填写),无需涉及技术细节。' : '' ">                                
+                                    resize="none" :maxlength="30" :show-word-limit="true" placeholder="请填写工作内容">                                
                             </el-input>
                             </div>
                         </template>
@@ -63,14 +63,6 @@
                                 :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill"></el-input-number>
                         </template>
                     </el-table-column>
-                    <!-- <el-table-column prop="projectAuditorId" :label="$t('approver')" width="160">
-                        <template slot-scope="scope">
-                            <span v-if="user.userNameNeedTranslate != '1'">{{ auditorNameFun(scope.row) }}</span>
-                            <span v-if="user.userNameNeedTranslate == '1'">
-                                <TranslationOpenDataText type='userName' :openid='auditorNameFun(scope.row)'></TranslationOpenDataText>
-                            </span>
-                        </template>
-                    </el-table-column> -->
                     <el-table-column prop="state" label="状态" width="140" fixed="right">
                         <template slot-scope="scope">
                             <div class="controls">
@@ -272,6 +264,22 @@ export default {
                 customText: '-',
             }
 
+            // 检查选择了项目但工时为0或未填写的行
+            if (draft == 0) {
+                const missingWorktime = newWeekData.filter(data => data.projectId && (!data.workingTime || data.workingTime <= 0));
+                if (missingWorktime.length > 0) {
+                    const projectNames = missingWorktime.map(data => {
+                        const project = this.projectList.find(p => p.id === data.projectId);
+                        return (project ? project.projectName : data.projectId) + '(' + data.dateTime + ')';
+                    });
+                    this.$message({
+                        message: `【${projectNames.join('、')}】项目的工时尚未填写`,
+                        type: 'warning'
+                    });
+                    return;
+                }
+            }
+
             const arr = newWeekData
                 .filter(data => data.projectId)
                 .map(data => ({
@@ -281,7 +289,7 @@ export default {
                     content: data.content ? data.content : '',
                     projectAuditorId: data.projectAuditorId,
                     workingTime: data.workingTime,
-                    groupId: data.groupId,
+                    groupId: data.groupId || 0,
                     id: data.id || -1,
                     degreeId: data.degreeId || -1
                 }));
@@ -418,18 +426,17 @@ export default {
                 reportList.forEach(report => {
                     const { state, taskGroups } = report;
                     console.log(state, taskGroups);
-                    if(state != 1 && state != 0 && taskGroups && taskGroups.length > 0) {
-                        console.log('执行');
-                        report.projectAuditorId = taskGroups[0].inchargerId;
-                        report.projectAuditorName = taskGroups[0].inchargerName;
-                    }
-                    if(state == 1 && state == 0 && taskGroups && taskGroups.length > 0) {
-                        taskGroups[0].inchargerId = report.projectAuditorId;
-                        taskGroups[0].inchargerName = report.projectAuditorName;
-                    }
+                    // if(state != 1 && state != 0 && taskGroups && taskGroups.length > 0) {
+                    //     console.log('执行');
+                    //     report.projectAuditorId = taskGroups[0].inchargerId;
+                    //     report.projectAuditorName = taskGroups[0].inchargerName;
+                    // }
                     if (report.degreeId == -1) {
                         report.degreeId = null;
                     }
+                    if (report.groupId == 0) {
+                        report.groupId = null;
+                    }
                     report.wuduList = report.degreeList;
                 });
             });