|
@@ -891,14 +891,14 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
if (ipLimited) {
|
|
|
//整体控制
|
|
|
- Integer totalLimit = getExamLimitProperty(examId, ipTotalLimit.getId(), 0);
|
|
|
- if (totalLimit == 1) {
|
|
|
+ Boolean totalLimit = getExamLimitProperty(examId, ipTotalLimit.getId(), false);
|
|
|
+ if (totalLimit) {
|
|
|
//在白名单中
|
|
|
int count = examIpLimitRepo.countByExamIdAndLimitTypeAndIp(examId, IpLimitType.HAS_ACCESS.getId(),realIp);
|
|
|
if (count>0) {
|
|
|
//学习中心访问控制
|
|
|
- Integer centerLimit = getExamLimitProperty(examId,ipCenterLimit.getId(), 0);
|
|
|
- if (centerLimit == 1) {
|
|
|
+ Boolean centerLimit = getExamLimitProperty(examId,ipCenterLimit.getId(), false);
|
|
|
+ if (centerLimit) {
|
|
|
StudentCacheBean studentCache = CacheHelper.getStudent(accessUser.getUserId());
|
|
|
Long orgId = studentCache.getOrgId();
|
|
|
String key = "IP_" + orgId;
|
|
@@ -983,15 +983,15 @@ public class ExamServiceImpl implements ExamService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Integer> getIpLimitedProperty(Long examId) {
|
|
|
- Map<String,Integer> map = new HashMap<>();
|
|
|
+ public Map<String, Boolean> getIpLimitedProperty(Long examId) {
|
|
|
+ Map<String,Boolean> map = new HashMap<>();
|
|
|
|
|
|
DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
|
DynamicEnum ipTotalLimit = manager.getByName("IP_TOTAL_LIMIT");
|
|
|
DynamicEnum ipCenterLimit = manager.getByName("IP_CENTER_LIMIT");
|
|
|
|
|
|
- map.put("totalLimit", getExamLimitProperty(examId,ipTotalLimit.getId(),0));
|
|
|
- map.put("centerLimit",getExamLimitProperty(examId,ipCenterLimit.getId(),0));
|
|
|
+ map.put("totalLimit", getExamLimitProperty(examId,ipTotalLimit.getId(),false));
|
|
|
+ map.put("centerLimit",getExamLimitProperty(examId,ipCenterLimit.getId(),false));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -1039,10 +1039,10 @@ public class ExamServiceImpl implements ExamService {
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
- private Integer getExamLimitProperty(Long examId, Long keyId ,Integer defaultValue) {
|
|
|
+ private Boolean getExamLimitProperty(Long examId, Long keyId ,Boolean defaultValue) {
|
|
|
ExamPropertyEntity propertyEntity = examPropertyRepo.findByExamIdAndKeyId(examId, keyId);
|
|
|
return propertyEntity != null && StringUtils.isNotBlank(propertyEntity.getValue())
|
|
|
- ? Integer.valueOf(propertyEntity.getValue()) : defaultValue;
|
|
|
+ ? Boolean.valueOf(propertyEntity.getValue()) : defaultValue;
|
|
|
}
|
|
|
|
|
|
private Specification<ExamIpLimitEntity> getSpec(Long examId, Integer limitType, String ip){
|