|
@@ -35,7 +35,7 @@ import cn.com.qmth.am.service.QuestionService;
|
|
@Service
|
|
@Service
|
|
public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity> implements QuestionService {
|
|
public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity> implements QuestionService {
|
|
|
|
|
|
- private static final String[] EXCEL_HEADER = new String[] { "考试ID", "科目代码", "大题号", "小题号", "满分", "试题内容", "试题答案","作答坐标" };
|
|
|
|
|
|
+ private static final String[] EXCEL_HEADER = new String[] { "考试ID", "科目代码","科目名称", "大题号", "小题号", "满分", "试题内容", "试题答案","作答坐标" };
|
|
@Autowired
|
|
@Autowired
|
|
private SysProperty sysProperty;
|
|
private SysProperty sysProperty;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -96,7 +96,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
|
|
if (msgFile.exists()) {
|
|
if (msgFile.exists()) {
|
|
msgFile.delete();
|
|
msgFile.delete();
|
|
}
|
|
}
|
|
- FileUtils.write(msgFile, ret.getCountInfo(), "UFT-8");
|
|
|
|
|
|
+ FileUtils.write(msgFile, ret.getCountInfo(), "utf-8");
|
|
} else {
|
|
} else {
|
|
File sucDir = new File(dir.getAbsoluteFile() + "/failed/");
|
|
File sucDir = new File(dir.getAbsoluteFile() + "/failed/");
|
|
if (!sucDir.exists()) {
|
|
if (!sucDir.exists()) {
|
|
@@ -113,7 +113,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
|
|
if (msgFile.exists()) {
|
|
if (msgFile.exists()) {
|
|
msgFile.delete();
|
|
msgFile.delete();
|
|
}
|
|
}
|
|
- FileUtils.writeLines(msgFile, ret.getErrMsg(), "UFT-8");
|
|
|
|
|
|
+ FileUtils.writeLines(msgFile, ret.getErrMsg(), "utf-8");
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
throw new StatusException("文件处理出错", e);
|
|
throw new StatusException("文件处理出错", e);
|
|
@@ -182,8 +182,16 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
|
|
msg.append(" 科目代码不能超过100个字符");
|
|
msg.append(" 科目代码不能超过100个字符");
|
|
}
|
|
}
|
|
imp.setSubjectCode(subjectCode);
|
|
imp.setSubjectCode(subjectCode);
|
|
|
|
+
|
|
|
|
+ String subjectName = trimAndNullIfBlank(line.get(EXCEL_HEADER[2]));
|
|
|
|
+ if (StringUtils.isBlank(subjectName)) {
|
|
|
|
+ msg.append(" 科目名称不能为空");
|
|
|
|
+ } else if (subjectName.length() > 100) {
|
|
|
|
+ msg.append(" 科目名称不能超过100个字符");
|
|
|
|
+ }
|
|
|
|
+ imp.setSubjectName(subjectName);
|
|
|
|
|
|
- String mainNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[2]));
|
|
|
|
|
|
+ String mainNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[3]));
|
|
if (StringUtils.isBlank(mainNum)) {
|
|
if (StringUtils.isBlank(mainNum)) {
|
|
msg.append(" 大题号不能为空");
|
|
msg.append(" 大题号不能为空");
|
|
} else if (mainNum.length() > 10) {
|
|
} else if (mainNum.length() > 10) {
|
|
@@ -200,7 +208,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- String subNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[3]));
|
|
|
|
|
|
+ String subNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[4]));
|
|
if (StringUtils.isBlank(subNum)) {
|
|
if (StringUtils.isBlank(subNum)) {
|
|
msg.append(" 小题号不能为空");
|
|
msg.append(" 小题号不能为空");
|
|
} else if (subNum.length() > 10) {
|
|
} else if (subNum.length() > 10) {
|
|
@@ -208,7 +216,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
|
|
}
|
|
}
|
|
imp.setSubNumber(subNum);
|
|
imp.setSubNumber(subNum);
|
|
|
|
|
|
- String fullScore = trimAndNullIfBlank(line.get(EXCEL_HEADER[4]));
|
|
|
|
|
|
+ String fullScore = trimAndNullIfBlank(line.get(EXCEL_HEADER[5]));
|
|
if (StringUtils.isBlank(fullScore)) {
|
|
if (StringUtils.isBlank(fullScore)) {
|
|
msg.append(" 满分不能为空");
|
|
msg.append(" 满分不能为空");
|
|
} else if (fullScore.length() > 10) {
|
|
} else if (fullScore.length() > 10) {
|
|
@@ -225,20 +233,20 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- String content = trimAndNullIfBlank(line.get(EXCEL_HEADER[5]));
|
|
|
|
|
|
+ String content = trimAndNullIfBlank(line.get(EXCEL_HEADER[6]));
|
|
if (StringUtils.isBlank(content)) {
|
|
if (StringUtils.isBlank(content)) {
|
|
msg.append(" 试题内容不能为空");
|
|
msg.append(" 试题内容不能为空");
|
|
}
|
|
}
|
|
imp.setContent(content);
|
|
imp.setContent(content);
|
|
|
|
|
|
- String answer = trimAndNullIfBlank(line.get(EXCEL_HEADER[6]));
|
|
|
|
|
|
+ String answer = trimAndNullIfBlank(line.get(EXCEL_HEADER[7]));
|
|
if (StringUtils.isBlank(answer)) {
|
|
if (StringUtils.isBlank(answer)) {
|
|
msg.append(" 试题答案不能为空");
|
|
msg.append(" 试题答案不能为空");
|
|
}
|
|
}
|
|
imp.setAnswer(answer);
|
|
imp.setAnswer(answer);
|
|
|
|
|
|
|
|
|
|
- String imageSlice = trimAndNullIfBlank(line.get(EXCEL_HEADER[7]));
|
|
|
|
|
|
+ String imageSlice = trimAndNullIfBlank(line.get(EXCEL_HEADER[8]));
|
|
if (StringUtils.isBlank(imageSlice)) {
|
|
if (StringUtils.isBlank(imageSlice)) {
|
|
msg.append(" 作答坐标不能为空");
|
|
msg.append(" 作答坐标不能为空");
|
|
} else if (imageSlice.length() > 1000) {
|
|
} else if (imageSlice.length() > 1000) {
|