Bladeren bron

虚拟设备ip查询

xiatian 3 jaren geleden
bovenliggende
commit
481e616127
11 gewijzigde bestanden met toevoegingen van 464 en 235 verwijderingen
  1. 24 17
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamRecordController.java
  2. 42 0
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncExamDataCloudServiceProvider.java
  3. 24 0
      examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamCaptureCameraInfoRepo.java
  4. 4 0
      examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamProcessRecordRepo.java
  5. 113 0
      examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/entity/ExamCaptureCameraInfoEntity.java
  6. 2 0
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamProcessRecordService.java
  7. 14 14
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamRecordService.java
  8. 11 0
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examrecord/ExamRecordQuery.java
  9. 9 24
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamCaptureServiceImpl.java
  10. 23 0
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamProcessRecordServiceImpl.java
  11. 198 180
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordServiceImpl.java

+ 24 - 17
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamRecordController.java

@@ -9,7 +9,6 @@ package cn.com.qmth.examcloud.core.oe.admin.api.controller;
 
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
-import cn.com.qmth.examcloud.commons.util.JsonMapper;
 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.ExamRecordDataRepo;
@@ -18,6 +17,7 @@ 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.service.AsyncExportService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCaptureService;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamProcessRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordFileAnswerInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordInfo;
@@ -68,6 +68,11 @@ public class ExamRecordController extends ControllerSupport {
 
     @Autowired
     private ExamRecordFileAnswerRepo examRecordFileAnswerRepo;
+    
+    @Autowired
+    private ExamProcessRecordService examProcessRecordService;
+    
+    
 
 
     @PostMapping("/waiting/audit/list")
@@ -85,6 +90,7 @@ public class ExamRecordController extends ControllerSupport {
                 if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)) {
                     examRecordInfo.setVirtualCameraNames(examCaptureService.getVirtualCameraNames(examRecordInfo.getDataId()));
                     examRecordInfo.setHasVirtual(StringUtils.isNotBlank(examRecordInfo.getVirtualCameraNames()));
+                    examRecordInfo.setIp(examProcessRecordService.getIps(examRecordInfo.getDataId()));
                 }
             }
         }
@@ -126,6 +132,7 @@ public class ExamRecordController extends ControllerSupport {
                 }
                 if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)) {
                     examRecordInfo.setVirtualCameraNames(examCaptureService.getVirtualCameraNames(examRecordInfo.getDataId()));
+                    examRecordInfo.setIp(examProcessRecordService.getIps(examRecordInfo.getDataId()));
                 }
             }
         }
@@ -154,22 +161,22 @@ public class ExamRecordController extends ControllerSupport {
     @GetMapping("/detail/list/export")
     @ApiOperation(value = "导出“考试明细”列表(Excel)", notes = "参数示例:query={\"pageNo\":1,\"pageSize\":10,\"examId\":123, ...}")
     public void exportExamRecordDetailList(@RequestParam String query, HttpServletResponse response) throws Exception {
-        ExamRecordQuery newQuery = new JsonMapper().parseJson(query, ExamRecordQuery.class);
-        Check.isNull(newQuery, "请求参数不能为空!");
-        Check.isNull(newQuery.getExamId(), "请先选择考试批次!");
-
-        List<ExamRecordInfo> examRecordInfoList = examRecordService.getExamRecordDetailList(newQuery);
-        if (examRecordInfoList != null && examRecordInfoList.size() > 0) {
-            String examType = examRecordInfoList.get(0).getExamType();
-
-            for (ExamRecordInfo examRecordInfo : examRecordInfoList) {
-                if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)) {
-                    examRecordInfo.setVirtualCameraNames(examCaptureService.getVirtualCameraNames(examRecordInfo.getDataId()));
-                }
-            }
-        }
-
-        ExportUtils.exportEXCEL("考试明细列表", ExamRecordInfo.class, examRecordInfoList, response);
+//        ExamRecordQuery newQuery = new JsonMapper().parseJson(query, ExamRecordQuery.class);
+//        Check.isNull(newQuery, "请求参数不能为空!");
+//        Check.isNull(newQuery.getExamId(), "请先选择考试批次!");
+//
+//        List<ExamRecordInfo> examRecordInfoList = examRecordService.getExamRecordDetailList(newQuery);
+//        if (examRecordInfoList != null && examRecordInfoList.size() > 0) {
+//            String examType = examRecordInfoList.get(0).getExamType();
+//
+//            for (ExamRecordInfo examRecordInfo : examRecordInfoList) {
+//                if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)) {
+//                    examRecordInfo.setVirtualCameraNames(examCaptureService.getVirtualCameraNames(examRecordInfo.getDataId()));
+//                }
+//            }
+//        }
+//
+//        ExportUtils.exportEXCEL("考试明细列表", ExamRecordInfo.class, examRecordInfoList, response);
     }
 
     @GetMapping("/detail/list/export/async")

+ 42 - 0
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncExamDataCloudServiceProvider.java

@@ -24,6 +24,9 @@ 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.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -118,6 +121,11 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
 
     @Autowired
     private RedisClient redisClient;
