소스 검색

教师考勤查询

dzx 1 개월 전
부모
커밋
1f0245adac

+ 7 - 0
src/main/java/com/xjrsoft/module/attendance/entity/TeacherAttendanceRecord.java

@@ -12,6 +12,7 @@ import lombok.Data;
 import java.io.Serializable;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.util.Date;
 
 
@@ -103,4 +104,10 @@ public class TeacherAttendanceRecord implements Serializable {
     @ApiModelProperty("考勤日期")
     private LocalDate attendanceDate;
 
+    @ApiModelProperty("开始时间")
+    private LocalDateTime startTime;
+
+    @ApiModelProperty("结束时间")
+    private LocalDateTime endTime;
+
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/attendance/mapper/TeacherAttendanceRecordMapper.java

@@ -7,6 +7,7 @@ import com.xjrsoft.module.attendance.dto.TeacherDetailsDto;
 import com.xjrsoft.module.attendance.entity.TeacherAttendanceRecord;
 import com.xjrsoft.module.attendance.vo.AttendanceStatisticsPageVo;
 import com.xjrsoft.module.attendance.vo.TeacherStatisticsPageVo;
+import com.xjrsoft.module.teacher.entity.WfTeacherleave;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -23,4 +24,7 @@ public interface TeacherAttendanceRecordMapper extends MPJBaseMapper<TeacherAtte
     Page<TeacherStatisticsPageVo> getPage(Page<TeacherStatisticsPageVo> page, TeacherDetailsDto dto);
 
     List<TeacherStatisticsPageVo> getList(@Param("dto") TeacherDetailsDto dto);
+
+
+    List<TeacherAttendanceRecord> getLeaveList(@Param("dto") WfTeacherleave dto);
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/job/AttendanceRecordTask.java

@@ -150,6 +150,8 @@ public class AttendanceRecordTask {
                     endTime = queryDate.atTime(detailsUserVo.getEveningEndTime());
                 }
             }
+            record.setStartTime(startTime);
+            record.setEndTime(endTime);
 
             WfTeacherleave studentLeave = wfTeacherleaveService.getLeaveByUserId(startTime, endTime, user.getId());
             if(studentLeave != null){

+ 2 - 0
src/main/java/com/xjrsoft/module/liteflow/node/WfTeacherleaveNode.java

@@ -27,6 +27,8 @@ public class WfTeacherleaveNode extends NodeComponent {
             wfTeacherleaveService.dataHandle(formId);
 
             wfTeacherleaveService.hikvisionLeave(formId);
+
+            wfTeacherleaveService.updateAttendancestatus(formId);
         }
     }
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/teacher/service/IWfTeacherleaveService.java

@@ -28,4 +28,6 @@ public interface IWfTeacherleaveService extends MPJBaseService<WfTeacherleave> {
     Map<Long, WfTeacherleave> getLeaveList(LocalDateTime startTime, LocalDateTime endTime);
 
     WfTeacherleave getLeaveByUserId(LocalDateTime startTime, LocalDateTime endTime, Long userId);
+
+    void updateAttendancestatus(Long id);
 }

+ 22 - 0
src/main/java/com/xjrsoft/module/teacher/service/impl/WfTeacherleaveServiceImpl.java

@@ -2,12 +2,15 @@ package com.xjrsoft.module.teacher.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.common.enums.LeaveReasonEnum;
+import com.xjrsoft.module.attendance.entity.TeacherAttendanceRecord;
+import com.xjrsoft.module.attendance.mapper.TeacherAttendanceRecordMapper;
 import com.xjrsoft.module.hikvision.entity.HikvisionData;
 import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
 import com.xjrsoft.module.hikvision.util.ApiUtil;
@@ -46,6 +49,9 @@ public class WfTeacherleaveServiceImpl extends MPJBaseServiceImpl<WfTeacherleave
     private final IWfHeadTeacherLeaveService wfHeadTeacherLeaveService;
     private final HikvisionDataMapper hikvisionDataMapper;
     private final WfTeacherleaveMapper wfTeacherleaveMapper;
+
+    private final TeacherAttendanceRecordMapper attendanceRecordMapper;
+
     @Override
     public Boolean dataHandle(Long dataId) {
         WfTeacherleave wfTeacherleave = this.getById(dataId);
@@ -207,6 +213,22 @@ public class WfTeacherleaveServiceImpl extends MPJBaseServiceImpl<WfTeacherleave
         return this.baseMapper.getLeaveByUserId(startTime, endTime, userId);
     }
 
+    @Override
+    public void updateAttendancestatus(Long id) {
+        WfTeacherleave teacherleave = this.getById(id);
+        List<TeacherAttendanceRecord> leaveList = attendanceRecordMapper.getLeaveList(teacherleave);
+        for (TeacherAttendanceRecord teacherAttendanceRecord : leaveList) {
+            UpdateWrapper<TeacherAttendanceRecord> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.eq("id", teacherAttendanceRecord.getId());
+            updateWrapper.setSql("attendance_mode = null");
+            updateWrapper.setSql("car_number = null");
+            updateWrapper.setSql("record_time = null");
+            updateWrapper.setSql("attendance_status = '" + teacherleave.getLeaveType() + "'");
+
+            attendanceRecordMapper.update(teacherAttendanceRecord, updateWrapper);
+        }
+    }
+
     JsonArray selectResource(ApiUtil apiUtil){
         String apiPath = "/api/irds/v2/resource/resourcesByParams";
         JsonObject jsonObject = new JsonObject();

+ 10 - 0
src/main/resources/mapper/attendance/TeacherAttendanceRecordMapper.xml

@@ -54,4 +54,14 @@
         </if>
 
     </select>
+
+    <select id="getLeaveList" parameterType="com.xjrsoft.module.teacher.entity.WfTeacherleave" resultType="com.xjrsoft.module.attendance.entity.TeacherAttendanceRecord">
+        SELECT * FROM teacher_attendance_record WHERE user_id = #{dto.userId}
+        AND
+        (
+            (#{dto.leaveStartTime} BETWEEN start_time and end_time)
+            OR
+            (#{dto.leaveEndTime} BETWEEN start_time AND end_time)
+        )
+    </select>
 </mapper>