| | |
| | | |
| | | package org.springblade.mdm.program.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.mdm.basesetting.producedivision.service.QinzheFgbService; |
| | | import org.springblade.mdm.flow.service.FlowProgramFileService; |
| | | import org.springblade.mdm.flow.service.TaskDispatchService; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.service.NcNodeService; |
| | | import org.springblade.mdm.program.service.NcProgramService; |
| | | import org.springblade.mdm.program.service.ProgramFlowStatusQueryService; |
| | | import org.springblade.mdm.program.vo.*; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Tag(name = "程序节点", description = "程序节点") |
| | | @Slf4j |
| | | public class NcNodeController { |
| | | private final NcProgramService ncProgramService; |
| | | private final NcNodeService ncNodeService; |
| | | private final ProgramFlowStatusQueryService programFlowStatusQueryService; |
| | | private final FlowProgramFileService flowProgramFileService; |
| | |
| | | @Operation(summary = "新增节点", description = "节点信息,id保持空") |
| | | public R<Boolean> save(@RequestBody NcNodeVO vo) { |
| | | ncNodeService.saveNcCode(vo); |
| | | return R.<Boolean>status(true); |
| | | return R.status(true); |
| | | } |
| | | |
| | | |
| | |
| | | @Operation(summary = "修改节点", description = "节点信息,必须传入ID") |
| | | public R<Boolean> update(@RequestBody NcNodeVO vo) { |
| | | ncNodeService.updateNcNode(vo); |
| | | return R.<Boolean>status(true); |
| | | return R.status(true); |
| | | } |
| | | |
| | | @PostMapping("/remove") |
| | | @Operation(summary = "删除节点") |
| | | public R<Boolean> remove(Long id) { |
| | | ncNodeService.removeById(id); |
| | | return R.<Boolean>status(true); |
| | | return R.status(true); |
| | | } |
| | | |
| | | @PostMapping("/lock") |
| | | @Operation(summary = "锁定节点(程序包名)") |
| | | public R<Boolean> lock(@Parameter(description="程序包名节点id)")Long id,@Parameter(description="锁定原因)")String remark) { |
| | | ncNodeService.lock(id,remark); |
| | | return R.<Boolean>status(true); |
| | | return R.status(true); |
| | | } |
| | | |
| | | @GetMapping("/query-lock-remark") |
| | |
| | | |
| | | return R.data(vo); |
| | | } |
| | | |
| | | @GetMapping("/content-by-nodeid") |
| | | @Operation(summary = "根据节点获取文件内容", description = "仅限文本格式的内容,二进制文件将返回空串") |
| | | public R<String> fileContentByNodeId(@Parameter(description = "节点id") Long nodeId) { |
| | | try { |
| | | NcNode ncnode = ncNodeService.getById(nodeId); |
| | | if(ncnode.getFlowProgramFileId() != null) { |
| | | return R.data(flowProgramFileService.getFileContent(ncnode.getFlowProgramFileId())); |
| | | }else{ |
| | | return R.data("找不到文件"); |
| | | } |
| | | }catch(Exception e) { |
| | | log.error("删除文件失败",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | } |