| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.excel.ExamScoreExcel; |
| | | import org.springblade.modules.exam.excel.ExamScoreImporter; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | | import org.springblade.modules.exam.util.SecurityPaperUtil; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | |
| | | private final ExamScoreService examScoreService; |
| | | |
| | | private final IUserService userService; |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | |
| | | /** |
| | | * 自定义分页 |
| | |
| | | * @param examScore 考试成绩信息对象 |
| | | */ |
| | | @PostMapping("/updateExamScore") |
| | | public R updateExamScore(@RequestBody ExamScore examScore) throws Exception { |
| | | public R updateExamScore(@RequestBody ExamScore examScore){ |
| | | if (null!=examScore.getLearnGrade() && null!=examScore.getTheoryGrade()){ |
| | | ExamScore examScore1 = examScoreService.getById(examScore.getId()); |
| | | if (examScore.getTheoryGrade()>=60 && examScore.getLearnGrade()>=60){ |
| | | //合格 |
| | | examScore.setQualified(0); |
| | | //去生成保安证编号 |
| | | //查询当前保安信息 |
| | | User user = userService.getById(examScore1.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++)); |
| | | //正式考试通过生成保安证编号 |
| | | ExamPaper paper = examPaperService.getById(examScore.getExamId()); |
| | | if (paper.getExamType()==1) { |
| | | //去生成保安证编号 |
| | | //查询当前保安信息 |
| | | User user = userService.getById(examScore1.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); |
| | | } |
| | | user.setSecuritynumber(result); |
| | | //更新保安数据 |
| | | userService.updateById(user); |
| | | }else { |
| | | //不合格 |
| | | examScore.setQualified(1); |