From cb4e11b19446843188cf628ac8f6be5fe1fa68c7 Mon Sep 17 00:00:00 2001 From: fujunling <2984387807@qq.com> Date: 星期二, 06 六月 2023 18:01:52 +0800 Subject: [PATCH] 配置 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 65 ++++---------------------------- 1 files changed, 9 insertions(+), 56 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java index 526c013..689147f 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java @@ -21,7 +21,6 @@ import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.starter.web.pagemodel.DataGrid; import com.vci.ubcs.starter.web.pagemodel.KeyValue; -import com.vci.ubcs.starter.web.util.LangBaseUtil; import com.vci.ubcs.starter.web.util.VciBaseUtil; import com.vci.ubcs.starter.web.util.VciDateUtil; import lombok.AllArgsConstructor; @@ -38,7 +37,6 @@ import javax.annotation.Resource; import java.io.File; -import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -257,60 +255,15 @@ String redisUUid=batchImportCodes(orderDTO,templateVO,dataSet,errorMap,true); CodeImProtRusultVO codeImProtRusultVO = new CodeImProtRusultVO(); List<String> needRowIndexList = new ArrayList<>(); - String filePath = returnErrorToExcel(dataSet.getRowData(), errorMap, needRowIndexList, dataSet.getColName()); - if(StringUtils.isNotBlank(filePath)) { - codeImProtRusultVO.setFilePath(filePath); - } - if(StringUtils.isNotBlank(redisUUid)){ - codeImProtRusultVO.setRedisUuid(redisUUid); - } -// return null; - return codeImProtRusultVO; - } - - /** - * 閿欒淇℃伅杩斿洖excel - * @param rowDataList 鎵�鏈夌殑瀵煎叆鏁版嵁 - * @param errorMap 閿欒鐨勪俊鎭� - * @param needRowIndexList 闇�瑕佸啓鍏ョ殑鏁版嵁鐨勮鍙� - * @param titleRowData 鏍囬琛� - * - * @return 閿欒鐨別xcel鏂囦欢锛屾病鏈夐敊璇細杩斿洖绌� - */ - private String returnErrorToExcel(Collection<SheetRowData> rowDataList, - Map<String,String> errorMap, - List<String> needRowIndexList,List<String> titleRowData){ - if(CollectionUtils.isEmpty(errorMap)){ - return ""; - } - Map<String, SheetRowData> rowIndexDataMap = rowDataList.stream().filter(s -> !needRowIndexList.contains(s.getRowIndex())).collect(Collectors.toMap(s -> s.getRowIndex(), t -> t)); - List<WriteExcelData> errorDataList = new ArrayList<>(); - errorDataList.add(new WriteExcelData(0,0,"閿欒淇℃伅")); - for (int i = 0; i < titleRowData.size(); i++) { - //閿欒淇℃伅鍦ㄦ渶鍚� - errorDataList.add(new WriteExcelData(0,i+1,titleRowData.get(i))); - } - Integer[] newRowIndex = new Integer[]{1}; - errorMap.forEach((index,error)->{ - //閿欒淇℃伅鍏ㄩ儴缁勫悎鍒颁竴璧� - SheetRowData rowData = rowIndexDataMap.getOrDefault(index, null); - if(rowData!=null){ - errorDataList.add(new WriteExcelData(newRowIndex[0],0,error)); - rowData.getData().forEach((colIndex,value)->{ - errorDataList.add(new WriteExcelData(newRowIndex[0],colIndex+1,value)); - }); - newRowIndex[0]++; - } - }); - String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒淇℃伅.xls"; - WriteExcelOption eo = new WriteExcelOption(errorDataList); - try { - new File(excelFileName).createNewFile(); - } catch (IOException e) { - throw new VciBaseException(LangBaseUtil.getErrorMsg(e)); - } - ExcelUtil.writeDataToFile(excelFileName,eo); - return excelFileName; +// String filePath = returnErrorToExcel(dataSet.getRowData(), errorMap, needRowIndexList, dataSet.getColName()); +// if(StringUtils.isNotBlank(filePath)) { +// codeImProtRusultVO.setFilePath(filePath); +// } +// if(StringUtils.isNotBlank(redisUUid)){ +// codeImProtRusultVO.setRedisUuid(redisUUid); +// } + return null; +// return codeImProtRusultVO; } /** -- Gitblit v1.9.3