| | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | 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.flow.service.FlowProgramFileService; |
| | | import org.springblade.mdm.flow.service.TaskDispatchService; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.service.NcNodeHisService; |
| | | import org.springblade.mdm.program.service.NcNodeService; |
| | | import org.springblade.mdm.program.service.ProgramFlowStatusQueryService; |
| | | import org.springblade.mdm.program.vo.*; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.rmi.ServerError; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | |
| | | @Slf4j |
| | | public class NcNodeController { |
| | | private final NcNodeService ncNodeService; |
| | | private final NcNodeHisService nodeHisService; |
| | | private final ProgramFlowStatusQueryService programFlowStatusQueryService; |
| | | private final FlowProgramFileService flowProgramFileService; |
| | | private final TaskDispatchService taskDispatchService; |
| | |
| | | public R<List<String>> drawingNoPick(String drawingNo) { |
| | | return R.data(taskDispatchService.drawingNoSeletDropList(drawingNo)); |
| | | } |
| | | /* |
| | | |
| | | @GetMapping("/history-by-nodeid") |
| | | @Operation(summary = "根据绑定节点id获取历史列表", description = "程序历史列表,仅‘程序包’字典值70的数据。用于显示程序的‘历史版本’") |
| | | public R<List<NcNodeVO>> historyByBindNodeId(@Parameter(description="节点ID(nodeType=70的节点id)")@RequestParam Long id) { |
| | | return R.data(this.ncNodeService.historyByNodeId(id)); |
| | | @Operation(summary = "根据绑定节点id获取历史列表", description = "程序历史列表,仅‘程序包’字典值60的数据。用于显示程序的‘历史版本’") |
| | | public R<List<NcNodeVO>> historyByBindNodeId(@Parameter(description="节点ID(nodeType=60的节点id)")@RequestParam Long id) { |
| | | return R.data(this.nodeHisService.historyByNodeId(id)); |
| | | } |
| | | |
| | | */ |
| | | |
| | | @GetMapping("/compare-content") |
| | | @Operation(summary = "对比内容数据", description = "查询对比内容的2个文本数据") |
| | |
| | | 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()); |
| | | |
| | | |
| | | @GetMapping("/download-by-nodeid") |
| | | @Operation(summary = "下载节点对应的文件", description = "下载节点对应的文件") |
| | | public void downloadByNodeId(@Parameter(description = "节点id") Long nodeId, HttpServletResponse response) throws IOException { |
| | | |
| | | NcNode ncnode = ncNodeService.getById(nodeId); |
| | | if(ncnode.getFlowProgramFileId() != null) { |
| | | flowProgramFileService.download(ncnode.getFlowProgramFileId(),response); |
| | | }else{ |
| | | log.error("非文件节点"); |
| | | throw new ServiceException("节点无文件id"); |
| | | } |
| | | |
| | | } |
| | | } |