wangliang 2 жил өмнө
parent
commit
d3ff29a95e

+ 1 - 11
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -344,17 +344,7 @@ public class TIeInvigilateController {
         //                .and(w -> w.ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_HANDLE.name()).or().ne(TEExamStudentLog::getType, SystemOperationEnum.BREACH_REVOKE.name()));
         List<TEExamStudentLog> teExamStudentLogList = teExamStudentLogService.list(teExamStudentLogQueryWrapper);
         if (!CollectionUtils.isEmpty(teExamStudentLogList)) {
-            String currentIp = teExamStudentLogList.get(0).getIp();
-            for (int i = 1; i < teExamStudentLogList.size(); i++) {
-                String ip = teExamStudentLogList.get(i).getIp();
-                if (Objects.isNull(currentIp) || Objects.equals(currentIp.trim(), "")) {
-                    currentIp = ip;
-                    continue;
-                } else if (Objects.nonNull(currentIp) && !Objects.equals(currentIp.trim(), "") && !Objects.equals(currentIp, ip)) {
-                    teExamStudentLogList.get(i).setIpChange(true);
-                    currentIp = ip;
-                }
-            }
+            teExamStudentLogList = teExamStudentLogList.get(0).ipChange(teExamStudentLogList);
         }
         invigilateListDetailBean.setExamStudentLogList(teExamStudentLogList);
 

+ 41 - 26
themis-business/src/main/java/com/qmth/themis/business/bean/admin/ExamStudentLogDetailListBean.java

@@ -1,20 +1,22 @@
 package com.qmth.themis.business.bean.admin;
 
-import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Objects;
 
 @ApiModel("报表-考生日志明细返回对象")
 public class ExamStudentLogDetailListBean {
 
-
-	@ApiModelProperty(name = "发生时间")
+    @ApiModelProperty(name = "发生时间")
     private Long createTime;
-	
-	@ApiModelProperty(name = "事件类型")
+
+    @ApiModelProperty(name = "事件类型")
     private String type;
-	
-	@ApiModelProperty(name = "详情")
+
+    @ApiModelProperty(name = "详情")
     private String remark;
 
     @ApiModelProperty(value = "ip地址")
@@ -38,6 +40,21 @@ public class ExamStudentLogDetailListBean {
     @ApiModelProperty(value = "ip是否改变")
     private Boolean ipChange;
 
+    public IPage<ExamStudentLogDetailListBean> ipChange(IPage<ExamStudentLogDetailListBean> examStudentLogDetailListBeanIPage) {
+        String currentIp = examStudentLogDetailListBeanIPage.getRecords().get(0).getIp();
+        for (int i = 1; i < examStudentLogDetailListBeanIPage.getRecords().size(); i++) {
+            String ip = examStudentLogDetailListBeanIPage.getRecords().get(i).getIp();
+            if (Objects.isNull(currentIp) || Objects.equals(currentIp.trim(), "")) {
+                currentIp = ip;
+                continue;
+            } else if (Objects.nonNull(currentIp) && !Objects.equals(currentIp.trim(), "") && !Objects.equals(currentIp, ip)) {
+                examStudentLogDetailListBeanIPage.getRecords().get(i).setIpChange(true);
+                currentIp = ip;
+            }
+        }
+        return examStudentLogDetailListBeanIPage;
+    }
+
     public String getIp() {
         return ip;
     }
@@ -95,30 +112,28 @@ public class ExamStudentLogDetailListBean {
     }
 
     public Long getCreateTime() {
-		return createTime;
-	}
+        return createTime;
+    }
 
-	public void setCreateTime(Long createTime) {
-		this.createTime = createTime;
-	}
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
 
-	public String getType() {
-		return type;
-	}
+    public String getType() {
+        return type;
+    }
 
-	public void setType(String type) {
-		this.type = type;
-	}
+    public void setType(String type) {
+        this.type = type;
+    }
 
-	public String getRemark() {
-		return remark;
-	}
+    public String getRemark() {
+        return remark;
+    }
 
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 
 
-    
-    
 }

+ 17 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TEExamStudentLog.java

@@ -10,6 +10,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * @Description: 考生轨迹
@@ -152,6 +154,21 @@ public class TEExamStudentLog implements Serializable {
         this.isp = isp;
     }
 
+    public List<TEExamStudentLog> ipChange(List<TEExamStudentLog> teExamStudentLogList) {
+        String currentIp = teExamStudentLogList.get(0).getIp();
+        for (int i = 1; i < teExamStudentLogList.size(); i++) {
+            String ip = teExamStudentLogList.get(i).getIp();
+            if (Objects.isNull(currentIp) || Objects.equals(currentIp.trim(), "")) {
+                currentIp = ip;
+                continue;
+            } else if (Objects.nonNull(currentIp) && !Objects.equals(currentIp.trim(), "") && !Objects.equals(currentIp, ip)) {
+                teExamStudentLogList.get(i).setIpChange(true);
+                currentIp = ip;
+            }
+        }
+        return teExamStudentLogList;
+    }
+
     public Boolean getIpChange() {
         return ipChange;
     }

+ 2 - 12
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEStudentServiceImpl.java

@@ -207,20 +207,10 @@ public class TEStudentServiceImpl extends ServiceImpl<TEStudentMapper, TEStudent
             teExamStudentLogQueryWrapper.lambda().eq(TEExamStudentLog::getExamStudentId, examStudentCacheBean.getId())
                     .eq(TEExamStudentLog::getExamRecordId, examRecordId)
                     .orderByAsc(TEExamStudentLog::getCreateTime);
+            teExamStudentLogList = teExamStudentLogService.list(teExamStudentLogQueryWrapper);
             if (!CollectionUtils.isEmpty(teExamStudentLogList)) {
-                String currentIp = teExamStudentLogList.get(0).getIp();
-                for (int i = 1; i < teExamStudentLogList.size(); i++) {
-                    String ip = teExamStudentLogList.get(i).getIp();
-                    if (Objects.isNull(currentIp) || Objects.equals(currentIp.trim(), "")) {
-                        currentIp = ip;
-                        continue;
-                    } else if (Objects.nonNull(currentIp) && !Objects.equals(currentIp.trim(), "") && !Objects.equals(currentIp, ip)) {
-                        teExamStudentLogList.get(i).setIpChange(true);
-                        currentIp = ip;
-                    }
-                }
+                teExamStudentLogList = teExamStudentLogList.get(0).ipChange(teExamStudentLogList);
             }
-            teExamStudentLogList = teExamStudentLogService.list(teExamStudentLogQueryWrapper);
         }
 
         IPage<TEStudentExamRecordVideoMessageDto> teStudentExamRecordVideoMessageDtoIPage = null;

