| | |
| | | import org.springblade.modules.apply.vo.ApplyPaPerVO; |
| | | import org.springblade.modules.apply.vo.ApplyVO; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private final ExamPaperService examPaperService; |
| | | |
| | | private final IUserService userService; |
| | | |
| | | private final ExamScoreService examScoreService; |
| | | |
| | | /** |
| | | * 自定义分页 |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateApplyStatus") |
| | | public void updateApplyStatus(@RequestBody ApplyVO apply){ |
| | | public ExamScore updateApplyStatus(@RequestBody ApplyVO apply){ |
| | | applyService.updateApplyStatus(apply); |
| | | //新增考试成绩,没有成绩数据,待提交答题后更新数据 |
| | | ExamScore examScore = new ExamScore(); |
| | | examScore.setExamId(apply.getExamId().toString()); |
| | | examScore.setUserId(apply.getUserId().toString()); |
| | | examScore.setExamTime(new Date()); |
| | | //新增 |
| | | examScoreService.save(examScore); |
| | | return examScore; |
| | | } |
| | | |
| | | |
| | |
| | | import org.springblade.modules.apply.excel.ApplyInfoExcel; |
| | | import org.springblade.modules.apply.vo.ApplyPaPerVO; |
| | | import org.springblade.modules.apply.vo.ApplyVO; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @param apply 报名信息,包含userId,applyid |
| | | * @return |
| | | */ |
| | | void updateApplyStatus(ApplyVO apply); |
| | | void updateApplyStatus(ApplyVO apply); |
| | | |
| | | /** |
| | | * 查询报名信息,取最新的一条(即当前userId,)applyId最大的一条记录 |
| | |
| | | import org.springblade.modules.apply.vo.ApplyPaPerVO; |
| | | import org.springblade.modules.apply.vo.ApplyVO; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | |
| | | public void updateApplyStatus(ApplyVO apply) { |
| | | //正式考 |
| | | if (apply.getExamType()==1){ |
| | | Apply apply1 = new Apply(); |
| | | apply1.setId(apply.getId()); |
| | | //考试中 |
| | | apply.setIsExam(3); |
| | | baseMapper.updateById(apply); |
| | | apply1.setIsExam(3); |
| | | baseMapper.updateById(apply1); |
| | | } |
| | | //模拟考 |
| | | if (apply.getExamType()==2){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取下一题的题目,并判断上一题的答案,且返回上一题答题结果 |
| | | * |
| | | * @param examSubjectChoices 选择题信息对象 |
| | | */ |
| | | @GetMapping("/getSubjectResultInfo") |
| | | @ApiOperation(value = "详情", notes = "传入examSubjectChoices") |
| | | public R<ExamSubjectChoicesVO> getSubjectResultInfo(ExamSubjectChoicesVO examSubjectChoices) { |
| | | //查询下一题题目详情 |
| | | ExamSubjectChoicesVO detail = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices); |
| | | //判断当前题目的答题结果 |
| | | if (examSubjectChoices.getPreSubJectId()!=null) { |
| | | if (null!=examSubjectChoices.getPreResult() && examSubjectChoices.getPreResult()!="" && !examSubjectChoices.getPreResult().equals("")) { |
| | | detail.setResult(examSubjectChoicesService.getAnswerResult(examSubjectChoices.getPreSubJectId(), examSubjectChoices.getPreResult())); |
| | | }else { |
| | | //无 |
| | | detail.setResult(3); |
| | | } |
| | | } |
| | | //返回 |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 查询试卷包含的题目 |
| | | */ |
| | | @GetMapping("/getEexPaperChoices") |
| | |
| | | * @param isCovered |
| | | */ |
| | | void importSubject(List<ExamSubjectExcel> data, Boolean isCovered); |
| | | |
| | | /** |
| | | * 判断当前题目的答题结果 |
| | | * @param preSubJectId 题目Id |
| | | * @param preResult 提交的结果 |
| | | * @return |
| | | */ |
| | | Integer getAnswerResult(Long preSubJectId, String preResult); |
| | | } |
| | |
| | | }else { |
| | | examScore.setQualified(1); |
| | | } |
| | | //保存成绩数据 |
| | | int i = baseMapper.insert(examScore); |
| | | //修改成绩数据 |
| | | int i = baseMapper.updateById(examScore); |
| | | //修改考试状态 |
| | | |
| | | if (i>0){ |
| | |
| | | }); |
| | | return true; |
| | | } |
| | | //内网数据同步 |
| | | try { |
| | | // arg.test01(arg.url+"/examSubjectChoices/saveSubjectChoicesAndOption",examSubjectChoices); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }else { |
| | | //修改 |
| | | ExamSubjectChoices subjectChoices = new ExamSubjectChoices(); |
| | |
| | | examSubjectOptionService.save(examSubjectOption); |
| | | }); |
| | | return true; |
| | | } |
| | | //内网数据同步 |
| | | try { |
| | | // arg.test01(arg.url+"/examSubjectChoices/saveSubjectChoicesAndOption",examSubjectChoices); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return status; |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断当前题目的答题结果 |
| | | * @param preSubJectId 题目Id |
| | | * @param preResult 提交的结果 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getAnswerResult(Long preSubJectId, String preResult) { |
| | | //查询题目信息 |
| | | ExamSubjectChoices choices = this.getById(preSubJectId); |
| | | //对比答案 |
| | | if (choices.getChoicesType() == 2 || choices.getChoicesType() == 3){ |
| | | //判断题逻辑 |
| | | if (preResult.equals(choices.getAnswer())) { |
| | | return 1; |
| | | }else { |
| | | return 2; |
| | | } |
| | | }else if(choices.getChoicesType() == 0 || choices.getChoicesType() == 1){ |
| | | //处理多选题的答案排序 |
| | | String[] split = preResult.split(","); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | builder.append(s); |
| | | } |
| | | char[] arrayCh = builder.toString().toCharArray(); |
| | | //利用数组帮助类自动排序 |
| | | Arrays.sort(arrayCh); |
| | | String sub0 = Arrays.toString(arrayCh); |
| | | String sub = sub0.substring(1,sub0.length()-1).replaceAll(" ",""); |
| | | if (sub.equals(choices.getAnswer())) { |
| | | return 1; |
| | | }else { |
| | | return 2; |
| | | } |
| | | } |
| | | return 2; |
| | | } |
| | | } |
| | |
| | | private List<ExamSubjectOption> examSubjectOptions; |
| | | |
| | | private String tmid; |
| | | |
| | | /** |
| | | * 上一题的题目id |
| | | */ |
| | | private Long preSubJectId; |
| | | |
| | | /** |
| | | * 上一题答题提交的结果 |
| | | */ |
| | | private String preResult; |
| | | |
| | | |
| | | /** |
| | | * 上一题的答题结果,对,错 1:对 2:错 |
| | | */ |
| | | private Integer result; |
| | | } |
| | |
| | | |
| | | <!--懒加载获取部门树形结构(包含用户数据)app--> |
| | | <select id="lazyTreeUserApp" resultType="org.springblade.modules.system.vo.DeptAndUserVO" > |
| | | select DISTINCT * from ( |
| | | (SELECT |
| | | dept.id, |
| | | dept.parent_id, |
| | | dept.dept_name AS label, |
| | | dept.id AS "key", |
| | | dept.id AS "value", |
| | | 1 as idCardNo, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and dept.is_deleted = 0 |
| | | ) AS "has_children" |
| | | FROM |
| | | blade_dept dept |
| | | left join |
| | | blade_user bu |
| | | on |
| | | bu.dept_id = dept.id |
| | | WHERE |
| | | dept.is_deleted = 0 |
| | | and bu.is_deleted = 0 |
| | | <if test="type==1"> |
| | | select DISTINCT |
| | | c.id, |
| | | c.parent_id, |
| | | c.title, |
| | | c.value, |
| | | c.key, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | where |
| | | id = c.parent_id |
| | | and dept_category=1 |
| | | AND dept.parent_id = "1413470343230877697" |
| | | </if> |
| | | <if test="type==2 or type==3"> |
| | | and dept_category=2 |
| | | AND dept.parent_id = "1123598813738675201" |
| | | </if> |
| | | <if test="type==4 and jurisdiction!=null and jurisdiction!=''"> |
| | | and dept_category=1 |
| | | AND dept.parent_id = "1413470343230877697" |
| | | and bu.jurisdiction = #{jurisdiction} |
| | | </if> |
| | | ) |
| | | ) AS "has_children" |
| | | from ( |
| | | (SELECT |
| | | dept.id, |
| | | dept.parent_id, |
| | | dept.dept_name AS label, |
| | | dept.id AS "key", |
| | | dept.id AS "value", |
| | | 1 as idCardNo, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and dept.is_deleted = 0 |
| | | ) AS "has_children" |
| | | FROM |
| | | blade_dept dept |
| | | left join |
| | | blade_user bu |
| | | on |
| | | bu.dept_id = dept.id |
| | | WHERE |
| | | dept.is_deleted = 0 |
| | | and bu.is_deleted = 0 |
| | | <if test="type==1"> |
| | | and dept_category=1 |
| | | AND dept.parent_id = "1413470343230877697" |
| | | </if> |
| | | <if test="type==2 or type==3"> |
| | | and dept_category=2 |
| | | AND dept.parent_id = "1123598813738675201" |
| | | </if> |
| | | <if test="type==4 and jurisdiction!=null and jurisdiction!=''"> |
| | | and dept_category=1 |
| | | AND dept.parent_id = "1413470343230877697" |
| | | and bu.jurisdiction = #{jurisdiction} |
| | | </if> |
| | | ) |
| | | |
| | | union all |
| | | union all |
| | | |
| | | (select |
| | | bu.id, |
| | | bu.dept_id parent_id, |
| | | bu.real_name AS label, |
| | | bu.id AS "key", |
| | | bu.id AS "value", |
| | | bu.cardid as idCardNo, |
| | | 0 as "has_children" |
| | | from blade_user bu |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = bu.dept_id |
| | | where 1=1 |
| | | and bu.is_deleted = 0 |
| | | <if test="type==1"> |
| | | and dept_category=1 |
| | | </if> |
| | | <if test="type==2 or type==3"> |
| | | and dept_category=2 |
| | | </if> |
| | | <if test="type==4 and jurisdiction!=null and jurisdiction!=''"> |
| | | and dept_category=1 |
| | | and bu.jurisdiction = #{jurisdiction} |
| | | </if> |
| | | ) |
| | | ( |
| | | select |
| | | bu.id, |
| | | bu.dept_id parent_id, |
| | | bu.real_name AS label, |
| | | bu.id AS "key", |
| | | bu.id AS "value", |
| | | bu.cardid as idCardNo, |
| | | 0 as "has_children" |
| | | from blade_user bu |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = bu.dept_id |
| | | where 1=1 |
| | | and bu.is_deleted = 0 |
| | | <if test="type==1"> |
| | | and dept_category=1 |
| | | </if> |
| | | <if test="type==2 or type==3"> |
| | | and dept_category=2 |
| | | </if> |
| | | <if test="type==4 and jurisdiction!=null and jurisdiction!=''"> |
| | | and dept_category=1 |
| | | and bu.jurisdiction = #{jurisdiction} |
| | | </if> |
| | | ) |
| | | )c |
| | | </select> |
| | | |
| | | <!--懒加载获取部门树形结构(包含用户数据)--> |
| | | <select id="lazyTreeUser" resultMap="treeNodeResultMap" > |
| | | select DISTINCT * from ( |
| | | select DISTINCT |
| | | c.id, |
| | | c.parent_id, |
| | | c.title, |
| | | c.value, |
| | | c.key, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | where |
| | | id = c.parent_id |
| | | <if test="parentId!=null and parentId!=''"> |
| | | and dept_category=1 |
| | | AND id = #{parentId} |
| | | </if> |
| | | ) AS "has_children" |
| | | from ( |
| | | (SELECT |
| | | dept.id, |
| | | dept.parent_id, |