对比新文件 |
| | |
| | | package com.iailab.module.data.api.plan.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月08日 |
| | | */ |
| | | @Data |
| | | @Tag(name = "计划项") |
| | | public class ApiPlanItemDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "指标编码") |
| | | private String itemNo; |
| | | |
| | | @Schema(description = "指标名称") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "指标分类") |
| | | private String itemCategory; |
| | | |
| | | @Schema(description = "时间粒度") |
| | | private String timeGranularity; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 测点频率类型 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum DataPointFreqEnum { |
| | | NET_10S("10s", 10), |
| | | NET_30S("30s", 30), |
| | | NET_1MIN("1min",60); |
| | | |
| | | private String code; |
| | | |
| | | private Integer value; |
| | | |
| | | public static DataPointFreqEnum getEumByCode(String code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (DataPointFreqEnum statusEnum : DataPointFreqEnum.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月08日 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TimeGranularityEnum { |
| | | |
| | | TG_MIN("min", Calendar.MINUTE), |
| | | TG_HOUR("hour", Calendar.HOUR_OF_DAY), |
| | | TG_DAY("day", Calendar.DAY_OF_YEAR), |
| | | TG_MON("mon",Calendar.MONTH); |
| | | |
| | | private String code; |
| | | |
| | | private Integer value; |
| | | |
| | | public static TimeGranularityEnum getEumByCode(String code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (TimeGranularityEnum statusEnum : TimeGranularityEnum.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemStatusEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月11日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface MmItemStatusDao extends BaseMapperX<MmItemStatusEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月11日 |
| | | */ |
| | | @Data |
| | | @TableName("t_mm_item_status") |
| | | public class MmItemStatusEntity implements Serializable { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemId; |
| | | |
| | | /** |
| | | * 最新运行时间 |
| | | */ |
| | | private Date lastTime; |
| | | |
| | | /** |
| | | * 运行状态 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 耗时(ms) |
| | | */ |
| | | private Long duration; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月11日 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ItemRunStatusEnum { |
| | | PROCESSING(1, "处理中"), |
| | | SUCCESS(2, "成功"), |
| | | FAIL(3, "失败"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | | |
| | | public static ItemRunStatusEnum getEumByCode(Integer code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (ItemRunStatusEnum statusEnum : ItemRunStatusEnum.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 预测粒度 |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月11日 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum PredGranularityEnum { |
| | | MIN1(60, "1min"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | | |
| | | public static PredGranularityEnum getEumByCode(Integer code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (PredGranularityEnum statusEnum : PredGranularityEnum.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月11日 |
| | | */ |
| | | public interface MmItemStatusService { |
| | | |
| | | void recordStatus(String itemId, ItemRunStatusEnum status, Long duration); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemStatusDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemStatusEntity; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemStatusService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月11日 |
| | | */ |
| | | @Service |
| | | public class MmItemStatusServiceImpl implements MmItemStatusService { |
| | | |
| | | |
| | | @Resource |
| | | public MmItemStatusDao mmItemStatusDao; |
| | | |
| | | public void recordStatus(String itemId, ItemRunStatusEnum status, Long duration) { |
| | | QueryWrapper<MmItemStatusEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("item_id", itemId); |
| | | MmItemStatusEntity entity = mmItemStatusDao.selectOne(queryWrapper); |
| | | if (entity == null) { |
| | | entity = new MmItemStatusEntity(); |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | entity.setItemId(itemId); |
| | | entity.setLastTime(new Date()); |
| | | entity.setStatus(status.getCode()); |
| | | entity.setDuration(duration); |
| | | mmItemStatusDao.insert(entity); |
| | | } else { |
| | | entity.setLastTime(new Date()); |
| | | entity.setStatus(status.getCode()); |
| | | entity.setDuration(duration); |
| | | mmItemStatusDao.updateById(entity); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 模型参数类型 |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月08日 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ModelParamType { |
| | | |
| | | DATAPOINT("DATAPOINT", "测点值"), |
| | | PREDICTITEM("PREDICTITEM", "预测值"), |
| | | IND("IND", "指标值"), |
| | | PLAN("PLAN", "计划值"); |
| | | |
| | | private String code; |
| | | private String desc; |
| | | |
| | | public static ModelParamType getEumByCode(String code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (ModelParamType statusEnum : ModelParamType.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |