|
@@ -1193,20 +1193,12 @@ public class PaperServiceImpl implements PaperService {
|
|
final String mp3FileName = questionId + "_" + randomNumber + "_" + file.getOriginalFilename();
|
|
final String mp3FileName = questionId + "_" + randomNumber + "_" + file.getOriginalFilename();
|
|
File mp3File = new File(mp3DirectoryPath + File.separator + mp3FileName);
|
|
File mp3File = new File(mp3DirectoryPath + File.separator + mp3FileName);
|
|
|
|
|
|
- FileOutputStream outputStream = null;
|
|
|
|
|
|
+ FileOutputStream outputStream;
|
|
try {
|
|
try {
|
|
outputStream = new FileOutputStream(mp3File);
|
|
outputStream = new FileOutputStream(mp3File);
|
|
} catch (FileNotFoundException e) {
|
|
} catch (FileNotFoundException e) {
|
|
log.error(e.getMessage(), e);
|
|
log.error(e.getMessage(), e);
|
|
throw new StatusException("500", "音频文件处理失败!");
|
|
throw new StatusException("500", "音频文件处理失败!");
|
|
- } finally {
|
|
|
|
- try {
|
|
|
|
- if (outputStream != null) {
|
|
|
|
- outputStream.close();
|
|
|
|
- }
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- //ignore
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
try (InputStream is = file.getInputStream();
|
|
try (InputStream is = file.getInputStream();
|
|
@@ -1228,6 +1220,14 @@ public class PaperServiceImpl implements PaperService {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(e.getMessage(), e);
|
|
log.error(e.getMessage(), e);
|
|
throw new StatusException("500", "音频文件保存失败!");
|
|
throw new StatusException("500", "音频文件保存失败!");
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if (outputStream != null) {
|
|
|
|
+ outputStream.close();
|
|
|
|
+ }
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ //ignore
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1266,7 +1266,7 @@ public class PaperServiceImpl implements PaperService {
|
|
//处理选项
|
|
//处理选项
|
|
for (QuesOption quesOption : question.getQuesOptions()) {
|
|
for (QuesOption quesOption : question.getQuesOptions()) {
|
|
Integer optNumber = CommonUtils.characterToNumber(numbers[2]);
|
|
Integer optNumber = CommonUtils.characterToNumber(numbers[2]);
|
|
- if (!quesOption.getNumber().equals(optNumber)) {
|
|
|
|
|
|
+ if (!quesOption.getNumber().equals(optNumber.toString())) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|