+    
+    @Autowired
+    private ExamCaptureCameraInfoRepo examCaptureCameraInfoRepo;
+    
+    
 
     /**
      * 同步考试记录数据
@@ -724,9 +732,43 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
     private void syncExamCapture(List<ExamCaptureBean> examCaptures, Long examRecordDataId) {
         for (ExamCaptureBean bean : examCaptures) {
             ExamCaptureEntity examCaptureEntity = copyExamCaptureFrom(bean, examRecordDataId);
+            saveExamCaptureCameraInfo(examCaptureEntity);
             examCaptureRepo.saveAndFlush(examCaptureEntity);
         }
     }
+    private void saveExamCaptureCameraInfo(ExamCaptureEntity examCaptureEntity) {
+        if(StringUtils.isEmpty(examCaptureEntity.getCameraInfos())) {
+        	return;
+        }
+        try {
+        	JSONArray jsonArray = new JSONArray(examCaptureEntity.getCameraInfos());
+            for (int i = 0; i < jsonArray.length(); i++) {
+        		JSONObject jsonObject = (JSONObject) jsonArray.get(i);
+        		ExamCaptureCameraInfoEntity ci=new ExamCaptureCameraInfoEntity();
+        		ci.setExamRecordDataId(examCaptureEntity.getExamRecordDataId());
+        		ci.setDetail(getVal(jsonObject, "detail"));
+        		ci.setName(getVal(jsonObject, "name"));
+        		ci.setPid(getVal(jsonObject, "pid"));
+        		ci.setVid(getVal(jsonObject, "vid"));
+        		if (jsonObject.isNull("pid") || StringUtils.isBlank(jsonObject.getString("pid"))) {
+        			ci.setVirtualCamera(true);
+        		}else {
+        			ci.setVirtualCamera(false);
+        		}
+        		examCaptureCameraInfoRepo.saveAndFlush(ci);
+            }
+        } catch (Exception e) {
+        	LOG.error("保存摄像信息失败:"+examCaptureEntity.getExamRecordDataId()+" "+examCaptureEntity.getCameraInfos(), e);
+        }
+    }
+    
+    private String getVal(JSONObject jsonObject,String name) throws JSONException {
+    	if (jsonObject.isNull(name) || StringUtils.isBlank(jsonObject.getString(name))) {
+    		return "";
+    	}else {
+    		return jsonObject.getString(name);
+    	}
+    }
 
     private ExamCaptureEntity copyExamCaptureFrom(ExamCaptureBean examCapture, Long examRecordDataId) {
         ExamCaptureEntity entity = new ExamCaptureEntity();

+ 24 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamCaptureCameraInfoRepo.java

@@ -0,0 +1,24 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamCaptureCameraInfoEntity;
+
+/**
+ * @author chenken
+ * @date 2018/8/15 10:23
+ * @company QMTH
+ * @description ExamCaptureEntityRepo
+ */
+@Repository
+public interface ExamCaptureCameraInfoRepo extends JpaRepository<ExamCaptureCameraInfoEntity, Long>, JpaSpecificationExecutor<ExamCaptureCameraInfoEntity> {
+
+	List<ExamCaptureCameraInfoEntity> findByExamRecordDataIdAndVirtualCamera(Long examRecordDataId, boolean b);
+
+	List<ExamCaptureCameraInfoEntity> findByExamRecordDataIdInAndVirtualCamera(List<Long> ids, boolean b);
+	
+}

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

@@ -18,4 +18,8 @@ public interface ExamProcessRecordRepo
         extends JpaRepository<ExamProcessRecordEntity, Long>, JpaSpecificationExecutor<ExamProcessRecordEntity> {
 
     List<ExamProcessRecordEntity> findByExamRecordDataIdOrderByRecordTimeAsc(Long examRecordDataId);
+
+	List<ExamProcessRecordEntity> findByExamRecordDataId(Long examRecordDataId);
+
+	List<ExamProcessRecordEntity> findByExamRecordDataIdIn(List<Long> ids);
 }

+ 113 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/entity/ExamCaptureCameraInfoEntity.java

