yusm 6 일 전
부모
커밋
49e0e1989e

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/ApplyFormMapper.java

@@ -21,4 +21,6 @@ public interface ApplyFormMapper extends BaseMapper<ApplyForm> {
     List<ApplyForm> getListByFirstDateAndLastDate(LocalDate startDate, LocalDate endDate);
 
     List<ApplyForm> getAllListByFirstDateAndLastDate(LocalDate startDate, LocalDate endDate);
+
+    List<ApplyForm> getListByTypeDate(String date, String userId);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/ApplyFormService.java

@@ -21,4 +21,6 @@ public interface ApplyFormService extends IService<ApplyForm> {
     List<ApplyForm> getListByFirstDateAndLastDate(LocalDate startDate, LocalDate endDate);
 
     List<ApplyForm> getAllListByFirstDateAndLastDate(LocalDate startDate, LocalDate nextMonthDate);
+
+    List<ApplyForm> getListByTypeDate(String format, String token);
 }

+ 5 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ApplyFormServiceImpl.java

@@ -38,4 +38,9 @@ public class ApplyFormServiceImpl extends ServiceImpl<ApplyFormMapper, ApplyForm
     public List<ApplyForm> getAllListByFirstDateAndLastDate(LocalDate startDate, LocalDate nextMonthDate) {
         return applyFormMapper.getAllListByFirstDateAndLastDate(startDate,nextMonthDate);
     }
+
+    @Override
+    public List<ApplyForm> getListByTypeDate(String date, String userId) {
+        return applyFormMapper.getListByTypeDate(date,userId);
+    }
 }

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

@@ -112,6 +112,9 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                     Optional<ApplyForm> first = applyFormList.stream().filter(a -> !a.getStartTime().toLocalDate().isAfter(date)
                             && !a.getEndTime().toLocalDate().isBefore(date)&&a.getApplyId().equals(jobNumber)).findFirst();
 
+                    List<ApplyForm> applyForms = applyFormList.stream().filter(a -> !a.getStartTime().toLocalDate().isAfter(date.plusDays(2))
+                            && !a.getStartTime().toLocalDate().isBefore(date.plusDays(-1))&&a.getApplyId().equals(jobNumber)&&a.getType()==6).collect(Collectors.toList());
+
                     if (first.isPresent()&&first.get().getType()!=6) {
                         ApplyForm applyForm = first.get();
                         //请假
@@ -242,20 +245,16 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                         }
 
                     }
-                    else if (first.isPresent()&&first.get().getType()==6) {
-                        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());
+                    //考勤证明
+                    if (!applyForms.isEmpty()) {
+                        for (ApplyForm applyForm : applyForms) {
+                            Attendance a1 = new Attendance();
+                            a1.setClockTime(applyForm.getStartTime());
+                            attendances.add(a1);
                         }
+                        attendances = attendances.stream()
+                                .sorted(Comparator.comparing(Attendance::getClockTime))
+                                .collect(Collectors.toList());
                     }
 
                     AttendanceRule baiBanRule = ruleList.get(0);
@@ -671,6 +670,7 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
             LocalDate clockDate = staff.getClockDate();
             String format = clockDate.format(formatter1);
             List<ApplyForm> applyFormList= applyFormService.getListByDate(format,userId==null|| StringUtils.isEmpty(userId)?request.getHeader("Token"):userId);
+            List<ApplyForm> applyFormTypeList= applyFormService.getListByTypeDate(format,userId==null|| StringUtils.isEmpty(userId)?request.getHeader("Token"):userId);
 
             LocalDateTime clockStartTime = staff.getClockStartTime();
             LocalDateTime clockEndTime = staff.getClockEndTime();
