| | |
| | | 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); |
| | |
| | | private String userId; |
| | | |
| | | |
| | | /** |
| | | * 考试id |
| | | */ |
| | | @TableField("exam_id") |
| | | private String examId; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | @ColumnWidth(25) |
| | | @ExcelProperty("考试名称") |
| | | private String examName; |
| | | |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("姓名") |
| | | private String name; |
| | |
| | | * @return |
| | | */ |
| | | List<TrainingRegistration> getTrainList(Long id); |
| | | |
| | | /** |
| | | * 使用考试名称匹配考试信息 |
| | | * @param examName 考试名称 |
| | | * @return |
| | | */ |
| | | ExamPaper getExamInfoByExamName(@Param("examName") String examName); |
| | | } |
| | |
| | | (select |
| | | ke.id,ke.exam_name examName, |
| | | sa.candidate_no candidateNo, |
| | | bu.real_name realName,bu.sex |
| | | bu.real_name realName,bu.sex,bu.cardid idCardNo |
| | | from |
| | | ksxt_exam ke |
| | | left join |
| | |
| | | on |
| | | bu.id = sa.user_id |
| | | where sa.user_id = #{userId} |
| | | and is_apply = 1 |
| | | and is_exam = 1 |
| | | and sa.apply_status = 2 |
| | | ) |
| | |
| | | (select |
| | | ke.id,ke.exam_name examName, |
| | | str.candidate_no candidateNo, |
| | | bu.real_name realName,bu.sex |
| | | bu.real_name realName,bu.sex,bu.cardid idCardNo |
| | | from |
| | | ksxt_exam ke |
| | | left join |
| | |
| | | on |
| | | bu.id = str.user_id |
| | | where str.user_id = #{userId} |
| | | and bu.is_train = 1 |
| | | and is_exam = 1 |
| | | and str.cancel = 3 |
| | | and ke.audit_status = 1 |
| | | and str.cancel = 1 |
| | | ) |
| | | </select> |
| | | |
| | |
| | | and str.cancel = 1 |
| | | </select> |
| | | |
| | | <!--使用考试名称匹配考试信息--> |
| | | <select id="getExamInfoByExamName" resultType="org.springblade.modules.exam.entity.ExamPaper"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | ksxt_exam |
| | | where exam_name like concat('%', #{examName},'%') |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * @param idCardNo 身份证号 |
| | | * @return |
| | | */ |
| | | ExamScore getExamScoreInfoByIdCardNo(@Param("idCardNo")String idCardNo); |
| | | ExamScore getExamScoreInfoByIdCardNo(@Param("idCardNo")String idCardNo,@Param("examId")Long examId); |
| | | |
| | | List<Map<String,Object>> scoreStatistics(); |
| | | } |
| | |
| | | <select id="selectExamScorePage" resultType="org.springblade.modules.exam.vo.ExamScoreVO"> |
| | | SELECT |
| | | es.id,es.theory_grade theoryGrade,ifnull(learn_grade,-1) learnGrade,es.user_id userId, |
| | | exam_name examName,bu.real_name securityName,company,exam_time examTime, |
| | | ke.exam_name examName,bu.real_name securityName,company,es.exam_time examTime, |
| | | all_grade allGrade,exam_end_time examEndTime,qualified, |
| | | bd.dept_name companyName |
| | | FROM |
| | |
| | | blade_dept bd |
| | | on |
| | | bd.id = es.company |
| | | left join |
| | | ksxt_exam ke |
| | | on |
| | | ke.id = es.exam_id |
| | | WHERE |
| | | 1=1 |
| | | <if test="examScore.examName!=null and examScore.examName!=''"> |
| | | and es.exam_name like concat('%', #{examScore.examName},'%') |
| | | and ke.exam_name like concat('%', #{examScore.examName},'%') |
| | | </if> |
| | | <if test="examScore.companyName!=null and examScore.companyName!=''"> |
| | | and bd.dept_name like concat('%', #{examScore.companyName},'%') |
| | |
| | | </if> |
| | | <if test="examScore.userId!=null and examScore.userId!=''"> |
| | | and es.user_id = #{examScore.userId} |
| | | </if> |
| | | <if test="examScore.examType!=null and examScore.examType!=''"> |
| | | and ke.exam_type = #{examScore.examType} |
| | | </if> |
| | | <if test="examScore.candidateNo!=null and examScore.candidateNo!=''"> |
| | | and es.candidate_no = #{examScore.candidateNo} |
| | |
| | | exam_score) b |
| | | </select> |
| | | |
| | | <!----> |
| | | <!--根据用户身份证号查询考试成绩--> |
| | | <select id="getExamScoreInfoByIdCardNo" resultType="org.springblade.modules.exam.entity.ExamScore"> |
| | | select |
| | | es.* |
| | |
| | | bu.id = es.user_id |
| | | where |
| | | bu.cardid = #{idCardNo} |
| | | and es.exam_id = #{examId} |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | List<TrainingRegistration> getTrainList(Long id); |
| | | |
| | | /** |
| | | * 使用考试名称匹配考试信息 |
| | | * @param examName 考试名称 |
| | | * @return |
| | | */ |
| | | ExamPaper getExamInfoByExamName(String examName); |
| | | } |
| | |
| | | public List<TrainingRegistration> getTrainList(Long id) { |
| | | return baseMapper.getTrainList(id); |
| | | } |
| | | |
| | | /** |
| | | * 使用考试名称匹配考试信息 |
| | | * @param examName 考试名称 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ExamPaper getExamInfoByExamName(String examName) { |
| | | return baseMapper.getExamInfoByExamName(examName); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.modules.apply.entity.Apply; |
| | | import org.springblade.modules.apply.service.ApplyService; |
| | | import org.springblade.modules.exam.entity.ExamExaminationSubject; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private final IUserService userService; |
| | | |
| | | private final ExamSubjectChoicesService examSubjectChoicesService; |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | |
| | | private final ApplyService applyService; |
| | | |
| | | private final TrainingRegistrationService trainingRegistrationService; |
| | | |
| | | /** |
| | | * 自定义分页数据 |
| | |
| | | } |
| | | } |
| | | } |
| | | //获取考试信息 |
| | | ExamPaper paper = examPaperService.getById(examScore.getPapersId()); |
| | | //使用准考证号查询报名信息,修改考试状态为已考试 |
| | | if(paper.getExamType()==1){ |
| | | Apply apply = new Apply(); |
| | | apply.setCandidateNo(examScore.getCandidateNo()); |
| | | Apply apply1 = applyService.getOne(Condition.getQueryWrapper(apply)); |
| | | //修改为已考试 |
| | | apply1.setIsExam(2); |
| | | applyService.updateById(apply1); |
| | | } |
| | | //模拟考试 |
| | | if(paper.getExamType()==2){ |
| | | TrainingRegistration trainingRegistration = new TrainingRegistration(); |
| | | trainingRegistration.setCandidateNo(examScore.getCandidateNo()); |
| | | TrainingRegistration trainingRegistration1 = trainingRegistrationService.getOne(Condition.getQueryWrapper(trainingRegistration)); |
| | | //修改为已考试 |
| | | trainingRegistration1.setIsExam(2); |
| | | trainingRegistrationService.updateById(trainingRegistration1); |
| | | } |
| | | //设置考试ID |
| | | examScore.setExamId(examScore.getPapersId().toString()); |
| | | //设置理论得分 |
| | | examScore.setTheoryGrade(theoryGrade); |
| | | //计算总成绩,此时没有实操成绩,总成绩为实操成绩和理论成绩和的一半 |
| | |
| | | if (examScoreExcelList.size()>0){ |
| | | examScoreExcelList.forEach(examScoreExcel -> { |
| | | if (null!=examScoreExcel.getLearnGrade() && null!=examScoreExcel.getIdCardNo() && examScoreExcel.getIdCardNo()!=""){ |
| | | ExamScore examScore = baseMapper.getExamScoreInfoByIdCardNo(examScoreExcel.getIdCardNo()); |
| | | //使用考试名称匹配考试信息 |
| | | ExamPaper examPaper = examPaperService.getExamInfoByExamName(examScoreExcel.getExamName()); |
| | | //查询出成绩数据 |
| | | ExamScore examScore = baseMapper.getExamScoreInfoByIdCardNo(examScoreExcel.getIdCardNo(),examPaper.getId()); |
| | | if (null!=examScore) { |
| | | examScore.setLearnGrade(examScoreExcel.getLearnGrade()); |
| | | 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++)); |
| | | //正式考试通过生成保安证编号 |
| | | if (examPaper.getExamType()==1) { |
| | | //去生成保安证编号 |
| | | //查询当前保安信息 |
| | | 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); |
| | | } |
| | | user.setSecuritynumber(result); |
| | | //更新保安数据 |
| | | userService.updateById(user); |
| | | } else { |
| | | //不合格 |
| | | examScore.setQualified(1); |
| | |
| | | private String companyName; |
| | | |
| | | /** |
| | | * 试卷id |
| | | * 考试id,提交成绩时用 |
| | | */ |
| | | private Long papersId; |
| | | |
| | |
| | | * 考勤提交的结果 |
| | | */ |
| | | private List<ExamResultVO> examResultVOS; |
| | | |
| | | /** |
| | | * 考试类型 |
| | | */ |
| | | private Integer examType; |
| | | } |
| | |
| | | * 自定义分页 |
| | | * @param query page,size |
| | | * @param liveLocation 实时位置信息对象 |
| | | * |
| | | */ |
| | | @GetMapping("/page") |
| | | public R<IPage<LiveLocationVo>> page(LiveLocationVo liveLocation, Query query) { |
| | |
| | | */ |
| | | @SneakyThrows |
| | | @PostMapping("/put-file-attach") |
| | | public R<BladeFile> putFileAttach(@RequestParam MultipartFile file,String deptid,String type) { |
| | | public R<BladeFile> putFileAttach(@RequestParam MultipartFile file,String deptid,String type,Long noticeId) { |
| | | String fileName = file.getOriginalFilename(); |
| | | BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); |
| | | Long attachId = buildAttach(fileName, file.getSize(), bladeFile,deptid,type); |
| | | Long attachId = buildAttach(fileName, file.getSize(), bladeFile,deptid,type,noticeId); |
| | | bladeFile.setAttachId(attachId); |
| | | return R.data(bladeFile); |
| | | } |
| | |
| | | */ |
| | | @SneakyThrows |
| | | @PostMapping("/put-file-attach-by-name") |
| | | public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file,String deptid,String type) { |
| | | public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file,String deptid,String type,Long noticeId) { |
| | | BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); |
| | | Long attachId = buildAttach(fileName, file.getSize(), bladeFile,deptid,type); |
| | | Long attachId = buildAttach(fileName, file.getSize(), bladeFile,deptid,type,noticeId); |
| | | bladeFile.setAttachId(attachId); |
| | | return R.data(bladeFile); |
| | | } |
| | |
| | | * @param bladeFile 对象存储文件 |
| | | * @return attachId |
| | | */ |
| | | private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile,String deptid,String type) throws Exception { |
| | | private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile,String deptid,String type,Long noticeId) throws Exception { |
| | | BladeUser user = AuthUtil.getUser(); |
| | | String fileExtension = FileUtil.getFileExtension(fileName); |
| | | Attach attach = new Attach(); |
| | |
| | | attach.setExtension(fileExtension); |
| | | attach.setDeptid(user.getDeptId()); |
| | | attach.setType(type); |
| | | if (null!=noticeId){ |
| | | attach.setNoticeId(noticeId); |
| | | } |
| | | attachService.save(attach); |
| | | // arg.test01(arg.url+"/blade-resource/attach/save",attach); |
| | | return attach.getId(); |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.springblade.modules.resource.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private String deptid; |
| | | private String type; |
| | | |
| | | /** |
| | | * 通知公告id |
| | | */ |
| | | @TableField("notice_id") |
| | | private Long noticeId; |
| | | |
| | | |
| | | } |