@@ -0,0 +1,113 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * @author chenken
+ * @date 2018/8/15 10:19
+ * @company QMTH
+ * @description ExamCaptureEntity
+ */
+@Entity
+@Table(name = "ec_oe_exam_capture_camera_info", indexes = {
+        @Index(name = "IDX_OE_CCI_001", columnList = "examRecordDataId"),
+        @Index(name = "IDX_OE_CCI_002", columnList = "name"),
+        @Index(name = "IDX_OE_CCI_003", columnList = "examRecordDataId,pid,vid,name", unique = true)
+})
+public class ExamCaptureCameraInfoEntity extends JpaEntity {
+
+
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 5768699298680442068L;
+
+	@Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+	@Column(nullable = false)
+    private Long examRecordDataId;
+
+    @Column(name = "virtual_camera",nullable = false)
+    private Boolean virtualCamera;
+
+    @Column(name = "detail", length = 2000)
+    private String detail;
+    
+    @Column(name = "pid", length = 200,nullable = false)
+    private String pid;
+    
+    @Column(name = "vid", length = 200,nullable = false)
+    private String vid;
+    
+    @Column(name = "name", length = 200,nullable = false)
+    private String name;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getExamRecordDataId() {
+		return examRecordDataId;
+	}
+
+	public void setExamRecordDataId(Long examRecordDataId) {
+		this.examRecordDataId = examRecordDataId;
+	}
+
+
+	public Boolean getVirtualCamera() {
+		return virtualCamera;
+	}
+
+	public void setVirtualCamera(Boolean virtualCamera) {
+		this.virtualCamera = virtualCamera;
+	}
+
+	public String getDetail() {
+		return detail;
+	}
+
+	public void setDetail(String detail) {
+		this.detail = detail;
+	}
+
+	public String getPid() {
+		return pid;
+	}
+
+	public void setPid(String pid) {
+		this.pid = pid;
+	}
+
+	public String getVid() {
+		return vid;
+	}
+
+	public void setVid(String vid) {
+		this.vid = vid;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+
+}

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

@@ -19,5 +19,7 @@ public interface ExamProcessRecordService {
      * @return
      */
     List<ExamProcessRecordInfo> getExamProcessRecords(Long examRecordDataId);
+    
+    String getIps(Long examRecordDataId);
 
 }

+ 14 - 14
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamRecordService.java

@@ -48,13 +48,13 @@ public interface ExamRecordService {
      */
     Page<ExamRecordInfo> getExamRecordWaitingAuditList(ExamRecordQuery query);
 
-    /**
-     * 查询“监考待审”列表(分页)
-     *
-     * @param query
-     * @return
-     */
-    List<ExamRecordInfo> getExamRecordWaitingAudit(ExamRecordQuery query);
+//    /**
+//     * 查询“监考待审”列表(分页)
+//     *
+//     * @param query
+//     * @return
+//     */
+//    List<ExamRecordInfo> getExamRecordWaitingAudit(ExamRecordQuery query);
 
     /**
      * Description 查询“监考待审”下一条记录
@@ -90,13 +90,13 @@ public interface ExamRecordService {
      */
     Long existsWarnExamRecordDetail(ExamRecordQuery query);
 
-    /**
-     * 根据条件查询 “考试明细”
-     *
-     * @param newQuery
-     * @return
-     */
-    List<ExamRecordInfo> getExamRecordDetailList(ExamRecordQuery newQuery);
+//    /**
+//     * 根据条件查询 “考试明细”
+//     *
+//     * @param newQuery
+//     * @return
+//     */
+//    List<ExamRecordInfo> getExamRecordDetailList(ExamRecordQuery newQuery);
 
     /**
      * 根据考试id和课程代码获取学生作答成绩

+ 11 - 0
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examrecord/ExamRecordQuery.java

@@ -114,6 +114,9 @@ public class ExamRecordQuery implements JsonSerializable {
 
     @ApiModelProperty("Ip")
     private String ip;
+    
+    @ApiModelProperty("虚拟设备名")
+    private String virtualName;
 
     @ApiModelProperty("审核人")
     private String auditUserName;
@@ -413,5 +416,13 @@ public class ExamRecordQuery implements JsonSerializable {
 		this.switchScreenCountEnd = switchScreenCountEnd;
 	}
 
+	public String getVirtualName() {
+		return virtualName;
+	}
+
+	public void setVirtualName(String virtualName) {
+		this.virtualName = virtualName;
+	}
+
     
 }

+ 9 - 24
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamCaptureServiceImpl.java

@@ -8,6 +8,7 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureCameraInfoRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
@@ -53,7 +54,10 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
 
     @Autowired
     private ExamCaptureRepo examCaptureRepo;
-
+    
+    @Autowired
+    private ExamCaptureCameraInfoRepo examCaptureCameraInfoRepo;
+    
     @Autowired
     private ExamAuditService examAuditService;
 
@@ -167,31 +171,12 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
     @Override
     public String getVirtualCameraNames(Long examRecordDataId) {
         Set<String> virtualCameraNames = new HashSet<String>();
-        List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(examRecordDataId);
+        List<ExamCaptureCameraInfoEntity> examCaptureList = examCaptureCameraInfoRepo.findByExamRecordDataIdAndVirtualCamera(examRecordDataId,true);
         if (examCaptureList != null && examCaptureList.size() > 0) {
-            for (ExamCaptureEntity examCapture : examCaptureList) {
-                String cameraInfos = examCapture.getCameraInfos();
+            for (ExamCaptureCameraInfoEntity examCapture : examCaptureList) {
+                String cameraInfos = examCapture.getName();
                 if (StringUtils.isNotBlank(cameraInfos)) {
-                    JSONArray jsonArray;
-                    try {
-                        jsonArray = new JSONArray(cameraInfos);
-                        for (int i = 0; i < jsonArray.length(); i++) {
-                            try {
-                                JSONObject jsonObject = (JSONObject) jsonArray.get(i);
-                                if (jsonObject.isNull("pid") || StringUtils.isBlank(jsonObject.getString("pid"))) {
-                                    virtualCameraNames.add(jsonObject.getString("name"));
-                                }
-                            } catch (JSONException e) {
-                                //主要针对json数组最后的空对象处理,不影响业务
-                                LOG.error("抓拍照片格式不正确", e);
-                                continue;
-                            }
-                        }
-                    } catch (JSONException e) {
-                        LOG.error("获取虚拟摄像头名称失败", e);
-                        throw new StatusException("ExamCaptureService-001", "获取虚拟摄像头名称失败");
-                    }
-
+                	virtualCameraNames.add(cameraInfos);
                 }
             }
         }

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

@@ -5,11 +5,15 @@ import cn.com.qmth.examcloud.core.oe.admin.dao.ExamProcessRecordRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamProcessRecordEntity;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamProcessRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.ExamProcessRecordInfo;
+
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @Description 考试过程记录
@@ -50,4 +54,23 @@ public class ExamProcessRecordServiceImpl implements ExamProcessRecordService {
         return resultList;
     }
 
+	@Override
+	public String getIps(Long examRecordDataId) {
+		Set<String> ips = new HashSet<String>();
+        List<ExamProcessRecordEntity> list = examProcessRecordRepo.findByExamRecordDataId(examRecordDataId);
+        if (list != null && list.size() > 0) {
+            for (ExamProcessRecordEntity ep : list) {
+                String ip = ep.getSourceIp();
+                if (StringUtils.isNotBlank(ip)) {
+                	ips.add(ip);
+                }
+            }
+        }
+        StringBuffer sb = new StringBuffer();
+        for (String ip : ips) {
+            sb.append(ip).append(";");
+        }
+        return sb.toString();
+	}
+
 }

+ 198 - 180
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordServiceImpl.java

@@ -18,7 +18,9 @@ import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SqlWrapper;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.BatchSetDataUtil;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.DateUtils;
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureCameraInfoRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureRepo;
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamProcessRecordRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordQuestionsRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
@@ -27,7 +29,6 @@ import cn.com.qmth.examcloud.core.oe.admin.dao.enums.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.oe.admin.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.admin.service.LocalCacheService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.ExamStudentEffectiveScoreInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordEntityConvert;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordInfo;
@@ -45,11 +46,6 @@ import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
@@ -78,8 +74,6 @@ import java.util.stream.Collectors;
 @Service
 public class ExamRecordServiceImpl implements ExamRecordService {
 
-    private static final Logger LOG = LoggerFactory.getLogger(ExamRecordServiceImpl.class);
-
     @Autowired
     private ExamScoreRepo examScoreRepo;
 
@@ -101,14 +95,20 @@ public class ExamRecordServiceImpl implements ExamRecordService {
     @Autowired
     private ExamRecordEntityConvert examRecordEntityConvert;
 
-    @Autowired
-    private LocalCacheService localCacheService;
+//    @Autowired
+//    private LocalCacheService localCacheService;
 
     @Autowired
     private StudentCloudService studentCloudService;
 
     @Autowired
     private ExamCaptureRepo examCaptureRepo;
+    
+    @Autowired
+    private ExamCaptureCameraInfoRepo examCaptureCameraInfoRepo;
+    
+    @Autowired
+    private ExamProcessRecordRepo examProcessRecordRepo;
 
 
     private static final String EXAM_RECORD_EXPORT_SQL = "select  record_data.id," +
@@ -152,7 +152,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             "record_data.switch_screen_count switchScreenCount," +
             "record_data.exam_stage_id examStageId," +
             "audit.audit_user_name audit_user_name," +
-            "GROUP_CONCAT(DISTINCT process.source_ip) ip," +
             "eoes.objective_score objectiveTotalScore," +
             "eoes.subjective_score subjectiveTotalScore," +
             "eoes.total_score paperTotalScore," +
@@ -164,12 +163,13 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             " LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id " +
             " LEFT JOIN ec_oe_exam_score eoes ON  record_data.id = eoes.exam_record_data_id " +
             " LEFT JOIN ec_oe_exam_student eoest ON  record_data.exam_student_id = eoest.exam_student_id " +
+            " left join ec_oe_exam_capture_camera_info camera on record_data.id=camera.exam_record_data_id "+
             " where 1=1";
 
     /**
      * ec_oe_exam_record_data  查询sql
      */
-    private static final String EXAM_RECORD_SQL = "select  record_data.id," +
+    private static final String EXAM_RECORD_HEAD_SQL = "select  record_data.id," +
             "record_data.exam_record_status," +
             "record_data.start_time," +
             "record_data.end_time," +
@@ -209,11 +209,12 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             "record_data.info_collector info_collector," +
             "record_data.switch_screen_count switchScreenCount," +
             "record_data.exam_stage_id examStageId," +
-            "audit.audit_user_name audit_user_name," +
-            "GROUP_CONCAT(DISTINCT process.source_ip) ip" +
-            " from ec_oe_exam_record_data record_data " +
+            "audit.audit_user_name audit_user_name ";
+            
+    private static final String EXAM_RECORD_FROM_SQL = " from ec_oe_exam_record_data record_data " +
             " LEFT JOIN ec_oe_exam_process_record AS process ON record_data.id = process.exam_record_data_id " +
             " LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id " +
+            " left join ec_oe_exam_capture_camera_info camera on record_data.id=camera.exam_record_data_id "+
             " where 1=1";
 
     /**
@@ -250,38 +251,38 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         return this.getExamRecordList(query);
     }
 
-    @Override
-    public List<ExamRecordInfo> getExamRecordWaitingAudit(ExamRecordQuery query) {
-        Check.isNull(query, "查询参数不能为空!");
-        //默认条件
-        query.setIsAudit(false);
-        query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
-        query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
-
-        //查询条件
-        StringBuilder sqlBuilder = new StringBuilder();
-        //待审核(按原先的sql,多了一个ip字段)
-        sqlBuilder.append(EXAM_RECORD_SQL);
-        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
-        if (query.getIsWarn() != null) {
-            //只查有异常未审核
-            if (query.getIsWarn()) {
-                sqlBuilder.append(" and record_data.is_warn  = 1 and record_data.is_audit = 0 ");
-            } else {
-                sqlBuilder.append(" and record_data.is_warn  = 0 ");
-            }
-        } else {
-            sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 0))");
-        }
-        sqlBuilder.append(" and record_data.is_illegality = 0");
-        //查询分页记录
-        sqlBuilder.append(" group by record_data.id ");
-
-        sqlBuilder.append(" order by record_data.id desc");
-        List<ExamRecordDataEntity> entities = jdbcTemplate.query(sqlBuilder.toString(), (rs, rowNum) -> getExamRecordDataEntityByResultSet(rs));
-
-        return examRecordEntityConvert.ofList(entities);
-    }
+//    @Override
+//    public List<ExamRecordInfo> getExamRecordWaitingAudit(ExamRecordQuery query) {
+//        Check.isNull(query, "查询参数不能为空!");
+//        //默认条件
+//        query.setIsAudit(false);
+//        query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
+//        query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
+//
+//        //查询条件
+//        StringBuilder sqlBuilder = new StringBuilder();
+//        //待审核(按原先的sql,多了一个ip字段)
+//        sqlBuilder.append(EXAM_RECORD_SQL);
+//        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
+//        if (query.getIsWarn() != null) {
+//            //只查有异常未审核
+//            if (query.getIsWarn()) {
+//                sqlBuilder.append(" and record_data.is_warn  = 1 and record_data.is_audit = 0 ");
+//            } else {
+//                sqlBuilder.append(" and record_data.is_warn  = 0 ");
+//            }
+//        } else {
+//            sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 0))");
+//        }
+//        sqlBuilder.append(" and record_data.is_illegality = 0");
+//        //查询分页记录
+//        sqlBuilder.append(" group by record_data.id ");
+//
+//        sqlBuilder.append(" order by record_data.id desc");
+//        List<ExamRecordDataEntity> entities = jdbcTemplate.query(sqlBuilder.toString(), (rs, rowNum) -> getExamRecordDataEntityByResultSet(rs));
+//
+//        return examRecordEntityConvert.ofList(entities);
+//    }
 
     @Override
     public Long getExamRecordWaitingAuditNextId(ExamRecordQuery query, Long examRecordDataId, String next) {
@@ -294,7 +295,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
         //查询条件
         StringBuilder sqlBuilder = new StringBuilder();
-        //待审核(按原先的sql,多了一个ip字段)
         sqlBuilder.append("select record_data.id from ec_oe_exam_record_data record_data where 1 = 1 ");
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         if (query.getIsWarn() != null) {
@@ -346,26 +346,23 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         Check.isNull(query.getExamId(), "请先选择考试批次!");
         //查询条件
         StringBuilder sqlBuilder = new StringBuilder();
-        sqlBuilder.append(EXAM_RECORD_SQL);
+        sqlBuilder.append(EXAM_RECORD_FROM_SQL);
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
         sqlBuilder.append(" group by record_data.id ");
-        //根据ip查询
-        /*if (StringUtils.isNoneBlank(query.getIp())) {
-            sqlBuilder.append(" having ip like '%"+query.getIp()+"%' ");
-        }*/
-        sqlBuilder.append(" order by record_data.id desc");
         //分页条件
         int currentNum = (query.getPageNo() - 1) * query.getPageSize();
-        sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
-        List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
+        List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(
+        		EXAM_RECORD_HEAD_SQL+sqlBuilder.toString()+" order by record_data.id desc limit " + currentNum + "," + query.getPageSize(), 
+        		new RowMapper<ExamRecordDataEntity>() {
             @Override
             public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
                 return getExamRecordDataEntityByResultSet(rs);
             }
         });
         //查询总数
-        long total = countExamRecordDetailListForPage(query);
+//        long total = countExamRecordDetailListForPage(query);
+        long total=jdbcTemplate.queryForObject("SELECT count(1) FROM (SELECT record_data.id "+sqlBuilder.toString()+") temtb", Long.class);
         Pageable pageable = PageRequest.of(query.getPageNo() - 1, query.getPageSize());
         Page<ExamRecordDataEntity> page = new PageImpl<ExamRecordDataEntity>(examRecordDataList, pageable, total);
         Page<ExamRecordInfo> ret=examRecordEntityConvert.of(page);
@@ -411,7 +408,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         examRecordData.setFaceSuccessPercent(rs.getDouble("face_success_percent"));
         examRecordData.setFaceVerifyResult(IsSuccess.strToEnum(rs.getString("face_verify_result")));
         examRecordData.setBaiduFaceLivenessSuccessPercent(rs.getDouble("baidu_face_liveness_success_percent"));
-        examRecordData.setIp(rs.getString("ip"));
         examRecordData.setAuditUserName(rs.getString("audit_user_name"));
         examRecordData.setSwitchScreenCount(rs.getInt("switchScreenCount"));
         if(rs.getString("examStageId")!=null) {
@@ -421,14 +417,16 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         return examRecordData;
     }
 
-    private long countExamRecordDetailListForPage(ExamRecordQuery query) {
-        StringBuilder sqlBuilder = new StringBuilder();
-        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data " +
-                "LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id where 1=1");
-        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
-        sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
-        return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
-    }
+//    private long countExamRecordDetailListForPage(ExamRecordQuery query) {
+//        StringBuilder sqlBuilder = new StringBuilder();
+//        sqlBuilder.append("select count(distinct record_data.id) from ec_oe_exam_record_data record_data " +
+//        		" LEFT JOIN ec_oe_exam_process_record AS process ON record_data.id = process.exam_record_data_id " +
+//                " LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id where 1=1 ");
+//        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
+//        sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
+//        sqlBuilder.append(" group by record_data.id ");
+//        return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
+//    }
 
     /**
      * 构建查询 考试明细sql语句
@@ -529,13 +527,23 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         //是否有虚拟设备
         if (query.getHasVirtual() != null) {
             if (query.getHasVirtual()) {
-                sql.append(" and record_data.id in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId() + " and t2.has_virtual_camera=1 )");
+            	sql.append(" and camera.virtual_camera=1 ");
+//                sql.append(" and record_data.id in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId() + " and t2.has_virtual_camera=1 )");
             } else {
                 //原先写法会跟有虚拟设备的出现重复情况,用有虚拟设备的not in
                 //sql.append(" and record_data.id in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId()+" and (t2.has_virtual_camera=0 or t2.has_virtual_camera is null) )");
-                sql.append(" and record_data.id not in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId() + " and t2.has_virtual_camera=1 )");
+//                sql.append(" and record_data.id not in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId() + " and t2.has_virtual_camera=1 )");
+            	sql.append(" and (camera.virtual_camera=0 or camera.virtual_camera is null) ");
             }
         }
+        if (StringUtils.isNotBlank(query.getVirtualName())) {
+        	sql.append(" and camera.name='"+query.getVirtualName()+"' ");
+        }
+        
+        //ip
+        if (StringUtils.isNotBlank(query.getIp())) {
+        	sql.append(" and process.source_ip='"+query.getIp()+"' ");
+        }
         return sql;
     }
 
@@ -549,7 +557,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         //查询条件
         StringBuilder sqlBuilder = new StringBuilder();
         //待审核(按原先的sql,多了一个ip字段)
-        sqlBuilder.append(EXAM_RECORD_SQL);
+        sqlBuilder.append(EXAM_RECORD_FROM_SQL);
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         if (query.getIsWarn() != null) {
             //只查有异常未审核
@@ -564,22 +572,20 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         sqlBuilder.append(" and record_data.is_illegality = 0");
         //查询分页记录
         sqlBuilder.append(" group by record_data.id ");
-        //根据ip查询
-        /*if (StringUtils.isNoneBlank(query.getIp())) {
-            sqlBuilder.append(" having ip like '%"+query.getIp()+"%' ");
-        }*/
-        sqlBuilder.append(" order by record_data.id desc");
+//        sqlBuilder.append(" order by record_data.id desc");
         //分页条件
         int currentNum = (query.getPageNo() - 1) * query.getPageSize();
