解决了文件上传重名文件问题

This commit is contained in:
ajaxfan
2021-02-09 10:37:55 +08:00
parent 3250541369
commit 160c3ec92a
2 changed files with 3 additions and 2 deletions

View File

@ -240,6 +240,7 @@ public class DefaultAttachmentClient implements AttachmentClient {
* @param filename
*/
private void removeDuplicateObject(String businessId, String filename) {
log.info("remove duplicate name files {} in business: {}", filename, businessId);
Optional<AttachmentDetail> op = findByBusinessId(Arrays.asList(businessId));
op.ifPresent(detail -> {

View File

@ -26,8 +26,8 @@ public class AttachmentDetail extends Hashtable<String, List<AttachmentEntity>>
@Override
public synchronized List<AttachmentEntity> get(Object key) {
if (contains(key)) {
super.get(key);
if (containsKey(key)) {
return super.get(key);
}
return new ArrayList<>();
}