修改人口基础信息异常捕获

This commit is contained in:
wans 2021-03-19 16:08:33 +08:00
parent f78fe6bd77
commit fe0d8127ad

View File

@ -154,7 +154,14 @@ public class BasePopulationInfoController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("uploadtemplate")
public SuccessResultData uploadTemplate(@RequestParam(value = "file") MultipartFile file) throws SearchException, IOException {
EasyExcel.read(file.getInputStream(),new PopulationBaseInfoUploadListener(basePopulationInfoService)).sheet().doRead();
try {
EasyExcel.read(file.getInputStream(),new PopulationBaseInfoUploadListener(basePopulationInfoService)).sheet().doRead();
} catch (Exception e){
return new SuccessResultData("第{" + PopulationBaseInfoUploadListener.rowNumber + "}行数据有误,请检查数据: "
+ PopulationBaseInfoUploadListener.errorCardNumber
+ "---"
+ PopulationBaseInfoUploadListener.errorName);
}
return new SuccessResultData("导入完成");
}