From 9ad5ed433a44fcce8db3fbd462b4c5879608fd27 Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Tue, 25 Jan 2022 11:12:55 +0800
Subject: [PATCH] 定时任务修改
---
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java | 94 ++++++++++++++++++++++++-----------------------
1 files changed, 48 insertions(+), 46 deletions(-)
diff --git a/src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java b/src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
index ef535ec..0cad646 100644
--- a/src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
+++ b/src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
@@ -357,54 +357,56 @@
this.updateById(trainingRegistration1);
//修改保安报名状态
User user = userService.getById(trainingRegistration1.getUserId());
- //考试结束
- user.setIsTrain(3);
- 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);
+ if (null != user) {
+ //考试结束
+ user.setIsTrain(3);
+ 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);
- //新增成绩,成绩为0
- ExamScore examScore = new ExamScore();
- examScore.setCandidateNo(trainingRegistration1.getCandidateNo());
- examScore.setTheoryGrade(0);
- examScore.setAllGrade(0);
- examScore.setQualified(3);
- examScore.setUserId(user.getId().toString());
- examScore.setApplyId(trainingRegistration1.getId());
- examScore.setExamId(trainingRegistration1.getTrainExamId());
- //新增
- examScoreService.save(examScore);
+ //新增成绩,成绩为0
+ ExamScore examScore = new ExamScore();
+ examScore.setCandidateNo(trainingRegistration1.getCandidateNo());
+ examScore.setTheoryGrade(0);
+ examScore.setAllGrade(0);
+ examScore.setQualified(3);
+ examScore.setUserId(user.getId().toString());
+ examScore.setApplyId(trainingRegistration1.getId());
+ examScore.setExamId(trainingRegistration1.getTrainExamId());
+ //新增
+ examScoreService.save(examScore);
- //内网同步
- 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() + "'" + ");" +
- "insert into exam_score(id,candidate_no,theory_grade,all_grade,qualified,user_id,apply_id,exam_id) " +
- "values(" + "'" + examScore.getId() + "'" + ","
- + "'" + examScore.getCandidateNo() + "'" + ","
- + "'" + examScore.getTheoryGrade() + "'" + ","
- + "'" + examScore.getAllGrade() + "'" + ","
- + "'" + examScore.getQualified() + "'" + ","
- + "'" + examScore.getUserId() + "'" + ","
- + "'" + examScore.getApplyId() + "'" + ","
- + "'" + examScore.getExamId() + "'" + ")";
- FtpUtil.sqlFileUpload(s);
+ //内网同步
+ 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() + "'" + ");" +
+ "insert into exam_score(id,candidate_no,theory_grade,all_grade,qualified,user_id,apply_id,exam_id) " +
+ "values(" + "'" + examScore.getId() + "'" + ","
+ + "'" + examScore.getCandidateNo() + "'" + ","
+ + "'" + examScore.getTheoryGrade() + "'" + ","
+ + "'" + examScore.getAllGrade() + "'" + ","
+ + "'" + examScore.getQualified() + "'" + ","
+ + "'" + examScore.getUserId() + "'" + ","
+ + "'" + examScore.getApplyId() + "'" + ","
+ + "'" + examScore.getExamId() + "'" + ")";
+ FtpUtil.sqlFileUpload(s);
+ }
}
}
});
--
Gitblit v1.9.3