| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | |
| | | tempFileRecord.setExpireTime(LocalDateTime.now().plusHours(2)); // 2小时后过期 |
| | | tempFileRecord.setType(type); |
| | | tempFileMapper.insert(tempFileRecord); |
| | | |
| | | return tempFileRecord; |
| | | } |
| | | |
| | | @Override |
| | | public String uploadByCommon(MultipartFile file, Integer type, Long id) throws IOException{ |
| | | TempFile tempFile = uploadFile(file, type); |
| | | if (tempFile != null) { |
| | | migrateTempFilesToFormal(id, Collections.singletonList(tempFile.getTempId()), type); |
| | | return tempFile.getTempPath(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将临时文件迁移到正式目录 |
| | | * |