考试回调参数

This commit is contained in:
tiger_zhou 2023-06-05 10:48:25 +08:00
parent 5cc2c02ccc
commit a6f75d5cbf

View File

@ -23,6 +23,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -64,6 +65,8 @@ public class PaperUserService {
private PagerQuestionService paperQuestionService;
@Autowired
private Training2PublishService training2PublishService;
@Autowired
private ApplicationContext applicationContext;
/**
* 获取理论或实操的所有标签
@ -214,16 +217,18 @@ public class PaperUserService {
rsp.setCommonScore(scoreCommon);
rsp.setTrainingScore(scoreTraining);
rsp.setPassScore(composition.getPassScore());
this.publishUserExam();
this.publishUserExam(user, rsp.getScore(), composition.getName(), (int) paperTime);
return rsp;
}
private void publishUserExam() {
// UserExam ue = new UserExam();
// ue.setExamId();
// ue.setUserId(user.getAccount());
//TODO 需要将 UserExam 发送 {@link UserExamService.submit 方法}
// this.applicationContext.publishEvent(new UserExamRecordEvent(userExam));
private void publishUserExam(AccountVO user, float score, String examName, int paperTimeMin) {
UserExam ue = new UserExam();
ue.setUserId(user.getId());
ue.setExamName(examName);
ue.setScore(score);
ue.setUsedTime(paperTimeMin * 60);
//需要将 UserExam 发送 {@link UserExamService.submit 方法}
this.applicationContext.publishEvent(new UserExamRecordEvent(ue));
}
/**