Commit 5267c35b authored by 高滢's avatar 高滢

模板导入 异常处理

parent 24a1514e
...@@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController; ...@@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ReviewEnterpriseArchive; import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.vo.EnterpriseImportFileVO; import com.ruoyi.domain.vo.EnterpriseImportFileVO;
...@@ -117,10 +118,14 @@ public class ReviewEnterpriseArchiveController extends BaseController { ...@@ -117,10 +118,14 @@ public class ReviewEnterpriseArchiveController extends BaseController {
@ApiOperation("车企文件导入") @ApiOperation("车企文件导入")
@RequestMapping(method = RequestMethod.POST, value = "/importExcel") @RequestMapping(method = RequestMethod.POST, value = "/importExcel")
public R<String> importEnterprise(HttpServletResponse response,ImportEnterpriseRequest request) throws IOException { public R<String> importEnterprise(HttpServletResponse response,ImportEnterpriseRequest request) throws IOException {
ExcelUtil<EnterpriseImportFileVO> util = new ExcelUtil<>(EnterpriseImportFileVO.class); try{
List<EnterpriseImportFileVO> list = util.importExcel(request.getFile().getInputStream()); ExcelUtil<EnterpriseImportFileVO> util = new ExcelUtil<>(EnterpriseImportFileVO.class);
reviewEnterpriseArchiveService.importEnterprise(list, request.getTaskId(),response); List<EnterpriseImportFileVO> list = util.importExcel(request.getFile().getInputStream());
return R.ok(); reviewEnterpriseArchiveService.importEnterprise(list, request.getTaskId(),response);
return R.ok();
}catch (Exception e){
throw new ServiceException("文件有误请重新上传!");
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment