2024-11-28 | 潘志宝 | |
2024-11-28 | dengzedong | |
2024-11-28 | dengzedong | |
2024-11-28 | 潘志宝 | |
2024-11-28 | 潘志宝 | |
2024-11-28 | liriming | |
2024-11-28 | liriming | |
2024-11-28 | liriming | |
2024-11-28 | liriming | |
2024-11-28 | 潘志宝 |
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/utils/ApiSecurityUtils.java
@@ -44,7 +44,7 @@ private void setTenantId(HttpServletRequest httpRequest) { String tenantId = httpRequest.getHeader(Constant.HEAD_TENANT_ID); if (StringUtils.isBlank(tenantId)) { if (StringUtils.isNotBlank(tenantId)) { TenantContextHolder.setTenantId(Long.parseLong(tenantId)); } } iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
@@ -40,6 +40,10 @@ @Operation(summary = "预测数据图表") PreDataSingleChartRespVO getPreDataSingleChart(@RequestBody PreDataSingleChartReqVO reqVO); @PostMapping(PREFIX + "/predict-data/cur") @Operation(summary = "获取当前预测数据") Map<String, List<Object[]>> getPreDataCur(PreDataJsonReqVO reqVO); @PostMapping(PREFIX + "/plan-data/single-chart") @Operation(summary = "计划数据图表") PlanDataSingleChartRespVO getPlanDataSingleChart(@RequestBody PreDataSingleChartReqVO reqVO); @@ -50,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 = "获取最新预警信息") @@ -60,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); 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; } 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; } iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataJsonReqVO.java
对比新文件 @@ -0,0 +1,26 @@ package com.iailab.module.model.api.mcs.dto; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年11月27日 */ @Data public class PreDataJsonReqVO implements Serializable { private static final long serialVersionUID = 1L; @Schema(description = "预测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date predictTime; @Schema(description = "预测输出ID") private List<String> outputIdList; } 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 @@ -356,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()); @@ -484,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); @@ -495,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); iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/common/utils/ApiSecurityUtils.java
@@ -42,7 +42,7 @@ private void setTenantId(HttpServletRequest httpRequest) { String tenantId = httpRequest.getHeader(Constant.HEAD_TENANT_ID); if (StringUtils.isBlank(tenantId)) { if (StringUtils.isNotBlank(tenantId)) { TenantContextHolder.setTenantId(Long.parseLong(tenantId)); } } 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); } 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); } } 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> 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} 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}">