From 231897591c909b164defebfdb5936387ec2807d0 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 28 十一月 2024 11:10:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/src/main/resources/template/menu.xml.vm | 8 ++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java | 15 ++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigReqDTO.java | 27 +++++++++ iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml | 19 ++++++ iailab-module-model/iailab-module-model-biz/src/main/resources/template/impl.java.vm | 3 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java | 15 ++++- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java | 6 ++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 14 ++++ iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigRespDTO.java | 72 ++++++++++++++++++++++++ 9 files changed, 170 insertions(+), 9 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 1ae76b1..039e10b 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 @@ -54,7 +54,11 @@ @GetMapping(PREFIX + "/alarm-message/list") @Operation(summary = "获取预警信息列表") - List<AlarmMessageRespDTO> listAlarmMessage(@RequestParam Map<String, Object> params); + List<AlarmMessageRespDTO> listAlarmMessage(@RequestParam("params") Map<String, Object> params); + + @GetMapping(PREFIX + "/alarm-config/list") + @Operation(summary = "获取预警配置列表") + List<AlarmConfigRespDTO> listAlarmConfig(@RequestParam("params") Map<String, Object> params); @GetMapping(PREFIX + "/alarm-message/last-one") @Operation(summary = "获取最新预警信息") @@ -64,14 +68,19 @@ @Operation(summary = "添加调度建议") Boolean createScheduleSuggest(@RequestBody ScheduleSuggestRespDTO dto); - @GetMapping(PREFIX + "/schedule-suggest/last-limit") + @GetMapping(PREFIX + "/schedule-suggest/list") @Operation(summary = "获取调度建议列表") - List<ScheduleSuggestRespDTO> getLastLimitScheduleSuggest(@RequestParam("scheduleObj") String scheduleObj, @RequestParam("limit") Integer limit); + List<ScheduleSuggestRespDTO> listScheduleSuggest(@RequestParam("params") ScheduleSuggestReqDTO params); @PostMapping(PREFIX + "/predict-model-setting/modify") @Operation(summary = "修改预测模型设置参数") Boolean modifyPredictModelSetting(@RequestBody List<PredictModelSettingReqDTO> dtos); + @GetMapping(PREFIX + "/schedule-suggest/last-limit") + @Operation(summary = "获取调度建议列表") + List<ScheduleSuggestRespDTO> getLastLimitScheduleSuggest(@RequestParam("scheduleObj") String scheduleObj, @RequestParam("limit") Integer limit); + + @PostMapping(PREFIX + "/schedule-model-setting/modify") @Operation(summary = "修改调度模型设置参数") Boolean modifyScheduleModelSetting(@RequestBody List<ScheduleModelSettingReqDTO> dtos); diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigReqDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigReqDTO.java new file mode 100644 index 0000000..657f56f --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigReqDTO.java @@ -0,0 +1,27 @@ +package com.iailab.module.model.api.mcs.dto; + +import com.iailab.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年11月20日 + */ +@Schema(description = "模型平台 - Request VO") +@Data +public class AlarmConfigReqDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "消息标题") + private String title; + + @Schema(description = "监控对象") + private String alarmObj; +} \ 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/AlarmConfigRespDTO.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigRespDTO.java new file mode 100644 index 0000000..8e3b6d1 --- /dev/null +++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/AlarmConfigRespDTO.java @@ -0,0 +1,72 @@ +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.math.BigDecimal; +import java.util.Date; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年11月20日 + */ +@Schema(description = "模型服务 - 预警配置 Response VO") +@Data +public class AlarmConfigRespDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + private String id; + + @Schema(description = "消息标题") + private String title; + + @Schema(description = "监控对象") + private String alarmObj; + + @Schema(description = "预测项ID") + private String itemId; + + private String itemName; + + @Schema(description = "输出ID") + private String outId; + + private String outName; + + @Schema(description = "比较长度") + private Integer compLength; + + @Schema(description = "上限") + private BigDecimal upperLimit; + + @Schema(description = "下限") + private BigDecimal lowerLimit; + + @Schema(description = "单位") + private String unit; + + @Schema(description = "转换系数") + private BigDecimal coefficient; + + @Schema(description = "调度方案") + private String scheduleId; + + @Schema(description = "是否启用(0禁用 1启用)") + private Integer isEnable; + + @Schema(description = "创建者") + private String creator; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "更新者") + private String updater; + + @Schema(description = "更新时间") + private Date updateTime; +} \ No newline at end of file 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 6bb4bbe..3242912 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 @@ -76,6 +76,10 @@ @Autowired private PlanItemApi planItemApi; + @Autowired + private MmPredictAlarmConfigService mmPredictAlarmConfigService; + + private int HOUR_MINS = 60; @Override @@ -496,6 +500,11 @@ } @Override + public List<AlarmConfigRespDTO> listAlarmConfig(Map<String, Object> params) { + return mmPredictAlarmConfigService.list(params); + } + + @Override public AlarmMessageRespDTO getLastAlarmMessage(String alarmObj) { MmPredictAlarmMessageEntity entity = mmPredictAlarmMessageService.getLast(alarmObj); return ConvertUtils.sourceToTarget(entity, AlarmMessageRespDTO.class); @@ -507,6 +516,11 @@ } @Override + public List<ScheduleSuggestRespDTO> listScheduleSuggest(ScheduleSuggestReqDTO params) { + return Collections.emptyList(); + } + + @Override public List<ScheduleSuggestRespDTO> getLastLimitScheduleSuggest(String scheduleObj, Integer limit) { List<StScheduleSuggestEntity> list = stScheduleSuggestService.getList(scheduleObj, limit); return ConvertUtils.sourceToTarget(list, ScheduleSuggestRespDTO.class); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java index 9009260..fb480b2 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictAlarmConfigService.java @@ -3,10 +3,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.BaseService; +import com.iailab.module.model.api.mcs.dto.AlarmConfigRespDTO; import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmConfigEntity; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigPageReqVO; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO; + +import java.util.List; +import java.util.Map; /** * @author PanZhibao @@ -24,4 +28,6 @@ void update(MmPredictAlarmConfigSaveReqVO reqVO); void delete(String id); + + List<AlarmConfigRespDTO> list(Map<String, Object> params); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java index a7d76f5..42b9252 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictAlarmConfigServiceImpl.java @@ -1,20 +1,24 @@ package com.iailab.module.model.mcs.pre.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.framework.security.core.util.SecurityFrameworkUtils; +import com.iailab.module.model.api.mcs.dto.AlarmConfigRespDTO; import com.iailab.module.model.mcs.pre.dao.MmPredictAlarmConfigDao; +import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmConfigEntity; +import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity; import com.iailab.module.model.mcs.pre.service.MmPredictAlarmConfigService; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigPageReqVO; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import java.util.Date; -import java.util.UUID; +import java.util.*; /** * @author PanZhibao @@ -57,4 +61,11 @@ public void delete(String id) { baseDao.deleteById(id); } + + @Override + public List<AlarmConfigRespDTO> list(Map<String, Object> params) { + QueryWrapper<MmPredictAlarmConfigEntity> wrapper = new QueryWrapper<>(); + wrapper.eq("is_enable", 1); + return BeanUtils.toBean(baseDao.selectList(wrapper), AlarmConfigRespDTO.class); + } } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml new file mode 100644 index 0000000..9cee8c2 --- /dev/null +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmPredictAlarmConfigDao.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="com.iailab.module.model.mcs.pre.dao.MmPredictAlarmConfigDao"> + <select id="getPageList" resultType="com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigRespVO"> + select t1.*,t2.itemname itemName,t3.tagname outName + from t_mm_predict_alarm_config t1 + left join t_mm_predict_item t2 on t2.id = t1.item_id + left join t_mm_item_output t3 on t3.id = t1.out_id + <where> + <if test="params.title != null and params.title != ''"> + AND t.title LIKE CONCAT('%', #{params.title},'%') + </if> + <if test="params.alarmObj != null and params.alarmObj != ''"> + AND t.alarmObj LIKE CONCAT('%', #{params.alarmObj},'%') + </if> + </where> + </select> +</mapper> \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/impl.java.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/impl.java.vm index f1ebee1..f111279 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/impl.java.vm +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/impl.java.vm @@ -23,11 +23,10 @@ #{end} if (#{foreach} ($column in [1..$entity.dataLength])#{if}($column==1)data${column} == null || data${column}.length == 0 || data${column}[0].length == 0#{else} || data${column} == null || data${column}.length == 0 || data${column}[0].length == 0#{end}#{end}) { result = new HashMap<String, Object>(); - result.put("status_code", "400"); + result.put("status_code", "998"); return result; } result = ${pyName}${entity.methodName}(#foreach ($column in [1..$entity.dataLength])data${column}, #{end}#{if}($entity.model==1)model, #{end}settings); - return utils.reverseResult(this.result); } #{end} diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/menu.xml.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/menu.xml.vm index a68f42b..e9d76e2 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/menu.xml.vm +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/menu.xml.vm @@ -18,7 +18,9 @@ #{if}($method.methodName=="train") <tab-train class="${model.pkgName}.impl.${model.pyName}Impl" method="train" params="#{foreach} ($column in [1..$method.dataLength])double[][],#{end}#{if}($method.model==1)java.util.HashMap,#{end}java.util.HashMap"> - <property key="data1" name="数据路径" type="file" valueType="file" min="" max=""/> +#{foreach} ($column in [1..$method.dataLength]) + <property key="data${column}" name="数据${column}路径" type="file" valueType="file" min="" max=""/> +#{end} #{foreach} ($setting in $method.methodSettings) #{if}($setting.type=="select") <property key="${setting.settingKey}" name="${setting.name}" type="select" valueType="${setting.valueType}" min="$!{setting.min}" max="$!{setting.max}"> @@ -35,7 +37,9 @@ <tab-load class="${model.pkgName}.impl.${model.pyName}Impl" method="predict" params="#{foreach} ($column in [1..$method.dataLength])double[][],#{end}#{if}($method.model==1)java.util.HashMap,#{end}java.util.HashMap" resultKey="$!{method.resultKey}" modelRules="${model.pkgName}.impl.${model.pyName}Impl.predict"> - <property key="data1" name="数据路径" type="file" valueType="file" min="" max=""/> +#{foreach} ($column in [1..$method.dataLength]) + <property key="data${column}" name="数据${column}路径" type="file" valueType="file" min="" max=""/> +#{end} #{foreach} ($setting in $method.methodSettings) #{if}($setting.type=="select") <property key="${setting.settingKey}" name="${setting.name}" type="select" valueType="${setting.valueType}" min="$!{setting.min}" max="$!{setting.max}"> -- Gitblit v1.9.3