iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql
@@ -324,6 +324,8 @@ UNIQUE KEY `uk_item_id` (`item_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '派生指标'; ALTER TABLE t_ind_item_der ADD COLUMN month_start int COMMENT '月周期开始日'; CREATE TABLE t_ind_item_cal( `id` VARCHAR(36) NOT NULL COMMENT 'ID' , `item_id` VARCHAR(36) COMMENT '指标ID' , iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java
@@ -16,6 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; @@ -160,29 +163,29 @@ case THIS_MONTH: whereSql.append(indItem.getTimeLabel()); whereSql.append("='"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append(getYearMonth(calendar,indItem.getMonthStart())); whereSql.append("'"); break; case LAST_MONTH: whereSql.append(indItem.getTimeLabel()); whereSql.append("' < '"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append(getYearMonth(calendar,indItem.getMonthStart())); whereSql.append("' AND "); whereSql.append(indItem.getTimeLabel()); whereSql.append(" >= '"); calendar.add(Calendar.MONTH, -1); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append(getYearMonth(calendar,indItem.getMonthStart())); whereSql.append("'"); break; case LAST_MONTH_12: whereSql.append(indItem.getTimeLabel()); whereSql.append(" <= '"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append(getYearMonth(calendar,indItem.getMonthStart())); whereSql.append("' AND "); whereSql.append(indItem.getTimeLabel()); whereSql.append("' >= '"); calendar.add(Calendar.MONTH, -12); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append(getYearMonth(calendar,indItem.getMonthStart())); whereSql.append("'"); break; case THIS_YEAR_MONTH: @@ -255,6 +258,27 @@ return result; } public static String getYearMonth(Calendar now,Integer monthStart) { int day = now.get(Calendar.DAY_OF_MONTH); // 当前月 if (monthStart > 0) { if (day < monthStart) { now.add(Calendar.MONTH, -1); } } if (monthStart < 0) { if (day >= Math.abs(monthStart)) { now.add(Calendar.MONTH, 1); } } // 定义日期格式化对象,指定格式为 yyyy-MM SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_MON); // 格式化日期并返回结果 return sdf.format(now.getTime()); } public QuerySourceValueDTO getDerSql(String itemId, Date startTime, Date endTime) { QuerySourceValueDTO result = getAtomSql(itemId); IndItemDerVO indItem = indItemDerService.getByItemId(itemId); iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/entity/IndItemDerEntity.java
@@ -58,4 +58,9 @@ * 分析维度 */ private String dimension; /** * 月周期开始日 */ private Integer monthStart; } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/vo/IndItemDerVO.java
@@ -53,4 +53,9 @@ * 分析维度 */ private String dimension; /** * 月周期开始日 */ private Integer monthStart; } iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
@@ -152,4 +152,9 @@ @PostMapping(PREFIX + "/item/result/last-point") @Operation(summary = "获取") List<Object[]> getItemResultLastPoint(@RequestBody PreItemResultReqVO reqVO); @PostMapping(PREFIX + "/schedule-suggest/update-status") @Operation(summary = "修改调度建议状态") Boolean updateSuggestStatus(@RequestBody StAlarmAndSuggestReqVO reqVO); } iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/StAlarmAndSuggestReqVO.java
对比新文件 @@ -0,0 +1,24 @@ 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; /** * @author PanZhibao * @Description * @createTime 2025年01月07日 */ @Schema(description = "RPC 模型 - 预警和建议 DTO") @Data public class StAlarmAndSuggestReqVO implements Serializable { private static final long serialVersionUID = 1L; private String id; private Integer status; } iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/StAlarmAndSuggestRespVO.java
@@ -18,6 +18,8 @@ private static final long serialVersionUID = 1L; private String id; @Schema(description = "类型(1:预警,2:建议)") private String type; iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -877,6 +877,11 @@ return mmItemResultLastPointService.getData(reqVO.getOutputid(),reqVO.getStartTime(),reqVO.getEndTime(),reqVO.getTimeFormat()); } @Override public Boolean updateSuggestStatus(StAlarmAndSuggestReqVO reqVO) { return stScheduleSuggestService.updateSuggestStatus(reqVO); } private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { Date[] result = new Date[3]; Date predictTime = predictItem.getLastTime(); iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSuggestService.java
@@ -4,6 +4,8 @@ import com.iailab.framework.common.service.BaseService; import com.iailab.module.model.api.mcs.dto.ScheduleSuggestReqDTO; import com.iailab.module.model.api.mcs.dto.ScheduleSuggestRespDTO; import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestReqVO; import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO; import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestPageReqVO; import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO; @@ -36,4 +38,6 @@ List<ScheduleSuggestRespDTO> list(ScheduleSuggestReqDTO vo); List<StScheduleSuggestEntity> getList(List<String> scheduleObjList, Date predictTime); Boolean updateSuggestStatus(StAlarmAndSuggestReqVO reqVO); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSuggestServiceImpl.java
@@ -7,8 +7,11 @@ import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.api.mcs.dto.ScheduleSuggestReqDTO; import com.iailab.module.model.api.mcs.dto.ScheduleSuggestRespDTO; import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestReqVO; import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO; import com.iailab.module.model.common.enums.ScheduleSuggestStatusEnum; import com.iailab.module.model.mcs.sche.dao.StScheduleSuggestDao; import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService; import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestPageReqVO; @@ -91,4 +94,13 @@ queryWrapper.eq("schedule_time", predictTime); return baseDao.selectList(queryWrapper); } @Override public Boolean updateSuggestStatus(StAlarmAndSuggestReqVO reqVO) { StScheduleSuggestEntity entity = new StScheduleSuggestEntity(); entity.setId(reqVO.getId()); entity.setStatus(reqVO.getStatus()); baseDao.updateById(entity); return true; } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -81,15 +81,6 @@ } } // 判断要调整的列 for (ColumnItemPort itemPort : sampleInfo.getColumnInfo()) { for (ColumnItem columnItem : itemPort.getColumnItemList()) { } } int portIdx = 1; //对每个爪分别进行计算 for (ColumnItemPort entry : sampleInfo.getColumnInfo()) { iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/StScheduleSchemeDao.xml
@@ -4,6 +4,7 @@ <select id="getAlarmAndSuggestPage" resultType="com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO"> select t.id, t.type, t.title, t.content, @@ -11,10 +12,10 @@ t.obj, t.status from ( select 'alarm' type, t1.title, t1.content, t1.alarm_time `time`, t1.alarm_obj obj,0 status select id,'alarm' type, t1.title, t1.content, t1.alarm_time `time`, t1.alarm_obj obj,0 status from t_mm_predict_alarm_message t1 UNION select 'suggest' type, t2.title, t2.content, t2.schedule_time `time`, t2.schedule_obj obj,t2.status select id,'suggest' type, t2.title, t2.content, t2.schedule_time `time`, t2.schedule_obj obj,t2.status from t_st_schedule_suggest t2 ) t <where>