From 1d6e7763f4a30272cc0818ea12f83697b7375c45 Mon Sep 17 00:00:00 2001 From: shikeying <shikeying@163.com> Date: 星期五, 23 二月 2024 15:17:19 +0800 Subject: [PATCH] 测试了aws oss,另外 mybatis模块还未完成 --- iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java index 937dba2..133af49 100644 --- a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java @@ -19,6 +19,7 @@ import com.walker.di.DataImportException; import com.walker.file.FileInfo; import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.FileCopyUtils; import com.walker.infrastructure.utils.NumberGenerator; import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; @@ -35,6 +36,8 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import java.io.File; +import java.io.FileOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -68,6 +71,18 @@ @PostMapping("/import") public ResponseValue importExcel(MultipartFile file, boolean updateSupport){ try { + // ~~~~~~~~~~~~~~~~~~~~~ 娴嬭瘯 +// String filePath = "d:/tmp/test_user_001.csv"; +// FileOutputStream fileOutputStream = new FileOutputStream(new File(filePath)); +// FileCopyUtils.copy(file.getInputStream(), fileOutputStream); +// logger.info("鏂囦欢鍐欏叆鎴愬姛:{}", filePath); +// FileInfo testFileInfo = this.uploadFileToRemote(filePath, null, String.valueOf(this.getOwner())); + + // 2024-02-23 浠ヤ笅浠g爜鎴愬姛鎵ц锛屾殏鏃舵敞閲� +// FileInfo testFileInfo = this.uploadFileToRemote(file.getInputStream(), "avatar.jpg", null, file.getSize(), null, String.valueOf(Constants.OWNER_PLATFORM)); +// logger.info("testFileInfo = {}", testFileInfo); + // ~~~~~~~~~~~~~~~~~~~~~ 娴嬭瘯 end + UserDataImportor dataImportor = new UserDataImportor(file.getInputStream()); dataImportor.setId("user_import"); this.getDataImportEngine().executeImport(dataImportor, this.getCurrentUserPrincipal().getUserName()); @@ -75,6 +90,9 @@ logger.info("閿欒缁撴灉鏂囦欢:{}", dataImportor.getErrorFile()); // FileInfo errorFileInfo = this.uploadFileToRemote(dataImportor.getErrorFile()); +// this.uploadFileToRemote(file.getInputStream(), null, null, String.valueOf(this.getOwner()),) + // 杩欓噷浼氭姤閿欙紝鍥犱负涓婁紶 s3 oss鏃跺姩鎬佺敓鎴愮殑鏂囦欢锛屾�绘槸璇磋鍙栭暱搴﹀拰鏈熸湜闀垮害涓嶄竴鑷达細 + // 淇濆瓨鏂囦欢鍒般�恛ss銆戦敊璇�:Data read has a different length than the expected: dataLength=2764; expectedLength=107374178304; FileInfo errorFileInfo = this.uploadFileToRemote(dataImportor.getErrorFile(), null, String.valueOf(this.getOwner())); if(errorFileInfo != null){ logger.debug("鐢ㄦ埛瀵煎叆瀛樺湪'涓嶇鍚堟暟鎹�': 锛�", errorFileInfo.toString()); -- Gitblit v1.9.1