| | |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.excel.TrainingRegistrationExcel; |
| | | import org.springblade.modules.training.excel.TrainingRegistrationImporter; |
| | |
| | | + "," + "'" + trainingRegistration.getIsExam() + "'" |
| | | + "," +"'" + trainingRegistration.getAuditStatus() + "'" + ");" + |
| | | "update blade_user set is_train = " + user1.getIsTrain() + " " +"where id = " + "'" + user1.getId() + "'"; |
| | | return FtpSyncUtil.sqlHandler(builder, sql); |
| | | return FtpSyncUtil.sqlHandler(builder, sql,500); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (status){ |
| | | return R.data(200,"取消报名成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | }else { |
| | | return R.data(201,"尚未报名"); |
| | | } |
| | | |
| | | } |
| | | return R.data(202,"取消报名失败"); |
| | | } |
| | |
| | | AtomicInteger count = new AtomicInteger(); |
| | | //创建年龄部分对象集合 |
| | | List<String> errorList = new ArrayList<>(); |
| | | AtomicReference<StringBuilder> builder = new AtomicReference<>(new StringBuilder()); |
| | | // AtomicReference<StringBuilder> builder = new AtomicReference<>(new StringBuilder()); |
| | | //遍历 |
| | | list.forEach(userId ->{ |
| | | User user = userService.getById(userId); |
| | | UserVO userVO = userService.getUserAgeById(Long.parseLong(userId)); |
| | | //判断年龄 |
| | | Integer age = AgeUtil.idCardToAge(user.getCardid()); |
| | | if (age>=18 && age<=60) { |
| | | if (userVO.getAge()>=18 && userVO.getAge()<=60) { |
| | | //未报名的新增,已报名的不做处理 |
| | | if (null == user.getIsTrain()) { |
| | | TrainingRegistration trainingRegistration1 = new TrainingRegistration(); |
| | |
| | | userService.updateById(user); |
| | | |
| | | //数据同步 |
| | | builder.set(batchSaveTrainingRegistration(trainingRegistration1, user, builder.get())); |
| | | saveTrainingRegistration(trainingRegistration1,user); |
| | | // builder.set(batchSaveTrainingRegistration(trainingRegistration1, user, builder.get())); |
| | | } else { |
| | | if (user.getIsTrain() != 1) { |
| | | TrainingRegistration trainingRegistration1 = new TrainingRegistration(); |
| | |
| | | userService.updateById(user); |
| | | |
| | | //数据同步 |
| | | builder.set(batchSaveTrainingRegistration(trainingRegistration1, user, builder.get())); |
| | | saveTrainingRegistration(trainingRegistration1,user); |
| | | // builder.set(batchSaveTrainingRegistration(trainingRegistration1, user, builder.get())); |
| | | } |
| | | } |
| | | }else { |
| | |
| | | errorList.add(user.getCardid()); |
| | | } |
| | | }); |
| | | //同步 |
| | | if (builder.get().length()>0) { |
| | | FtpSyncUtil.slqSync(builder.get()); |
| | | } |
| | | // //同步 |
| | | // if (builder.get().length()>0) { |
| | | // FtpSyncUtil.slqSync(builder.get()); |
| | | // } |
| | | //如果存在年龄不符的,则抛出异常 |
| | | if (count.get()>0){ |
| | | String errorAccount = StringUtils.join(errorList, "\\\n"); |