|
@@ -1,13 +1,20 @@
|
|
package com.boman.file.service;
|
|
package com.boman.file.service;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.boman.common.core.utils.SecurityUtils;
|
|
|
|
+import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
|
+import com.boman.common.core.utils.poi.ExcelUtil;
|
|
|
|
+import com.boman.file.utils.FileUploadUtils;
|
|
|
|
+import com.boman.system.api.domain.SysUser;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.context.annotation.Primary;
|
|
import org.springframework.context.annotation.Primary;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
-import com.boman.file.utils.FileUploadUtils;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 本地文件存储
|
|
* 本地文件存储
|
|
@@ -64,4 +71,25 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
String name = FileUploadUtils.upload(localFilePath, multipartFile);
|
|
String name = FileUploadUtils.upload(localFilePath, multipartFile);
|
|
return domain + localFilePrefix + name;
|
|
return domain + localFilePrefix + name;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 功能描述: 通用的导入接口
|
|
|
|
+ *
|
|
|
|
+ * @param multipartFile multipartFile
|
|
|
|
+ * @param tableName tableName
|
|
|
|
+ * @return java.util.List<com.alibaba.fastjson.JSONObject>
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<JSONObject> importExcelCommon(MultipartFile multipartFile, String tableName) throws Exception {
|
|
|
|
+ Objects.requireNonNull(multipartFile, "multipartFile is empty");
|
|
|
|
+ ObjectUtils.requireNonNull(tableName, "tableName is empty");
|
|
|
|
+
|
|
|
|
+ ExcelUtil<JSONObject> util = new ExcelUtil<>(JSONObject.class);
|
|
|
|
+ List<JSONObject> list = util.importExcel(multipartFile.getInputStream());
|
|
|
|
+ String operName = SecurityUtils.getUsername();
|
|
|
|
+// String message = userService.importUser(list, updateSupport, operName);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|