From 6eeac9efdb16f92d19536bf23a2d1471705fe752 Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期二, 31 十二月 2024 18:34:38 +0800
Subject: [PATCH] 调度模型下发

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelOutService.java          |   25 +++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelOutDao.java                  |   17 ++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelSaveReqVO.java                |    4 
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java    |    8 +
 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/StScheduleModelOutDTO.java                   |   62 ++++++++
 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java                                      |    4 
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/controller/admin/McsApiController.java               |   22 ++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelOutServiceImpl.java |   75 ++++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java                                      |   81 +++++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelOutEntity.java            |   69 +++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java |    7 +
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelRespVO.java                   |    4 
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/ModelServiceApplication.java                                          |    1 
 13 files changed, 373 insertions(+), 6 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
index 9e5bd0a..638ca65 100644
--- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
+++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
@@ -85,6 +85,10 @@
     @Operation(summary = "修改调度模型设置参数")
     Boolean modifyScheduleModelSetting(@RequestBody List<ScheduleModelSettingReqDTO> dtos);
 
+    @GetMapping(PREFIX + "/schedule-model/out")
+    @Operation(summary = "调度模型数据下发")
+    Boolean scheduleModelOut(@RequestParam MdkScheduleRespDTO dto);
+
     @GetMapping(PREFIX + "/schedule-scheme/list")
     @Operation(summary = "获取调度方案列表")
     List<StScheduleSchemeDTO> listScheduleScheme(@RequestParam Map<String, Object> params);
diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/StScheduleModelOutDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/StScheduleModelOutDTO.java
new file mode 100644
index 0000000..b0a2061
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/StScheduleModelOutDTO.java
@@ -0,0 +1,62 @@
+package com.iailab.module.model.api.mcs.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Schema(description = "RPC 模型 - 下发配置 DTO")
+@Data
+public class StScheduleModelOutDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 模型id
+     */
+    private String modelId;
+
+    /**
+     * key
+     */
+    private String resultKey;
+
+    /**
+     * 数据类型
+     */
+    private String resultType;
+
+    /**
+     * resultPort
+     */
+    private Integer resultPort;
+
+    /**
+     * resultIndex
+     */
+    private Integer resultIndex;
+
+    /**
+     * 是否下发
+     */
+    private Integer isWrite;
+
+    /**
+     * 下发的点位
+     */
+    private String pointNo;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 无扰切换点位
+     */
+    private String disturbancePointNo;
+}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/ModelServiceApplication.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/ModelServiceApplication.java
index 07d569d..e080cbe 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/ModelServiceApplication.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/ModelServiceApplication.java
@@ -8,6 +8,7 @@
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 import javax.annotation.PostConstruct;
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 9a6275c..bd7dc00 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
@@ -8,6 +8,7 @@
 import com.iailab.module.data.api.point.dto.ApiPointDTO;
 import com.iailab.module.data.api.point.dto.ApiPointValueDTO;
 import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO;
+import com.iailab.module.data.api.point.dto.ApiPointValueWriteDTO;
 import com.iailab.module.data.common.ApiDataQueryDTO;
 import com.iailab.module.model.api.mcs.McsApi;
 import com.iailab.module.model.api.mcs.dto.*;
@@ -18,7 +19,9 @@
 import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity;
 import com.iailab.module.model.mcs.pre.service.*;
 import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO;
+import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
 import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity;
+import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService;
 import com.iailab.module.model.mcs.sche.service.StScheduleSchemeService;
 import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService;
 import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO;
@@ -46,6 +49,9 @@
 public class McsApiImpl implements McsApi {
 
     @Autowired
+    private DataPointApi dataPointApi;
+
+    @Autowired
     private DmModuleService dmModuleService;
 
     @Autowired
@@ -59,9 +65,6 @@
 
     @Autowired
     private MmItemResultLastPointService mmItemResultLastPointService;
-
-    @Autowired
-    private DataPointApi dataPointApi;
 
     @Autowired
     private MmItemResultJsonService mmItemResultJsonService;
@@ -83,6 +86,9 @@
 
     @Autowired
     private StScheduleSchemeService stScheduleSchemeService;
+
+    @Autowired
+    private StScheduleModelOutService stScheduleModelOutService;
 
     private int HOUR_MINS = 60;
 
@@ -554,6 +560,75 @@
         return stScheduleSchemeService.list(params);
     }
 
