From c860df8407951bd2170c5ad51487aa31bffc1193 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 10 十月 2024 11:07:19 +0800 Subject: [PATCH] 模型调用接口 --- iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkPredictReqDTO.java | 5 + iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageReqDTO.java | 36 +++++++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/MdkApi.java | 28 +++--- iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestRespDTO.java | 2 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleModelSettingReqDTO.java | 24 ++++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestReqDTO.java | 34 ++++++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageRespDTO.java | 2 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java | 26 +++-- iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictModelSettingReqDTO.java | 30 +++++++ 9 files changed, 159 insertions(+), 28 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 abb31a0..99d264b 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 @@ -1,10 +1,7 @@ package com.iailab.module.model.api.mcs; import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.module.model.api.mcs.dto.AlarmMessageDTO; -import com.iailab.module.model.api.mcs.dto.PredictItemInfoDTO; -import com.iailab.module.model.api.mcs.dto.PredictItemTreeDTO; -import com.iailab.module.model.api.mcs.dto.ScheduleSuggestDTO; +import com.iailab.module.model.api.mcs.dto.*; import com.iailab.module.model.enums.ApiConstants; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -23,7 +20,7 @@ * @createTime 2024年08月26日 */ @FeignClient(name = ApiConstants.NAME) -@Tag(name = "RPC 服务 - MCS") +@Tag(name = "RPC 服务 - 模型配置接口") public interface McsApi { String PREFIX = ApiConstants.PREFIX + "/mcs"; @@ -38,18 +35,25 @@ @PostMapping(PREFIX + "/alarm-message/create") @Operation(summary = "添加预警信息") - CommonResult<Boolean> createAlarmMessage(@RequestBody AlarmMessageDTO dto); + CommonResult<Boolean> createAlarmMessage(@RequestBody AlarmMessageRespDTO dto); @GetMapping(PREFIX + "/alarm-message/list") - @Operation(summary = "获取预警信息") - CommonResult<AlarmMessageDTO> listAlarmMessage(@RequestParam Map<String, Object> params); + @Operation(summary = "获取预警信息列表") + CommonResult<AlarmMessageRespDTO> listAlarmMessage(@RequestParam Map<String, Object> params); @PostMapping(PREFIX + "/schedule-suggest/create") @Operation(summary = "添加调度建议") - CommonResult<Boolean> createScheduleSuggest(@RequestBody ScheduleSuggestDTO dto); + CommonResult<Boolean> createScheduleSuggest(@RequestBody ScheduleSuggestRespDTO dto); @GetMapping(PREFIX + "/alarm-message/list") - @Operation(summary = "获取调度建议") - CommonResult<ScheduleSuggestDTO> listScheduleSuggest(@RequestParam Map<String, Object> params); + @Operation(summary = "获取调度建议列表") + CommonResult<ScheduleSuggestRespDTO> listScheduleSuggest(@RequestParam ScheduleSuggestReqDTO params); + @PostMapping(PREFIX + "/predict-model-setting/modify") + @Operation(summary = "修改预测模型设置参数") + CommonResult<Boolean> modifyPredictModelSetting(@RequestBody List<PredictModelSettingReqDTO> dtos); + + @PostMapping(PREFIX + "/schedule-model-setting/modify") + @Operation(summary = "修改调度模型设置参数") + CommonResult<Boolean> modifyScheduleModelSetting(@RequestBody List<ScheduleModelSettingReqDTO> dtos); } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageReqDTO.java new file mode 100644 index 0000000..a55af61 --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageReqDTO.java @@ -0,0 +1,36 @@ +package com.iailab.module.model.api.mcs.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年10月10日 + */ +@Schema(description = "RPC 模型 - 预警消息 DTO") +@Data +public class AlarmMessageReqDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "监控对象") + private String alarmObj; + + @Schema(description = "监控点位ID") + private String pointId; + + @Schema(description = "预测项ID") + private String itemId; + + @Schema(description = "预警时间") + private Date alarmTime; + + @Schema(description = "开始时间") + private Date startTime; + + @Schema(description = "结束时间") + private Date endTime; +} \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageRespDTO.java similarity index 95% rename from iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageDTO.java rename to iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageRespDTO.java index e4be30f..c9d164d 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageDTO.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmMessageRespDTO.java @@ -20,7 +20,7 @@ */ @Schema(description = "RPC 模型 - 预警消息 DTO") @Data -public class AlarmMessageDTO implements Serializable { +public class AlarmMessageRespDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictModelSettingReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictModelSettingReqDTO.java new file mode 100644 index 0000000..5d1f29b --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PredictModelSettingReqDTO.java @@ -0,0 +1,30 @@ +package com.iailab.module.model.api.mcs.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年10月10日 + */ +@Schema(description = "RPC 模型 - 调度建议 DTO") +@Data +public class PredictModelSettingReqDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String modelid; + + /** + * 键 + */ + private String key; + + /** + * 值 + */ + private String value; +} \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleModelSettingReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleModelSettingReqDTO.java new file mode 100644 index 0000000..bd40728 --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleModelSettingReqDTO.java @@ -0,0 +1,24 @@ +package com.iailab.module.model.api.mcs.dto; + +import java.io.Serializable; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年10月10日 + */ +public class ScheduleModelSettingReqDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String modelid; + + /** + * 键 + */ + private String key; + + /** + * 值 + */ + private String value; +} \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestReqDTO.java new file mode 100644 index 0000000..ba217bd --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestReqDTO.java @@ -0,0 +1,34 @@ +package com.iailab.module.model.api.mcs.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年10月10日 + */ +@Schema(description = "RPC 模型 - 调度建议req DTO") +@Data +public class ScheduleSuggestReqDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "预测项ID") + private String itemId; + + @Schema(description = "模型ID") + private String modelId; + + @Schema(description = "调整对象") + private String adjustObj; + + @Schema(description = "开始时间") + private Date startTime; + + @Schema(description = "结束时间") + private Date endTime; + +} \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestRespDTO.java similarity index 96% rename from iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestDTO.java rename to iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestRespDTO.java index 9151fae..a0418c1 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestDTO.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/ScheduleSuggestRespDTO.java @@ -14,7 +14,7 @@ */ @Schema(description = "RPC 模型 - 调度建议 DTO") @Data -public class ScheduleSuggestDTO implements Serializable { +public class ScheduleSuggestRespDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/MdkApi.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/MdkApi.java index d098d94..54be190 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/MdkApi.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/MdkApi.java @@ -2,11 +2,10 @@ import com.iailab.module.model.api.mdk.dto.*; import com.iailab.module.model.enums.ApiConstants; -import com.iailab.framework.common.pojo.CommonResult; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import javax.validation.Valid; @@ -17,25 +16,24 @@ * @createTime 2024年08月26日 */ @FeignClient(name = ApiConstants.NAME) -@Tag(name = "RPC 服务 - MDK") +@Tag(name = "RPC 服务 - 模型调用接口") public interface MdkApi { String PREFIX = ApiConstants.PREFIX + "/mdk"; - @GetMapping(PREFIX + "/predict-module") - @Operation(summary = "模块预测") - CommonResult<MdkPredictModuleRespDTO> predictModule(@Valid @RequestBody MdkPredictReqDTO reqDTO); + @PostMapping(PREFIX + "/predict-module") + @Operation(summary = "执行模块预测") + MdkPredictModuleRespDTO predictModule(@Valid @RequestBody MdkPredictReqDTO reqDTO); - @GetMapping(PREFIX + "/predict-item") - @Operation(summary = "单独预测") - CommonResult<MdkPredictItemRespDTO> predictItem(@Valid @RequestBody MdkPredictReqDTO reqDTO); + @PostMapping(PREFIX + "/predict-item") + @Operation(summary = "执行单独预测") + MdkPredictItemRespDTO predictItem(@Valid @RequestBody MdkPredictReqDTO reqDTO); - @GetMapping(PREFIX + "/predict-auto-adjust") + @PostMapping(PREFIX + "/predict-adjust") @Operation(summary = "预测自动调整") - CommonResult<Boolean> predictAutoAdjust(@Valid @RequestBody MdkPredictReqDTO reqDTO); + Boolean predictAutoAdjust(@Valid @RequestBody MdkPredictReqDTO reqDTO); - - @GetMapping(PREFIX + "/schedule") - @Operation(summary = "执行调度") - CommonResult<MdkScheduleRespDTO> doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO); + @PostMapping(PREFIX + "/schedule-scheme") + @Operation(summary = "执行调度方案") + MdkScheduleRespDTO doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO); } diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkPredictReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkPredictReqDTO.java index 0cef75c..c8d1297 100644 --- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkPredictReqDTO.java +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mdk/dto/MdkPredictReqDTO.java @@ -3,6 +3,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import javax.validation.constraints.NotNull; import java.util.Date; /** @@ -14,9 +15,13 @@ @Data public class MdkPredictReqDTO { + @Schema(description = "预测时间") + @NotNull(message="预测时间不能为空") private Date predictTime; + @Schema(description = "预测模块") private String moduleType; + @Schema(description = "预测项编号") private String itemNo; } \ No newline at end of file -- Gitblit v1.9.3