-        sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
-        List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
+//        sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
+        List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(
+        		EXAM_RECORD_HEAD_SQL+sqlBuilder.toString()+" order by record_data.id desc limit " + currentNum + "," + query.getPageSize(), new RowMapper<ExamRecordDataEntity>() {
             @Override
             public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
                 return getExamRecordDataEntityByResultSet(rs);
             }
         });
         //查询总数
-        long total = countExamRecordListForPage(query);
+//        long total = countExamRecordListForPage(query);
+        long total=jdbcTemplate.queryForObject("SELECT count(1) FROM (SELECT record_data.id "+sqlBuilder.toString()+") temtb", Long.class);
         Pageable pageable = PageRequest.of(query.getPageNo() - 1, query.getPageSize());
 
         Page<ExamRecordDataEntity> page = new PageImpl<ExamRecordDataEntity>(examRecordDataList, pageable, total);
@@ -590,24 +596,25 @@ public class ExamRecordServiceImpl implements ExamRecordService {
      * 监考待审:数量查询
      * 查询无异常的数据和有异常未审核的数据
      */
-    private long countExamRecordListForPage(ExamRecordQuery query) {
-        StringBuilder sqlBuilder = new StringBuilder();
-        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data where 1=1");
-        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
-        if (query.getIsWarn() != null) {
-            if (query.getIsWarn()) {
-                sqlBuilder.append(" and record_data.is_warn  = 1 and record_data.is_audit = 0 ");
-            } else {
-                sqlBuilder.append(" and record_data.is_warn  = 0 ");
-            }
-        } else {
-            sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 0))");
-        }
-        sqlBuilder.append(" and record_data.is_illegality = 0");
-        return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
-    }
-
-    @Override
+//    private long countExamRecordListForPage(ExamRecordQuery query) {
+//        StringBuilder sqlBuilder = new StringBuilder();
+//        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data where 1=1");
+//        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
+//        if (query.getIsWarn() != null) {
+//            if (query.getIsWarn()) {
+//                sqlBuilder.append(" and record_data.is_warn  = 1 and record_data.is_audit = 0 ");
+//            } else {
+//                sqlBuilder.append(" and record_data.is_warn  = 0 ");
+//            }
+//        } else {
+//            sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 0))");
+//        }
+//        sqlBuilder.append(" and record_data.is_illegality = 0");
+//        return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
+//    }
+
+    @SuppressWarnings("unchecked")
+	@Override
     public List<Long> getExamRecordingStudentIds(Long examId) {
         Check.isNull(examId, "考试ID不能为空!");
 
@@ -737,6 +744,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         String examType = examRecordDataList.get(0).getExamType();
         if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)) {
             setVirtualCameraNames(examRecordDataList);
+            setIps(examRecordDataList);
         }
         fillStage(examRecordDataList);
         return examRecordDataList;
