|
|
@ -1,5 +1,7 @@ |
|
|
package com.project.appeal.domain.service.Impl; |
|
|
package com.project.appeal.domain.service.Impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.github.tingyugetc520.ali.dingtalk.error.DtErrorException; |
|
|
import com.github.tingyugetc520.ali.dingtalk.error.DtErrorException; |
|
|
import com.project.appeal.domain.dto.AppealDTO; |
|
|
import com.project.appeal.domain.dto.AppealDTO; |
|
|
import com.project.appeal.domain.entity.AppealEntity; |
|
|
import com.project.appeal.domain.entity.AppealEntity; |
|
|
@ -15,8 +17,10 @@ import com.project.exam.domain.dto.ExamRecordDTO; |
|
|
import com.project.exam.domain.entity.ExamRecordEntity; |
|
|
import com.project.exam.domain.entity.ExamRecordEntity; |
|
|
import com.project.exam.mapper.ExamRecordMapper; |
|
|
import com.project.exam.mapper.ExamRecordMapper; |
|
|
import com.project.task.domain.entity.TaskEntity; |
|
|
import com.project.task.domain.entity.TaskEntity; |
|
|
|
|
|
import com.project.task.domain.entity.TaskUserEntity; |
|
|
import com.project.task.domain.enums.QuestionTypeEnum; |
|
|
import com.project.task.domain.enums.QuestionTypeEnum; |
|
|
import com.project.task.mapper.TaskMapper; |
|
|
import com.project.task.mapper.TaskMapper; |
|
|
|
|
|
import com.project.task.mapper.TaskUserMapper; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -32,6 +36,8 @@ public class SaveAppealDomainServiceImpl implements SaveAppealDomainService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ExamRecordMapper examRecordMapper; |
|
|
private ExamRecordMapper examRecordMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
private TaskUserMapper taskUserMapper; |
|
|
|
|
|
@Autowired |
|
|
private TaskMapper taskMapper; |
|
|
private TaskMapper taskMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DingUtil dingUtil; |
|
|
private DingUtil dingUtil; |
|
|
@ -108,6 +114,19 @@ public class SaveAppealDomainServiceImpl implements SaveAppealDomainService { |
|
|
//总分+单题分数
|
|
|
//总分+单题分数
|
|
|
BigDecimal score = BigDecimal.valueOf(questionScore).add(BigDecimal.valueOf(examRecordDTO.getScore())).setScale(2, RoundingMode.HALF_UP); |
|
|
BigDecimal score = BigDecimal.valueOf(questionScore).add(BigDecimal.valueOf(examRecordDTO.getScore())).setScale(2, RoundingMode.HALF_UP); |
|
|
|
|
|
|
|
|
|
|
|
//判断是否考试通过
|
|
|
|
|
|
BigDecimal passScoreBig = taskEntity.getPassScore() == null ? BigDecimal.ZERO : new BigDecimal(taskEntity.getPassScore()); |
|
|
|
|
|
if (score.compareTo(passScoreBig) >= 0){ |
|
|
|
|
|
//更新考试结果
|
|
|
|
|
|
taskUserMapper.update( |
|
|
|
|
|
null, |
|
|
|
|
|
new LambdaUpdateWrapper<TaskUserEntity>() |
|
|
|
|
|
.eq(TaskUserEntity::getUserId, appealDTO.getUserId()) |
|
|
|
|
|
.eq(TaskUserEntity::getTaskId, taskEntity.getId()) |
|
|
|
|
|
.set(TaskUserEntity::getStatus, 2) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//保存
|
|
|
//保存
|
|
|
examRecordMapper.updateScore(index,score.doubleValue(),examRecord.getId()); |
|
|
examRecordMapper.updateScore(index,score.doubleValue(),examRecord.getId()); |
|
|
//通知用户
|
|
|
//通知用户
|
|
|
|