diff --git a/tp-admin/src/main/java/com/inscloudtech/web/controller/system/ToolManageController.java b/tp-admin/src/main/java/com/inscloudtech/web/controller/system/ToolManageController.java index 2df0cb4..fd057c5 100644 --- a/tp-admin/src/main/java/com/inscloudtech/web/controller/system/ToolManageController.java +++ b/tp-admin/src/main/java/com/inscloudtech/web/controller/system/ToolManageController.java @@ -96,7 +96,7 @@ public class ToolManageController extends BaseController { MultipartFile tipsFile, @RequestPart("moduleName") String moduleName, @RequestPart("toolName") String toolName, - @RequestPart("toolManageId") Long toolManageId) { + @RequestPart("toolManageId") Long toolManageId, String toolPath, String tipsPath) { if (StrUtil.isEmpty(moduleName)) { return R.fail("模块名不能为空!"); @@ -104,7 +104,7 @@ public class ToolManageController extends BaseController { if (StrUtil.isEmpty(toolName)) { return R.fail("文件名不能为空!"); } - iToolManageService.uploadToolAndTips(file,tipsFile,toolName,moduleName, toolManageId); + iToolManageService.uploadToolAndTips(file,tipsFile,toolName,moduleName, toolManageId,toolPath,tipsPath); return R.ok("操作成功!"); } diff --git a/tp-system/src/main/java/com/inscloudtech/system/service/IToolManageService.java b/tp-system/src/main/java/com/inscloudtech/system/service/IToolManageService.java index 3d89aa8..66c7195 100644 --- a/tp-system/src/main/java/com/inscloudtech/system/service/IToolManageService.java +++ b/tp-system/src/main/java/com/inscloudtech/system/service/IToolManageService.java @@ -52,7 +52,7 @@ public interface IToolManageService { */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); - Boolean uploadToolAndTips(MultipartFile file, MultipartFile tipsFile, String toolName,String moduleName,Long toolManageId); + Boolean uploadToolAndTips(MultipartFile file, MultipartFile tipsFile, String toolName,String moduleName,Long toolManageId,String toolPath,String tipsPath); void downloadByToolName(DownloadToolRequest downloadToolRequest,HttpServletResponse response); } diff --git a/tp-system/src/main/java/com/inscloudtech/system/service/impl/ToolManageServiceImpl.java b/tp-system/src/main/java/com/inscloudtech/system/service/impl/ToolManageServiceImpl.java index f562c15..739ecba 100644 --- a/tp-system/src/main/java/com/inscloudtech/system/service/impl/ToolManageServiceImpl.java +++ b/tp-system/src/main/java/com/inscloudtech/system/service/impl/ToolManageServiceImpl.java @@ -128,7 +128,7 @@ public class ToolManageServiceImpl implements IToolManageService { } @Override - public Boolean uploadToolAndTips(MultipartFile file, MultipartFile tipsFile, String toolName,String moduleName,Long toolManageId) { + public Boolean uploadToolAndTips(MultipartFile file, MultipartFile tipsFile, String toolName,String moduleName,Long toolManageId,String toolPath,String tipsPath) { ToolManage toolManage; if(null != toolManageId && toolManageId != 0L){ toolManage = baseMapper.selectById(toolManageId); @@ -144,20 +144,20 @@ public class ToolManageServiceImpl implements IToolManageService { } try { - if(FileUploadUtils.checkFileValid(file)){ + if(file != null && FileUploadUtils.checkFileValid(file)){ SysOssVo toolVo = iSysOssService.upload(file); toolManage.setToolOssId(toolVo.getOssId()); toolManage.setToolPath(toolVo.getOriginalName()); - }else if(null != toolManageId && toolManageId != 0L){ + }else if(null != toolManageId && toolManageId != 0L && StrUtil.isEmpty(toolPath)){ toolManage.setToolOssId(0L); toolManage.setToolPath(""); } - if(FileUploadUtils.checkFileValid(tipsFile)){ + if(tipsFile != null && FileUploadUtils.checkFileValid(tipsFile)){ SysOssVo tipsVo = iSysOssService.upload(tipsFile); toolManage.setTipsOssId(tipsVo.getOssId()); toolManage.setTipsPath(tipsVo.getOriginalName()); - }else if(null != toolManageId && toolManageId != 0L){ + }else if(null != toolManageId && toolManageId != 0L && StrUtil.isEmpty(tipsPath) ){ toolManage.setTipsOssId(0L); toolManage.setTipsPath(""); }