From d3be4d813f6745f245d36a07ea705b4db169d273 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期三, 06 十二月 2023 17:21:28 +0800 Subject: [PATCH] 后端返回数据流格式,前端无法捕获到错误信息 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java index afa4e65..df1421c 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java @@ -874,8 +874,13 @@ File file1 = new File(excelFileName); try { file.transferTo(new File(excelFileName)); - mdmIOService.importGroupCode(codeClassifyOid,file1); - return R.success("鎿嶄綔鎴愬姛锛�"); + String excelName=mdmIOService.importGroupCode(codeClassifyOid,file1); + if(StringUtils.isNotBlank(excelName)) { + ControllerUtil.writeFileToResponse(response,excelName); + return R.fail("闆嗗洟鐮佸鍏ュ嚭鐜伴棶棰橈紝璇锋煡鐪嬫枃浠�"); + }else{ + return R.status(true); + } }catch (Throwable e) { logger.error("瀵煎叆閿欒",e); String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt"; @@ -885,7 +890,7 @@ codeImProtRusultVO.setRedisUuid(""); codeImProtRusultVO.setFileOid(uuid); codeImProtRusultVO.setFilePath(errorFile); - R r = R.fail("瀵煎叆澶辫触"); + R r = R.fail("闆嗗洟鐮佸鍏ュけ璐�"); r.setData(codeImProtRusultVO); return r; }finally { -- Gitblit v1.9.3