deason 11 mesi fa
parent
commit
760cd9465e

+ 1 - 55
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamStudentController.java

@@ -1,10 +1,3 @@
-/*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-08-16 17:40:53.
- * *************************************************
- */
-
 package cn.com.qmth.examcloud.core.oe.admin.api.controller;
 
 import cn.com.qmth.examcloud.api.commons.enums.AdminOperateType;
@@ -12,12 +5,9 @@ import cn.com.qmth.examcloud.api.commons.enums.DataRuleType;
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.api.commons.security.bean.UserDataRule;
 import cn.com.qmth.examcloud.commons.util.JsonMapper;
-import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.excel.ExportUtils;
-import cn.com.qmth.examcloud.core.oe.admin.dao.IllegallyTypeRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.IllegallyTypeEntity;
 import cn.com.qmth.examcloud.core.oe.admin.service.AsyncExportService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
@@ -32,14 +22,12 @@ import cn.com.qmth.examcloud.web.security.DataRule;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * 考生信息接口
@@ -58,36 +46,6 @@ public class ExamStudentController extends ControllerSupport {
     @Autowired
     private AsyncExportService asyncExportService;
 
-    @Autowired
-    private IllegallyTypeRepo illegallyTypeRepo;
-
-    /**
-     * 查询课程本地缓存
-     */
-    private static Map<Long, CourseBean> courseBeanLocalCache;
-
-    private static Timer timer;
-
-    static {
-        courseBeanLocalCache = new ConcurrentHashMap<Long, CourseBean>();
-        timer = new Timer();
-    }
-
-    class CleanCourseBeanCacheTask extends TimerTask {
-
-        @Override
-        public void run() {
-            courseBeanLocalCache.clear();
-        }
-
-    }
-
-    public ExamStudentController() {
-        long delay = 10 * 60 * 1000;//10分钟后开始
-        long period = 30 * 60 * 1000;//30分钟清理一次
-        timer.schedule(new CleanCourseBeanCacheTask(), delay, period);
-    }
-
     @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @PostMapping("/examScheduling/list")
     @ApiOperation(value = "查询“考试进度详情”列表(分页)")
@@ -177,20 +135,8 @@ public class ExamStudentController extends ControllerSupport {
         if (examStudentId == null) {
             return;
         }
-        examStudentService.setReexamine(examStudentId, reexamineType, reexamineDetail);
         User user = getAccessUser();
-        StringBuilder sb = new StringBuilder();
-        sb.append("考生ID:" + examStudentId);
-        if (StringUtils.isNotEmpty(reexamineType)) {
-            IllegallyTypeEntity it = illegallyTypeRepo.findByRootOrgIdAndCode(-1L, reexamineType);
-            if (it != null) {
-                sb.append(" 重考理由:" + it.getName());
-            }
-        }
-        if (StringUtils.isNotEmpty(reexamineDetail)) {
-            sb.append(" 详情描述:" + reexamineDetail);
-        }
-        ReportsUtil.report(new AdminOperateReport(user.getRootOrgId(), user.getUserId(), AdminOperateType.TYPE20.getDesc(), sb.toString()));
+        examStudentService.setReexamine(examStudentId, reexamineType, reexamineDetail, user.getUserId(), user.getDisplayName());
     }
 
     @PostMapping("/statistic/by/finished")

+ 1 - 5
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamStudentService.java

@@ -112,12 +112,8 @@ public interface ExamStudentService {
 
     /**
      * 设置重考
-     *
-     * @param examStudentId
-     * @param reexamineType
-     * @param reexamineDetail
      */
-    public void setReexamine(Long examStudentId, String reexamineType, String reexamineDetail);
+    void setReexamine(Long examStudentId, String reexamineType, String reexamineDetail, Long operateUserId, String operateUserName);
 
     /**
      * 课程进度查询

+ 4 - 0
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ReexamineLogService.java

@@ -1,5 +1,9 @@
 package cn.com.qmth.examcloud.core.oe.admin.service;
 
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ReexamineLogEntity;
+
 public interface ReexamineLogService {
 
+    void addReexamineLog(ReexamineLogEntity reexamineLog);
+
 }

+ 23 - 13
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamStudentServiceImpl.java

@@ -24,10 +24,7 @@ import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordFileAnswerRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordForMarkingRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamStudentRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordFileAnswerEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordForMarkingEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.*;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FinishStatus;
@@ -141,6 +138,9 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     @Autowired
     private StudentCloudService studentCloudService;
 
+    @Autowired
+    private ReexamineLogService reexamineLogService;
+
     @Transactional
     @Override
     public List<Long> saveExamStudentList(List<ExamStudentInfo> examStudents) {
@@ -1018,25 +1018,22 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 
     @Override
     @Transactional
-    public void setReexamine(Long examStudentId, String reexamineType, String reexamineDetail) {
-        List<ExamRecordDataEntity> examRecordDataList = examRecordService
-                .getExamRecordListByExamStudentId(examStudentId);
+    public void setReexamine(Long examStudentId, String reexamineType, String reexamineDetail, Long operateUserId, String operateUserName) {
         // 查询出上一次重考的记录
+        List<ExamRecordDataEntity> examRecordDataList = examRecordService.getExamRecordListByExamStudentId(examStudentId);
         Optional<ExamRecordDataEntity> examRecordOptional = examRecordDataList.stream()
                 .filter(examRecordData -> examRecordData.getExamRecordStatus() != ExamRecordStatus.EXAM_INVALID
                         && examRecordData.getIsReexamine() != null && examRecordData.getIsReexamine())
                 .findFirst();
-        ExamRecordDataEntity examRecordData = null;
+
         if (examRecordOptional.isPresent()) {
-            examRecordData = examRecordOptional.get();
-        }
-        if (examRecordData != null) {
+            ExamRecordDataEntity examRecordData = examRecordOptional.get();
             // 将上一次重考的记录设置成无效
             examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_INVALID);
             examRecordDataRepo.save(examRecordData);
+
             // 删除生成的阅卷数据,避免传到阅卷
-            ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo
-                    .findByExamRecordDataId(examRecordData.getId());
+            ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo.findByExamRecordDataId(examRecordData.getId());
             if (examRecordForMarking != null) {
                 examRecordForMarkingRepo.delete(examRecordForMarking);
             }
@@ -1051,10 +1048,23 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         examStudent.setExtraNum(extraExamNum + 1);
         examStudent.setReexamineType(reexamineType);
         examStudent.setReexamineDetail(reexamineDetail);
+        examStudent.setUpdateTime(new Date());
         examStudentRepo.save(examStudent);
 
         // 刷新考生的缓存
         examStudentCache.refresh(examStudentId);
+
+        // 重考设置日志
+        ReexamineLogEntity reexamineLog = new ReexamineLogEntity();
+        reexamineLog.setExamId(examStudent.getExamId());
+        reexamineLog.setExamStudentId(examStudentId);
+        reexamineLog.setReexamineType(reexamineType);
+        reexamineLog.setReexamineDetail(reexamineDetail);
+        reexamineLog.setOperateUserId(operateUserId);
+        reexamineLog.setOperateUserName(operateUserName);
+        reexamineLog.setUpdateTime(new Date());
+        reexamineLog.setCreationTime(new Date());
+        reexamineLogService.addReexamineLog(reexamineLog);
     }
 
     @Override

+ 10 - 0
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ReexamineLogServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
 import cn.com.qmth.examcloud.core.oe.admin.dao.ReexamineLogRepo;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ReexamineLogEntity;
 import cn.com.qmth.examcloud.core.oe.admin.service.ReexamineLogService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -15,5 +16,14 @@ public class ReexamineLogServiceImpl implements ReexamineLogService {
     @Autowired
     private ReexamineLogRepo reexamineLogRepo;
 
+    @Override
+    public void addReexamineLog(ReexamineLogEntity reexamineLog) {
+        if (reexamineLog == null) {
+            return;
+        }
+
+        reexamineLogRepo.save(reexamineLog);
+        log.warn("reexamineLog:{}", reexamineLog);
+    }
 
 }