refactor(nex-be): 优化客户端服务和镜像虚拟机服务
- 在 ClientServiceImpl 中,将文件大小的字符串转换为长整型 - 在 imageVirtualMachinesServiceImpl 中,增加删除镜像前的克隆桌面数量检查master
parent
258e65fd1b
commit
fc743e5aa6
|
|
@ -66,7 +66,7 @@ public class ClientServiceImpl implements ClientService {
|
|||
map.put("name", e.getDesktopName()+"."+e.getDesktopType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(e.getFileSize())) {
|
||||
map.put("file_size", e.getFileSize());
|
||||
map.put("file_size", StringUtils.isNotEmpty(e.getFileSize()) ? Long.parseLong(e.getFileSize()) : 0L);
|
||||
}
|
||||
if (StringUtils.isNotBlank(e.getStoragePath())) {
|
||||
map.put("storage_path", e.getStoragePath());
|
||||
|
|
|
|||
|
|
@ -254,6 +254,12 @@ public class ImageVirtualMachinesServiceImpl extends ServiceImpl<ImageVirtualMac
|
|||
log.info("查询镜像虚拟机返回为空");
|
||||
return Result.errorResult(BaseErrorCode.HTTP_ERROR_CODE_500, "虚拟机不存在");
|
||||
}
|
||||
LambdaQueryWrapper<ImageDesktop> desktopLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
||||
desktopLambdaQueryWrapper.eq(ImageDesktop::getImageVirtualId, imageVirtualMachines.getId());
|
||||
int count = imageDesktopService.count(desktopLambdaQueryWrapper);
|
||||
if (count>0){
|
||||
return Result.errorResult(BaseErrorCode.HTTP_ERROR_CODE_500, "该镜像有对应的克隆桌面,不允许删除");
|
||||
}
|
||||
|
||||
// 调用镜像删除服务
|
||||
ImageDeleteReq deleteReq = ImageDeleteReq.builder()
|
||||
|
|
|
|||
Loading…
Reference in New Issue