|
|
|
@ -84,12 +84,12 @@ public class FileServiceImpl implements FileService {
|
|
|
|
FileClient client = fileConfigService.getMasterFileClient();
|
|
|
|
FileClient client = fileConfigService.getMasterFileClient();
|
|
|
|
Assert.notNull(client, "客户端(master) 不能为空");
|
|
|
|
Assert.notNull(client, "客户端(master) 不能为空");
|
|
|
|
String url = client.upload(content, path, type);
|
|
|
|
String url = client.upload(content, path, type);
|
|
|
|
|
|
|
|
FileDO fileDO = new FileDO().setConfigId(client.getId())
|
|
|
|
// 3. 保存到数据库
|
|
|
|
|
|
|
|
fileMapper.insert(new FileDO().setConfigId(client.getId())
|
|
|
|
|
|
|
|
.setName(name).setPath(path).setUrl(url)
|
|
|
|
.setName(name).setPath(path).setUrl(url)
|
|
|
|
.setType(type).setSize(content.length));
|
|
|
|
.setType(type).setSize(content.length);
|
|
|
|
return url;
|
|
|
|
// 3. 保存到数据库
|
|
|
|
|
|
|
|
fileMapper.insert(fileDO);
|
|
|
|
|
|
|
|
return fileDO.getId().toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@VisibleForTesting
|
|
|
|
@VisibleForTesting
|
|
|
|
|