|
|
@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.inscloudtech.common.exception.ServiceException; |
|
|
|
import com.inscloudtech.common.exception.file.InvalidExtensionException; |
|
|
|
import com.inscloudtech.common.utils.file.FileUploadUtils; |
|
|
|
import com.inscloudtech.common.utils.file.MimeTypeUtils; |
|
|
|
import com.inscloudtech.system.domain.SysOss; |
|
|
|
import com.inscloudtech.system.domain.vo.DownloadToolRequest; |
|
|
|
import com.inscloudtech.system.domain.vo.SysOssVo; |
|
|
@ -129,7 +132,7 @@ public class ToolManageServiceImpl implements IToolManageService { |
|
|
|
ToolManage toolManage; |
|
|
|
if(null != toolManageId && toolManageId != 0L){ |
|
|
|
toolManage = baseMapper.selectById(toolManageId); |
|
|
|
if (ObjectUtil.isNotNull(toolManage)) { |
|
|
|
if (ObjectUtil.isNull(toolManage)) { |
|
|
|
throw new ServiceException("修改对象不存在!"); |
|
|
|
} |
|
|
|
}else { |
|
|
@ -139,19 +142,39 @@ public class ToolManageServiceImpl implements IToolManageService { |
|
|
|
} |
|
|
|
toolManage = new ToolManage(); |
|
|
|
} |
|
|
|
SysOssVo toolVo = iSysOssService.upload(file); |
|
|
|
SysOssVo tipsVo = iSysOssService.upload(tipsFile); |
|
|
|
toolManage.setToolName(toolName); |
|
|
|
toolManage.setModuleName(moduleName); |
|
|
|
toolManage.setToolOssId(toolVo.getOssId()); |
|
|
|
toolManage.setToolPath(toolVo.getOriginalName()); |
|
|
|
toolManage.setTipsOssId(tipsVo.getOssId()); |
|
|
|
toolManage.setTipsPath(tipsVo.getOriginalName()); |
|
|
|
if(null != toolManageId && toolManageId != 0L){ |
|
|
|
baseMapper.updateById(toolManage); |
|
|
|
}else { |
|
|
|
baseMapper.insert(toolManage); |
|
|
|
|
|
|
|
try { |
|
|
|
if(FileUploadUtils.checkFileValid(file)){ |
|
|
|
SysOssVo toolVo = iSysOssService.upload(file); |
|
|
|
toolManage.setToolOssId(toolVo.getOssId()); |
|
|
|
toolManage.setToolPath(toolVo.getOriginalName()); |
|
|
|
}else if(null != toolManageId && toolManageId != 0L){ |
|
|
|
toolManage.setToolOssId(0L); |
|
|
|
toolManage.setToolPath(""); |
|
|
|
} |
|
|
|
|
|
|
|
if(FileUploadUtils.checkFileValid(tipsFile)){ |
|
|
|
SysOssVo tipsVo = iSysOssService.upload(tipsFile); |
|
|
|
toolManage.setTipsOssId(tipsVo.getOssId()); |
|
|
|
toolManage.setTipsPath(tipsVo.getOriginalName()); |
|
|
|
}else if(null != toolManageId && toolManageId != 0L){ |
|
|
|
toolManage.setTipsOssId(0L); |
|
|
|
toolManage.setTipsPath(""); |
|
|
|
} |
|
|
|
|
|
|
|
toolManage.setToolName(toolName); |
|
|
|
toolManage.setModuleName(moduleName); |
|
|
|
|
|
|
|
if(null != toolManageId && toolManageId != 0L){ |
|
|
|
baseMapper.updateById(toolManage); |
|
|
|
}else { |
|
|
|
baseMapper.insert(toolManage); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -162,6 +185,10 @@ public class ToolManageServiceImpl implements IToolManageService { |
|
|
|
ToolManage dbObj = baseMapper.selectOne(new LambdaQueryWrapper<ToolManage>().eq(ToolManage::getToolName, request.getToolName()) |
|
|
|
.eq(ToolManage::getModuleName, request.getModuleName())); |
|
|
|
if (ObjectUtil.isNull(dbObj)) { |
|
|
|
throw new ServiceException("测试包信息不存在!"); |
|
|
|
} |
|
|
|
|
|
|
|
if(dbObj.getToolOssId() == null || dbObj.getToolOssId() == 0L){ |
|
|
|
throw new ServiceException("文件数据不存在!"); |
|
|
|
} |
|
|
|
|
|
|
|