| | |
| | | package com.iailab.module.model.api.mcs; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.model.api.mcs.dto.*; |
| | | import com.iailab.module.model.enums.ApiConstants; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @GetMapping(PREFIX + "/chart/param/list") |
| | | @Operation(summary = "图表配置列表") |
| | | List<ChartParamDTO> getChartParamList(@RequestParam("chartCode") String chartCode); |
| | | |
| | | @PostMapping(PREFIX + "/alarm-suggest/page") |
| | | @Operation(summary = "获取预警信息和调度建议分页列表") |
| | | PageResult<StAlarmAndSuggestRespVO> getAlarmAndSuggestPage(@RequestBody StAlarmAndSuggestPageReqVO reqVO); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年01月07日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预警和建议 DTO") |
| | | @Data |
| | | public class StAlarmAndSuggestPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "对象") |
| | | private String obj; |
| | | |
| | | @Schema(description = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | @Schema(description = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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 StAlarmAndSuggestRespVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "类型(1:预警,2:建议)") |
| | | private String type; |
| | | |
| | | @Schema(description = "消息标题") |
| | | private String title; |
| | | |
| | | @Schema(description = "消息内容") |
| | | private String content; |
| | | |
| | | @Schema(description = "对象") |
| | | private String obj; |
| | | |
| | | @Schema(description = "时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date time; |
| | | } |
| | |
| | | package com.iailab.module.model.api; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.api.plan.PlanItemApi; |
| | |
| | | return chartParamService.list(chartCode); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<StAlarmAndSuggestRespVO> getAlarmAndSuggestPage(StAlarmAndSuggestPageReqVO reqVO) { |
| | | return stScheduleSchemeService.getAlarmAndSuggestPage(reqVO); |
| | | } |
| | | |
| | | private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { |
| | | Date[] result = new Date[3]; |
| | | Date predictTime = predictItem.getLastTime(); |
| | |
| | | package com.iailab.module.model.api.controller.admin; |
| | | |
| | | 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.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.*; |
| | | import com.iailab.module.model.common.utils.ApiSecurityUtils; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | List<ScheduleSuggestRespDTO> data = mcsApi.getLastLimitScheduleSuggest(scheduleObj, limit); |
| | | return CommonResult.success(data); |
| | | } |
| | | |
| | | @GetMapping("/alarm-suggest/page") |
| | | @Operation(summary = "获取预警信息和调度建议分页列表") |
| | | public CommonResult<PageResult<StAlarmAndSuggestRespVO>> getAlarmAndSuggestPage(@RequestBody StAlarmAndSuggestPageReqVO reqVO) { |
| | | PageResult<StAlarmAndSuggestRespVO> page = mcsApi.getAlarmAndSuggestPage(reqVO); |
| | | return success(BeanUtils.toBean(page, StAlarmAndSuggestRespVO.class)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestPageReqVO; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleSchemePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | |
| | | .likeIfPresent(StScheduleSchemeEntity::getName, reqVO.getName()) |
| | | .orderByDesc(StScheduleSchemeEntity::getCreateTime)); |
| | | } |
| | | |
| | | IPage<StAlarmAndSuggestRespVO> getAlarmAndSuggestPage(IPage<StScheduleSchemeEntity> page, @Param("params") StAlarmAndSuggestPageReqVO reqVO); |
| | | |
| | | default IPage<StAlarmAndSuggestRespVO> selectAlarmAndSuggestPageList(StAlarmAndSuggestPageReqVO reqVO) { |
| | | return getAlarmAndSuggestPage(getPage(reqVO), reqVO); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestPageReqVO; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO; |
| | | import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleSchemePageReqVO; |
| | |
| | | void enableByIds(String[] ids); |
| | | |
| | | void disableByIds(String[] ids); |
| | | |
| | | PageResult<StAlarmAndSuggestRespVO> getAlarmAndSuggestPage(StAlarmAndSuggestPageReqVO reqVO); |
| | | } |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | 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.common.util.object.ConvertUtils; |
| | | import com.iailab.module.model.api.mcs.dto.AlarmConfigRespDTO; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestPageReqVO; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO; |
| | | import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmConfigEntity; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleSchemeDao; |
| | |
| | | baseDao.updateById(entity); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<StAlarmAndSuggestRespVO> getAlarmAndSuggestPage(StAlarmAndSuggestPageReqVO reqVO) { |
| | | IPage<StAlarmAndSuggestRespVO> page = baseDao.selectAlarmAndSuggestPageList(reqVO); |
| | | return new PageResult<>(page.getRecords(), page.getTotal()); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | <?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.sche.dao.StScheduleSchemeDao"> |
| | | |
| | | <select id="getAlarmAndSuggestPage" resultType="com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO"> |
| | | select |
| | | t.type, |
| | | t.title, |
| | | t.content, |
| | | t.time, |
| | | t.obj |
| | | from ( |
| | | select 'alarm' type, t1.title, t1.content, t1.alarm_time `time`, t1.alarm_obj obj |
| | | from t_mm_predict_alarm_message t1 |
| | | UNION |
| | | select 'suggest' type, t2.title, t2.content, t2.schedule_time `time`, t2.schedule_obj obj |
| | | from t_st_schedule_suggest t2 |
| | | ) t |
| | | <where> |
| | | <if test="params.obj != null and params.obj != ''"> |
| | | and t.obj = #{obj} |
| | | </if> |
| | | <if test="params.startTime != null and params.startTime != ''"> |
| | | and t.time >= #{startTime} |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"> |
| | | and t.time <= #{endTime} |
| | | </if> |
| | | </where> |
| | | order by t.time desc |
| | | |
| | | </select> |
| | | </mapper> |