@@ -813,36 +821,17 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             public void setData(List<ExamRecordInfo> dataList) {
                 List<Long> ids = dataList.stream().map(dto -> dto.getId()).distinct().collect(Collectors.toList());
                 Map<Long, Set<String>> map = new HashMap<>();
-                List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataIdIn(ids);
+                List<ExamCaptureCameraInfoEntity> examCaptureList = examCaptureCameraInfoRepo.findByExamRecordDataIdInAndVirtualCamera(ids,true);
                 if (examCaptureList != null && examCaptureList.size() > 0) {
-                    for (ExamCaptureEntity examCapture : examCaptureList) {
+                    for (ExamCaptureCameraInfoEntity examCapture : examCaptureList) {
                         Set<String> virtualCameraNames = map.get(examCapture.getExamRecordDataId());
                         if (virtualCameraNames == null) {
                             virtualCameraNames = new HashSet<String>();
                             map.put(examCapture.getExamRecordDataId(), virtualCameraNames);
                         }
-                        String cameraInfos = examCapture.getCameraInfos();
+                        String cameraInfos = examCapture.getName();
                         if (StringUtils.isNotBlank(cameraInfos)) {
-                            JSONArray jsonArray;
-                            try {
-                                jsonArray = new JSONArray(cameraInfos);
-                                for (int i = 0; i < jsonArray.length(); i++) {
-                                    try {
-                                        JSONObject jsonObject = (JSONObject) jsonArray.get(i);
-                                        if (StringUtils.isBlank(jsonObject.getString("pid"))) {
-                                            virtualCameraNames.add(jsonObject.getString("name"));
-                                        }
-                                    } catch (JSONException e) {
-                                        //主要针对json数组最后的空对象处理,不影响业务
-                                        LOG.error("抓拍照片格式不正确", e);
-                                        continue;
-                                    }
-                                }
-                            } catch (JSONException e) {
-                                LOG.error("获取虚拟摄像头名称失败", e);
-                                throw new StatusException("ExamCaptureService-001", "获取虚拟摄像头名称失败");
-                            }
-
+                            virtualCameraNames.add(cameraInfos);
                         }
                     }
                 }
@@ -854,6 +843,35 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         };
         tool.setDataForBatch(examRecordDataList, 100);
     }
