|
@@ -8,13 +8,13 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import java.util.Map.Entry;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Element;
|
|
import org.jsoup.nodes.Element;
|
|
-import org.jsoup.safety.Whitelist;
|
|
|
|
import org.jsoup.select.Elements;
|
|
import org.jsoup.select.Elements;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -65,6 +65,7 @@ import cn.com.qmth.examcloud.web.helpers.SequenceLockHelper;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class ExamServiceImpl implements ExamService {
|
|
public class ExamServiceImpl implements ExamService {
|
|
|
|
+ private static Pattern pattern = Pattern.compile("\\s*");
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
ExamRepo examRepo;
|
|
ExamRepo examRepo;
|
|
@@ -312,7 +313,8 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
if (null != beforeExamRemark) {
|
|
if (null != beforeExamRemark) {
|
|
Document doc = Jsoup.parse(beforeExamRemark);
|
|
Document doc = Jsoup.parse(beforeExamRemark);
|
|
- String simpleText = doc.wholeText();
|
|
|
|
|
|
+ Matcher m = pattern.matcher(doc.text());
|
|
|
|
+ String simpleText = m.replaceAll("").replaceAll(" ", "");
|
|
if (simpleText.length() > 800) {
|
|
if (simpleText.length() > 800) {
|
|
throw new StatusException("001002", "考前说明内容不得超过800个字符");
|
|
throw new StatusException("001002", "考前说明内容不得超过800个字符");
|
|
}
|
|
}
|
|
@@ -325,7 +327,8 @@ public class ExamServiceImpl implements ExamService {
|
|
String afterExamRemark = properties.get("AFTER_EXAM_REMARK");
|
|
String afterExamRemark = properties.get("AFTER_EXAM_REMARK");
|
|
if (null != afterExamRemark ) {
|
|
if (null != afterExamRemark ) {
|
|
Document doc = Jsoup.parse(afterExamRemark);
|
|
Document doc = Jsoup.parse(afterExamRemark);
|
|
- String simpleText = doc.wholeText();
|
|
|
|
|
|
+ Matcher m = pattern.matcher(doc.text());
|
|
|
|
+ String simpleText = m.replaceAll("").replaceAll(" ", "");
|
|
if (simpleText.length() > 800) {
|
|
if (simpleText.length() > 800) {
|
|
throw new StatusException("001002", "考后说明内容不得超过800个字符");
|
|
throw new StatusException("001002", "考后说明内容不得超过800个字符");
|
|
}
|
|
}
|
|
@@ -338,7 +341,8 @@ public class ExamServiceImpl implements ExamService {
|
|
String cheatingRemark = properties.get("CHEATING_REMARK");
|
|
String cheatingRemark = properties.get("CHEATING_REMARK");
|
|
if (null != cheatingRemark) {
|
|
if (null != cheatingRemark) {
|
|
Document doc = Jsoup.parse(cheatingRemark);
|
|
Document doc = Jsoup.parse(cheatingRemark);
|
|
- String simpleText = doc.wholeText();
|
|
|
|
|
|
+ Matcher m = pattern.matcher(doc.text());
|
|
|
|
+ String simpleText = m.replaceAll("").replaceAll(" ", "");
|
|
if (simpleText.length() > 800) {
|
|
if (simpleText.length() > 800) {
|
|
throw new StatusException("001002", "作弊说明内容不得超过800个字符");
|
|
throw new StatusException("001002", "作弊说明内容不得超过800个字符");
|
|
}
|
|
}
|