BUGFIX: library upload md5重复校验优化;
This commit is contained in:
@@ -90,7 +90,11 @@ public class LibraryController {
|
||||
}
|
||||
String md5 = MD5Utils.encryptFile(file);
|
||||
if (checkMd5 == null || checkMd5 == 1) {
|
||||
libraryService.checkMd5(level1Type, level2Type, sex, md5);
|
||||
if (!libraryService.checkMd5(level1Type, level2Type, sex, md5)) {
|
||||
LibraryUpdateVo libraryUpdateVo = new LibraryUpdateVo();
|
||||
libraryUpdateVo.setCheckMd5(Boolean.FALSE);
|
||||
return Response.success(libraryUpdateVo);
|
||||
}
|
||||
}
|
||||
return Response.success(libraryService.upload(new LibraryUploadDTO(file, level1Type,level2Type,
|
||||
timeZone, md5,high,width,modelType,sex)));
|
||||
|
||||
@@ -43,5 +43,8 @@ public class LibraryUpdateVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("存放地址")
|
||||
private String minIOPath;
|
||||
|
||||
@ApiModelProperty("校验md5")
|
||||
private Boolean checkMd5;
|
||||
|
||||
}
|
||||
|
||||
@@ -72,5 +72,5 @@ public interface LibraryService extends IService<Library> {
|
||||
|
||||
String processMannequins(String uploadPath);
|
||||
|
||||
void checkMd5(String level1Type, String level2Type, String sex, String md5);
|
||||
Boolean checkMd5(String level1Type, String level2Type, String sex, String md5);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkMd5(String level1Type, String level2Type, String sex, String md5) {
|
||||
public Boolean checkMd5(String level1Type, String level2Type, String sex, String md5) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
QueryWrapper<Library> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Library::getAccountId, userInfo.getId());
|
||||
@@ -274,7 +274,10 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
qw.lambda().eq(Library::getMd5, md5);
|
||||
List<Library> libraryList = libraryMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(libraryList)) {
|
||||
throw new BusinessException("Your library already contains the images you uploaded, Are you sure to upload them");
|
||||
// throw new BusinessException("Your library already contains the images you uploaded, Are you sure to upload them");
|
||||
return Boolean.FALSE;
|
||||
}else {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user