yangys
2025-09-06 e1c5c27a41e2410c0689b70319488c16d2e4fd51
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/controller/DncSendBackController.java
@@ -1,6 +1,7 @@
package org.springblade.mdm.program.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -10,7 +11,8 @@
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.mdm.program.service.DNCSendBackService;
import org.springblade.mdm.program.vo.DncSendBackData;
import org.springblade.mdm.program.service.DncBackFileService;
import org.springblade.mdm.program.vo.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -30,6 +32,7 @@
public class DncSendBackController {
   private final DNCSendBackService dncSendBackService;
   private final DncBackFileService dncBackFileService;
   /**
    * 上传DNC回传文件
    *
@@ -68,4 +71,47 @@
      }
      return R.success();
   }
   @Operation(summary = "工控网回传记录分页查询", description = "工控网回传记录分页查询,查询回传历史")
   @GetMapping("/dnc-back-page")
   public R<IPage<DncBackFileVO>> page(DncBackFileQueryVO query) {
      return R.data(dncBackFileService.pageQuery(query));
   }
   @Operation(summary = "回传取消", description = "工控网回传记录中取消未开始执行的流程")
   @PostMapping("/cancel-process")
   public R<Void> cancelProcess(@Parameter(description = "回传记录id")long id) {
      try{
         dncBackFileService.cancelProcess(id);
         return R.success();
      }catch (Exception e){
         log.error("流程取消失败",e);
         return R.fail(e.getMessage());
      }
   }
   @Operation(summary = "获取回传记录的文件列表", description = "获取回传记录的文件列表")
   @GetMapping("/files-by-id")
   public R<List<DncSendBackFile>> filesById(long id) {
      try {
         return R.data(dncBackFileService.filesById(id));
      }catch (Exception e){
         log.error("获取历史文件列表失败",e);
         return R.fail(e.getMessage());
      }
   }
   @GetMapping("/history-file-content")
   @Operation(summary = "临时记录回传文件内容", description = "临时记录回传文件内容")
   public R<String> historyContent(@Parameter(description = "历史记录id")long id,@Parameter(description = "文件的entryName") String entryName) {
      try {
         return R.data(dncBackFileService.getEntryFileContent(id,entryName));
      }catch(Exception e) {
         log.error("获取历史文件内容失败",e);
         return R.fail(e.getMessage());
      }
   }
}