| | |
| | | @PostMapping("/upload") |
| | | @Operation(summary = "上传文件", description = "上传程序/附件文件") |
| | | public R<Boolean> upload(NcProgramUploadVO uploadVO) { |
| | | //@Parameter(description="文件") @RequestPart("file") MultipartFile file, @Parameter(description="所属节点ID")@RequestParam Long nodeId, |
| | | // @Parameter(description="文件分类,使用字典(node_file_type)") @RequestParam String category |
| | | ncProgramService.uploadProgramFileNew(uploadVO); |
| | | return R.<Boolean>status(true); |
| | | try { |
| | | boolean existOther = ncProgramService.programExistsUnderOtherNode(uploadVO.getNodeId(), uploadVO.getFile().getOriginalFilename()); |
| | | if (existOther) { |
| | | //程序存在,则返回提示信息 |
| | | return R.fail("程序其他节点已存在"); |
| | | } |
| | | if (uploadVO.getConfirm() == null || uploadVO.getConfirm() != 1) { |
| | | //默认情况,需要检查程序是否存在 |
| | | boolean exists = ncProgramService.programExistsUnderNode(uploadVO.getNodeId(), uploadVO.getFile().getOriginalFilename()); |
| | | if (exists) { |
| | | //程序存在,则返回提示信息 |
| | | return R.fail(2, "存在重复程序名"); |
| | | } else { |
| | | ncProgramService.uploadProgramFileNew(uploadVO); |
| | | } |
| | | } else { |
| | | //同名文件用户确认上传了() |
| | | ncProgramService.uploadProgramFileNew(uploadVO); |
| | | } |
| | | }catch(Exception e) { |
| | | log.error("程序上传执行错误",e); |
| | | return R.fail("上传失败:" + e.getMessage()); |
| | | } |
| | | return R.success(); |
| | | } |
| | | |
| | | @PostMapping("/remove") |