@ -60,6 +60,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit ;
import java.util.concurrent.TimeUnit ;
import java.util.stream.Collectors ;
import java.util.stream.Collectors ;
import static org.dromara.common.core.constant.TenantConstants.SUPER_ADMIN_ID ;
/**
/**
* 施工人员补卡申请Service业务层处理
* 施工人员补卡申请Service业务层处理
*
*
@ -185,60 +187,46 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
@Override
@Override
@Transactional ( rollbackFor = Exception . class )
@Transactional ( rollbackFor = Exception . class )
public Boolean managerReview ( BusReissueCardManagerReviewReq req ) {
public Boolean managerReview ( BusReissueCardManagerReviewReq req ) {
// Long id = req.getId();
// String managerOpinion = req.getManagerOpinion() ;
BusReissueCard bean = getById ( req . getId ( ) ) ;
// // 判断该补卡记录是否存在
if ( bean = = null ) {
// BusReissueCard oldReissueCard = this.getById(id) ;
throw new ServiceException ( " 未找到该申请 " ) ;
// if (oldReissueCard == null) {
}
// throw new ServiceException("施工人员补卡申请不存在", HttpStatus.NOT_FOUND) ;
Long attendanceId = bean . getAttendanceId ( ) ;
// }
BeanUtil . copyProperties ( req , bean ) ;
// // 如果已经审核过,则返回
boolean b = updateById ( bean ) ;
// if (!BusOpinionStatusEnum.UNREAD.getValue().equals(managerOpinion)) {
if ( " 2 " . equals ( bean . getGangerOpinion ( ) ) ) {
// throw new ServiceException("该请假已审核,请勿重复操作", HttpStatus.BAD_REQUEST) ;
BusAttendance byId = attendanceService . getById ( attendanceId ) ;
// }
String clockStatus = byId . getClockStatus ( ) ;
// // 判断班组长是否审核通过
byId . setClockStatus ( BusAttendanceClockStatusEnum . REISSUE . getValue ( ) ) ;
// String gangerOpinion = oldReissueCard.getGangerOpinion() ;
attendanceService . updateById ( byId ) ;
// if (!BusOpinionStatusEnum.PASS.getValue().equals(gangerOpinion)) {
//缺卡补充当天的工资表
// throw new ServiceException("请等待班组长审核通过后再进行操作", HttpStatus.BAD_REQUEST);
if ( BusAttendanceClockStatusEnum . UNCLOCK . getValue ( ) . equals ( clockStatus ) ) {
// }
userSalaryDetailService . insertByAttendance ( byId . getUserId ( ) , byId . getClockDate ( ) ) ;
// // todo 判断当前用户是否为项目管理员
}
// // 填充默认值,更新数据
CompletableFuture . runAsync ( ( ) - > {
// BusReissueCard reissueCard = new BusReissueCard();
try {
// reissueCard.setId(id) ;
chatServerHandler . sendSystemMessageToUser ( bean . getUserId ( ) , " 补卡申请已通过 " , " 1 " ) ;
// reissueCard.setManagerOpinion(managerOpinion);
} catch ( Exception e ) {
// reissueCard.setManagerExplain(req.getManagerExplain()) ;
log . error ( " 异步发送系统消息失败, 用户ID: {}, 消息: {} " , bean . getUserId ( ) , " 补卡申请已通过 " , e ) ;
// reissueCard.setManagerTime(new Date());
}
// reissueCard.setRemark(req.getRemark()) ;
} ) ;
// boolean result = this.updateById(reissueCard);
// if (!result) {
}
// throw new ServiceException("更新管理员审核操作失败", HttpStatus.ERROR);
if ( " 3 " . equals ( bean . getGangerOpinion ( ) ) ) {
// }
BusAttendance byId = attendanceService . getById ( attendanceId ) ;
// // 更新考勤表记录
byId . setHandle ( " 0 " ) ;
// BusAttendance oldAttendance = attendanceService.getById(oldReissueCard.getAttendanceId()) ;
attendanceService . updateById ( byId ) ;
// if (oldAttendance == null) {
CompletableFuture . runAsync ( ( ) - > {
// throw new ServiceException("考勤记录不存在", HttpStatus.NOT_FOUND);
try {
// }
chatServerHandler . sendSystemMessageToUser ( bean . getUserId ( ) , " 补卡申请未通过 " , " 1 " ) ;
// BusAttendance attendance = new BusAttendance();
} catch ( Exception e ) {
// BusProject project = projectService.getById(oldReissueCard.getProjectId()) ;
log . error ( " 异步发送系统消息失败, 用户ID: {}, 消息: {} " , bean . getUserId ( ) , " 补卡申请未通过 " , e ) ;
// // 根据补卡类型更新考勤时间
}
// String[] clockTime = project.getPunchRange().split(",") ;
} ) ;
// String reissueCardType = oldReissueCard.getReissueCardType();
// if (BusAttendanceCommuterEnum.CLOCKIN.getValue().equals(reissueCardType)) {
}
// // 拼接时间,获取项目的上班打卡时间
return b ;
// Date date = DateUtils.combineDateAndTime(oldAttendance.getClockDate(), clockTime[0] + ":00");
// attendance.setClockTime(date);
// } else if (BusAttendanceCommuterEnum.CLOCKOUT.getValue().equals(reissueCardType)) {
// // 拼接时间,获取项目的下班打卡时间
// Date date = DateUtils.combineDateAndTime(oldAttendance.getClockDate(), clockTime[1] + ":00");
// attendance.setClockTime(date);
// }
// attendance.setId(oldReissueCard.getAttendanceId());
// attendance.setClockStatus(BusAttendanceClockStatusEnum.REISSUE.getValue());
// boolean updateAttendance = attendanceService.updateById(attendance);
// if (!updateAttendance) {
// throw new ServiceException("更新考勤记录失败", HttpStatus.ERROR);
// }
return true ;
}
}
/**
/**
@ -312,13 +300,15 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
// 精确查询
// 精确查询
lqw . eq ( ObjectUtils . isNotEmpty ( id ) , BusReissueCard : : getId , id ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( id ) , BusReissueCard : : getId , id ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( userId ) , BusReissueCard : : getUserId , userId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( userId ) , BusReissueCard : : getUserId , userId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( gangerId ) , BusReissueCard : : getGangerId , gangerId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( gangerId ) & & ! Objects . equals ( gangerId , SUPER_ADMIN_ID ) , BusReissueCard : : getGangerId , gangerId ) ;
lqw . eq ( StringUtils . isNotBlank ( gangerOpinion ) , BusReissueCard : : getGangerOpinion , gangerOpinion ) ;
lqw . eq ( StringUtils . isNotBlank ( gangerOpinion ) , BusReissueCard : : getGangerOpinion , gangerOpinion ) ;
lqw . eq ( StringUtils . isNotBlank ( managerOpinion ) , BusReissueCard : : getManagerOpinion , managerOpinion ) ;
lqw . eq ( StringUtils . isNotBlank ( managerOpinion ) , BusReissueCard : : getManagerOpinion , managerOpinion ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( projectId ) , BusReissueCard : : getProjectId , projectId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( projectId ) , BusReissueCard : : getProjectId , projectId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( teamId ) , BusReissueCard : : getTeamId , teamId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( teamId ) , BusReissueCard : : getTeamId , teamId ) ;
lqw . eq ( StringUtils . isNotBlank ( reissueCardType ) , BusReissueCard : : getReissueCardType , reissueCardType ) ;
lqw . eq ( StringUtils . isNotBlank ( reissueCardType ) , BusReissueCard : : getReissueCardType , reissueCardType ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( attendanceId ) , BusReissueCard : : getAttendanceId , attendanceId ) ;
lqw . eq ( ObjectUtils . isNotEmpty ( attendanceId ) , BusReissueCard : : getAttendanceId , attendanceId ) ;
lqw . orderByDesc ( BusReissueCard : : getCreateTime ) ;
return lqw ;
return lqw ;
}
}