+    @Override
+    public Boolean scheduleModelOut(MdkScheduleRespDTO dto) {
+        String modelId = stScheduleSchemeService.getByCode(dto.getScheduleCode()).getModelId();
+        Map<String,Object> result =  dto.getResult();
+        List<StScheduleModelOutDTO> list =  stScheduleModelOutService.list(modelId);
+        try{
+        list.forEach(
+                item -> {
+                    double value = 0;
+                    //判断点位是否下发以及返回结果是否存在
+                    if(item.getIsWrite()==1){
+                        if(result.get(item.getResultKey())==null){
+                            log.error(result.get(item.getResultKey()) + "resultKey匹配失败");
+                        }
+                        Object resultValue = result.get(item.getResultKey());
+                        //判断解析方式
+                        if(item.getResultType().equals("double")){
+                            if(resultValue instanceof Double) {
+                                value = (Double) resultValue;
+                            }
+                        }else if(item.getResultType().equals("double[]")){
+                            ArrayList<Double> doubleList = (ArrayList<Double>) resultValue;
+                            double[] array = new double[doubleList.size()];
+                            for (int i = 0; i < doubleList.size(); i++) {
+                                array[i] = doubleList.get(i);
+                            }
+                            if(array!= null && item.getResultPort() < array.length){
+                                value = array[item.getResultPort()];
+                            }else{
+                                log.error(result.get(item.getResultKey()) + "下角标超限");
+                            }
+
+                        }else if(item.getResultType().equals("double[][]")){
+                            if (item.getResultType().equals("double[][]")) {
+                                if (resultValue instanceof ArrayList) {
+                                    ArrayList<ArrayList<Double>> doubleListList = (ArrayList<ArrayList<Double>>) resultValue;
+                                    double[][] array = new double[doubleListList.size()][];
+                                    for (int i = 0; i < doubleListList.size(); i++) {
+                                        ArrayList<Double> doubleList = doubleListList.get(i);
+                                        array[i] = new double[doubleList.size()];
+                                        for (int j = 0; j < doubleList.size(); j++) {
+                                            array[i][j] = doubleList.get(j);
+                                        }
+                                    }
+                                    if (array != null && item.getResultPort() < array.length && item.getResultIndex() < array[item.getResultPort()].length) {
+                                        value = array[item.getResultPort()][item.getResultIndex()];
+                                    } else {
+                                        log.error(result.get(item.getResultKey()) + "下标超限");
+                                    }
+                                }
+                            }
+                        }
+                        //下发到point点位
+                        ApiPointValueWriteDTO ApiPointValueWriteDTO = new ApiPointValueWriteDTO();
+                        ApiPointValueWriteDTO.setPointNo(item.getPointNo());
+                        ApiPointValueWriteDTO.setValue(value);
+                        if (!dataPointApi.writePointRealValue(ApiPointValueWriteDTO)) {
+                            log.error(result.get(item.getResultKey()) + "下发数据异常");
+                        }
+
+                    }
+                }
+        );
+        }catch (Exception ex){
+            log.error("下发数据异常");
+            ex.printStackTrace();
+        }
+        return true;
+    }
 
     private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) {
         Date[] result = new Date[3];
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 41b12ec..cc50c48 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
@@ -1,6 +1,5 @@
 package com.iailab.module.model.api.controller.admin;
 
-import com.iailab.framework.apilog.core.annotation.ApiAccessLog;
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.module.model.api.mcs.McsApi;
 import com.iailab.module.model.api.mcs.dto.*;
@@ -19,8 +18,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
-
-import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import java.util.Map;
 
 /**
  * @author PanZhibao
@@ -89,6 +87,16 @@
         return CommonResult.success(respVO);
     }
 
+    @PostMapping("/predict-data/cur")
+    @Operation(summary = "获取当前预测数据")
+    public CommonResult<Map<String, List<Object[]>>> getPreDataCur(HttpServletResponse response, HttpServletRequest
+            request, @RequestBody PreDataJsonReqVO reqVO)throws Exception {
+        apiSecurityUtils.validate(request);
+        reqVO.setPredictTime(new Date());
+        Map<String, List<Object[]>> map = mcsApi.getPreDataCur(reqVO);
+        return CommonResult.success(map);
+    }
+
     @GetMapping("/predict-data/exportValue")
     @Operation(summary = "导出预测数据")
     public void exportPointValue(@RequestParam("itemId") String itemId,
@@ -137,4 +145,12 @@
         List<ScheduleSuggestRespDTO> data = mcsApi.getLastLimitScheduleSuggest(scheduleObj, limit);
         return CommonResult.success(data);
     }
+
+    @PostMapping("/schedule-model/out")
+    @Operation(summary = "调度模型数据下发")
+    public Boolean scheduleModelOut(HttpServletResponse response, HttpServletRequest
+            request, @RequestBody MdkScheduleRespDTO dto) throws Exception {
+        apiSecurityUtils.validate(request);
+        return mcsApi.scheduleModelOut(dto);
+    }
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
index ced1d63..6ac4dcf 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
@@ -3,9 +3,12 @@
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.model.api.mcs.dto.StScheduleModelOutDTO;
 import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity;
+import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
 import com.iailab.module.model.mcs.sche.entity.StScheduleModelParamEntity;
 import com.iailab.module.model.mcs.sche.entity.StScheduleModelSettingEntity;
+import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService;
 import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService;
 import com.iailab.module.model.mcs.sche.service.StScheduleModelService;
 import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService;
@@ -40,6 +43,8 @@
 
     @Autowired
     private StScheduleModelSettingService stScheduleModelSettingService;
+    @Autowired
+    private StScheduleModelOutService stScheduleModelOutService;
 
     @GetMapping("/page")
     @Operation(summary = "获得分页")
@@ -66,6 +71,8 @@
         result.setParamList(BeanUtils.toBean(paramList, StScheduleModelParamRespVO.class));
         List<StScheduleModelSettingEntity> settingList = stScheduleModelSettingService.getByModelId(data.getId());
         result.setSettingList(BeanUtils.toBean(settingList, StScheduleModelSettingRespVO.class));
+        List<StScheduleModelOutDTO> outList = stScheduleModelOutService.list(data.getId());
+        result.setModelOut(outList);
         return success(result);
     }
 
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelOutDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelOutDao.java
new file mode 100644
index 0000000..796a814
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/dao/StScheduleModelOutDao.java
@@ -0,0 +1,17 @@
+package com.iailab.module.model.mcs.sche.dao;
+
+import com.iailab.framework.common.dao.BaseDao;
+import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
+import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
+import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @description:
+ * @author: dyk
+ * @date: 2024/12/30 17:50
+ **/
+@TenantDS
+@Mapper
+public interface StScheduleModelOutDao extends BaseMapperX<StScheduleModelOutEntity> {
+}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelOutEntity.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelOutEntity.java
new file mode 100644
index 0000000..8998bd8
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelOutEntity.java
@@ -0,0 +1,69 @@
+package com.iailab.module.model.mcs.sche.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.iailab.framework.mybatis.core.dataobject.BaseDO;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @description: 调度模型下发配置
+ * @author: dyk
+ * @date: 2024/12/30 17:21
+ **/
+@Data
+@TableName("t_st_schedule_model_out")
+public class StScheduleModelOutEntity implements Serializable {
+
+    /**
+     * id
+     */
+    @TableId
+    private String id;
+
+    /**
+     * 模型id
+     */
+    private String modelId;
+
+    /**
+     * key
+     */
+    private String resultKey;
+
+    /**
+     * 数据类型
+     */
+    private String resultType;
+
+    /**
+     * 角标1
+     */
+    private Integer resultPort;
+
+    /**
+     * 角标2
+     */
+    private Integer resultIndex;
+
+    /**
+     * 是否下发
+     */
+    private Integer isWrite;
+
+    /**
+     * 下发的点位
+     */
+    private String pointNo;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 无扰切换点位
+     */
+    private String disturbancePointNo;
+}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelOutService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelOutService.java
new file mode 100644
index 0000000..1b89ed9
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelOutService.java
@@ -0,0 +1,25 @@
+package com.iailab.module.model.mcs.sche.service;
+
+
+import com.iailab.framework.common.service.BaseService;
+import com.iailab.module.model.api.mcs.dto.StScheduleModelOutDTO;
+import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description:
+ * @author: dyk
+ * @date: 2024/12/30 17:42
+ **/
+public interface StScheduleModelOutService extends BaseService<StScheduleModelOutEntity> {
+
+    void deleteByMap(Map<String, Object> map);
+
+    void insertList(List<StScheduleModelOutEntity> list, String modelId);
+
+    void deleteScheduleModelOut(String modelId);
+
+    List<StScheduleModelOutDTO> list(String modelId);
+}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelOutServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelOutServiceImpl.java
new file mode 100644
index 0000000..fb781d1
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelOutServiceImpl.java
@@ -0,0 +1,75 @@
+package com.iailab.module.model.mcs.sche.service.impl;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.iailab.framework.common.service.impl.BaseServiceImpl;
+import com.iailab.framework.common.util.object.ConvertUtils;
+import com.iailab.module.model.api.mcs.dto.StScheduleModelOutDTO;
+import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO;
+import com.iailab.module.model.mcs.sche.dao.StScheduleModelOutDao;
+import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
+import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity;
+import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService;
+import com.iailab.module.model.mpk.service.MethodSettingService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @description:
+ * @author: dyk
+ * @date: 2024/12/30 17:43
+ **/
+@Slf4j
+@Service
+public class StScheduleModelOutServiceImpl extends BaseServiceImpl<StScheduleModelOutDao, StScheduleModelOutEntity> implements StScheduleModelOutService {
+
+    @Autowired
+    private MethodSettingService methodSettingService;
+
+    @Override
+    public void deleteByMap(Map<String, Object> map) {
+        baseDao.delete(getWrapper(map));
+    }
+
+    private QueryWrapper<StScheduleModelOutEntity> getWrapper(Map<String, Object> params) {
+        String mpkFileId = (String) params.get("modelId");
+
+        QueryWrapper<StScheduleModelOutEntity> wrapper = new QueryWrapper<>();
+        wrapper.eq(StringUtils.isNotBlank(mpkFileId), "mpk_file_id", mpkFileId);
+
+        return wrapper;
+    }
+
+    @Override
+    public void insertList(List<StScheduleModelOutEntity> list, String modelId) {
+        for (int i = 0; i < list.size(); i++) {
+            StScheduleModelOutEntity entity = ConvertUtils.sourceToTarget(list.get(i), StScheduleModelOutEntity.class);
+            entity.setId(UUID.randomUUID().toString());
+            entity.setModelId(modelId);
+            entity.setSort(i);
+            baseDao.insert(entity);
+        }
+    }
+
+    @Override
+    public void deleteScheduleModelOut(String modelId) {
+        Map<String,Object> map = new HashMap<>();
+        map.put("model_id", modelId);
+        baseDao.deleteByMap(map);
+    }
+
+    @Override
+    public List<StScheduleModelOutDTO> list(String modelId) {
+        QueryWrapper<StScheduleModelOutEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("model_id", modelId);
+        List<StScheduleModelOutEntity> list = baseDao.selectList(queryWrapper);
+        return ConvertUtils.sourceToTarget(list, StScheduleModelOutDTO.class);
+    }
+}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java
index a3cf4d3..2932e85 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java
@@ -6,6 +6,7 @@
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.module.model.mcs.sche.dao.StScheduleModelDao;
 import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity;
+import com.iailab.module.model.mcs.sche.service.StScheduleModelOutService;
 import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService;
 import com.iailab.module.model.mcs.sche.service.StScheduleModelService;
 import com.iailab.module.model.mcs.sche.service.StScheduleModelSettingService;
@@ -36,6 +37,9 @@
     @Autowired
     private StScheduleModelSettingService stScheduleModelSettingService;
 
+    @Autowired
+    private StScheduleModelOutService stScheduleModelOutService;
+
     @Override
     public PageResult<StScheduleModelEntity> page(StScheduleModelPageReqVO reqVO) {
         return stScheduleModelDao.selectPage(reqVO);
@@ -54,6 +58,7 @@
         entity.setId(UUID.randomUUID().toString());
         stScheduleModelDao.insert(entity);
         stScheduleModelParamService.saveList(entity.getId(), reqVO.getParamList());
+        stScheduleModelOutService.insertList(reqVO.getModelOut(), entity.getId());
         stScheduleModelSettingService.saveList(entity.getId(), reqVO.getSettingList());
     }
 
@@ -64,6 +69,8 @@
         stScheduleModelDao.updateById(entity);
         stScheduleModelParamService.saveList(entity.getId(), reqVO.getParamList());
         stScheduleModelSettingService.saveList(entity.getId(), reqVO.getSettingList());
+        stScheduleModelOutService.deleteScheduleModelOut(entity.getId());
+        stScheduleModelOutService.insertList(reqVO.getModelOut(), entity.getId());
     }
 
     @Override