+    
+    private void setIps(List<ExamRecordInfo> examRecordDataList) {
+        BatchSetDataUtil<ExamRecordInfo> tool = new BatchSetDataUtil<ExamRecordInfo>() {
+            @Override
+            public void setData(List<ExamRecordInfo> dataList) {
+                List<Long> ids = dataList.stream().map(dto -> dto.getId()).distinct().collect(Collectors.toList());
+                Map<Long, Set<String>> map = new HashMap<>();
+                List<ExamProcessRecordEntity> list = examProcessRecordRepo.findByExamRecordDataIdIn(ids);
+                if (list != null && list.size() > 0) {
+                    for (ExamProcessRecordEntity ep : list) {
+                        Set<String> ips = map.get(ep.getExamRecordDataId());
+                        if (ips == null) {
+                        	ips = new HashSet<String>();
+                            map.put(ep.getExamRecordDataId(), ips);
+                        }
+                        String ip = ep.getSourceIp();
+                        if (StringUtils.isNotBlank(ip)) {
+                            ips.add(ip);
+                        }
+                    }
+                }
+                for (ExamRecordInfo erInfo : dataList) {
+                    erInfo.setIp(getStrFromSet(map.get(erInfo.getId())));
+                }
+            }
+
+        };
+        tool.setDataForBatch(examRecordDataList, 100);
+    }
 
     private String getStrFromSet(Set<String> set) {
         if (set == null || set.size() == 0) {
@@ -939,68 +957,68 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         return ret;
     }
 
-    @Override
-    public List<ExamRecordInfo> getExamRecordDetailList(ExamRecordQuery query) {
-        Check.isNull(query, "查询参数不能为空!");
-        query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
-        query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
-
-        StringBuilder sqlBuilder = new StringBuilder();
-        sqlBuilder.append(EXAM_RECORD_SQL);
-        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
-        sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
-        sqlBuilder.append(" group by record_data.id ");
-        //根据ip查询
-        /*if (StringUtils.isNoneBlank(query.getIp())) {
-            sqlBuilder.append(" having ip like '%"+query.getIp()+"%' ");
-        }*/
-        sqlBuilder.append(" order by record_data.id desc");
-
-        List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
-            @Override
-            public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
-                return getExamRecordDataEntityByResultSet(rs);
-            }
-        });
-
-        List<ExamRecordInfo> examRecordInfoList = examRecordEntityConvert.of(examRecordDataList);
-        return this.loadExamRecordDetailData(examRecordInfoList, query.getExamId());
-    }
-
-    private List<ExamRecordInfo> loadExamRecordDetailData(List<ExamRecordInfo> list, Long examId) {
-        if (list == null || list.size() == 0) {
-            return new ArrayList<ExamRecordInfo>();
-        }
-        //缓存
-        Map<String, Object> cahcheMap = new HashMap<String, Object>();
-
-        list.forEach(examRecordInfo -> {
-            //获取考试名称
-            ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
-            examRecordInfo.setExamName(examBean.getName());
-
-            ExamStudentInfo examStudent = (ExamStudentInfo) cahcheMap.get("examStudentinfo_" + examRecordInfo.getExamStudentId());
-            if (examStudent == null) {
-                examStudent = examStudentService.getExamStudentInfo(examRecordInfo.getExamStudentId());
-                cahcheMap.put("examStudentinfo_" + examRecordInfo.getExamStudentId(), examStudent);
-            }
-
-            String photoNumber = localCacheService.getStudentPhotoNumber(cahcheMap, examRecordInfo.getStudentId());
-            examRecordInfo.setPhone(photoNumber);//电话号码
-            if (examStudent != null) {
-                examRecordInfo.setSpecialtyName(examStudent.getSpecialtyName());
-                examRecordInfo.setGrade(examStudent.getGrade());
-            }
-            Map<String, String> data = this.getPaperScore(examRecordInfo.getDataId());
-            //试卷总分
-            examRecordInfo.setPaperTotalScore(data.get("paperTotalScore"));
-            //客观题总分
-            examRecordInfo.setObjectiveTotalScore(data.get("objectiveTotalScore"));
-            //主观题总分
-            examRecordInfo.setSubjectiveTotalScore(data.get("subjectiveTotalScore"));
-        });
-        return list;
-    }
+//    @Override
+//    public List<ExamRecordInfo> getExamRecordDetailList(ExamRecordQuery query) {
+//        Check.isNull(query, "查询参数不能为空!");
+//        query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
+//        query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
+//
+//        StringBuilder sqlBuilder = new StringBuilder();
+//        sqlBuilder.append(EXAM_RECORD_SQL);
+//        sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
+//        sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
+//        sqlBuilder.append(" group by record_data.id ");
+//        //根据ip查询
+//        /*if (StringUtils.isNoneBlank(query.getIp())) {
+//            sqlBuilder.append(" having ip like '%"+query.getIp()+"%' ");
+//        }*/
+//        sqlBuilder.append(" order by record_data.id desc");
+//
+//        List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
+//            @Override
+//            public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
+//                return getExamRecordDataEntityByResultSet(rs);
+//            }
+//        });
+//
+//        List<ExamRecordInfo> examRecordInfoList = examRecordEntityConvert.of(examRecordDataList);
+//        return this.loadExamRecordDetailData(examRecordInfoList, query.getExamId());
+//    }
+
+//    private List<ExamRecordInfo> loadExamRecordDetailData(List<ExamRecordInfo> list, Long examId) {
+//        if (list == null || list.size() == 0) {
+//            return new ArrayList<ExamRecordInfo>();
+//        }
+//        //缓存
+//        Map<String, Object> cahcheMap = new HashMap<String, Object>();
+//
+//        list.forEach(examRecordInfo -> {
+//            //获取考试名称
+//            ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
+//            examRecordInfo.setExamName(examBean.getName());
+//
+//            ExamStudentInfo examStudent = (ExamStudentInfo) cahcheMap.get("examStudentinfo_" + examRecordInfo.getExamStudentId());
+//            if (examStudent == null) {
+//                examStudent = examStudentService.getExamStudentInfo(examRecordInfo.getExamStudentId());
+//                cahcheMap.put("examStudentinfo_" + examRecordInfo.getExamStudentId(), examStudent);
+//            }
+//
+//            String photoNumber = localCacheService.getStudentPhotoNumber(cahcheMap, examRecordInfo.getStudentId());
+//            examRecordInfo.setPhone(photoNumber);//电话号码
+//            if (examStudent != null) {
+//                examRecordInfo.setSpecialtyName(examStudent.getSpecialtyName());
+//                examRecordInfo.setGrade(examStudent.getGrade());
+//            }
+//            Map<String, String> data = this.getPaperScore(examRecordInfo.getDataId());
+//            //试卷总分
+//            examRecordInfo.setPaperTotalScore(data.get("paperTotalScore"));
+//            //客观题总分
+//            examRecordInfo.setObjectiveTotalScore(data.get("objectiveTotalScore"));
+//            //主观题总分
+//            examRecordInfo.setSubjectiveTotalScore(data.get("subjectiveTotalScore"));
+//        });
+//        return list;
+//    }
 
     @Override
     public List<ExamStudentQuestionScoreInfo> getExamStudentQuestionScoreList(Long examId, String courseCode) {