From 9e844c4d7cd254a69accdf10dd09df962afceeb2 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期五, 15 十一月 2024 14:10:36 +0800 Subject: [PATCH] 输出结果 --- iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java | 9 +++++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/controller/admin/McsApiController.java | 7 ++++++- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 23 +++++++++++++++-------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java index f01b123..0e3f2cf 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java @@ -26,6 +26,15 @@ @Schema(description = "预测项名称") private String itemName; + @Schema(description = "输出ID") + private String outId; + + @Schema(description = "输出结果") + private String resultstr; + + @Schema(description = "输出结果") + private String resultName; + @Schema(description = "预测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date predictTime; diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java index 5a3ddbd..81a761c 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java @@ -9,9 +9,7 @@ import com.iailab.module.model.api.mcs.dto.*; import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; -import com.iailab.module.model.mcs.pre.enums.ItemStatus; import com.iailab.module.model.mcs.pre.service.*; -import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; import com.iailab.module.model.mdk.vo.ItemVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -95,15 +93,21 @@ List<String> outIds = reqVO.getOutIds(); List<String> legends = new ArrayList<>(); List<PreDataViewRespDTO> dataViewList = new ArrayList<>(); - if (CollectionUtils.isEmpty(reqVO.getQueryIds())) { + if (CollectionUtils.isEmpty(outIds)) { return result; } Date predictTime = reqVO.getPredictTime(); if (predictTime == null) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.MILLISECOND, 0); - calendar.set(Calendar.SECOND, 0); - predictTime = calendar.getTime(); + MmItemOutputEntity output = mmItemOutputService.getOutPutById(reqVO.getOutIds().get(0)); + ItemVO predictItem = mmPredictItemService.getItemById(output.getItemid()); + if (predictItem.getLastTime() != null) { + predictTime = predictItem.getLastTime(); + } else { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.MILLISECOND, 0); + calendar.set(Calendar.SECOND, 0); + predictTime = calendar.getTime(); + } } Date startTime = reqVO.getStartTime(); if (startTime == null) { @@ -125,9 +129,12 @@ String outId = outIds.get(i); MmItemOutputEntity output = mmItemOutputService.getOutPutById(outId); if (output == null) { - continue; + continue; } legends.add(output.getResultstr()); + viewDto.setItemId(output.getItemid()); + viewDto.setOutId(outId); + viewDto.setResultstr(output.getResultstr()); viewDto.setRealData(getHisData(output.getPointid(), startTime, endTime)); viewDto.setPreDataN(mmItemResultService.getData(output.getId(), startTime, endTime)); viewDto.setPreDataL(mmItemResultLastPointService.getData(output.getId(), startTime, endTime)); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/controller/admin/McsApiController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/controller/admin/McsApiController.java index 247f271..e02730c 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/controller/admin/McsApiController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/controller/admin/McsApiController.java @@ -49,7 +49,12 @@ public CommonResult<PreDataBarLineRespVO> getPreDataCharts(HttpServletResponse response, HttpServletRequest request, @RequestBody PreDataBarLineReqVO reqVO) throws Exception { apiSecurityUtils.validate(request); - PreDataBarLineRespVO respVO = mcsApi.getPreDataCharts(reqVO); + PreDataBarLineRespVO respVO = new PreDataBarLineRespVO(); + try { + respVO = mcsApi.getPreDataCharts(reqVO); + } catch (Exception e) { + e.printStackTrace(); + } return CommonResult.success(respVO); } -- Gitblit v1.9.3