Bladeren bron

修改sql查询异常

yusm 1 week geleden
bovenliggende
commit
14ce6960c7

+ 17 - 11
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/AttendanceStaffServiceImpl.java

@@ -186,33 +186,39 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                         continue;
                     }
                     else if (first.isPresent()&&first.get().getType()==6) {
-                        ApplyForm applyForm = first.get();
-                        Attendance a1 = new Attendance();
-                        a1.setClockTime(applyForm.getStartTime());
-                        attendances.add(a1);
-                        attendances = attendances.stream()
-                                .sorted(Comparator.comparing(Attendance::getClockTime))
+                        List<ApplyForm> collect = applyFormList.stream().filter(a -> !a.getStartTime().toLocalDate().isAfter(date)
+                                        && !a.getEndTime().toLocalDate().isBefore(date) && a.getApplyId().equals(jobNumber))
                                 .collect(Collectors.toList());
+                        if (!collect.isEmpty()) {
+                            for (ApplyForm applyForm : collect) {
+                                Attendance a1 = new Attendance();
+                                a1.setClockTime(applyForm.getStartTime());
+                                attendances.add(a1);
+                            }
+                            attendances = attendances.stream()
+                                    .sorted(Comparator.comparing(Attendance::getClockTime))
+                                    .collect(Collectors.toList());
+                        }
                     }
 
 
                     //早班上下班时间判断
                     Optional<Attendance> zaoShangCount = attendances.stream().filter(a ->!a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 7, 0))
-                            &&!a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 8, 0))
+                            &&!a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 8, 30))
                     ).findFirst();
                     Optional<Attendance> zaoXiaCount = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
                             && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 20, 30))
                     ).findFirst();
                     //异常早班1时间判断
-                    Optional<Attendance> zaoShangYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 8, 0))
-                            && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 9, 0))
+                    Optional<Attendance> zaoShangYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 8, 30))
+                            && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 9, 30))
                     ).findFirst();
                     Optional<Attendance> zaoXiaYiChang1Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
                             && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 20, 30))).findFirst();
 
                     //异常早班2时间判断
-                    Optional<Attendance> zaoShangYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 9, 0))
-                            && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 10, 0))
+                    Optional<Attendance> zaoShangYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 9, 30))
+                            && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 10, 30))
                     ).findFirst();
                     Optional<Attendance> zaoXiaYiChang2Count = attendances.stream().filter(a -> a.getClockTime().isAfter(LocalDateTime.of(year, monthValue, dayValue, 16, 30))
                             && a.getClockTime().isBefore(LocalDateTime.of(year, monthValue, dayValue, 20, 30))

+ 3 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanServiceImpl.java

@@ -1490,7 +1490,9 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         List<Integer> ids = planProcedureTotals.stream().map(PlanProcedureTotal::getId).collect(Collectors.toList());
         ids.add(-1);
         List<ProdProcedureTeam> list = prodProcedureTeamService.list(new LambdaQueryWrapper<ProdProcedureTeam>().in(ProdProcedureTeam::getPlanProcedureId, ids));
-        prodProcedureTeamService.removeByIds(list.stream().map(ProdProcedureTeam::getId).collect(Collectors.toList()));
+        if (!list.isEmpty()){
+            prodProcedureTeamService.removeByIds(list.stream().map(ProdProcedureTeam::getId).collect(Collectors.toList()));
+        }
         if(!updateById(plan)){
             httpRespMsg.setError("验证失败");
         }