|
@@ -24,11 +24,11 @@ public abstract class BaseFileService implements FileService {
|
|
|
@Override
|
|
|
public String upload(String fileName, String appId, String userId, String groupCode, String projectId, MultipartFile file) throws Exception {
|
|
|
ObjectNode extension = store(fileName, appId, groupCode, projectId, file);
|
|
|
- String resourceId = record(fileName, appId, userId,groupCode, projectId, extension);
|
|
|
+ String resourceId = record(file.getSize(), fileName, appId, userId,groupCode, projectId, extension);
|
|
|
return resourceId;
|
|
|
}
|
|
|
|
|
|
- private String record(String fileName,String appId, String userId, String groupCode, String projectId, ObjectNode extension) throws Exception {
|
|
|
+ private String record(Long size, String fileName,String appId, String userId, String groupCode, String projectId, ObjectNode extension) throws Exception {
|
|
|
FileResource entity = new FileResource();
|
|
|
entity.setId(UUID.randomUUID().toString());
|
|
|
entity.setAppId(appId);
|
|
@@ -40,8 +40,9 @@ public abstract class BaseFileService implements FileService {
|
|
|
}
|
|
|
LocalDateTime localDateTime = LocalDateTime.now();
|
|
|
String format = localDateTime.format(formatter);
|
|
|
- extension.putPOJO("date", format);
|
|
|
- extension.putPOJO("type", this.getType());
|
|
|
+ extension.put("date", format);
|
|
|
+ extension.put("type", this.getType());
|
|
|
+ extension.put("size", size);
|
|
|
entity.setExtension(extension);
|
|
|
fileResourceRepository.save(entity);
|
|
|
return entity.getId();
|