改造图片上传组件,将url改为id保存

master
yangxiaozhong 4 weeks ago
parent 66b9bd916a
commit c26a89edb7

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

@ -172,4 +172,10 @@ public interface ErrorCodeConstants {
ErrorCode DUST_DUSTINFO_NOT_EXISTS = new ErrorCode(1_002_029_000, "涉尘信息不存在");
ErrorCode DUST_COMPANYINFO_NOT_EXISTS = new ErrorCode(1_002_029_001, "企业基础信息不存在");
// ========== 巡查记录 TODO 补充编号 ==========
ErrorCode DUST_PATROL_RECORD_NOT_EXISTS = new ErrorCode(1_002_029_003, "巡查记录不存在");
// ========== 巡查问题整改 TODO 补充编号 ==========
ErrorCode DUST_PATROL_RECTIFY_NOT_EXISTS = new ErrorCode(1_002_029_004, "巡查问题整改不存在");
}

Loading…
Cancel
Save