| | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.absentrecords.entity.AbsentRecords; |
| | | import org.springblade.modules.absentrecords.service.AbsentRecordsService; |
| | | import org.springblade.modules.apply.entity.Apply; |
| | | import org.springblade.modules.apply.excel.ApplyInfoExcel; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | |
| | | private final IUserDeptService userDeptService; |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | |
| | | private final AbsentRecordsService absentRecordsService; |
| | | |
| | | |
| | | @Override |
| | |
| | | trainingRegistrationVo.setSerialEnd(trainingRegistrationVo.getSerialEnd() -trainingRegistrationVo.getSerialStart()); |
| | | return baseMapper.getTrainIds(trainingRegistrationVo); |
| | | } |
| | | |
| | | /** |
| | | * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名 |
| | | */ |
| | | @Override |
| | | public void examApplyStatus() { |
| | | //封装条件 |
| | | TrainingRegistration trainingRegistration = new TrainingRegistration(); |
| | | trainingRegistration.setCancel(1); |
| | | trainingRegistration.setAuditStatus(1); |
| | | trainingRegistration.setIsExam(1); |
| | | //查询考试申请审核通过,已报名,未考试的人员 |
| | | List<TrainingRegistration> trainingRegistrationList = baseMapper.selectTrainingRegistrationList(trainingRegistration); |
| | | if (trainingRegistrationList.size()>0) { |
| | | trainingRegistrationList.forEach(trainingRegistration1 -> { |
| | | //判断时间 |
| | | //查询考试信息 |
| | | ExamPaper paper = examPaperService.getById(trainingRegistration1.getTrainExamId()); |
| | | if (null!=paper) { |
| | | //比对考试结束时间 |
| | | Date now = new Date(); |
| | | Date exanEndTime = paper.getEndTime(); |
| | | //考试截止时间小于当前时间,说明已过考试时间 |
| | | if (exanEndTime.before(now)) { |
| | | //修改报名状态 |
| | | trainingRegistration1.setCancel(2); |
| | | //缺考标记 |
| | | trainingRegistration1.setIsExam(4); |
| | | this.updateById(trainingRegistration1); |
| | | //修改保安报名状态 |
| | | User user = userService.getById(trainingRegistration1.getUserId()); |
| | | user.setIsTrain(2); |
| | | userService.updateById(user); |
| | | //生成缺考记录 |
| | | AbsentRecords absentRecords = new AbsentRecords(); |
| | | absentRecords.setUserId(user.getId()); |
| | | absentRecords.setApplyId(trainingRegistration1.getId()); |
| | | absentRecords.setExamId(Long.parseLong(trainingRegistration1.getTrainExamId())); |
| | | absentRecords.setCandidateNo(trainingRegistration1.getCandidateNo()); |
| | | absentRecords.setCreateTime(new Date()); |
| | | //新增 |
| | | absentRecordsService.save(absentRecords); |
| | | |
| | | //内网同步 |
| | | String s = |
| | | "update sys_training_registration set cancel = " + trainingRegistration1.getCancel() + |
| | | ",is_exam = " + "'" + trainingRegistration1.getIsExam() + "'" + |
| | | " " + "where id = " + "'" + trainingRegistration1.getId() + "';" + |
| | | "update blade_user set is_train = " + user.getIsTrain() + " " + "where id = " + "'" + user.getId() + "';" + |
| | | "insert into sys_absent_records(id,user_id,create_time,exam_id,apply_id,candidate_no) " + |
| | | "values(" + "'" + absentRecords.getId() + "'" + "," |
| | | + "'" + absentRecords.getUserId() + "'" + "," |
| | | + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(absentRecords.getCreateTime()) + "'" + "," |
| | | + "'" + absentRecords.getExamId() + "'" + "," |
| | | + "'" + absentRecords.getApplyId() + "'" + "," |
| | | + "'" + absentRecords.getCandidateNo() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |