| | |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | | import org.springblade.modules.exam.service.ExamSubjectChoicesService; |
| | | import org.springblade.modules.exam.util.SecurityPaperUtil; |
| | | import org.springblade.modules.exam.vo.ExamResultVO; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @AllArgsConstructor |
| | | public class ExamScoreServiceImpl extends ServiceImpl<ExamScoreMapper, ExamScore> implements ExamScoreService { |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | private final IUserService userService; |
| | | |
| | | private final ExamSubjectChoicesService examSubjectChoicesService; |
| | | |
| | |
| | | if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() >= 60) { |
| | | //合格 |
| | | examScore.setQualified(0); |
| | | //去生成保安证编号 |
| | | //查询当前保安信息 |
| | | User user = userService.getById(examScore.getUserId()); |
| | | String pre = SecurityPaperUtil.getSecurityPaper(); |
| | | //查询当前年份已有的保安证编号 |
| | | int count = userService.getSecurityPaperCount(pre); |
| | | String result = null; |
| | | if (count==0){ |
| | | result = pre + "00000"; |
| | | }else { |
| | | //格式化 |
| | | DecimalFormat decimalFormat = new DecimalFormat("00000"); |
| | | result = pre + (decimalFormat.format(count++)); |
| | | } |
| | | user.setSecuritynumber(result); |
| | | //更新保安数据 |
| | | userService.updateById(user); |
| | | } else { |
| | | //不合格 |
| | | examScore.setQualified(1); |
| | | } |
| | | //总成绩 |
| | | examScore.setAllGrade(Math.round((examScore.getTheoryGrade()+examScoreExcel.getLearnGrade())/2)); |
| | | //更新成绩数据 |
| | | baseMapper.updateById(examScore); |
| | | } |