智慧保安后台管理-外网项目备份
zhongrj
2023-11-06 60a6d8c41dd5212441210ccf3f21a004ac029892
重置考试修改
3 files modified
38 ■■■■■ changed files
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/ExamScoreService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
@@ -429,7 +429,7 @@
     */
    @PostMapping("/refreshTrainExamInfo")
    public R refreshTrainExamInfo(@RequestBody UpdateParamVo updateParamVo) {
        return R.status(examScoreService.refreshTrainExamInfo(updateParamVo));
        return R.data(examScoreService.refreshTrainExamInfo(updateParamVo));
    }
    /**
src/main/java/org/springblade/modules/exam/service/ExamScoreService.java
@@ -75,7 +75,7 @@
     * @param updateParamVo
     * @return
     */
    boolean refreshTrainExamInfo(UpdateParamVo updateParamVo);
    Object refreshTrainExamInfo(UpdateParamVo updateParamVo);
    /**
     * 按条件查询成绩数据
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -596,7 +596,8 @@
     * @return
     */
    @Override
    public boolean refreshTrainExamInfo(UpdateParamVo updateParamVo) {
    public Object refreshTrainExamInfo(UpdateParamVo updateParamVo) {
        Map<String, Object> map = new HashMap<>();
        if (null != updateParamVo.getScoreId()) {
            ExamScore examScore = this.getById(updateParamVo.getScoreId());
            //获取成绩数据,准考证号,用户id,报名培训id,考试id
@@ -636,6 +637,15 @@
                }
                //培训考试
                if (paper.getExamType() == 2) {
                    // 判断是否在考试时间内,如果不是则无法重置
                    long l = System.currentTimeMillis();
                    long endTime = paper.getEndTime().getTime();
                    if (l>endTime){
                        map.put("msg","已过考试时间,无法重置考试");
                        map.put("code",400);
                        // 已过考试时间
                        return map;
                    }
                    //1.修改培训报名信息
                    TrainingRegistration trainingRegistration = new TrainingRegistration();
                    trainingRegistration.setId(examScore.getApplyId());
@@ -654,16 +664,18 @@
                    this.removeById(updateParamVo.getScoreId());
                    //4.内网数据同步
                    String s1 =
                        "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
                            " " + "where id = " + "'" + trainingRegistration.getId() + "';" +
                            "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
                            " " + "where id = " + "'" + user.getId() + "';" +
                            "delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'";
                    //FtpUtil.sqlFileUpload(s1);
                    myAsyncService.dataSync(s1);
                    return true;
//                    String s1 =
//                        "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
//                            " " + "where id = " + "'" + trainingRegistration.getId() + "';" +
//                            "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
//                            " " + "where id = " + "'" + user.getId() + "';" +
//                            "delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'";
//                    //FtpUtil.sqlFileUpload(s1);
//                    myAsyncService.dataSync(s1);
                    map.put("msg","重置成功");
                    map.put("code",200);
                    // 已过考试时间
                    return map;
                }
            }
        }