|
|
@@ -7,15 +7,19 @@ import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.StudyStatusEnum;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.attendance.dto.AttendanceStatisticDto;
|
|
|
import com.xjrsoft.module.attendance.vo.TeacherStatisticsVo;
|
|
|
import com.xjrsoft.module.attendance.vo.VisitorInfoVo;
|
|
|
import com.xjrsoft.module.concat.service.IXjrUserService;
|
|
|
import com.xjrsoft.module.organization.entity.UserDeptRelation;
|
|
|
+import com.xjrsoft.module.outint.entity.CarOutInRecord;
|
|
|
import com.xjrsoft.module.outint.entity.StudentOutInRecord;
|
|
|
import com.xjrsoft.module.outint.entity.TeacherOutInRecord;
|
|
|
+import com.xjrsoft.module.outint.service.ICarOutInRecordService;
|
|
|
import com.xjrsoft.module.outint.service.IStudentOutInRecordService;
|
|
|
import com.xjrsoft.module.outint.service.ITeacherOutInRecordService;
|
|
|
+import com.xjrsoft.module.personnel.entity.CarMessageApply;
|
|
|
import com.xjrsoft.module.personnel.service.IReservationSchoolService;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudent;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
@@ -60,6 +64,7 @@ public class StatisticsController {
|
|
|
private final IWfTeacherleaveService wfTeacherleaveService;
|
|
|
private final IStudentLeaveService studentLeaveService;
|
|
|
private final IReservationSchoolService reservationSchoolService;
|
|
|
+ private final ICarOutInRecordService carOutInRecordService;
|
|
|
|
|
|
@GetMapping(value = "/teacher-statistics")
|
|
|
@ApiOperation(value="教职工考勤统计")
|
|
|
@@ -77,28 +82,43 @@ public class StatisticsController {
|
|
|
if(dto.getDate() != null && !"".equals(dto.getDate())){
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE;
|
|
|
LocalDate queryDate = LocalDate.parse(dto.getDate(), formatter);
|
|
|
- LocalDateTime startTime, endTime;
|
|
|
+ LocalDateTime startTime, endTime, amEndTime = null;
|
|
|
if(dto.getTimePeriod() != null && dto.getTimePeriod() == 1){
|
|
|
startTime = queryDate.atTime(5, 0, 0);
|
|
|
endTime = queryDate.atTime(12, 0, 0);
|
|
|
}else if(dto.getTimePeriod() != null && dto.getTimePeriod() == 2){
|
|
|
startTime = queryDate.atTime(12, 0, 0);
|
|
|
endTime = queryDate.atTime(18, 0, 0);
|
|
|
+ amEndTime = queryDate.atTime(12, 0, 0);
|
|
|
}else if(dto.getTimePeriod() != null && dto.getTimePeriod() == 3){
|
|
|
startTime = queryDate.atTime(18, 0, 0);
|
|
|
endTime = queryDate.atTime(23, 59, 59);
|
|
|
+ amEndTime = queryDate.atTime(18, 0, 0);
|
|
|
}else{
|
|
|
startTime = queryDate.atTime(0, 0, 0);
|
|
|
endTime = queryDate.atTime(23, 59, 59);
|
|
|
}
|
|
|
|
|
|
List<TeacherOutInRecord> outInRecords = teacherOutInRecordService.list(
|
|
|
- new QueryWrapper<TeacherOutInRecord>().lambda()
|
|
|
- .between(TeacherOutInRecord::getRecordTime, startTime, endTime)
|
|
|
+ new MPJLambdaWrapper<TeacherOutInRecord>()
|
|
|
+ .le(TeacherOutInRecord::getRecordTime, endTime)
|
|
|
.eq(TeacherOutInRecord::getStatus, 1)
|
|
|
+ .eq("DATE_FORMAT(record_time, '%Y-%m-%d')", endTime.toLocalDate())
|
|
|
+ .ge(dto.getTimePeriod() == 2 && amEndTime != null, CarOutInRecord::getRecordTime, amEndTime)
|
|
|
.orderByAsc(TeacherOutInRecord::getRecordTime)
|
|
|
);
|
|
|
|
|
|
+ List<CarOutInRecord> list = carOutInRecordService.list(
|
|
|
+ new MPJLambdaWrapper<CarOutInRecord>()
|
|
|
+ .select(CarOutInRecord.class, x -> VoToColumnUtil.fieldsToColumns(CarOutInRecord.class).contains(x.getProperty()))
|
|
|
+ .leftJoin(CarMessageApply.class, CarMessageApply::getId, CarOutInRecord::getCarMessageApplyId)
|
|
|
+ .le(CarOutInRecord::getRecordTime, endTime)
|
|
|
+ .eq("DATE_FORMAT(record_time, '%Y-%m-%d')", endTime.toLocalDate())
|
|
|
+ .ge(dto.getTimePeriod() == 2 && amEndTime != null, CarOutInRecord::getRecordTime, amEndTime)
|
|
|
+ .eq(CarOutInRecord::getStatus, 0)
|
|
|
+ .orderByAsc(CarOutInRecord::getRecordTime)
|
|
|
+ );
|
|
|
+
|
|
|
Set<Long> collect = outInRecords.stream().map(TeacherOutInRecord::getUserId).collect(Collectors.toSet());
|
|
|
Set<Long> userIds = new HashSet<>(collect);
|
|
|
//实到人数
|