Bladeren bron

根据HMC查询飞参

Gaokun Wang 6 maanden geleden
bovenliggende
commit
e0b31b0621

+ 28 - 1
als-modules/agile-assurance/src/main/java/org/eco/als/controller/WarningController.java

@@ -5,13 +5,18 @@ import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.RequiredArgsConstructor;
 import org.eco.als.domain.bo.WarningBo;
+import org.eco.als.domain.vo.DataImportVo;
 import org.eco.als.domain.vo.WarningImportVo;
 import org.eco.als.domain.vo.WarningVo;
 import org.eco.als.listener.WarningImportListener;
+import org.eco.als.service.IDataImportService;
 import org.eco.als.service.IWarningService;
+import org.eco.als.utils.CsvUtils;
+import org.eco.common.core.constant.Constants;
 import org.eco.common.core.core.domain.CommonResult;
 import org.eco.common.core.core.domain.model.LoginUser;
 import org.eco.common.core.core.page.PageResult;
+import org.eco.common.core.utils.StringUtils;
 import org.eco.common.excel.core.ExcelResult;
 import org.eco.common.excel.utils.ExcelUtil;
 import org.eco.common.log.annotation.Log;
@@ -19,12 +24,15 @@ import org.eco.common.log.enums.BusinessType;
 import org.eco.common.security.utils.LoginHelper;
 import org.eco.common.web.annotation.RepeatSubmit;
 import org.eco.common.web.core.BaseController;
+import org.eco.system.domain.vo.SysOssVo;
+import org.eco.system.service.ISysOssService;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * 警告信息Controller
@@ -40,6 +48,12 @@ public class WarningController extends BaseController {
     @Resource
     private IWarningService warningService;
 
+    @Resource
+    private IDataImportService dataImportService;
+
+    @Resource
+    private ISysOssService sysOssService;
+
     /**
      * 查询警告信息列表
      */
@@ -62,7 +76,7 @@ public class WarningController extends BaseController {
 //        return CommonResult.success();
 //    }
 
-//    @SaCheckPermission("als:warning:import")
+    //    @SaCheckPermission("als:warning:import")
     @PostMapping("/importTemplate")
     public void importTemplate(HttpServletResponse response) {
         ExcelUtil.exportExcel(new ArrayList<>(), "警告信息", WarningImportVo.class, response);
@@ -132,4 +146,17 @@ public class WarningController extends BaseController {
         }
         return CommonResult.success();
     }
+
+    /**
+     * 获取警告信息对应的参数详细信息
+     */
+    @GetMapping(value = "/{code}/{sortieNo}")
+    public CommonResult<WarningVo> getInfoByHmc(@PathVariable String code, @PathVariable String sortieNo) {
+        String columnData = "时间,发动机排气温度";
+        DataImportVo dataImportVo = dataImportService.selectBySortieNo(sortieNo);
+        SysOssVo ossVo = sysOssService.getById(dataImportVo.getOssId());
+        // 数据库资源地址
+        String path = StringUtils.substringAfter(ossVo.getFileName(), Constants.RESOURCE_PREFIX);
+        return CommonResult.success(String.valueOf(CsvUtils.getPlaybackByHeaders(path, Arrays.asList(columnData.split(",")), null)));
+    }
 }

+ 8 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/service/IDataImportService.java

@@ -26,6 +26,14 @@ public interface IDataImportService extends IBaseService<DataImport> {
      */
     DataImportVo selectById(Long id);
 
+    /**
+     * 查询数据导入信息
+     *
+     * @param sortieNo 架次号
+     * @return 数据导入信息
+     */
+    DataImportVo selectBySortieNo(String sortieNo);
+
     /**
      * 查询数据导入信息列表
      *

+ 5 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/service/impl/DataImportServiceImpl.java

@@ -97,6 +97,11 @@ public class DataImportServiceImpl extends BaseServiceImpl<DataImportMapper, Dat
 
     }
 
+    @Override
+    public DataImportVo selectBySortieNo(String sortieNo) {
+        return this.getOneAs(query().where(DATA_IMPORT.SORTIE_NO.eq(sortieNo)), DataImportVo.class);
+    }
+
 
     /**
      * 查询数据导入信息列表

+ 1 - 1
als-modules/agile-assurance/src/main/java/org/eco/als/utils/CsvUtils.java

@@ -216,7 +216,7 @@ public class CsvUtils {
     }
 
     public static JSONObject getPlaybackByHeaders(String csvFilePath, List<String> headerNames, Integer step) {
-        List<CsvRow> rows = getCsvRowList(EcoConfig.getUploadPath() + csvFilePath);
+        List<CsvRow> rows = getCsvRowList(EcoConfig.getProfile() + csvFilePath);
         // 获取CSV表头,即第一行数据
         List<String> headers = rows.get(0).getRawList();
         List<Integer> indexList = new ArrayList<>();