丽知:钉钉文件上传优化
This commit is contained in:
parent
b04277e53a
commit
bd3b677e90
|
@ -217,10 +217,13 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
List<FileModuleVO> fileModuleVOList = new ArrayList<>();
|
List<FileModuleVO> fileModuleVOList = new ArrayList<>();
|
||||||
for (SysFileVO fileVO : fileVOS) {
|
for (SysFileVO fileVO : fileVOS) {
|
||||||
// 指定输出文件路径
|
// 指定输出文件路径
|
||||||
Path outputPath = Paths.get(fileVO.getFileName() + "." + fileVO.getType());
|
Path outputPath = Paths.get("D:\\ding-file\\"+fileVO.getFileName());
|
||||||
// 1. 解码Base64字符串并写入文件
|
// 1. 解码Base64字符串并写入文件
|
||||||
byte[] decodedBytes = Base64.getDecoder().decode(fileVO.getBaseCode());
|
byte[] decodedBytes = Base64.getDecoder().decode(fileVO.getBaseCode());
|
||||||
Files.write(outputPath, decodedBytes);
|
Files.write(outputPath, decodedBytes);
|
||||||
|
// 获取文件大小
|
||||||
|
String fileSizeInBytes = String.valueOf(Files.size(outputPath));
|
||||||
|
fileVO.setFileSize(fileSizeInBytes);
|
||||||
logger.info("文件已成功创建: " + outputPath);
|
logger.info("文件已成功创建: " + outputPath);
|
||||||
// 2. 将文件内容读取到ByteArrayOutputStream
|
// 2. 将文件内容读取到ByteArrayOutputStream
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
|
|
Loading…
Reference in New Issue