@@ -1166,8 +1166,9 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                     staff.setAttendanceTypeName("异常小夜班2");
                 }
                 if (!maplist.isEmpty()) {
+                    HashMap<String, Object> map = new HashMap<>();
+                    StringBuilder stringBuilder = new StringBuilder();
                     if (!applyFormList.isEmpty()){
-                        StringBuilder stringBuilder = new StringBuilder();
                         for (ApplyForm applyForm : applyFormList) {
                             if (applyForm.getType()==3) {
                                 stringBuilder
@@ -1176,7 +1177,7 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                                         .append(applyForm.getApplyBillName())
                                         .append(" 时长")
                                         .append(applyForm.getSumTime()).append("小时");
-                            }else {
+                            }else if (applyForm.getType()!=6){
                                 stringBuilder
                                         .append(applyForm.getStartTime().format(formatter2))
                                         .append("-").append(applyForm.getEndTime().format(formatter2))
@@ -1185,18 +1186,30 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                                         .append(applyForm.getSumTime()).append("小时");
                             }
                         }
-                        HashMap<String, Object> map = new HashMap<>();
+                    }
+                    if (!applyFormTypeList.isEmpty()){
+                        for (ApplyForm applyForm : applyFormTypeList) {
+                            if (applyForm.getStartTime().toLocalDate().isEqual(clockDate)&&applyForm.getStartTime().toLocalTime().isAfter(LocalTime.of(4,0))) {
+                                stringBuilder
+                                        .append(applyForm.getStartTime().format(formatter2))
+                                        .append(applyForm.getTypeName());
+                            } else if (applyForm.getStartTime().toLocalDate().isAfter(clockDate)&&applyForm.getStartTime().toLocalTime().isBefore(LocalTime.of(4,0))) {
+                                stringBuilder
+                                        .append(applyForm.getStartTime().format(formatter2))
+                                        .append(applyForm.getTypeName());
+                            }
+                        }
+                    }
+                    if (stringBuilder.length()>0) {
                         map.put("res", stringBuilder.toString());
                         map.put("color","#F56C6C");
-                        /*for (HashMap<String, Object> hashMap : maplist) {
-                            hashMap.put("res","正常");
-                        }*/
                         maplist.add(1,map);
                     }
+
                 }
                 else {
+                    StringBuilder stringBuilder = new StringBuilder();
                     if (!applyFormList.isEmpty()){
-                        StringBuilder stringBuilder = new StringBuilder();
                         for (ApplyForm applyForm : applyFormList) {
                             if (applyForm.getType()==3) {
                                 stringBuilder
@@ -1205,7 +1218,7 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                                         .append(applyForm.getApplyBillName())
                                         .append(" 时长")
                                         .append(applyForm.getSumTime()).append("小时");
-                            }else {
+                            }else if (applyForm.getType()!=6){
                                 stringBuilder
                                         .append(applyForm.getStartTime().format(formatter2))
                                         .append("-").append(applyForm.getEndTime().format(formatter2))
@@ -1214,7 +1227,22 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
                                         .append(applyForm.getSumTime()).append("小时");
                             }
                         }
-                        HashMap<String, Object> map = new HashMap<>();
+                    }
+                    if (!applyFormTypeList.isEmpty()){
+                        for (ApplyForm applyForm : applyFormTypeList) {
+                            if (applyForm.getStartTime().toLocalDate().isEqual(clockDate)&&applyForm.getStartTime().toLocalTime().isAfter(LocalTime.of(4,0))) {
+                                stringBuilder
+                                        .append(applyForm.getStartTime().format(formatter2))
+                                        .append(applyForm.getTypeName());
+                            } else if (applyForm.getStartTime().toLocalDate().isAfter(clockDate)&&applyForm.getStartTime().toLocalTime().isBefore(LocalTime.of(4,0))) {
+                                stringBuilder
+                                        .append(applyForm.getStartTime().format(formatter2))
+                                        .append(applyForm.getTypeName());
+                            }
+                        }
+                    }
+                    HashMap<String, Object> map = new HashMap<>();
+                    if(stringBuilder.length()>0) {
                         map.put("res", stringBuilder.toString());
                         map.put("color","#F56C6C");
                         maplist.add(map);

+ 8 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ApplyFormMapper.xml

@@ -36,5 +36,13 @@
         WHERE  a.start_time &lt; #{endDate}  and  a.end_time &gt;= #{startDate}
         order by a.type asc
     </select>
+    <select id="getListByTypeDate" resultType="com.management.platform.entity.ApplyForm">
+        select a.* from apply_form a
+                            LEFT JOIN `user` on `user`.job_number=a.apply_id
+        WHERE
+            DATE(a.start_time) BETWEEN #{date} AND DATE_ADD(#{date}, INTERVAL 2 DAY)
+        AND `user`.id=#{userId} and a.type=6
+        order by a.type asc
+    </select>
 
 </mapper>