|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import cn.hutool.poi.excel.ExcelReader; |
|
|
|
import cn.hutool.poi.excel.ExcelUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
@@ -91,20 +92,20 @@ public class QxProjectImportManage { |
|
|
|
String constructionFileIds = MapUtil.getStr(map, "建设方案附件(多附件逗号隔开)"); |
|
|
|
String[] split = constructionFileIds.split(","); |
|
|
|
if (split.length > 0) { |
|
|
|
String fileIds = Arrays.stream(split).map(w -> { |
|
|
|
List<FileResultVO> fileResults = Arrays.stream(split).map(w -> { |
|
|
|
File tmpFile = mhFileClient.downloadToTmpFile(w); |
|
|
|
try (FileInputStream inputStream = new FileInputStream(tmpFile)) { |
|
|
|
String mimeType = FileUtil.getMimeType(tmpFile.getPath()); |
|
|
|
MockMultipartFile multipartFile = new MockMultipartFile(tmpFile.getName(), tmpFile.getName(), mimeType, inputStream); |
|
|
|
ApiResponse<FileResultVO> fileRet = fileController.upload(multipartFile, "default"); |
|
|
|
return fileRet.getData().getId().toString(); |
|
|
|
return fileRet.getData(); |
|
|
|
} catch (Exception e) { |
|
|
|
throw BizException.wrap("建设方案上传失败"); |
|
|
|
} finally { |
|
|
|
tmpFile.deleteOnExit(); |
|
|
|
} |
|
|
|
}).collect(Collectors.joining(",")); |
|
|
|
project.setConstructionPlanFile(fileIds); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
project.setConstructionPlanFile(JSONUtil.toJsonStr(fileResults)); |
|
|
|
} |
|
|
|
projects.add(project); |
|
|
|
} |
|
|
|