+ 1 - 11
themis-business/src/main/java/com/qmth/themis/business/service/impl/TIeReportServiceImpl.java

@@ -325,17 +325,7 @@ public class TIeReportServiceImpl implements TIeReportService {
     public IPage<ExamStudentLogDetailListBean> examStudentLogListDetail(Long examStudentId, int pageNumber, int pageSize) {
         IPage<ExamStudentLogDetailListBean> examStudentLogDetailListBeanIPage = examStudentLogMapper.getExamStudentLogList(new Page<>(pageNumber, pageSize), examStudentId);
         if (Objects.nonNull(examStudentLogDetailListBeanIPage) && !CollectionUtils.isEmpty(examStudentLogDetailListBeanIPage.getRecords())) {
-            String currentIp = examStudentLogDetailListBeanIPage.getRecords().get(0).getIp();
-            for (int i = 1; i < examStudentLogDetailListBeanIPage.getRecords().size(); i++) {
-                String ip = examStudentLogDetailListBeanIPage.getRecords().get(i).getIp();
-                if (Objects.isNull(currentIp) || Objects.equals(currentIp.trim(), "")) {
-                    currentIp = ip;
-                    continue;
-                } else if (Objects.nonNull(currentIp) && !Objects.equals(currentIp.trim(), "") && !Objects.equals(currentIp, ip)) {
-                    examStudentLogDetailListBeanIPage.getRecords().get(i).setIpChange(true);
-                    currentIp = ip;
-                }
-            }
+            examStudentLogDetailListBeanIPage = examStudentLogDetailListBeanIPage.getRecords().get(0).ipChange(examStudentLogDetailListBeanIPage);
         }
         return examStudentLogDetailListBeanIPage;
     }