@@ -77,6 +84,7 @@
         stScheduleModelDao.deleteById(id);
         stScheduleModelParamService.deleteByModelId(id);
         stScheduleModelSettingService.deleteByModelId(id);
+        stScheduleModelOutService.deleteScheduleModelOut(id);
     }
 
     @Override
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelRespVO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelRespVO.java
index eebe19f..5b42d8c 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelRespVO.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelRespVO.java
@@ -1,6 +1,7 @@
 package com.iailab.module.model.mcs.sche.vo;
 
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.iailab.module.model.api.mcs.dto.StScheduleModelOutDTO;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -58,4 +59,7 @@
 
     @Schema(description = "设置参数列表", example = "设置参数列表")
     private List<StScheduleModelSettingRespVO> settingList;
+
+    @Schema(description = "下发配置列表", example = "下发配置列表")
+    private List<StScheduleModelOutDTO> modelOut;
 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelSaveReqVO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelSaveReqVO.java
index 290e47c..54fe1a2 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelSaveReqVO.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleModelSaveReqVO.java
@@ -1,5 +1,6 @@
 package com.iailab.module.model.mcs.sche.vo;
 
+import com.iailab.module.model.mcs.sche.entity.StScheduleModelOutEntity;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -58,4 +59,7 @@
 
     @Schema(description = "设置参数", example = "设置参数")
     private List<StScheduleModelSettingSaveReqVO> settingList;
+
+    @Schema(description = "下发设置", example = "下发设置")
+    private List<StScheduleModelOutEntity> modelOut;
 }
\ No newline at end of file

--
Gitblit v1.9.3