@ -1,6 +1,7 @@
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				package   com.ruoyi.wgz.service.impl ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   cn.hutool.core.bean.BeanUtil ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   cn.hutool.core.collection.CollectionUtil ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   cn.hutool.core.util.StrUtil ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.core.toolkit.Wrappers ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -8,13 +9,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.BgtProjectRecruit ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.BgtProjectRecruitApply ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.dto.BgtAttendanceDTO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.dto.BgtAttendanceDetailDTO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.vo.BgtAttendanceCountVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.vo.BgtAttendanceDetailVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.vo.BgtAttendanceVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.vo.WgzAttendanceRecordVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.service.IBgtProjectRecruitApplyService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.service.IBgtProjectRecruitService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.common.core.page.TableDataInfo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.common.util.DataUtil ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.common.utils.DateUtils ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.common.utils.PageUtils ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.common.utils.SecurityUtils ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.fbs.domain.FbsProjectTask ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.fbs.service.IFbsProjectTaskService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.bo.WgzAttendanceQueryBo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.bo.req.WgzAppSubmitTheClockReq ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.bo.res.WgzAppCardReplacementApplicationRes ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -24,24 +33,22 @@ import com.ruoyi.wgz.bo.rests.WgzAppCardReplacementApplicationTwo;
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.bo.rests.WgzAppPunchTheCalendarRecordThree ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.bo.rests.WgzAppPunchTheCalendarRecordTwo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.domain.WgzAttendance ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.domain.WgzLeave  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.bgt.domain.vo.BgtAttendanceCountVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.domain.WgzUser  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.mapper.WgzAttendanceMapper ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.service.IWgzAttendanceService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.service.IWgzLeaveService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.aspectj.weaver.ast.Var ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.ruoyi.wgz.service.IWgzUserService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.beans.factory.annotation.Autowired ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.stereotype.Service ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.transaction.annotation.Transactional ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.text.DecimalFormat ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.text.SimpleDateFormat ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.time.* ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.time.format.DateTimeFormatter ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.time.temporal.TemporalAdjusters ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.util.* ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.util.Collection  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.util.List ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.util.Map ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   java.util.stream. Collectors  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				/** 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				 * 考勤打卡Service业务层处理 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -65,6 +72,12 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Autowired 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 private    IWgzLeaveService   iWgzLeaveService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Autowired 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 private   IFbsProjectTaskService   taskService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Autowired 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 private   IWgzUserService   wgzUserService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   WgzAttendance   queryById ( Long   id ) { 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -325,6 +338,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 return   baseMapper . selectCount ( apply ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 public   List < BgtAttendanceCountVO >   countByTaskId ( Long   taskId ,   LocalDate   beginDate ,   LocalDate   endDate )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 return   baseMapper . countByTaskId ( taskId ,   beginDate ,   endDate ) ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -332,14 +346,62 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 public   BgtAttendanceVO   attendanceDetail ( BgtAttendanceDTO   dto )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 BgtAttendanceVO   bgtAttendanceVO   =   new   BgtAttendanceVO ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 FbsProjectTask   task   =   taskService . getById ( dto . getTaskId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceVO . setTaskId ( task . getId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceVO . setTaskName ( task . getTaskName ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LocalDate   date   =   dto . getDate ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LocalDate   startData   =   null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LocalDate   endData   =   null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 if ( dto . getDateType ( ) . equals ( DateUtils . DAY ) ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 // 获取本月开始日期 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 startData   =   date . with ( TemporalAdjusters . firstDayOfMonth ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 endData   =   date ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 return   null ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 List < BgtAttendanceCountVO >   countVOS   =   countByTaskId ( dto . getTaskId ( ) ,   startData ,   endData ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							  if ( CollectionUtil . isNotEmpty ( countVOS ) ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 bgtAttendanceVO . setCountVOs ( DataUtil . fillMissingDates ( countVOS ,   startData ,   endData ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 BgtAttendanceCountVO   countVO   =   countVOS . stream ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
									 . filter ( vo   - >   vo . getDate ( ) . isEqual ( date ) ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
									 . findFirst ( ) . orElse ( null ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 bgtAttendanceVO . setReportToDutyNum ( countVO . getReportToDutyNum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 bgtAttendanceVO . setTotalNum ( countVO . getTotalNum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 bgtAttendanceVO . setAbsenceDutyNum ( countVO . getTotalNum ( ) - countVO . getReportToDutyNum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 } else   if ( dto . getDateType ( ) . equals ( DateUtils . MONTH ) ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 // 获取本年开始日期 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 startData   =   date . with ( TemporalAdjusters . firstDayOfYear ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 endData   =   date . with ( TemporalAdjusters . lastDayOfMonth ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 List < BgtAttendanceCountVO >   countVOS   =   countByTaskId ( dto . getTaskId ( ) ,   startData ,   endData ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 if ( CollectionUtil . isNotEmpty ( countVOS ) ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 bgtAttendanceVO . setCountVOs ( DataUtil . statisticsByMonth ( countVOS , startData ,   endData ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 BgtAttendanceCountVO   countVO   =   countVOS . stream ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 . filter ( vo   - >   YearMonth . from ( vo . getDate ( ) ) . equals ( YearMonth . from ( date ) ) ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 . findFirst ( ) . orElse ( null ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 bgtAttendanceVO . setReportToDutyNum ( countVO . getReportToDutyNum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 bgtAttendanceVO . setTotalNum ( countVO . getTotalNum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 bgtAttendanceVO . setAbsenceDutyNum ( countVO . getAbsenceDutyNum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 getLateAndLeave ( bgtAttendanceVO ,   startData ,   endData ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 return   bgtAttendanceVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 //	@Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 public   void   getLateAndLeave ( BgtAttendanceVO   vo , LocalDate   startDate ,   LocalDate   endDate ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < BgtProjectRecruit >   bgtProjectRecruits   =   iBgtProjectRecruitService . getBaseMapper ( ) . selectList ( Wrappers . < BgtProjectRecruit > lambdaQuery ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 . eq ( BgtProjectRecruit : : getTaskId ,   vo . getTaskId ( ) ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < Long >   recruitIds   =   bgtProjectRecruits . stream ( ) . map ( BgtProjectRecruit : : getId ) . collect ( Collectors . toList ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 Integer   late   =   baseMapper . selectCount ( Wrappers . < WgzAttendance > lambdaQuery ( ) . eq ( WgzAttendance : : getLate ,   1 ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 . in ( WgzAttendance : : getRecruitId ,   recruitIds ) . between ( WgzAttendance : : getDate ,   startDate ,   endDate ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 Integer   leave   =   baseMapper . selectCount ( Wrappers . < WgzAttendance > lambdaQuery ( ) . isNotNull ( WgzAttendance : : getLeaveMarkId ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 . in ( WgzAttendance : : getRecruitId ,   recruitIds ) . between ( WgzAttendance : : getDate ,   startDate ,   endDate ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 vo . setLateNum ( late ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 vo . setLeaveNum ( leave ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				//	@Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				//	public WgzAttendance findByUserIdWait(Long appUserId, Long recruitId, String date) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				//		LambdaQueryWrapper<WgzAttendance> qw = new LambdaQueryWrapper<>(); 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				//		qw.eq(WgzAttendance::getRecruitId,recruitId); 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -444,4 +506,105 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 . setFillingDataTime ( fillingDataTime ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 list . add ( two ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 public   BgtAttendanceDetailVO   bgtAttendanceDetail ( BgtAttendanceDetailDTO   dto )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 BgtAttendanceDetailVO   bgtAttendanceDetailVO   =   new   BgtAttendanceDetailVO ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 WgzUser   wgzUser   =   wgzUserService . getById ( dto . getUserId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setUserId ( wgzUser . getUserId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setUsername ( wgzUser . getUsername ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setAvatarName ( wgzUser . getAvatarName ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < BgtProjectRecruit >   bgtProjectRecruits   =   iBgtProjectRecruitService . getBaseMapper ( ) . selectList ( Wrappers . < BgtProjectRecruit > lambdaQuery ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 . eq ( BgtProjectRecruit : : getTaskId ,   dto . getTaskId ( ) ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < Long >   recruitIds   =   bgtProjectRecruits . stream ( ) . map ( BgtProjectRecruit : : getId ) . collect ( Collectors . toList ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 BgtProjectRecruitApply   recruitApply   =   iBgtProjectRecruitApplyService . getById ( recruitIds . get ( 0 ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setEntryTime ( recruitApply . getEntryTime ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setStatus ( recruitApply . getStatus ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LambdaQueryWrapper < WgzAttendance >   wrapper   =   new   LambdaQueryWrapper < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 wrapper . eq ( WgzAttendance : : getUserId , dto . getUserId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 wrapper . in ( WgzAttendance : : getRecruitId , recruitIds ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LocalDate   date   =   dto . getDate ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LocalDate   startDate   =   date . with ( TemporalAdjusters . firstDayOfMonth ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 LocalDate   endData   =   date . with ( TemporalAdjusters . lastDayOfMonth ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 wrapper . between ( WgzAttendance : : getDate , startDate , endData ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < WgzAttendance >   wgzAttendances   =   baseMapper . selectList ( wrapper ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 // 创建SimpleDateFormat对象,  格式化日期为中文星期 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 SimpleDateFormat   sdf   =   new   SimpleDateFormat ( " EEEE " ,   java . util . Locale . CHINESE ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 //获取招工打卡时间 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < BgtProjectRecruit >   list   =   iBgtProjectRecruitService . list ( Wrappers . < BgtProjectRecruit > lambdaQuery ( ) . in ( BgtProjectRecruit : : getId ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 Map < Long ,   BgtProjectRecruit >   recruitMap   =   list . stream ( ) . collect ( Collectors . toMap ( BgtProjectRecruit : : getId ,   recruit   - >   recruit ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < WgzAttendanceRecordVO >   lateRecords   =   new   ArrayList < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < WgzAttendanceRecordVO >   earlyLeaveRecords =   new   ArrayList < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < WgzAttendanceRecordVO >   missRecords =   new   ArrayList < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 List < WgzAttendanceRecordVO >   records =   new   ArrayList < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 for   ( WgzAttendance   wgzAttendance : wgzAttendances ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 WgzAttendanceRecordVO   recordVO   =   new   WgzAttendanceRecordVO ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 recordVO . setDate ( wgzAttendance . getDate ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 recordVO . setWeek ( sdf . format ( date ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 if ( wgzAttendance . getMissedIn ( ) = = 0   & &   wgzAttendance . getMissedOut ( ) = = 0 ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 recordVO . setDay ( 1D ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 records . add ( recordVO ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } else   if ( wgzAttendance . getMissedIn ( ) = = 1   & &   wgzAttendance . getMissedOut ( ) = = 1 ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 recordVO . setDay ( 0D ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } else   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 recordVO . setDay ( 0 . 5D ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 records . add ( recordVO ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 BgtProjectRecruit   recruit   =   recruitMap . get ( wgzAttendance . getRecruitId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 LocalDateTime   clockInTime   =   wgzAttendance . getClockInTime ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 LocalDateTime   clockOutTime   =   wgzAttendance . getClockOutTime ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 LocalTime   beginWorkTime   =   recruit . getBeginWorkTime ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 LocalTime   endWorkTime   =   recruit . getEndWorkTime ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 if   ( wgzAttendance . getLate ( )   = =   1 )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 WgzAttendanceRecordVO   LateRecordVO   =   BeanUtil . copyProperties ( recordVO ,   WgzAttendanceRecordVO . class ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 LateRecordVO . setTime ( clockInTime . toLocalTime ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 LateRecordVO . setMinutes ( DataUtil . getMinutes ( clockInTime , beginWorkTime ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 lateRecords . add ( LateRecordVO ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 if   ( wgzAttendance . getEarlyLeave ( )   = =   1 )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 WgzAttendanceRecordVO   earlyLeaveRecordVO   =   BeanUtil . copyProperties ( recordVO ,   WgzAttendanceRecordVO . class ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 earlyLeaveRecordVO . setTime ( clockOutTime . toLocalTime ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 earlyLeaveRecordVO . setMinutes ( DataUtil . getMinutes ( clockOutTime , endWorkTime ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 earlyLeaveRecords . add ( earlyLeaveRecordVO ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 if   ( wgzAttendance . getMissedIn ( )   = =   1 )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 WgzAttendanceRecordVO   missRecordVO   =   BeanUtil . copyProperties ( recordVO ,   WgzAttendanceRecordVO . class ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 missRecordVO . setTime ( beginWorkTime ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 missRecords . add ( missRecordVO ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 if   ( wgzAttendance . getMissedOut ( )   = =   1 )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 WgzAttendanceRecordVO   missRecordVO   =   BeanUtil . copyProperties ( recordVO ,   WgzAttendanceRecordVO . class ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 missRecordVO . setTime ( endWorkTime ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
								 missRecords . add ( missRecordVO ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
							 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setDayNum ( records . stream ( ) . mapToDouble ( WgzAttendanceRecordVO : : getDay ) . sum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setLateNum ( lateRecords . size ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setLateMinute ( lateRecords . stream ( ) . mapToInt ( WgzAttendanceRecordVO : : getMinutes ) . sum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setLateRecords ( lateRecords ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setEarlyLeaveNum ( earlyLeaveRecords . size ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setEarlyLeaveMinute ( earlyLeaveRecords . stream ( ) . mapToInt ( WgzAttendanceRecordVO : : getMinutes ) . sum ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setEarlyLeaveRecords ( earlyLeaveRecords ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setMissNum ( earlyLeaveRecords . size ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 bgtAttendanceDetailVO . setMissRecords ( earlyLeaveRecords ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
						 return   bgtAttendanceDetailVO ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
					 } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				}