Przeglądaj źródła

加力导入考勤工时并分配

QuYueTing 4 tygodni temu
rodzic
commit
2017f0cfcd

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

@@ -262,7 +262,7 @@ public class ReportLogController {
                         List<Integer> reportSubIds = Arrays.asList(split).stream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
                         reportIdList.addAll(reportSubIds);
                     });
-                    List<Report> reportList = reportMapper.selectList(new LambdaQueryWrapper<Report>().select(Report::getId, Report::getCreateTime, Report::getProjectAuditTime).in(Report::getId, reportIdList));
+                    List<Report> reportList = reportMapper.selectList(new LambdaQueryWrapper<Report>().select(Report::getId, Report::getCreateTime, Report::getProjectAuditTime, Report::getCreatorId).in(Report::getId, reportIdList));
                     List<ReportLogDetail> allReportLogDetails = reportLogDetailService.list(new LambdaQueryWrapper<ReportLogDetail>().select(ReportLogDetail::getMsg,ReportLogDetail::getId).in(ReportLogDetail::getReportId, reportIdList));
                     StringBuilder sb=new StringBuilder();
                     List<Report> needUpdateReportList=new ArrayList<>();

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

@@ -586,8 +586,8 @@ public class TaskController {
                 }
             }
 
-            if (company.getId() == 7757) {
-                //针对梦迪莱斯,同一个任务列表里面的要按创建顺序先后完成
+            if (company.getId() == 7757 || company.getId() == 7783) {
+                //针对梦迪莱斯和影邦,同一个任务列表里面的要按创建顺序先后完成
                 QueryWrapper<Task> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("stages_id", old.getStagesId()).lt("id", old.getId()).isNull("parent_tid").orderByDesc("id").last("limit 1");
                 Task lastItem = taskService.getOne(queryWrapper);
@@ -796,13 +796,16 @@ public class TaskController {
 
 
     @RequestMapping("/getTaskOnlyList")
-    public HttpRespMsg getTaskOnlyList(Integer projectId) {
+    public HttpRespMsg getTaskOnlyList(Integer projectId, Integer groupId) {
         HttpRespMsg msg = new HttpRespMsg();
         String userId = request.getHeader("Token");
         User user = userMapper.selectById(userId);
         QueryWrapper<Task> queryWrapper = new QueryWrapper<>();
         //只看任务类型的
         queryWrapper.eq("project_id", projectId).eq("task_type", 0);
+        if (groupId != null) {
+            queryWrapper.eq("group_id", groupId);
+        }
         queryWrapper.orderByDesc("id");
         List<Task> list = taskService.nameList(queryWrapper);
         Project project = projectService.getById(projectId);

+ 129 - 107
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskFilesController.java

@@ -115,56 +115,66 @@ public class TaskFilesController {
         record.setTaskId(taskId);
         record.setProjectId(projectId);
         record.setFileRejectReason(null);
-        if(0 != timeType.getTaskFileCharge()){
-            record.setNeedFileCharge(1);
-        }
-        if(1 == timeType.getTaskFileCharge()){
-            if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
-                msg.setError("员工所在部门无负责人,请重新设置");
-                return msg;
-            }
-            if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
-                msg.setError("该项目未设置项目经理,请重新设置");
-                return msg;
-            }
-            record.setChargeOneId(department.getManagerId());
-            record.setChargeTwoId(project.getInchargerId());
-            //根据老阶段重置任务状态
-            record.setFinalChargeStatus(0);
-            if(1 == oldTaskFile.getChargeStage()){
-                record.setChargeOneStatus(0);
-            }else if(2 == oldTaskFile.getChargeStage()){
-                record.setChargeTwoStatus(0);
-            } else if (3 == oldTaskFile.getChargeStage()) {
-                record.setChargeStage(1);
-                record.setChargeOneStatus(0);
-                record.setChargeTwoStatus(0);
-            }
-        } else if (2 == timeType.getTaskFileCharge()) {
-            record.setFinalChargeStatus(0);
-            if(1 == oldTaskFile.getChargeStage()){
-                record.setChargeOneStatus(0);
-            }else if(2 == oldTaskFile.getChargeStage()){
-                record.setChargeTwoStatus(0);
-            } else if (3 == oldTaskFile.getChargeStage()) {
-                record.setChargeStage(1);
-                record.setChargeOneStatus(0);
-                record.setChargeTwoStatus(0);
+        Task task = taskMapper.selectById(taskId);
+        if (task.getCreaterId().equals(user.getId()) || project.getCreatorId().equals(user.getId())) {
+            record.setNeedFileCharge(0);
+            record.setChargeOneStatus(1);
+            record.setChargeTwoStatus(1);
+            record.setFinalChargeStatus(1);
+        } else {
+            if(0 != timeType.getTaskFileCharge()){
+                record.setNeedFileCharge(1);
             }
-            //重新上传文件根据文件上传人的该任务执行的审核人一、二
-            TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
-                    .eq(TaskExecutor::getTaskId, taskId)
-                    .eq(TaskExecutor::getExecutorId, user.getId())
-            );
-            if(null == taskExecutor){
-                msg.setError("该任务下执行人无当前用户");
-                return msg;
-            }else{
-                record.setChargeOneId(taskExecutor.getFileChargeOneId());
-                record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+            if(1 == timeType.getTaskFileCharge()){
+                if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+                    msg.setError("员工所在部门无负责人,请重新设置");
+                    return msg;
+                }
+                if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+                    msg.setError("该项目未设置项目经理,请重新设置");
+                    return msg;
+                }
+                record.setChargeOneId(department.getManagerId());
+                record.setChargeTwoId(project.getInchargerId());
+                //根据老阶段重置任务状态
+                record.setFinalChargeStatus(0);
+                if(1 == oldTaskFile.getChargeStage()){
+                    record.setChargeOneStatus(0);
+                }else if(2 == oldTaskFile.getChargeStage()){
+                    record.setChargeTwoStatus(0);
+                } else if (3 == oldTaskFile.getChargeStage()) {
+                    record.setChargeStage(1);
+                    record.setChargeOneStatus(0);
+                    record.setChargeTwoStatus(0);
+                }
+            } else if (2 == timeType.getTaskFileCharge()) {
+                record.setFinalChargeStatus(0);
+                if(1 == oldTaskFile.getChargeStage()){
+                    record.setChargeOneStatus(0);
+                }else if(2 == oldTaskFile.getChargeStage()){
+                    record.setChargeTwoStatus(0);
+                } else if (3 == oldTaskFile.getChargeStage()) {
+                    record.setChargeStage(1);
+                    record.setChargeOneStatus(0);
+                    record.setChargeTwoStatus(0);
+                }
+                //重新上传文件根据文件上传人的该任务执行的审核人一、二
+                TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
+                        .eq(TaskExecutor::getTaskId, taskId)
+                        .eq(TaskExecutor::getExecutorId, user.getId())
+                );
+                if(null == taskExecutor){
+                    msg.setError("该任务下执行人无当前用户");
+                    return msg;
+                }else{
+                    record.setChargeOneId(taskExecutor.getFileChargeOneId());
+                    record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+                }
             }
+
         }
 
+
         if (oldTaskFile.getDocumentId() == null) {
             //仅当前任务上传的,需要把文件删掉
             File dir = new File(uploadPath);
@@ -209,10 +219,7 @@ public class TaskFilesController {
                     taskFilesMapper.updateById(record);
                     //生成原文件名称与服务器文件名称对应
                     msg.data = record;
-
-
                     //添加动态消息
-                    Task task = taskMapper.selectById(taskId);
                     String content = user.getName()+"在任务【"+task.getName()+"】中重新上传了文件【"+file.getOriginalFilename()+"】";
                     TaskComment comment =  new TaskComment();
                     comment.setTaskId(taskId);
@@ -295,34 +302,42 @@ public class TaskFilesController {
         record.setServerName(document.getServerName());
         record.setUrl(document.getUrl());
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
-        if(0 != timeType.getTaskFileCharge()){
-            record.setNeedFileCharge(1);
-        }
-        if(1 == timeType.getTaskFileCharge()){
-            Department department = departmentMapper.selectById(user.getDepartmentId());
-            Project project = projectMapper.selectById(taskId);
-            if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
-                msg.setError("员工所在部门无负责人,请重新设置");
-                return msg;
-            }
-            if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
-                msg.setError("该项目未设置项目经理,请重新设置");
-                return msg;
+        Task task = taskMapper.selectById(taskId);
+        Project project = projectMapper.selectById(projectId);
+        if (task.getCreaterId().equals(user.getId()) || project.getCreatorId().equals(user.getId())) {
+            record.setNeedFileCharge(0);
+            record.setChargeOneStatus(1);
+            record.setChargeTwoStatus(1);
+            record.setFinalChargeStatus(1);
+        } else {
+            if(0 != timeType.getTaskFileCharge()){
+                record.setNeedFileCharge(1);
             }
-            record.setChargeOneId(department.getManagerId());
-            record.setChargeTwoId(project.getInchargerId());
-        } else if (2 == timeType.getTaskFileCharge()) {
-            //重新上传文件根据文件上传人的该任务执行的审核人一、二
-            TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
-                    .eq(TaskExecutor::getTaskId, taskId)
-                    .eq(TaskExecutor::getExecutorId, user.getId())
-            );
-            if(null == taskExecutor){
-                msg.setError("该任务下执行人无当前用户");
-                return msg;
-            }else{
-                record.setChargeOneId(taskExecutor.getFileChargeOneId());
-                record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+            if(1 == timeType.getTaskFileCharge()){
+                Department department = departmentMapper.selectById(user.getDepartmentId());
+                if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+                    msg.setError("员工所在部门无负责人,请重新设置");
+                    return msg;
+                }
+                if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+                    msg.setError("该项目未设置项目经理,请重新设置");
+                    return msg;
+                }
+                record.setChargeOneId(department.getManagerId());
+                record.setChargeTwoId(project.getInchargerId());
+            } else if (2 == timeType.getTaskFileCharge()) {
+                //重新上传文件根据文件上传人的该任务执行的审核人一、二
+                TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
+                        .eq(TaskExecutor::getTaskId, taskId)
+                        .eq(TaskExecutor::getExecutorId, user.getId())
+                );
+                if(null == taskExecutor){
+                    msg.setError("该任务下执行人无当前用户");
+                    return msg;
+                }else{
+                    record.setChargeOneId(taskExecutor.getFileChargeOneId());
+                    record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+                }
             }
         }
         taskFilesMapper.insert(record);
@@ -333,7 +348,6 @@ public class TaskFilesController {
 //        }
 
         //添加动态消息
-        Task task = taskMapper.selectById(taskId);
         String content = user.getName()+"在任务【"+task.getName()+"】中关联了文件【"+document.getDocumentName()+"】";
         TaskComment comment =  new TaskComment();
         comment.setTaskId(taskId);
@@ -376,6 +390,7 @@ public class TaskFilesController {
         User user = userMapper.selectById(request.getHeader("Token"));
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
         Department department = departmentMapper.selectById(user.getDepartmentId());
+        Task task = taskMapper.selectById(taskId);
         Project project = projectMapper.selectById(projectId);
         StringBuilder fileNames = new StringBuilder();
         for (MultipartFile file : files) {
@@ -386,38 +401,46 @@ public class TaskFilesController {
             fileNames.append(file.getOriginalFilename()).append(",");
             record.setTaskId(taskId);
             record.setProjectId(projectId);
-            if(0 != timeType.getTaskFileCharge()){
-                record.setNeedFileCharge(1);
-            }
-            if(1 == timeType.getTaskFileCharge()){
-                if (department == null) {
-                    msg.setError("您无所属部门,请重新设置");
-                    return msg;
-                }
-                if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
-                    msg.setError("您所在部门无负责人,请重新设置");
-                    return msg;
-                }
-                if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
-                    msg.setError("该项目未设置项目经理,请重新设置");
-                    return msg;
+            if (task.getCreaterId().equals(user.getId()) || project.getCreatorId().equals(user.getId())) {
+                record.setNeedFileCharge(0);
+                record.setChargeOneStatus(1);
+                record.setChargeTwoStatus(1);
+                record.setFinalChargeStatus(1);
+            } else {
+                if(0 != timeType.getTaskFileCharge()){
+                    record.setNeedFileCharge(1);
                 }
-                record.setChargeOneId(department.getManagerId());
-                record.setChargeTwoId(project.getInchargerId());
-            }else if(2 == timeType.getTaskFileCharge()) {
-                //重新上传文件根据文件上传人的该任务执行的审核人一、二
-                TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
-                        .eq(TaskExecutor::getTaskId, taskId)
-                        .eq(TaskExecutor::getExecutorId, user.getId())
-                );
-                if(null == taskExecutor){
-                    msg.setError("该任务下执行人无当前用户");
-                    return msg;
-                }else{
-                    record.setChargeOneId(taskExecutor.getFileChargeOneId());
-                    record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+                if(1 == timeType.getTaskFileCharge()){
+                    if (department == null) {
+                        msg.setError("您无所属部门,请重新设置");
+                        return msg;
+                    }
+                    if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+                        msg.setError("您所在部门无负责人,请重新设置");
+                        return msg;
+                    }
+                    if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+                        msg.setError("该项目未设置项目经理,请重新设置");
+                        return msg;
+                    }
+                    record.setChargeOneId(department.getManagerId());
+                    record.setChargeTwoId(project.getInchargerId());
+                }else if(2 == timeType.getTaskFileCharge()) {
+                    //重新上传文件根据文件上传人的该任务执行的审核人一、二
+                    TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
+                            .eq(TaskExecutor::getTaskId, taskId)
+                            .eq(TaskExecutor::getExecutorId, user.getId())
+                    );
+                    if(null == taskExecutor){
+                        msg.setError("该任务下执行人无当前用户");
+                        return msg;
+                    }else{
+                        record.setChargeOneId(taskExecutor.getFileChargeOneId());
+                        record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+                    }
                 }
             }
+
             if (file != null && !file.isEmpty()) {
                 //截取文件后缀
                 String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
@@ -497,7 +520,6 @@ public class TaskFilesController {
 
         //添加动态消息
         String resFileNames = fileNames.deleteCharAt(fileNames.length() - 1).toString();
-        Task task = taskMapper.selectById(taskId);
         String content = user.getName()+"在任务【"+task.getName()+"】中上传了文件【"+resFileNames+"】";
         TaskComment comment =  new TaskComment();
         comment.setTaskId(taskId);

Plik diff jest za duży
+ 1217 - 114
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserCorpwxTimeController.java


+ 19 - 15
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserWithBeisenController.java

@@ -244,16 +244,16 @@ public class UserWithBeisenController {
         Optional<User> first = userList.stream().filter(f -> f.getJobNumber().equals(withBeisen.get().getJobNumber())).findFirst();
         System.out.println("考勤数据:"+item.toString());
         //todo: 获取早晚打卡时间
-        String firstCard = item.getString("firstCardIncludeFillCheck").split(" ")[1];
-        String lastCard = item.getString("lastCardIncludeFillCheck").split(" ")[1];
+        String firstCard = item.getString("firstCardIncludeFillCheck");
+        String lastCard = item.getString("lastCardIncludeFillCheck");
         //获取最晚下班时间
         if(first.isPresent()){
             boolean workDay = WorkDayCalculateUtils.isWorkDay(LocalDate.parse(createDate,df));
             //todo:针对景昱 工作日默认以8小时工作制度加上加班时长 非工作日以加班时长为准
             Double workTime;
-            Duration between = Duration.between(LocalTime.parse(firstCard, df4), LocalTime.parse(lastCard, df4));
-            LocalTime min = LocalTime.parse(firstCard, df4);
-            LocalTime max = LocalTime.parse(lastCard, df4);
+            Duration between = Duration.between(LocalDateTime.parse(firstCard, df1), LocalDateTime.parse(lastCard, df1));
+            LocalDateTime min = LocalDateTime.parse(firstCard, df1);
+            LocalDateTime max = LocalDateTime.parse(lastCard, df1);
             if(between.toHours()<=0){
                 msg.setError("无考勤记录");
                 return msg;
@@ -270,9 +270,6 @@ public class UserWithBeisenController {
             Optional<UserWithBeisen> beisen = userWithBeisenList.stream().filter(u -> u.getJobNumber() != null && u.getJobNumber().equals(first.get().getJobNumber())).findFirst();
             if(beisen.isPresent()){
                 //todo:之前的逻辑
-//                        List<JSONObject> overTimeList = overTimeStream.filter(a -> a.getString("StaffId").equals(beisen.get().getUserId())
-//                                && (a.getIntValue("ApproveStatus") == 2||a.getIntValue("ApproveStatus") == 1)
-//                                &&LocalDateTime.parse(a.getString("StartDate"),df1).toLocalDate().isEqual(localDate)).collect(Collectors.toList());
                 List<JSONObject> overTimeList = overTimeStream.filter(a -> a.getString("StaffId").equals(beisen.get().getUserId())
                         && (a.getIntValue("ApproveStatus") == 2||a.getIntValue("ApproveStatus") == 1)).collect(Collectors.toList());
                 LocalDate localDate = LocalDate.parse(createDate, df);
@@ -281,16 +278,23 @@ public class UserWithBeisenController {
                 //计算加班时长 工作日打卡超过19:00:00算加班那 非工作日全天算加班
                 if(workDay){
                     //工作日打卡超过19:00:00算加班那 非工作日全天算加班
-                    if(max.isAfter(LocalTime.parse("19:00:00", df4))){
-                        overTimeBigDecimal = new BigDecimal(Duration.between(LocalTime.parse("18:00:00", df4), LocalTime.parse(lastCard, df4)).toMinutes());
+                    LocalDateTime start = min.withHour(18).withMinute(0).withSecond(0).withNano(0);
+                    LocalDateTime overtimeStart = min.withHour(19).withMinute(0).withSecond(0).withNano(0);
+                    if (max.isAfter(overtimeStart)) {
+                        //超过一天,下班是第二天凌晨的打卡
+                        overTimeBigDecimal = new BigDecimal(Duration.between(start,max).toMinutes());
                     }
                 }else {
                     //非工作日全天 去掉休息时长 都算加班
-                    overTimeBigDecimal=new BigDecimal(Duration.between(LocalTime.parse(firstCard, df4), LocalTime.parse(lastCard, df4)).toMinutes()) ;
-                    long rest1 = DateTimeUtil.calculateOverlap(min, max, LocalTime.parse("12:00:00", df4), LocalTime.parse("13:00:00", df4));
-                    long rest2 = DateTimeUtil.calculateOverlap(min, max, LocalTime.parse("17:30:00", df4), LocalTime.parse("18:00:00", df4));
+                    overTimeBigDecimal=new BigDecimal(Duration.between(min, max).toMinutes()) ;
+                    long rest1 = DateTimeUtil.calculateOverlap(min, max, min.withHour(12).withMinute(0).withSecond(0), min.withHour(13).withMinute(0).withSecond(0));
+                    long rest2 = DateTimeUtil.calculateOverlap(min, max, min.withHour(17).withMinute(30).withSecond(0), min.withHour(18).withMinute(0).withSecond(0));
                     overTimeBigDecimal=overTimeBigDecimal.subtract(new BigDecimal(rest1)).subtract(new BigDecimal(rest2));
                 }
+                if (overTimeList.size() == 0) {
+                    BigDecimal divide = overTimeBigDecimal.divide(new BigDecimal(60),1,RoundingMode.HALF_DOWN);
+                    workTime += round(divide.doubleValue(),0.5);
+                }
                 for (JSONObject o : overTimeList) {
                     //存在开始日期为当前日期的数据以及结束日期为当天日期的数据 分开计算
                     if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(localDate)){
@@ -377,8 +381,8 @@ public class UserWithBeisenController {
             }
             UserFvTime userFvTime=new UserFvTime();
             userFvTime.setWorkDate(LocalDate.parse(createDate,df));
-            userFvTime.setStartTime(!StringUtils.isEmpty(firstCard)?firstCard:"08:30:00");
-            userFvTime.setEndTime(!StringUtils.isEmpty(lastCard)?lastCard:"17:30:00");
+            userFvTime.setStartTime(!StringUtils.isEmpty(firstCard)?firstCard.split(" ")[1]:"08:30:00");
+            userFvTime.setEndTime(!StringUtils.isEmpty(lastCard)?lastCard.split(" ")[1]:"17:30:00");
             userFvTime.setUserId(first.get().getId());
             userFvTime.setCompanyId(companyId);
             userFvTime.setWorkHours(workTime.floatValue());

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/UserCorpwxTime.java

@@ -116,6 +116,9 @@ public class UserCorpwxTime extends Model<UserCorpwxTime> {
     @TableField("modified_by_admin")
     private Integer modifiedByAdmin;
 
+    @TableField(exist = false)
+    private String jobNumber;
+
 
     @Override
     protected Serializable pkVal() {

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

@@ -1687,9 +1687,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             //检测是否开启项目人天预估工时的功能
             if (timeType.getProjectManDay() == 1) {
                 if (canViewAll && pageIndex == null) {
-                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, create_date, project_id, working_time").eq("company_id",companyId).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
+                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, create_date, project_id, working_time").eq("company_id",companyId).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1)));
                 } else {
-                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, create_date, project_id, working_time").in("project_id",projectIds).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
+                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, create_date, project_id, working_time").in("project_id",projectIds).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1)));
                 }
             }
             //获取项目关联的部门
@@ -3758,9 +3758,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             //todo:计算剩余工时
             List<Report> reportList;
             if(project.getManDayStartDate()!=null){
-                reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).gt("create_date",project.getManDayStartDate()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
+                reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).gt("create_date",project.getManDayStartDate()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1)));
             }else {
-                reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
+                reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1)));
             }
             //已发送工时
             double sum = reportList.stream().mapToDouble(Report::getWorkingTime).sum();

+ 18 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserWithBeisenServiceImpl.java

@@ -161,24 +161,24 @@ public class UserWithBeisenServiceImpl extends ServiceImpl<UserWithBeisenMapper,
                 if (!ubOptinal.isPresent()) {
                     continue;
                 }
-                String jobNumber = ubOptinal.get().getJobNumber();
+                String jobNumber = "194917458".equals(beisengUserId)?"SR0896":ubOptinal.get().getJobNumber();
                 Optional<User> first = userList.stream().filter(f -> f.getJobNumber().equals(jobNumber)).findFirst();
                 //todo: 获取考勤打卡时间集合
                 JSONArray times = item.getJSONArray("Times");
                 Stream<JSONObject> timeStream = times.stream().map(time -> (JSONObject) time);
                 Stream<JSONObject> timeStream1 = times.stream().map(time -> (JSONObject) time);
                 //获取最早上班打卡时间
-                List<LocalTime> minLocalTimeList = timeStream.filter(t -> t.getIntValue("Type") == 1).map(i -> LocalDateTime.parse(i.getString("ActualTime"),df1).toLocalTime()).collect(Collectors.toList());
-                Optional<LocalTime> minOp = minLocalTimeList.stream().min(LocalTime::compareTo);
+                List<LocalDateTime> minLocalTimeList = timeStream.filter(t -> t.getIntValue("Type") == 1).map(i -> LocalDateTime.parse(i.getString("ActualTime"),df1)).collect(Collectors.toList());
+                Optional<LocalDateTime> minOp = minLocalTimeList.stream().min(LocalDateTime::compareTo);
                 //获取最晚下班时间
-                List<LocalTime> maxLocalTimeList = timeStream1.filter(t -> t.getIntValue("Type") == 9).map(i -> LocalDateTime.parse(i.getString("ActualTime"),df1).toLocalTime()).collect(Collectors.toList());
-                Optional<LocalTime> maxOp = maxLocalTimeList.stream().max(LocalTime::compareTo);
+                List<LocalDateTime> maxLocalTimeList = timeStream1.filter(t -> t.getIntValue("Type") == 9).map(i -> LocalDateTime.parse(i.getString("ActualTime"),df1)).collect(Collectors.toList());
+                Optional<LocalDateTime> maxOp = maxLocalTimeList.stream().max(LocalDateTime::compareTo);
                 if(first.isPresent()){
                     boolean workDay = WorkDayCalculateUtils.isWorkDay(localDate);
                     //todo:针对景昱 工作日默认以8小时工作制度加上加班时长 非工作日以加班时长为准
                     Double workTime;
-                    LocalTime min = minOp.get();
-                    LocalTime max = maxOp.get();
+                    LocalDateTime min = minOp.get();
+                    LocalDateTime max = maxOp.get();
                     Duration between = Duration.between(min,max);
                     if(between.toHours()<=0){
                         continue;
@@ -203,16 +203,23 @@ public class UserWithBeisenServiceImpl extends ServiceImpl<UserWithBeisenMapper,
                         //计算加班时长 工作日打卡超过19:00:00算加班那 非工作日全天算加班
                         if(workDay){
                             //工作日打卡超过19:00:00算加班那 非工作日全天算加班
-                            if(max.isAfter(LocalTime.parse("19:00:00", df4))){
-                                overTimeBigDecimal = new BigDecimal(Duration.between(LocalTime.parse("18:00:00", df4),max).toMinutes());
+                            LocalDateTime start = min.withHour(18).withMinute(0).withSecond(0).withNano(0);
+                            LocalDateTime overtimeStart = min.withHour(19).withMinute(0).withSecond(0).withNano(0);
+                            if (max.isAfter(overtimeStart)) {
+                                //超过一天,下班是第二天凌晨的打卡
+                                overTimeBigDecimal = new BigDecimal(Duration.between(start,max).toMinutes());
                             }
                         }else {
                             //非工作日全天 去掉休息时长 都算加班
                             overTimeBigDecimal=new BigDecimal(Duration.between(min, max).toMinutes()) ;
-                            long rest1 = DateTimeUtil.calculateOverlap(min, max, LocalTime.parse("12:00:00", df4), LocalTime.parse("13:00:00", df4));
-                            long rest2 = DateTimeUtil.calculateOverlap(min, max, LocalTime.parse("17:30:00", df4), LocalTime.parse("18:00:00", df4));
+                            long rest1 = DateTimeUtil.calculateOverlap(min, max, min.withHour(12).withMinute(0).withSecond(0), min.withHour(13).withMinute(0).withSecond(0));
+                            long rest2 = DateTimeUtil.calculateOverlap(min, max, min.withHour(17).withMinute(30).withSecond(0), min.withHour(18).withMinute(0).withSecond(0));
                             overTimeBigDecimal=overTimeBigDecimal.subtract(new BigDecimal(rest1)).subtract(new BigDecimal(rest2));
                         }
+                        if (overTimeList.size() == 0) {
+                            BigDecimal divide = overTimeBigDecimal.divide(new BigDecimal(60),1,RoundingMode.HALF_DOWN);
+                            workTime += round(divide.doubleValue(),0.5);
+                        }
                         for (JSONObject o : overTimeList) {
                             //存在开始日期为当前日期的数据以及结束日期为当天日期的数据 分开计算
                             if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(localDate)){

+ 7 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -871,6 +871,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                 HttpMethod.POST, requestEntity, String.class);
         if (responseEntity.getStatusCode() == HttpStatus.OK) {
             String resp = responseEntity.getBody();
+            System.out.println("getBatchSearchUserInfo response=="+resp);
             JSONObject json = JSONObject.parseObject(resp);
             if(json.getIntValue("errcode")>0){
                 throw new Exception(json.toJSONString());
@@ -891,9 +892,11 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                 }
                 List<String> openUseridList = (List<String>) userOb.get("open_userid");
                 if(openUseridList.size()>1){
-                    msg.data=userName;
-                    msg.code="0";
-                    return msg;
+//                    msg.data=userName;
+//                    msg.code="0";
+//                    return msg;
+                    System.out.println("跳过,存在重名用户==" + userName);
+                    continue;
                 }
                 user.setCorpwxUserid(openUseridList.get(0));
                 userList.add(user);
@@ -1435,7 +1438,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                                 leaveStart = baseMorningStart;
                                                 isWholeDayLeave = true;
                                             } else {
-                                                leaveStart = "14:00";
+                                                leaveStart = baseAfternoonStart;
                                                 leaveEnd = baseAfternoonEnd;//请假的下班打卡时间,算上班结束的时间
                                             }
                                         } else if (leaveEnd.equals("上午")) {

+ 11 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/DateTimeUtil.java

@@ -49,6 +49,17 @@ public class DateTimeUtil {
         return ChronoUnit.MINUTES.between(overlapStart, overlapEnd);
     }
 
+    public static long calculateOverlap(LocalDateTime start1, LocalDateTime end1, LocalDateTime start2, LocalDateTime end2) {
+        if (start1.isAfter(end2) || start2.isAfter(end1)) {
+            return 0;
+        }
+
+        LocalDateTime overlapStart = start1.isBefore(start2) ? start2 : start1;
+        LocalDateTime overlapEnd = end1.isAfter(end2) ? end2 : end1;
+
+        return ChronoUnit.MINUTES.between(overlapStart, overlapEnd);
+    }
+
     /**
      * 返回四舍五入到整数的部分
      */

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -761,6 +761,9 @@
             <if test="queryBO.taskName != null and queryBO.taskName != ''">
                 and task.name like concat('%',#{queryBO.taskName},'%')
             </if>
+            <if test="queryBO.projectId != null">
+                and task.project_id = #{queryBO.projectId}
+            </if>
             <if test="deptIds!=null and deptIds.size()>0">
                 and p.dept_id in
                 <foreach collection="deptIds" open="(" close=")" separator="," item="item">