From f96689bddf69ea3d635116cf1dd98bd5e5e0755a Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期四, 28 十一月 2024 09:23:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java |   46 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 3 deletions(-)

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 7092979..80e1c93 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
@@ -15,8 +15,12 @@
 import com.iailab.module.model.common.enums.PreLineTypeEnum;
 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.entity.MmPredictAlarmMessageEntity;
 import com.iailab.module.model.mcs.pre.service.*;
 import com.iailab.module.model.mcs.pre.service.impl.MmPredictAlarmConfigServiceImpl;
+import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO;
+import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity;
+import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService;
 import com.iailab.module.model.mdk.vo.ItemVO;
 import com.iailab.module.model.mpk.service.ChartService;
 import lombok.extern.slf4j.Slf4j;
@@ -63,6 +67,12 @@
 
     @Autowired
     private ChartService chartService;
+
+    @Autowired
+    private MmPredictAlarmMessageService mmPredictAlarmMessageService;
+
+    @Autowired
+    private StScheduleSuggestService stScheduleSuggestService;
 
     @Autowired
     private PlanItemApi planItemApi;
@@ -350,6 +360,18 @@
     }
 
     @Override
+    public Map<String, List<Object[]>> getPreDataCur(PreDataJsonReqVO reqVO) {
+        Map<String, List<Object[]>> result = new HashMap<>();
+        if (reqVO == null || reqVO.getPredictTime() == null || CollectionUtils.isEmpty(reqVO.getOutputIdList())) {
+            return result;
+        }
+        reqVO.getOutputIdList().forEach(outPutId -> {
+            result.put(outPutId, mmItemResultJsonService.getData(outPutId, reqVO.getPredictTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
+        });
+        return result;
+    }
+
+    @Override
     public PlanDataSingleChartRespVO getPlanDataSingleChart(PreDataSingleChartReqVO reqVO) {
         PlanDataSingleChartRespVO result = new PlanDataSingleChartRespVO();
         Map<String, String> chartParams = chartService.getByChartCode(reqVO.getChartCode());
@@ -456,9 +478,20 @@
         return result;
     }
 
+    /**
+     * 新增预警信息
+     *
+     * @param dto
+     * @return
+     */
     @Override
     public Boolean createAlarmMessage(AlarmMessageRespDTO dto) {
-        return true;
+        try {
+            mmPredictAlarmMessageService.create(ConvertUtils.sourceToTarget(dto, MmPredictAlarmMessageSaveReqVO.class));
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
     }
 
     @Override
@@ -472,13 +505,20 @@
     }
 
     @Override
+    public AlarmMessageRespDTO getLastAlarmMessage(String alarmObj) {
+        MmPredictAlarmMessageEntity entity = mmPredictAlarmMessageService.getLast(alarmObj);
+        return ConvertUtils.sourceToTarget(entity, AlarmMessageRespDTO.class);
+    }
+
+    @Override
     public Boolean createScheduleSuggest(ScheduleSuggestRespDTO dto) {
         return true;
     }
 
     @Override
-    public List<ScheduleSuggestRespDTO> listScheduleSuggest(ScheduleSuggestReqDTO params) {
-        return null;
+    public List<ScheduleSuggestRespDTO> getLastLimitScheduleSuggest(String scheduleObj, Integer limit) {
+        List<StScheduleSuggestEntity> list = stScheduleSuggestService.getList(scheduleObj, limit);
+        return ConvertUtils.sourceToTarget(list, ScheduleSuggestRespDTO.class);
     }
 
     @Override

--
Gitblit v1.9.3