| | |
| | | // 设置题型 |
| | | question.setQuestionType(QuestionTypeEnum.get(excelQuestion.getQuestionType())); |
| | | // 答案去掉空格 |
| | | String rightAnswer = excelQuestion.getCorrect().replaceAll("\\s", ""); |
| | | String rightAnswer = excelQuestion.getCorrect().replaceAll("\\s+", ""); |
| | | // 答案(多选需要用,分割保存字符串到数据库) |
| | | String[] corrects = rightAnswer.split(SPLIT); |
| | | if (corrects.length > 1) { |
| | |
| | | // 设置题型 |
| | | question.setQuestionType(QuestionTypeEnum.get(excelQuestion.getQuestionType())); |
| | | // 答案去掉空格 |
| | | String rightAnswer = excelQuestion.getCorrect().replaceAll("\\s", ""); |
| | | String rightAnswer = excelQuestion.getCorrect().replaceAll("\\s+", ""); |
| | | // 答案(多选需要用,分割保存字符串到数据库) |
| | | String[] corrects = rightAnswer.split(SPLIT); |
| | | if (corrects.length > 1) { |
| | |
| | | @PostMapping("/upload") |
| | | public RestResponse uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | // 检查文件是否为空 |
| | | if (file.isEmpty()) { |
| | | return RestResponse.fail(500, "上传的文件为空"); |
| | | } |
| | | // // 检查文件是否为空 |
| | | // if (file.isEmpty()) { |
| | | // return RestResponse.fail(500, "上传的文件为空"); |
| | | // } |
| | | try { |
| | | // 获取文件名 |
| | | String originalFileName = StringUtils.cleanPath(file.getOriginalFilename()); |