导入菜谱格式错误
This commit is contained in:
parent
2599b8076e
commit
e470a01f2c
|
|
@ -164,12 +164,10 @@ public class CookRecipeController extends BaseController {
|
|||
return ObjectUtil.isNull(excel) ? AjaxResult.error("请选择导入文件 ^_^") :
|
||||
AjaxResult.success(this.cookRecipeService.recipeImportDishes(excel, recipeId));
|
||||
}catch (Exception e){
|
||||
String message = e.toString();
|
||||
//取倒数第二个:之后的信息
|
||||
String finalMessage = message.substring(message.lastIndexOf(":") - 7);
|
||||
String message = e.getMessage();
|
||||
String finalMessage = message.substring(message.lastIndexOf(":") + 1);
|
||||
String errorMes = finalMessage.replace("Error:", "");
|
||||
System.err.println("errorMes="+errorMes);
|
||||
return error("导入失败:"+errorMes);
|
||||
return error("导入失败:"+errorMes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -470,6 +470,9 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
readSheet.getCustomReadListenerList().add(cookRecipeImportListener);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(listeners)) {
|
||||
throw new ServiceException("导入文件格式错误,未找到菜谱信息");
|
||||
}
|
||||
excelReader.read(readSheets);
|
||||
notImportDishesNames.addAll(
|
||||
listeners.stream()
|
||||
|
|
|
|||
Loading…
Reference in New Issue