From a874b928e16320839315b9abcdf2cece1229a424 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期四, 07 十一月 2024 09:20:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java |   44 +++++++++++++++++++++++++++++---------------
 1 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java
index 8f73d14..a5d05a8 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java
@@ -13,17 +13,16 @@
 import com.iailab.module.model.mdk.predict.PredictItemHandler;
 import com.iailab.module.model.mdk.predict.PredictModuleHandler;
 import com.iailab.module.model.mdk.predict.PredictResultHandler;
+import com.iailab.module.model.mdk.schedule.ScheduleModelHandler;
 import com.iailab.module.model.mdk.vo.DataValueVO;
 import com.iailab.module.model.mdk.vo.ItemVO;
 import com.iailab.module.model.mdk.vo.PredictResultVO;
+import com.iailab.module.model.mdk.vo.ScheduleResultVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
-
-import javax.validation.Valid;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -62,6 +61,9 @@
     @Autowired
     private PredictResultHandler predictResultHandler;
 
+    @Autowired
+    private ScheduleModelHandler scheduleModelHandler;
+
     /**
      * 按模块预测
      *
@@ -69,7 +71,7 @@
      * @return
      */
     @Override
-    public CommonResult<MdkPredictModuleRespDTO> predictModule(MdkPredictReqDTO reqDTO) {
+    public MdkPredictModuleRespDTO predictModule(MdkPredictReqDTO reqDTO) {
         MdkPredictModuleRespDTO resp = new MdkPredictModuleRespDTO();
         Map<String, MdkPredictItemRespDTO> predictItemRespMap = new HashMap<>();
         try {
@@ -107,10 +109,11 @@
             }
             log.info("预测计算结束: " + System.currentTimeMillis());
         } catch (Exception ex) {
-            return error(999, ex.getMessage());
+            ex.printStackTrace();
+            return resp;
         }
         resp.setPredictItemRespMap(predictItemRespMap);
-        return success(resp);
+        return resp;
     }
 
     /**
@@ -120,7 +123,7 @@
      * @return
      */
     @Override
-    public CommonResult<MdkPredictItemRespDTO> predictItem(@Valid @RequestBody MdkPredictReqDTO reqDTO) {
+    public MdkPredictItemRespDTO predictItem(MdkPredictReqDTO reqDTO) {
         MdkPredictItemRespDTO resp = new MdkPredictItemRespDTO();
 
         try {
@@ -140,11 +143,11 @@
             resp.setPredictTime(reqDTO.getPredictTime());
             log.info("预测计算结束: " + System.currentTimeMillis());
         } catch (Exception ex) {
-            log.info("预测计算异常: " + System.currentTimeMillis());
-            ex.printStackTrace();
+            log.info("预测计算异常: " + System.currentTimeMillis(),ex);
+            return resp;
         }
 
-        return success(resp);
+        return resp;
     }
 
     /**
@@ -154,10 +157,10 @@
      * @return
      */
     @Override
-    public CommonResult<Boolean> predictAutoAdjust(@Valid @RequestBody MdkPredictReqDTO reqDTO) {
+    public Boolean predictAutoAdjust(MdkPredictReqDTO reqDTO) {
 
 
-        return success(true);
+        return true;
     }
 
     /**
@@ -167,9 +170,20 @@
      * @return
      */
     @Override
-    public CommonResult<MdkScheduleRespDTO> doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO) {
+    public MdkScheduleRespDTO doSchedule(MdkScheduleReqDTO reqDTO) {
         MdkScheduleRespDTO resp = new MdkScheduleRespDTO();
-
-        return success(resp);
+        resp.setScheduleCode(reqDTO.getScheduleCode());
+        resp.setScheduleTime(reqDTO.getScheduleTime());
+        try {
+            log.info("调度计算开始: " + System.currentTimeMillis());
+            ScheduleResultVO scheduleResult = scheduleModelHandler.doSchedule(reqDTO.getModelCode(), reqDTO.getScheduleTime());
+            resp.setResult(scheduleResult.getResult());
+            log.info("预测计算结束: " + System.currentTimeMillis());
+        } catch (Exception ex) {
+            log.info("调度计算异常: " + System.currentTimeMillis());
+            ex.printStackTrace();
+            return resp;
+        }
+        return resp;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3