Forráskód Böngészése

update ipLimit remark.

deason 1 éve
szülő
commit
a91ecfb83d

+ 7 - 2
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamController.java

@@ -197,7 +197,7 @@ public class ExamController extends ControllerSupport {
     private static final String[] EXAM_ORG_SETTINGS_EXCEL_HEADER = new String[]{"学习中心ID", "学习中心代码",
             "学习中心名称", "是否可以考试(是/否)", "开始考试时间 yyyy-MM-dd hh:mm:ss", "结束考试时间 yyyy-MM-dd hh:mm:ss"};
 
-    private static final String[] EXCEL_IP_LIMIT_HEADER = new String[]{"IP地址", "限制类型"};
+    private static final String[] EXCEL_IP_LIMIT_HEADER = new String[]{"IP地址", "限制类型", "备注"};
 
     @ApiOperation(value = "查询考试课程的试卷类型集合")
     @GetMapping("queryExamCoursePaperTypeList")
@@ -1463,6 +1463,11 @@ public class ExamController extends ControllerSupport {
             }
             entity.setLimitType(ipLimitType);
 
+            // 备注
+            if(line.length == 3 && line[2] != null){
+                entity.setRemark(line[2]);
+            }
+
             Date date = new Date();
             entity.setCreationTime(date);
             entity.setUpdateTime(date);
@@ -1500,7 +1505,7 @@ public class ExamController extends ControllerSupport {
 
         for (ExamIpLimitEntity cur : list) {
             String type = cur.getLimitType() == null ? "" : cur.getLimitType().getTitle();
-            datas.add(new Object[]{cur.getIp(), type});
+            datas.add(new Object[]{cur.getIp(), type, cur.getRemark()});
         }
 
         String filePath = systemConfig.getTempDataDir() + File.separator

+ 10 - 0
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/bean/ExamIpLimitInfo.java

@@ -35,6 +35,8 @@ public class ExamIpLimitInfo implements JsonSerializable {
 
 	private String limitType;
 
+	private String remark;
+
 	/**
 	 * 创建时间
 	 */
@@ -100,4 +102,12 @@ public class ExamIpLimitInfo implements JsonSerializable {
 	public void setUpdateTime(Date updateTime) {
 		this.updateTime = updateTime;
 	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
 }

+ 12 - 1
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamServiceImpl.java

@@ -861,8 +861,14 @@ public class ExamServiceImpl implements ExamService {
         List<ExamIpLimitInfo> list = new ArrayList<>();
         pages.getList().forEach(e -> {
             ExamIpLimitInfo domain = new ExamIpLimitInfo();
-            BeanUtils.copyProperties(e, domain);
+            domain.setId(e.getId());
+            domain.setIp(e.getIp());
+            domain.setExamId(e.getExamId());
             domain.setLimitType(e.getLimitType() == null ? "" : e.getLimitType().getTitle());
+            domain.setRemark(e.getRemark());
+            domain.setCreationTime(e.getCreationTime());
+            domain.setUpdateTime(e.getUpdateTime());
+
             Optional<ExamEntity> byId = examRepo.findById(examId);
             byId.ifPresent(examEntity -> domain.setExamName(examEntity.getName()));
             list.add(domain);
@@ -976,6 +982,11 @@ public class ExamServiceImpl implements ExamService {
                     if (entity.getLimitType() != null) {
                         ipLimitEntity.setLimitType(entity.getLimitType());
                     }
+
+                    if (StringUtils.isNotEmpty(entity.getRemark())) {
+                        ipLimitEntity.setRemark(entity.getRemark());
+                    }
+
                     ipLimitEntity.setUpdateTime(now);
                     examIpLimitRepo.save(ipLimitEntity);
                 }

BIN
examcloud-core-examwork-starter/src/main/resources/templates/ipLimitImportTemplate.xlsx